Class: Archangel::Commands::ExtensionCommand
- Inherits:
-
BaseCommand
- Object
- Thor::Group
- BaseCommand
- Archangel::Commands::ExtensionCommand
- Defined in:
- lib/archangel/commands/extension_command.rb
Overview
Generate Archangel extension
Instance Method Summary collapse
-
#banner ⇒ Object
Banner.
-
#copy_common_directories ⇒ Object
Copy common directories that are shared with theme generator.
-
#copy_common_templates ⇒ Object
Copy common templates that are shared with theme generator.
-
#copy_plugin_directories ⇒ Object
Copy extension directories and chmod bin scripts.
-
#copy_plugin_templates ⇒ Object
Copy extension templates.
-
#create_plugin_directory ⇒ Object
Create extension directory.
-
#create_plugin_gemspec ⇒ Object
Create extension .gemspec file.
-
#generate ⇒ Object
Generate extension.
Instance Method Details
#banner ⇒ Object
Banner
Say something nice
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/archangel/commands/extension_command.rb', line 96 def say %( ****************************************************************** Your extension has been generated with a gemspec dependency on Archangel ~> v#{archangel_version} I have a feeling you're about to build something amazing. ****************************************************************** ) end |
#copy_common_directories ⇒ Object
Copy common directories that are shared with theme generator
52 53 54 55 56 57 58 59 60 |
# File 'lib/archangel/commands/extension_command.rb', line 52 def copy_common_directories %w[ bin lib spec ].each do |dir| directory("../common/#{dir}", "#{extension_name}/#{dir}") end chmod("#{extension_name}/bin/rails", 0o755) end |
#copy_common_templates ⇒ Object
Copy common templates that are shared with theme generator
74 75 76 77 78 79 80 |
# File 'lib/archangel/commands/extension_command.rb', line 74 def copy_common_templates %w[ .gitignore .rspec Gemfile MIT-LICENSE Rakefile ].each do |tpl| template("../common/#{tpl}", "#{extension_name}/#{tpl}") end end |
#copy_plugin_directories ⇒ Object
Copy extension directories and chmod bin scripts
65 66 67 68 69 |
# File 'lib/archangel/commands/extension_command.rb', line 65 def copy_plugin_directories %w[ config lib ].each { |dir| directory(dir, "#{extension_name}/#{dir}") } end |
#copy_plugin_templates ⇒ Object
Copy extension templates
85 86 87 88 89 |
# File 'lib/archangel/commands/extension_command.rb', line 85 def copy_plugin_templates %w[ README.md ].each { |tpl| template(tpl, "#{extension_name}/#{tpl}") } end |
#create_plugin_directory ⇒ Object
Create extension directory
37 38 39 |
# File 'lib/archangel/commands/extension_command.rb', line 37 def create_plugin_directory empty_directory(extension_name) end |
#create_plugin_gemspec ⇒ Object
Create extension .gemspec file
44 45 46 47 |
# File 'lib/archangel/commands/extension_command.rb', line 44 def create_plugin_gemspec template("extension.gemspec", "#{extension_name}/#{extension_name}.gemspec") end |
#generate ⇒ Object
Generate extension
Usage
archangel extension [EXTENSION_NAME]
bundle exec bin/archangel extension [EXTENSION_NAME]
30 31 32 |
# File 'lib/archangel/commands/extension_command.rb', line 30 def generate name_plugin end |