ember-appkit-rails 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/templates/application.hbs +569 -5
  3. data/lib/ember-appkit-rails.rb +0 -9
  4. data/lib/ember/appkit/rails.rb +15 -3
  5. data/lib/ember/appkit/rails/active_support.rb +1 -0
  6. data/lib/ember/appkit/rails/active_support/dependencies.rb +10 -0
  7. data/lib/ember/appkit/rails/engine.rb +49 -19
  8. data/lib/ember/appkit/rails/sprockets.rb +1 -0
  9. data/lib/ember/appkit/rails/sprockets/context.rb +10 -0
  10. data/lib/ember/appkit/rails/sprockets/processed_asset.rb +1 -1
  11. data/lib/ember/appkit/rails/template.rb +109 -0
  12. data/lib/ember/appkit/rails/version.rb +1 -1
  13. data/lib/ember/appkit/rails/walker.rb +99 -0
  14. data/lib/generators/ember/bootstrap_generator.rb +16 -8
  15. data/lib/generators/ember/component_generator.rb +1 -1
  16. data/lib/generators/ember/generator_helpers.rb +1 -1
  17. data/lib/generators/ember/model_generator.rb +1 -1
  18. data/lib/generators/ember/resource_generator.rb +3 -4
  19. data/lib/generators/ember/resource_override.rb +21 -0
  20. data/lib/generators/ember/scaffold_controller_override.rb +14 -0
  21. data/lib/generators/ember/scaffold_override.rb +25 -0
  22. data/lib/generators/templates/{adapter.js → adapter.js.erb} +1 -1
  23. data/lib/generators/templates/application.js.erb +0 -1
  24. data/lib/generators/templates/environments/development.js +3 -0
  25. data/lib/generators/templates/environments/production.js +3 -0
  26. data/lib/generators/templates/environments/test.js +3 -0
  27. data/lib/generators/templates/scaffold/template/index.hbs +2 -2
  28. data/lib/generators/templates/scaffold/template/show.hbs +1 -1
  29. data/lib/generators/templates/scaffold_controller/controller.rb +56 -0
  30. data/test/dummy/Gemfile +0 -3
  31. data/test/dummy/app/assets/javascripts/application.js +16 -0
  32. data/test/dummy/app/models/is_a_module/dog.rb +0 -0
  33. data/test/dummy/config/adapter.js.erb +3 -0
  34. data/test/dummy/config/application.js +0 -1
  35. data/test/dummy/config/environments/development.js +3 -0
  36. data/test/dummy/config/environments/production.js +3 -0
  37. data/test/dummy/config/environments/test.js +3 -0
  38. data/test/dummy/config/initializers/secret_token.rb +1 -1
  39. data/test/dummy/log/test.log +47 -12
  40. data/test/dummy/tmp/{ember-rails/ember.js → cache/assets/test/sprockets/012cc56cb3d167247c623ab5a4dd2f8a} +0 -0
  41. data/test/dummy/tmp/cache/assets/test/sprockets/07afa5d8ceda557642e2330ab45eb203 +0 -0
  42. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  43. data/test/dummy/tmp/cache/assets/test/sprockets/1d5975f28925835fe6077b200f4f150f +0 -0
  44. data/test/dummy/tmp/cache/assets/test/sprockets/1f15c49a05b13c3a7ee50d2ac3900f38 +0 -0
  45. data/test/dummy/tmp/{ember-rails/ember-data.js → cache/assets/test/sprockets/352c2af460d03b624ae5652411a463d1} +0 -0
  46. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  47. data/test/dummy/tmp/cache/assets/test/sprockets/4a1d4e32cd7b9fd1c62bfd553ae56051 +0 -0
  48. data/test/dummy/tmp/cache/assets/test/sprockets/{6870da13c3305651063dc22ccce27d5c → 5421e30f80c2b8cdf4379b8dce18bcd3} +0 -0
  49. data/test/dummy/tmp/cache/assets/test/sprockets/645beb565f2e6d67728537e06963533d +0 -0
  50. data/test/dummy/tmp/cache/assets/test/sprockets/660bc633c8899c6c1b20514637fa0169 +0 -0
  51. data/test/dummy/tmp/cache/assets/test/sprockets/67afcba9807cd5e57b80b5fdf9f26758 +0 -0
  52. data/test/dummy/tmp/cache/assets/test/sprockets/{8ebc8c58233ab12eee6edfc0feca2492 → 702dbd08a7eb5e831dd268e0460d97b2} +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sprockets/7ca4966e0a480430a858a7ab74518c75 +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sprockets/827fafc13575b345cc572fd041ef1fba +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sprockets/83af35bb6b852de883a26a9458fd4e3a +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sprockets/9160f792acb62d1f7721c714681fcfe6 +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sprockets/ae884a1acda0e6f9bb27a856a22bb08d +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sprockets/bb4a2293175928af3e23c47488077098 +0 -0
  59. data/test/dummy/tmp/cache/assets/test/sprockets/bf689240392e7355c0de5cfd47272146 +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sprockets/d5a48c6656341c56cac8a8e42bb925a5 +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sprockets/de0932670a6c856bc6eda1586fd29061 +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sprockets/de94a60b438eb5bf57653f3a220acd80 +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sprockets/e15ec26dd7914851e352c6f2c73c4284 +0 -0
  65. data/test/dummy/tmp/cache/assets/test/sprockets/e3ddb4a07e99c5bbf5f9cd9db3cdb82a +0 -0
  66. data/test/dummy/tmp/cache/assets/test/sprockets/e9abb671d48f6ff2be6ffb463ea652bf +0 -0
  67. data/test/dummy/tmp/cache/assets/test/sprockets/eeb5bd38d1dad0d908461fd114f702bc +0 -0
  68. data/test/dummy/tmp/cache/assets/test/sprockets/fde9e78f8d55a70f4ef757638fc6cde0 +0 -0
  69. data/test/dummy/tmp/cache/assets/test/sprockets/fdfac6623944c5a23737724cbd90e58e +0 -0
  70. data/test/fixtures/routes_with_api_and_version_namespaces.rb +6 -0
  71. data/test/fixtures/routes_with_api_namespace.rb +4 -0
  72. data/test/generators/bootstrap_generator_test.rb +6 -3
  73. data/test/generators/component_generator_test.rb +6 -6
  74. data/test/generators/model_generator_test.rb +8 -2
  75. data/test/generators/resource_generator_test.rb +6 -6
  76. data/test/generators/resource_override_test.rb +10 -4
  77. data/test/generators/scaffold_override_test.rb +94 -0
  78. data/test/integration/autoload_modules_test.rb +22 -0
  79. data/test/integration/navigation_test.rb +1 -2
  80. data/test/support/generator_test_support.rb +8 -10
  81. data/test/test_helper.rb +2 -1
  82. data/vendor/assets/javascripts/app.js.es6.erb +1 -1
  83. data/vendor/assets/javascripts/ember-appkit/index.js +1 -3
  84. data/vendor/assets/javascripts/ember-appkit/loader.js +53 -0
  85. metadata +98 -41
  86. data/lib/ember/appkit.rb +0 -5
  87. data/lib/ember/appkit/rails/resource_override.rb +0 -14
  88. data/test/dummy/config/adapter.js +0 -3
  89. data/test/dummy/tmp/cache/assets/test/sprockets/07a9ce16127008e142b1b0223c4d7784 +0 -0
  90. data/test/dummy/tmp/cache/assets/test/sprockets/a2f615309ade94c14ae81d7ebc94fd67 +0 -0
  91. data/test/dummy/tmp/cache/assets/test/sprockets/a9648a765fed0738b076bd24099109a3 +0 -0
  92. data/test/dummy/tmp/cache/assets/test/sprockets/b340d5578308bb4c197a8ca3538b0e24 +0 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/c8c4c1b316845f30168739b5795846d6 +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/e22019b3c13c20bc08e899fb2b7248ea +0 -0
  95. data/vendor/assets/javascripts/ember-appkit/almond.js +0 -417
@@ -1,10 +1 @@
1
- # This is necessary because the generators live in `lib/generators`
2
- # this path is on the Rubygems load path and the first wins. We need
3
- # to ensure the ember-appkit-rails is always on the load path *before*
4
- # ember-rails
5
-
6
- $:.delete(File.expand_path('..', __FILE__))
7
- $:.unshift(File.expand_path('..', __FILE__))
8
-
9
- require 'ember/appkit'
10
1
  require 'ember/appkit/rails'
@@ -1,6 +1,18 @@
1
- module Ember::Appkit::Rails; end
1
+ require 'ember/source'
2
+ require 'es6_module_transpiler/rails'
3
+ require 'active_model_serializers'
4
+ require 'sprockets/railtie'
5
+ require 'ember/source'
6
+ require 'ember/data/source'
7
+ require 'handlebars/source'
8
+
9
+ module Ember
10
+ module Appkit
11
+ module Rails; end
12
+ end
13
+ end
2
14
 
3
15
  require 'ember/appkit/rails/engine'
4
16
  require 'ember/appkit/rails/sprockets'
5
-
6
- Rails::WelcomeController.view_paths = File.expand_path('../rails/templates', __FILE__)
17
+ require 'ember/appkit/rails/template'
18
+ require 'ember/appkit/rails/active_support'
@@ -0,0 +1 @@
1
+ require 'ember/appkit/rails/active_support/dependencies'
@@ -0,0 +1,10 @@
1
+ module ActiveSupport::Dependencies
2
+ def autoloadable_module?(path_suffix)
3
+ autoload_paths.each do |load_path|
4
+ path = File.join(load_path, path_suffix)
5
+ return load_path if File.directory?(path) && Dir.glob(File.join(path, '**/*.rb')).present?
6
+ end
7
+
8
+ return false
9
+ end
10
+ end
@@ -1,31 +1,56 @@
1
- require 'ember-rails'
2
-
3
1
  class Ember::Appkit::Rails::Engine < ::Rails::Engine
4
- config.ember.appkit = ActiveSupport::OrderedOptions.new
5
- config.ember.appkit.paths = ActiveSupport::OrderedOptions.new
6
- config.ember.appkit.namespaces = ActiveSupport::OrderedOptions.new
7
- config.ember.appkit.prefix_patterns = ActiveSupport::OrderedOptions.new
2
+ config.ember = ActiveSupport::OrderedOptions.new
3
+ config.ember.paths = ActiveSupport::OrderedOptions.new
4
+ config.ember.namespaces = ActiveSupport::OrderedOptions.new
5
+ config.ember.prefix_patterns = ActiveSupport::OrderedOptions.new
6
+
7
+ config.ember.paths.app = 'app'
8
+ config.ember.paths.config = 'config'
9
+ config.ember.namespaces.app = 'app'
10
+ config.ember.namespaces.config = 'config'
8
11
 
9
- config.ember.appkit.paths.app = 'app'
10
- config.ember.appkit.paths.config = 'config'
11
- config.ember.appkit.namespaces.app = 'app'
12
- config.ember.appkit.namespaces.config = 'config'
12
+ config.ember.enable_logging = ::Rails.env.development?
13
+ config.ember.api_version = 1
13
14
 
14
- config.ember.appkit.enable_logging = ::Rails.env.development?
15
+ generators do |app|
16
+ app.config.generators.helper false
17
+ app.config.generators.assets false
18
+ app.config.generators.template_engine false
19
+
20
+ ::Rails::Generators.configure!(app.config.generators)
21
+ ::Rails::Generators.hidden_namespaces.uniq!
22
+ require 'generators/ember/resource_override'
23
+ require 'generators/ember/scaffold_override'
24
+ require 'generators/ember/scaffold_controller_override'
25
+ end
15
26
 
16
27
  initializer :appkit_transpiler do
17
- config.ember.appkit.prefix_patterns.app ||= Regexp.new(File.join(::Rails.root, config.ember.appkit.namespaces.app))
18
- config.ember.appkit.prefix_patterns.config ||= Regexp.new(File.join(::Rails.root, config.ember.appkit.namespaces.config))
28
+ config.ember.prefix_patterns.app ||= Regexp.new(File.join(::Rails.root, config.ember.namespaces.app))
29
+ config.ember.prefix_patterns.config ||= Regexp.new(File.join(::Rails.root, config.ember.namespaces.config))
19
30
 
20
- ES6ModuleTranspiler.add_prefix_pattern config.ember.appkit.prefix_patterns.app, config.ember.appkit.namespaces.app
21
- ES6ModuleTranspiler.add_prefix_pattern config.ember.appkit.prefix_patterns.config, config.ember.appkit.namespaces.config
31
+ ES6ModuleTranspiler.add_prefix_pattern config.ember.prefix_patterns.app, config.ember.namespaces.app
32
+ ES6ModuleTranspiler.add_prefix_pattern config.ember.prefix_patterns.config, config.ember.namespaces.config
22
33
  ES6ModuleTranspiler.transform = lambda { |name| name.split('/').map { |n| n.underscore.dasherize }.join('/') }
23
34
  end
24
35
 
25
36
  initializer :appkit_handlebars do
37
+ config.handlebars = ActiveSupport::OrderedOptions.new
38
+
39
+ config.handlebars.precompile = true
40
+ config.handlebars.output_type = :global
41
+ config.handlebars.templates_root = "templates"
42
+ config.handlebars.templates_path_separator = '/'
43
+
44
+ config.before_initialize do |app|
45
+ Sprockets::Engines # force autoloading
46
+ Sprockets.register_engine '.handlebars', Ember::Appkit::Rails::Template
47
+ Sprockets.register_engine '.hbs', Ember::Appkit::Rails::Template
48
+ Sprockets.register_engine '.hjs', Ember::Appkit::Rails::Template
49
+ end
50
+
26
51
  config.handlebars ||= ActiveSupport::OrderedOptions.new
27
52
  config.handlebars.output_type = :amd
28
- config.handlebars.amd_namespace = config.ember.appkit.namespaces.app
53
+ config.handlebars.amd_namespace = config.ember.namespaces.app
29
54
  end
30
55
 
31
56
  initializer :appkit_router do |app|
@@ -40,8 +65,13 @@ class Ember::Appkit::Rails::Engine < ::Rails::Engine
40
65
  assets_javascript = assets.paths.delete(::Rails.root.join('app','assets','javascripts').to_s)
41
66
 
42
67
  index_of_last_app_assets = assets.paths.rindex{|s| s.start_with?(::Rails.root.join('app').to_s) } + 1
43
- assets.paths.insert(index_of_last_app_assets, assets_javascript) if assets_javascript
44
- assets.paths.insert(index_of_last_app_assets, File.join(::Rails.root, config.ember.appkit.paths.config))
45
- assets.paths.insert(index_of_last_app_assets, File.join(::Rails.root, config.ember.appkit.paths.app))
68
+ assets.paths.insert(index_of_last_app_assets, File.join(::Rails.root, config.ember.paths.app))
69
+ assets.paths.insert(index_of_last_app_assets, File.join(::Rails.root, config.ember.paths.config))
70
+ end
71
+
72
+ initializer :appkit_setup_vendor, after: :append_assets_path, :group => :all do |app|
73
+ app.config.assets.paths.append(File.dirname(::Ember::Source.bundled_path_for("ember.js")))
74
+ app.config.assets.paths.append(File.dirname(::Ember::Data::Source.bundled_path_for("ember-data.js")))
75
+ app.config.assets.paths.append(File.expand_path('../', ::Handlebars::Source.bundled_path))
46
76
  end
47
77
  end
@@ -1,4 +1,5 @@
1
1
  module Ember::Appkit::Rails::Sprockets; end
2
2
 
3
+ require 'ember/appkit/rails/sprockets/context'
3
4
  require 'ember/appkit/rails/sprockets/processed_asset'
4
5
  require 'ember/appkit/rails/sprockets/directive_processor'
@@ -0,0 +1,10 @@
1
+ require 'sprockets/context'
2
+
3
+ module Ember::Appkit::Rails::Sprockets::Context
4
+ def asset_requirable?(path)
5
+ return false if path.to_s.match File.join(::Rails.root, 'app/assets')
6
+ super
7
+ end
8
+ end
9
+
10
+ Sprockets::Context.send(:prepend, Ember::Appkit::Rails::Sprockets::Context)
@@ -16,7 +16,7 @@ module Ember::Appkit::Rails::Sprockets::ProcessedAsset
16
16
  private
17
17
 
18
18
  def _make_ember_application_template_stale(pathname)
19
- if pathname.to_s =~ /ember-appkit-rails.+\/app\/assets\/javascripts\/templates\/application.hbs/
19
+ if pathname.to_s =~ /(ember-appkit-rails.+\/app\/assets\/javascripts\/templates\/application.hbs)|(.*\.erb)/
20
20
  def self.fresh?(environment)
21
21
  false
22
22
  end
@@ -0,0 +1,109 @@
1
+ require 'sprockets'
2
+ require 'sprockets/engines'
3
+ require 'barber'
4
+
5
+ class Ember::Appkit::Rails::Template < Tilt::Template
6
+ def self.default_mime_type
7
+ 'application/javascript'
8
+ end
9
+
10
+ def prepare; end
11
+
12
+ def evaluate(scope, locals, &block)
13
+ raw = handlebars?(scope)
14
+
15
+ if raw
16
+ template = data
17
+ else
18
+ template = mustache_to_handlebars(scope, data)
19
+ end
20
+
21
+ if configuration.precompile
22
+ if raw
23
+ template = precompile_handlebars(template)
24
+ else
25
+ template = precompile_ember_handlebars(template)
26
+ end
27
+ else
28
+ if raw
29
+ template = compile_handlebars(data)
30
+ else
31
+ template = compile_ember_handlebars(template)
32
+ end
33
+ end
34
+
35
+ if configuration.output_type == :amd
36
+ target = amd_template_target(scope)
37
+
38
+ "define('#{target}', ['exports'], function(__exports__){ __exports__.default = #{template} });"
39
+ else
40
+ target = global_template_target(scope)
41
+
42
+ "#{target} = #{template}\n"
43
+ end
44
+ end
45
+
46
+ private
47
+
48
+ def handlebars?(scope)
49
+ scope.pathname.to_s =~ /\.raw\.(handlebars|hjs|hbs)/
50
+ end
51
+
52
+ def amd_template_target(scope)
53
+ "#{configuration.amd_namespace}/#{scope.logical_path.split(".").first}"
54
+ end
55
+
56
+ def global_template_target(scope)
57
+ "Ember.TEMPLATES[#{template_path(scope.logical_path).inspect}]"
58
+ end
59
+
60
+ def compile_handlebars(string)
61
+ "Handlebars.compile(#{indent(string).inspect});"
62
+ end
63
+
64
+ def precompile_handlebars(string)
65
+ Barber::FilePrecompiler.call(string)
66
+ end
67
+
68
+ def compile_ember_handlebars(string)
69
+ "Ember.Handlebars.compile(#{indent(string).inspect});"
70
+ end
71
+
72
+ def precompile_ember_handlebars(string)
73
+ Barber::Ember::FilePrecompiler.call(string)
74
+ end
75
+
76
+ def mustache_to_handlebars(scope, template)
77
+ if scope.pathname.to_s =~ /\.mustache\.(handlebars|hjs|hbs)/
78
+ template.gsub(/\{\{(\w[^\}\}]+)\}\}/){ |x| "{{unbound #{$1}}}" }
79
+ else
80
+ template
81
+ end
82
+ end
83
+
84
+ def template_path(path)
85
+ root = configuration.templates_root
86
+
87
+ if root.kind_of? Array
88
+ root.each do |root|
89
+ path.sub!(/#{Regexp.quote(root)}\//, '')
90
+ end
91
+ else
92
+ unless root.empty?
93
+ path.sub!(/#{Regexp.quote(root)}\/?/, '')
94
+ end
95
+ end
96
+
97
+ path = path.split('/')
98
+
99
+ path.join(configuration.templates_path_separator)
100
+ end
101
+
102
+ def configuration
103
+ ::Rails.configuration.handlebars
104
+ end
105
+
106
+ def indent(string)
107
+ string.gsub(/$(.)/m, "\\1 ").strip
108
+ end
109
+ end
@@ -1,7 +1,7 @@
1
1
  module Ember
2
2
  module Appkit
3
3
  module Rails
4
- VERSION = '0.2.2'
4
+ VERSION = '0.3.0'
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,99 @@
1
+ require 'ripper'
2
+
3
+ class Walker
4
+ def initialize(resource, path, api_version)
5
+ @resource = resource
6
+ @file = File.open(path, 'r+')
7
+ content = @file.read
8
+ @ast = Ripper.sexp(content)
9
+ @lines = content.split("\n")
10
+ @api_version = api_version
11
+ end
12
+
13
+ def run
14
+ find_api_namespace(@ast)
15
+
16
+ output = nil
17
+ line_number = @lines.index { |line| line =~ /routes\.draw do/ }
18
+
19
+ if @write_to
20
+ if @write_to.first == :version
21
+ output = write_resource
22
+ else
23
+ output = write_version_namespace do
24
+ write_resource
25
+ end
26
+ end
27
+ line_number = @write_to.last - 1
28
+ else
29
+ output = write_api_namespace do
30
+ write_version_namespace do
31
+ write_resource
32
+ end
33
+ end
34
+ end
35
+
36
+ @lines.insert(line_number + 1, output)
37
+ @file.rewind
38
+ @file.write(@lines.join("\n"))
39
+ @file.close
40
+ end
41
+
42
+ def write_api_namespace
43
+ " namespace :api do\n#{yield}\n end"
44
+ end
45
+
46
+ def write_version_namespace
47
+ " namespace :v#{@api_version} do\n#{yield}\n end"
48
+ end
49
+
50
+ def write_resource
51
+ " resources :#{@resource}, except: [:new, :edit]"
52
+ end
53
+
54
+ def find_api_namespace(ast)
55
+ find_namespace(ast, 'api') do |ast|
56
+ find_version_namespace(ast, @api_version)
57
+
58
+ if @write_to.nil?
59
+ @write_to = [:api, ast[1][1][2][0]]
60
+ end
61
+
62
+ # found the first instance of the namespace
63
+ # immediately short-circuit
64
+ return
65
+ end
66
+ end
67
+
68
+ def find_version_namespace(ast, version)
69
+ find_namespace(ast, "v#{version}") do |ast|
70
+ @write_to = [:version, ast[1][1][2][0]]
71
+
72
+ # found the first instance of the namespace
73
+ # immediately short-circuit
74
+ return
75
+ end
76
+
77
+ @write_to
78
+ end
79
+
80
+ def find_namespace(ast, name)
81
+ walk(ast) do |ast, node|
82
+ if node == :method_add_block
83
+ flat_ast = ast[1].flatten
84
+ if flat_ast.include?('namespace') && flat_ast.include?(name)
85
+ yield(ast)
86
+ end
87
+ end
88
+ end
89
+ end
90
+
91
+ def walk(ast, &block)
92
+ if ast.is_a?(Array)
93
+ ast.each do |node|
94
+ yield(ast, node)
95
+ walk(node, &block)
96
+ end
97
+ end
98
+ end
99
+ end
@@ -7,7 +7,7 @@ module Ember
7
7
 
8
8
  source_root File.expand_path("../../templates", __FILE__)
9
9
 
10
- desc "Creates a default Ember.js folder layout in app/assets/javascripts"
10
+ desc "Creates a default Ember.js folder layout in app/ and config/"
11
11
 
12
12
  class_option :app_path, :type => :string, :aliases => "-a", :default => false, :desc => "Custom ember app path"
13
13
  class_option :config_path, :type => :string, :aliases => "-c", :default => false, :desc => "Custom ember config path"
@@ -20,10 +20,6 @@ module Ember
20
20
  end
21
21
  end
22
22
 
23
- def remove_javascript_assets_directory
24
- remove_dir "app/assets/javascripts"
25
- end
26
-
27
23
  def create_router_file
28
24
  template "router.js.es6", "#{config_path}/router.js.es6"
29
25
  end
@@ -33,7 +29,7 @@ module Ember
33
29
  end
34
30
 
35
31
  def create_ember_adapter_file
36
- template "adapter.js", "#{config_path}/adapter.js"
32
+ template "adapter.js.erb", "#{config_path}/adapter.js.erb"
37
33
  end
38
34
 
39
35
  def create_ember_environment_files
@@ -52,6 +48,10 @@ module Ember
52
48
  remove_turbolinks_from_layout
53
49
  end
54
50
 
51
+ def remove_jbuilder
52
+ remove_jbuilder_from_gemfile
53
+ end
54
+
55
55
  def add_custom_paths
56
56
  if app_path != configuration.paths.app
57
57
  insert_into_file 'config/application.rb', before: /\s\send\nend/ do
@@ -75,11 +75,19 @@ module Ember
75
75
  gsub_file path, /(?:, "data-turbolinks-track" => true)/, ''
76
76
  end
77
77
 
78
- def remove_turbolinks_from_gemfile
78
+ def remove_gem_from_gemfile(gem)
79
79
  path = Pathname.new(destination_root).join('Gemfile')
80
80
  return unless path.exist?
81
81
 
82
- gsub_file path, /(?:#.+$\n)?gem 'turbolinks'\n\n/, ''
82
+ gsub_file path, /(?:#.+$\n)?gem '#{gem}.*'\n\n/, ''
83
+ end
84
+
85
+ def remove_turbolinks_from_gemfile
86
+ remove_gem_from_gemfile(:turbolinks)
87
+ end
88
+
89
+ def remove_jbuilder_from_gemfile
90
+ remove_gem_from_gemfile(:jbuilder)
83
91
  end
84
92
  end
85
93
  end
@@ -11,7 +11,7 @@ module Ember
11
11
 
12
12
  def create_component_files
13
13
  dashed_file_name = file_name.gsub(/_/, '-')
14
- component_path = File.join(app_path, 'components', class_path, "#{dashed_file_name}_component.js.es6")
14
+ component_path = File.join(app_path, 'components', class_path, "#{dashed_file_name}.js.es6")
15
15
  template "component.js.es6", component_path
16
16
 
17
17
  template_path = File.join(app_path, 'templates/components', class_path, "#{dashed_file_name}.hbs")