Class: Ember::Generators::BootstrapGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
GeneratorHelpers
Defined in:
lib/generators/ember/bootstrap_generator.rb

Instance Method Summary collapse

Methods included from GeneratorHelpers

#app_path, #application_name, #class_name, #config_path, #configuration, #engine_name, #handlebars_template_path, #javascript_assets_path, #rails_engine?

Instance Method Details

#add_custom_pathsObject



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/generators/ember/bootstrap_generator.rb', line 55

def add_custom_paths
  if app_path != configuration.paths.app
    insert_into_file 'config/application.rb', before: /\s\send\nend/ do
      "    config.ember.appkit.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.appkit.paths.config = '#{config_path}'\n"
    end
  end
end

#create_application_fileObject



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

def create_application_file
  template "application.js.erb", "#{config_path}/application.js"
end

#create_dir_layoutObject



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

def create_dir_layout
  %W{routes components templates templates/components mixins}.each do |dir|
    empty_directory "#{app_path}/#{dir}"
    create_file "#{app_path}/#{dir}/.gitkeep" unless options[:skip_git]
  end
end

#create_ember_adapter_fileObject



31
32
33
# File 'lib/generators/ember/bootstrap_generator.rb', line 31

def create_ember_adapter_file
  template "adapter.js.erb", "#{config_path}/adapter.js.erb"
end

#create_ember_environment_filesObject



35
36
37
38
39
40
# File 'lib/generators/ember/bootstrap_generator.rb', line 35

def create_ember_environment_files
  template "environment.js", "#{config_path}/environment.js"
  template "environments/development.js", "#{config_path}/environments/development.js"
  template "environments/production.js", "#{config_path}/environments/production.js"
  template "environments/test.js", "#{config_path}/environments/test.js"
end

#create_router_fileObject



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

def create_router_file
  template "router.js.es6", "#{config_path}/router.js.es6"
end

#create_utils_csrf_fileObject



42
43
44
# File 'lib/generators/ember/bootstrap_generator.rb', line 42

def create_utils_csrf_file
  template "csrf.js", "#{config_path}/initializers/csrf.js"
end

#remove_jbuilderObject



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

def remove_jbuilder
  remove_jbuilder_from_gemfile
end


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

def remove_turbolinks
  remove_turbolinks_from_gemfile
  remove_turbolinks_from_layout
end