Module: MarionetteDust::Generators::Helpers

Instance Method Summary collapse

Instance Method Details

#app_nameObject



61
62
63
# File 'lib/generators/md/helpers.rb', line 61

def app_name
  rails_app_name.camelize
end

#apps_pathObject



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_pathObject



5
6
7
# File 'lib/generators/md/helpers.rb', line 5

def asset_path
  File.join('app', 'assets')
end

#entities_pathObject



13
14
15
# File 'lib/generators/md/helpers.rb', line 13

def entities_path
  File.join(javascript_path, "entities")
end

#extensionObject



57
58
59
# File 'lib/generators/md/helpers.rb', line 57

def extension
  @ext ||= options.coffeescript ? ".js.coffee" : ".js"
end

#javascript_pathObject



9
10
11
# File 'lib/generators/md/helpers.rb', line 9

def javascript_path
  File.join(asset_path, 'javascripts')
end

#plural_entity_nameObject



41
42
43
# File 'lib/generators/md/helpers.rb', line 41

def plural_entity_name
  file_name.pluralize.camelize
end

#plural_file_nameObject



29
30
31
# File 'lib/generators/md/helpers.rb', line 29

def plural_file_name
  "#{file_name.pluralize}#{extension}"
end

#rails_app_nameObject



65
66
67
# File 'lib/generators/md/helpers.rb', line 65

def rails_app_name
  Rails.application.class.name.split('::').first
end

#singular_entity_nameObject



37
38
39
# File 'lib/generators/md/helpers.rb', line 37

def singular_entity_name
  file_name.singularize.camelize
end

#singular_file_nameObject



25
26
27
# File 'lib/generators/md/helpers.rb', line 25

def singular_file_name
  "#{file_name.singularize}#{extension}"
end

#sub_app_file_nameObject



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_nameObject



45
46
47
# File 'lib/generators/md/helpers.rb', line 45

def sub_app_name
  [file_name.camelize, "App"].join("")
end

#sub_app_scopeObject



53
54
55
# File 'lib/generators/md/helpers.rb', line 53

def sub_app_scope
  @submodule_name.camelize
end

#template_pathObject



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