Module: MarionetteDust::Generators::Helpers
- Included in:
- Md::Generators::InstallGenerator, Md::Generators::ScaffoldGenerator, Md::Generators::SubmoduleGenerator
- Defined in:
- lib/generators/md/helpers.rb
Instance Method Summary collapse
- #app_name ⇒ Object
- #apps_path ⇒ Object
- #asset_file_name(type) ⇒ Object
- #asset_path ⇒ Object
- #entities_path ⇒ Object
- #extension ⇒ Object
- #javascript_path ⇒ Object
- #plural_entity_name ⇒ Object
- #plural_file_name ⇒ Object
- #rails_app_name ⇒ Object
- #singular_entity_name ⇒ Object
- #singular_file_name ⇒ Object
- #sub_app_file_name ⇒ Object
- #sub_app_name ⇒ Object
- #sub_app_scope ⇒ Object
- #template_path ⇒ Object
- #trackeable_directory(path) ⇒ Object
Instance Method Details
#app_name ⇒ Object
61 62 63 |
# File 'lib/generators/md/helpers.rb', line 61 def app_name rails_app_name.camelize end |
#apps_path ⇒ Object
17 18 19 |
# File 'lib/generators/md/helpers.rb', line 17 def apps_path File.join(javascript_path, "apps") end |
#asset_file_name(type) ⇒ Object
33 34 35 |
# File 'lib/generators/md/helpers.rb', line 33 def asset_file_name(type) "#{@submodule_name.downcase.singularize}_#{type}#{extension}" end |
#asset_path ⇒ Object
5 6 7 |
# File 'lib/generators/md/helpers.rb', line 5 def asset_path File.join('app', 'assets') end |
#entities_path ⇒ Object
13 14 15 |
# File 'lib/generators/md/helpers.rb', line 13 def entities_path File.join(javascript_path, "entities") end |
#extension ⇒ Object
57 58 59 |
# File 'lib/generators/md/helpers.rb', line 57 def extension @ext ||= .coffeescript ? ".js.coffee" : ".js" end |
#javascript_path ⇒ Object
9 10 11 |
# File 'lib/generators/md/helpers.rb', line 9 def javascript_path File.join(asset_path, 'javascripts') end |
#plural_entity_name ⇒ Object
41 42 43 |
# File 'lib/generators/md/helpers.rb', line 41 def plural_entity_name file_name.pluralize.camelize end |
#plural_file_name ⇒ Object
29 30 31 |
# File 'lib/generators/md/helpers.rb', line 29 def plural_file_name "#{file_name.pluralize}#{extension}" end |
#rails_app_name ⇒ Object
65 66 67 |
# File 'lib/generators/md/helpers.rb', line 65 def rails_app_name Rails.application.class.name.split('::').first end |
#singular_entity_name ⇒ Object
37 38 39 |
# File 'lib/generators/md/helpers.rb', line 37 def singular_entity_name file_name.singularize.camelize end |
#singular_file_name ⇒ Object
25 26 27 |
# File 'lib/generators/md/helpers.rb', line 25 def singular_file_name "#{file_name.singularize}#{extension}" end |
#sub_app_file_name ⇒ Object
49 50 51 |
# File 'lib/generators/md/helpers.rb', line 49 def sub_app_file_name [file_name.singularize.downcase, "_app", "#{extension}"].join("") end |
#sub_app_name ⇒ Object
45 46 47 |
# File 'lib/generators/md/helpers.rb', line 45 def sub_app_name [file_name.camelize, "App"].join("") end |
#sub_app_scope ⇒ Object
53 54 55 |
# File 'lib/generators/md/helpers.rb', line 53 def sub_app_scope @submodule_name.camelize end |
#template_path ⇒ Object
21 22 23 |
# File 'lib/generators/md/helpers.rb', line 21 def template_path File.join(asset_path, "templates") end |
#trackeable_directory(path) ⇒ Object
69 70 71 72 |
# File 'lib/generators/md/helpers.rb', line 69 def trackeable_directory(path) empty_directory path template ".gitkeep", "#{path}/.gitkeep" end |