Module: Ember::Generators::GeneratorHelpers

Instance Method Summary collapse

Instance Method Details

#app_pathObject


7
8
9
10
11
12
13
# File 'lib/generators/ember/generator_helpers.rb', line 7

def app_path
  if options[:app_path]
    options[:app_path]
  else
    configuration.paths.app
  end
end

#application_nameObject


31
32
33
34
35
36
37
38
39
40
41
# File 'lib/generators/ember/generator_helpers.rb', line 31

def application_name
  if options[:app_name]
    options[:app_name]
  elsif configuration.app_name
    configuration.app_name
  elsif rails_engine?
    engine_name
  else
    'App'
  end
end

#class_nameObject


43
44
45
# File 'lib/generators/ember/generator_helpers.rb', line 43

def class_name
  (class_path + [file_name]).map!{ |m| m.camelize }.join()
end

#config_pathObject


15
16
17
18
19
20
21
# File 'lib/generators/ember/generator_helpers.rb', line 15

def config_path
  if options[:config_path]
    options[:config_path]
  else
    configuration.paths.config
  end
end

#configurationObject


59
60
61
# File 'lib/generators/ember/generator_helpers.rb', line 59

def configuration
  ::Rails.configuration.ember
end

#engine_nameObject


27
28
29
# File 'lib/generators/ember/generator_helpers.rb', line 27

def engine_name
  ENGINE_PATH.split('/')[-2]
end

#handlebars_template_pathObject


51
52
53
# File 'lib/generators/ember/generator_helpers.rb', line 51

def handlebars_template_path
  File.join(class_path, file_name).gsub(/^\//, '')
end

#javascript_assets_pathObject


55
56
57
# File 'lib/generators/ember/generator_helpers.rb', line 55

def javascript_assets_path
  File.join(::Rails.root, 'app/assets/javascripts')
end

#rails_engine?Boolean


23
24
25
# File 'lib/generators/ember/generator_helpers.rb', line 23

def rails_engine?
  defined?(ENGINE_PATH)
end

#require_nameObject


47
48
49
# File 'lib/generators/ember/generator_helpers.rb', line 47

def require_name
  (class_path + [file_name]).map!{ |m| m.dasherize }.join('/')
end