ember-cli-rails 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa89f6f26b26bbf222e7881b397422868795a55c
4
- data.tar.gz: 3d2b5205aa404925fa0a76fabae819646b9298f8
3
+ metadata.gz: 7f0547176e2856d0b34ef53d83724a6d5dbdb741
4
+ data.tar.gz: 5edaffcc86f429e1dcdc2085414fa4824b78b795
5
5
  SHA512:
6
- metadata.gz: 2a92409bab6abf2f119b3ae5ce064f33eb452cc1abc486a805fb57f759b83df1a0257a5a3432d86daf257e6d07048244b266c806e5f03208e4b82ed1a9275edf
7
- data.tar.gz: 8ad3eb7eef5f6084ca30a583a5f9407e99702b491d92e1c00bb05e7f79236b9d3a5cd5dde83a822ebbfe416cb5f4131216da5e2b8fa65e9eda85b69d9c2dc2aa
6
+ metadata.gz: fec38204f90ffac056042df6d658a11e4099ff29b45b4702bfb48e002e7114818772d6ed6f4f6b92e57f159cebe1b96b8c0c7fbe28f20f831df31d94eb693a39
7
+ data.tar.gz: cc713397c80da2e9d4b1449666707fe5d247cc9ad282ff9fa41958b67e9abdf07736487663d06185de073853dd9a9300593b568ff2d74eb33d23704737fff612
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  master
2
2
  ------
3
3
 
4
+ 0.7.2
5
+ -----
6
+
7
+ * Enhance `rake ember:install` to fully reinstall if necessary. [#396]
8
+ * `EmberCli::Deploy::File` serves assets with Rails' `static_cache_control`
9
+ value. [#403]
10
+
11
+ [#396]: https://github.com/thoughtbot/ember-cli-rails/pull/396
12
+ [#403]: https://github.com/thoughtbot/ember-cli-rails/pull/403
13
+
4
14
  0.7.1
5
15
  -----
6
16
 
data/README.md CHANGED
@@ -203,8 +203,22 @@ As long as your [CDN is configured to pull from your Rails application][dns-cdn]
203
203
 
204
204
  ### Deployment Strategies
205
205
 
206
- By default, EmberCLI-Rails will serve the `index.html` file that `ember build`
207
- produces.
206
+ By default, EmberCLI-Rails uses a file-based deployment strategy that depends on
207
+ the output of `ember build`.
208
+
209
+ Using this deployment strategy, Rails will serve the `index.html` file and other
210
+ assets that `ember build` produces.
211
+
212
+ These EmberCLI-generated assets are served with the same `Cache-Control` headers
213
+ as Rails' other static files:
214
+
215
+ ```rb
216
+ # config/environments/production.rb
217
+ Rails.application.configure do
218
+ # serve static files with cache headers set to expire in 1 year
219
+ config.static_cache_control = "public, max-age=31622400"
220
+ end
221
+ ```
208
222
 
209
223
  If you need to override this behavior (for instance, if you're using
210
224
  [`ember-cli-deploy`'s "Lightning Fast Deployment"][lightning] strategy in
@@ -237,14 +251,15 @@ Specifying a deployment strategy is only supported for applications that use the
237
251
 
238
252
  To configure your EmberCLI-Rails applications for Heroku:
239
253
 
240
- 1. Execute `rails generate ember:heroku`
254
+ 1. Execute `rails generate ember:heroku`.
255
+ 1. Commit the newly generated files.
241
256
  1. [Add the NodeJS buildpack][buildpack] and configure NPM to include the
242
257
  `bower` dependency's executable file.
243
258
 
244
259
  ```sh
245
260
  $ heroku buildpacks:clear
246
- $ heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-nodejs
247
- $ heroku buildpacks:add --index 2 https://github.com/heroku/heroku-buildpack-ruby
261
+ $ heroku buildpacks:add --index 1 heroku/nodejs
262
+ $ heroku buildpacks:add --index 2 heroku/ruby
248
263
  $ heroku config:set NPM_CONFIG_PRODUCTION=false
249
264
  $ heroku config:unset SKIP_EMBER
250
265
  ```
@@ -13,7 +13,7 @@ module EmberCli
13
13
  end
14
14
 
15
15
  def to_rack
16
- Rack::File.new(app.dist_path.to_s)
16
+ Rack::File.new(app.dist_path.to_s, rack_headers)
17
17
  end
18
18
 
19
19
  def index_html
@@ -28,6 +28,12 @@ module EmberCli
28
28
 
29
29
  attr_reader :app
30
30
 
31
+ def rack_headers
32
+ {
33
+ "Cache-Control" => Rails.configuration.static_cache_control,
34
+ }
35
+ end
36
+
31
37
  def check_for_error_and_raise!
32
38
  app.check_for_errors!
33
39
 
@@ -78,10 +78,18 @@ module EmberCli
78
78
  end
79
79
  end
80
80
 
81
+ def bower_components
82
+ @bower_components ||= root.join("bower_components")
83
+ end
84
+
81
85
  def npm
82
86
  @npm ||= app_options.fetch(:npm_path) { which("npm") }
83
87
  end
84
88
 
89
+ def node_modules
90
+ @node_modules ||= root.join("node_modules")
91
+ end
92
+
85
93
  def tee
86
94
  @tee ||= app_options.fetch(:tee_path) { which("tee") }
87
95
  end
@@ -9,11 +9,17 @@ module EmberCli
9
9
  @options = options
10
10
  end
11
11
 
12
- def run!(command)
12
+ def run(command)
13
13
  output, status = Open3.capture2e(@env, command, @options)
14
14
 
15
15
  @out.write(output)
16
16
 
17
+ [output, status]
18
+ end
19
+
20
+ def run!(command)
21
+ output, status = run(command)
22
+
17
23
  unless status.success?
18
24
  @err.write <<-MSG.strip_heredoc
19
25
  ERROR: Failed command: `#{command}`
@@ -21,7 +27,7 @@ module EmberCli
21
27
  #{output}
22
28
  MSG
23
29
 
24
- exit 1
30
+ exit status.exitstatus
25
31
  end
26
32
 
27
33
  true
@@ -14,7 +14,7 @@ module EmberCli
14
14
  end
15
15
 
16
16
  def compile
17
- exec ember.build
17
+ run! ember.build
18
18
  end
19
19
 
20
20
  def build_and_watch
@@ -34,15 +34,19 @@ module EmberCli
34
34
 
35
35
  def install
36
36
  if paths.gemfile.exist?
37
- exec "#{paths.bundler} install"
37
+ run! "#{paths.bundler} install"
38
38
  end
39
39
 
40
- exec "#{paths.npm} prune && #{paths.npm} install"
41
- exec "#{paths.bower} prune && #{paths.bower} install"
40
+ if invalid_ember_dependencies?
41
+ clean_ember_dependencies!
42
+ end
43
+
44
+ run! "#{paths.npm} prune && #{paths.npm} install"
45
+ run! "#{paths.bower} prune && #{paths.bower} install"
42
46
  end
43
47
 
44
48
  def test
45
- exec ember.test
49
+ run! ember.test
46
50
  end
47
51
 
48
52
  private
@@ -50,6 +54,25 @@ module EmberCli
50
54
  attr_accessor :pid
51
55
  attr_reader :ember, :env, :options, :paths
52
56
 
57
+ delegate :run, :run!, to: :runner
58
+
59
+ def invalid_ember_dependencies?
60
+ !run("#{paths.ember} version")
61
+ rescue DependencyError
62
+ false
63
+ end
64
+
65
+ def clean_ember_dependencies!
66
+ ember_dependency_directories.select(&:exist?).each(&:rmtree)
67
+ end
68
+
69
+ def ember_dependency_directories
70
+ [
71
+ paths.node_modules,
72
+ paths.bower_components,
73
+ ]
74
+ end
75
+
53
76
  def spawn(command)
54
77
  Kernel.spawn(
55
78
  env,
@@ -59,13 +82,13 @@ module EmberCli
59
82
  ) || exit(1)
60
83
  end
61
84
 
62
- def exec(command)
85
+ def runner
63
86
  Runner.new(
64
87
  options: { chdir: paths.root.to_s },
65
88
  out: paths.log,
66
89
  err: $stderr,
67
90
  env: env,
68
- ).run!(command)
91
+ )
69
92
  end
70
93
 
71
94
  def running?
@@ -1,3 +1,3 @@
1
1
  module EmberCli
2
- VERSION = "0.7.1".freeze
2
+ VERSION = "0.7.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ember-cli-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Pravosud
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-02 00:00:00.000000000 Z
13
+ date: 2016-02-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ember-cli-rails-assets