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
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/archangel/commands/extension_command.rb', line 94 def puts %( ****************************************************************** Your extension has been generated with a gemspec dependency on Archangel v#{archangel_version} #{random_compliment} ****************************************************************** ) end |
#copy_common_directories ⇒ Object
Copy common directories that are shared with theme generator
52 53 54 55 56 |
# File 'lib/archangel/commands/extension_command.rb', line 52 def copy_common_directories %w[spec].each do |dir| directory("../common/#{dir}", "#{extension_name}/#{dir}") end end |
#copy_common_templates ⇒ Object
Copy common templates that are shared with theme generator
72 73 74 75 76 77 78 |
# File 'lib/archangel/commands/extension_command.rb', line 72 def copy_common_templates %w[ .editorconfig .gitignore .rspec .rubocop.yml MIT-LICENSE ].each do |tpl| template("../common/#{tpl}", "#{extension_name}/#{tpl}") end end |
#copy_plugin_directories ⇒ Object
Copy extension directories and chmod bin scripts
61 62 63 64 65 66 67 |
# File 'lib/archangel/commands/extension_command.rb', line 61 def copy_plugin_directories %w[ app bin config lib ].each { |dir| directory(dir, "#{extension_name}/#{dir}") } chmod("#{extension_name}/bin/rails", 0o755) end |
#copy_plugin_templates ⇒ Object
Copy extension templates
83 84 85 86 87 |
# File 'lib/archangel/commands/extension_command.rb', line 83 def copy_plugin_templates %w[ Gemfile Rakefile 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 |