Class: Padrino::Generators::Plugin

Inherits:
Thor::Group
  • Object
show all
Includes:
Actions, Runner, Thor::Actions
Defined in:
padrino-gen/lib/padrino-gen/generators/plugin.rb

Overview

Responsible for executing plugins instructions within a Padrino project.

Constant Summary collapse

PLUGIN_URL =

Defines the default URL for official padrino recipe plugins.

'https://github.com/padrino/padrino-recipes/tree/master/plugins'

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Runner

#app, #generate, #git, #project, #rake

Methods included from Actions

#already_exists?, #app_skeleton, #apply_component_for, #apply_default_fields, #check_app_existence, #destination_root, #empty_directory_with_keep_file, #execute_component_setup, #fetch_app_name, #fetch_component_choice, #fetch_project_name, #in_app_root?, #include_component_module_for, #initializer, #inject_into_file, #insert_hook, #insert_into_gemfile, #insert_middleware, #invalid_fields, #keep_file, #middleware, #recognize_path, #require_contrib, #require_dependencies, #resolve_valid_choice, #retrieve_component_config, #run_bundler, #store_component_choice, #store_component_config, #test?, #tiny?, #valid_choice?, #valid_constant?, #validate_namespace

Class Method Details



15
# File 'padrino-gen/lib/padrino-gen/generators/plugin.rb', line 15

def self.banner; "padrino-gen plugin [plugin_identifier] [options]"; end

.source_rootObject



14
# File 'padrino-gen/lib/padrino-gen/generators/plugin.rb', line 14

def self.source_root; File.expand_path(File.dirname(__FILE__)); end

Instance Method Details

#setup_pluginObject

Create the Padrino Plugin.



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'padrino-gen/lib/padrino-gen/generators/plugin.rb', line 35

def setup_plugin
  if options[:list] || plugin_file.nil?
    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