Parent

Padrino::Generators::Plugin

Responsible for executing plugins instructions within a Padrino project.

Constants

PLUGIN_URL

Defines the default URL for official padrino recipe plugins

Public Class Methods

source_root() click to toggle source

Define the source plugin root

# File lib/padrino-gen/generators/plugin.rb, line 16
def self.source_root; File.expand_path(File.dirname(__FILE__)); end

Public Instance Methods

setup_plugin() click to toggle source

Create the Padrino Plugin

@api private

# File lib/padrino-gen/generators/plugin.rb, line 38
def setup_plugin
  if options[:list] # list method ran here
    plugins = {}
    uri = URI.parse(PLUGIN_URL)
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true if uri.scheme == "https"
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    http.start do
      http.request_get(uri.path) do |res|
        plugins = res.body.scan(%{/plugins/(\w+)_plugin.rb}).uniq
      end
    end
    say "Available plugins:", :green
    say plugins.map { |plugin| "  - #{plugin}" }.join("\n")
  else # executing the plugin instructions
    if in_app_root?
      self.behavior = :revoke if options[:destroy]
      self.destination_root = options[:root]
      execute_runner(:plugin, plugin_file)
    else
      say "You are not at the root of a Padrino application! (config/boot.rb not found)"
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.