Module: Chaplin::Generators::Helpers
- Included in:
- InstallGenerator
- Defined in:
- lib/generators/chaplin/helpers.rb
Instance Method Summary collapse
- #app_filename ⇒ Object
- #app_name ⇒ Object
- #asset_path ⇒ Object
- #base_path(path) ⇒ Object
- #collection_namespace ⇒ Object
- #controller_path ⇒ Object
- #display(output, color = :green) ⇒ Object
- #javascript_path ⇒ Object
- #layout_path ⇒ Object
- #lib_path ⇒ Object
- #model_namespace ⇒ Object
- #model_path ⇒ Object
- #plural_file_name ⇒ Object
- #rails_app_name ⇒ Object
- #router_file_name ⇒ Object
- #router_namespace ⇒ Object
- #singular_file_name ⇒ Object
- #template_namespace ⇒ Object
- #template_path ⇒ Object
- #view_file_name ⇒ Object
- #view_namespace ⇒ Object
- #view_path ⇒ Object
Instance Method Details
#app_filename ⇒ Object
77 78 79 |
# File 'lib/generators/chaplin/helpers.rb', line 77 def app_filename rails_app_name.underscore end |
#app_name ⇒ Object
73 74 75 |
# File 'lib/generators/chaplin/helpers.rb', line 73 def app_name rails_app_name.camelize end |
#asset_path ⇒ Object
5 6 7 |
# File 'lib/generators/chaplin/helpers.rb', line 5 def asset_path File.join('app', 'assets') end |
#base_path(path) ⇒ Object
29 30 31 |
# File 'lib/generators/chaplin/helpers.rb', line 29 def base_path(path) File.join(path, 'base') end |
#collection_namespace ⇒ Object
57 58 59 |
# File 'lib/generators/chaplin/helpers.rb', line 57 def collection_namespace [app_name, "Collections", file_name.pluralize.camelize].join(".") end |
#controller_path ⇒ Object
21 22 23 |
# File 'lib/generators/chaplin/helpers.rb', line 21 def controller_path File.join(javascript_path, "controllers") end |
#display(output, color = :green) ⇒ Object
89 90 91 |
# File 'lib/generators/chaplin/helpers.rb', line 89 def display(output, color = :green) say(" - #{output}", color) end |
#javascript_path ⇒ Object
9 10 11 |
# File 'lib/generators/chaplin/helpers.rb', line 9 def javascript_path File.join(asset_path, 'javascripts') end |
#layout_path ⇒ Object
85 86 87 |
# File 'lib/generators/chaplin/helpers.rb', line 85 def layout_path Dir['app/views/layouts/application*'].first end |
#lib_path ⇒ Object
25 26 27 |
# File 'lib/generators/chaplin/helpers.rb', line 25 def lib_path File.join(javascript_path, "lib") end |
#model_namespace ⇒ Object
53 54 55 |
# File 'lib/generators/chaplin/helpers.rb', line 53 def model_namespace [app_name, "Models", file_name.singularize.camelize].join(".") end |
#model_path ⇒ Object
13 14 15 |
# File 'lib/generators/chaplin/helpers.rb', line 13 def model_path File.join(javascript_path, "models") end |
#plural_file_name ⇒ Object
41 42 43 |
# File 'lib/generators/chaplin/helpers.rb', line 41 def plural_file_name "#{file_name.pluralize}#{@ext}" end |
#rails_app_name ⇒ Object
81 82 83 |
# File 'lib/generators/chaplin/helpers.rb', line 81 def rails_app_name Rails.application.class.name.split('::').first end |
#router_file_name ⇒ Object
45 46 47 |
# File 'lib/generators/chaplin/helpers.rb', line 45 def router_file_name "#{file_name.pluralize}_router#{@ext}" end |
#router_namespace ⇒ Object
61 62 63 |
# File 'lib/generators/chaplin/helpers.rb', line 61 def router_namespace [app_name, "Routers", file_name.pluralize.camelize].join(".") end |
#singular_file_name ⇒ Object
37 38 39 |
# File 'lib/generators/chaplin/helpers.rb', line 37 def singular_file_name "#{file_name.singularize}#{@ext}" end |
#template_namespace ⇒ Object
69 70 71 |
# File 'lib/generators/chaplin/helpers.rb', line 69 def template_namespace File.join(file_path.pluralize, "index") end |
#template_path ⇒ Object
33 34 35 |
# File 'lib/generators/chaplin/helpers.rb', line 33 def template_path File.join(asset_path, "templates") end |
#view_file_name ⇒ Object
49 50 51 |
# File 'lib/generators/chaplin/helpers.rb', line 49 def view_file_name "#{file_name.pluralize}_index#{@ext}" end |
#view_namespace ⇒ Object
65 66 67 |
# File 'lib/generators/chaplin/helpers.rb', line 65 def view_namespace [app_name, "Views", "#{file_name.pluralize.camelize}Index"].join(".") end |
#view_path ⇒ Object
17 18 19 |
# File 'lib/generators/chaplin/helpers.rb', line 17 def view_path File.join(javascript_path, "views") end |