Class: Ember::Generators::BootstrapGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Ember::Generators::BootstrapGenerator
show all
- Includes:
- GeneratorHelpers
- Defined in:
- lib/generators/ember/bootstrap_generator.rb
Constant Summary
collapse
- APP_FOLDERS =
%W{models controllers views routes components templates templates/components mixins}
- CONFIG_FOLDERS =
%W{serializers}
Instance Method Summary
collapse
#app_path, #application_name, #class_name, #config_path, #configuration, #engine_name, #handlebars_template_path, #javascript_assets_path, #rails_engine?, #require_name
Instance Method Details
#add_custom_paths ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 67
def add_custom_paths
if app_path != configuration.paths.app
insert_into_file 'config/application.rb', before: /\s\send\nend/ do
" config.ember.paths.app = '#{app_path}'\n"
end
end
if config_path != configuration.paths.config
insert_into_file 'config/application.rb', before: /\s\send\nend/ do
" config.ember.paths.config = '#{config_path}'\n"
end
end
end
|
#add_greedy_rails_route ⇒ Object
59
60
61
62
63
64
65
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 59
def add_greedy_rails_route
insert_into_file 'config/routes.rb', before: /^end$/ do
"\n" +
" # Uncomment when using 'history' as the location in Ember's router\n" +
" # get '*foo', :to => 'landing#index'\n"
end
end
|
#add_teaspoon_files ⇒ Object
81
82
83
84
85
86
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 81
def add_teaspoon_files
copy_file "initializers/teaspoon.rb", "config/initializers/teaspoon.rb"
copy_file "test/teaspoon_env.rb", "test/teaspoon_env.rb"
copy_file "test/test_helper.js", "test/test_helper.js"
empty_directory "test/integration"
end
|
#create_app_dir_layout ⇒ Object
19
20
21
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 19
def create_app_dir_layout
create_layout(APP_FOLDERS)
end
|
#create_application_file ⇒ Object
31
32
33
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 31
def create_application_file
template "application.js.erb", "#{config_path}/application.js"
end
|
#create_config_dir_layout ⇒ Object
23
24
25
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 23
def create_config_dir_layout
create_layout(CONFIG_FOLDERS, config_path)
end
|
#create_ember_adapter_file ⇒ Object
35
36
37
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 35
def create_ember_adapter_file
copy_file "adapters/application.es6.erb", "#{config_path}/adapters/application.es6.erb"
end
|
#create_ember_environment_files ⇒ Object
39
40
41
42
43
44
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 39
def create_ember_environment_files
copy_file "environment.js.erb", "#{config_path}/environment.js.erb"
copy_file "environments/development.js.erb", "#{config_path}/environments/development.js.erb"
copy_file "environments/production.js.erb", "#{config_path}/environments/production.js.erb"
copy_file "environments/test.js.erb", "#{config_path}/environments/test.js.erb"
end
|
#create_router_file ⇒ Object
27
28
29
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 27
def create_router_file
template "router.es6", "#{config_path}/router.es6"
end
|
#create_utils_csrf_file ⇒ Object
46
47
48
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 46
def create_utils_csrf_file
template "csrf.js", "#{config_path}/initializers/csrf.js"
end
|
#remove_jbuilder ⇒ Object
55
56
57
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 55
def remove_jbuilder
remove_jbuilder_from_gemfile
end
|
#remove_turbolinks ⇒ Object
50
51
52
53
|
# File 'lib/generators/ember/bootstrap_generator.rb', line 50
def remove_turbolinks
remove_turbolinks_from_gemfile
remove_turbolinks_from_layout
end
|