Class: Padrino::Generators::Plugin

### Home Classes Methods

### In Files

- lib/padrino-gen/generators/plugin.rb

### Parent

Thor::Group

### Methods

- ::banner
- ::source_root
- #list_plugins
- #setup_plugin

### Included Modules

- Thor::Actions
- Padrino::Generators::Actions
- Padrino::Generators::Runner

### Files

- README.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Generators
- Padrino::Generators::Actions
- Padrino::Generators::Actions::ClassMethods
- Padrino::Generators::App
- Padrino::Generators::AppRootNotFound
- Padrino::Generators::Cli
- Padrino::Generators::Components
- Padrino::Generators::Components::Actions
- Padrino::Generators::Controller
- Padrino::Generators::Mailer
- Padrino::Generators::Migration
- Padrino::Generators::Model
- Padrino::Generators::Plugin
- Padrino::Generators::Project
- Padrino::Generators::Runner
- Padrino::Generators::SqlHelpers
- ActiveRecord
- ActiveRecord::Schema
- Object

No matching classes.

# 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

banner() click to toggle source

Defines the banner for this CLI generator

    # File lib/padrino-gen/generators/plugin.rb, line 18
    def self.banner; "padrino-gen plugin [plugin_identifier] [options]"; end

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

list_plugins() click to toggle source

    # File lib/padrino-gen/generators/plugin.rb, line 53
    def list_plugins
      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")
    end

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] || plugin_file.nil? # list method ran here
        list_plugins
      else # executing the plugin instructions
        self.destination_root = options[:root]
        if in_app_root?
          self.behavior = :revoke if options[:destroy]
          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.