Class: Shiny::Plugin::PluginBuilder
- Inherits:
-
Object
- Object
- Shiny::Plugin::PluginBuilder
- Defined in:
- lib/generators/shiny/plugin/plugin_builder.rb
Overview
Supporting code for the ShinyCMS plugin generator
Instance Method Summary collapse
- #app ⇒ Object
- #bin(force: false) ⇒ Object
- #config ⇒ Object
- #gemfile ⇒ Object
- #gemfile_entry ⇒ Object
- #gemspec ⇒ Object
- #lib ⇒ Object
- #license ⇒ Object
- #rakefile ⇒ Object
- #readme ⇒ Object
Instance Method Details
#app ⇒ Object
17 18 19 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 17 def app directory 'app' end |
#bin(force: false) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 49 def bin( force: false ) bin_file = 'bin/rails.tt' template bin_file, force: force do |content| "#{shebang}\n" + content end chmod 'bin', 0o755, verbose: false end |
#config ⇒ Object
44 45 46 47 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 44 def config template 'config/routes.rb' template 'config/locales/en.yml' end |
#gemfile ⇒ Object
25 26 27 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 25 def gemfile template 'Gemfile' end |
#gemfile_entry ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 57 def gemfile_entry return unless inside_application? gemfile_in_app_path = File.join( rails_app_path, 'Gemfile' ) return unless File.exist? gemfile_in_app_path entry = "\ngem '#{name}', path: '#{relative_path}'" append_file gemfile_in_app_path, entry end |
#gemspec ⇒ Object
33 34 35 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 33 def gemspec template '%name%.gemspec' end |
#lib ⇒ Object
37 38 39 40 41 42 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 37 def lib template 'lib/%namespaced_name%.rb' template 'lib/%namespaced_name%/engine.rb' template 'lib/%namespaced_name%/version.rb' template 'lib/tasks/%namespaced_name%_tasks.rake' end |
#license ⇒ Object
29 30 31 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 29 def license template 'LICENSE' end |
#rakefile ⇒ Object
13 14 15 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 13 def rakefile template 'Rakefile' end |
#readme ⇒ Object
21 22 23 |
# File 'lib/generators/shiny/plugin/plugin_builder.rb', line 21 def readme template 'README.md' end |