Skip to content

Commit 292459f

Browse files
committed
Only compile from before_action in test env
No longer invoke `EmberCli::App#compile` from within `EmberCli::App#build` unless in the `test` environment. When deploying to `production`-like environments, `rake assets:precompile` will invoke `EmberCli::App#compile`. When serving locally in `development`, compilation isn't necessary, as we'll spawn an `ember build` into a separate process. When testing, the first request to an Ember app will trigger a compile.
1 parent 1c87745 commit 292459f

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
master
22
------
33

4+
* Invoke `EmberCli::App#compile` in `test` environment, spawn `build` process in
5+
development, rely on `rake assets:precompile` in `production`-like
6+
environments.
7+
48
0.5.0
59
-----
610

lib/ember-cli/app.rb

+10-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def compile
3535
end
3636

3737
def build
38-
if EmberCli.env.development?
38+
if development?
3939
build_and_watch
40-
else
40+
elsif test?
4141
compile
4242
end
4343

@@ -59,7 +59,7 @@ def sprockets
5959
end
6060

6161
def index_file
62-
if EmberCli.env.production?
62+
if production?
6363
paths.applications.join("#{name}.html")
6464
else
6565
paths.dist.join("index.html")
@@ -68,6 +68,12 @@ def index_file
6868

6969
private
7070

71+
delegate :development?, :production?, :test?, to: :env
72+
73+
def env
74+
EmberCli.env
75+
end
76+
7177
def build_and_watch
7278
prepare
7379
@shell.build_and_watch
@@ -84,7 +90,7 @@ def prepare
8490
end
8591

8692
def copy_index_html_file
87-
if EmberCli.env.production?
93+
if production?
8894
FileUtils.cp(paths.app_assets.join("index.html"), index_file)
8995
end
9096
end

0 commit comments

Comments
 (0)