lib/ember-cli/app.rb in ember-cli-rails-0.2.3 vs lib/ember-cli/app.rb in ember-cli-rails-0.3.0
- old
+ new
@@ -15,34 +15,39 @@
@name, @options = name.to_s, options
@paths = PathSet.new(self)
end
def compile
- prepare
- silence_build { exec command }
- check_for_build_error!
+ @compiled ||= begin
+ prepare
+ silence_build{ exec command }
+ check_for_build_error!
+ true
+ end
end
def install_dependencies
exec "#{bundler_path} install" if gemfile_path.exist?
exec "#{npm_path} install"
end
def run
prepare
+ FileUtils.touch lockfile_path
cmd = command(watch: true)
@pid = exec(cmd, method: :spawn)
- at_exit{ stop }
+ Process.detach pid
+ set_on_exit_callback
end
def run_tests
prepare
exit 1 unless exec("#{ember_path} test")
end
def stop
- Process.kill "INT", pid if pid
+ Process.kill :INT, pid if pid
@pid = nil
end
def exposed_js_assets
%W[#{name}/vendor #{name}/#{ember_app_name}]
@@ -98,10 +103,14 @@
end
end
private
+ def set_on_exit_callback
+ @on_exit_callback ||= at_exit{ stop }
+ end
+
def supported_path_method(original)
path_method = original.to_s[/\A(.+)_path\z/, 1]
path_method if path_method && paths.respond_to?(path_method)
end
@@ -138,10 +147,9 @@
def prepare
@prepared ||= begin
check_addon!
check_ember_cli_version!
reset_build_error!
- FileUtils.touch lockfile_path
symlink_to_assets_root
add_assets_to_precompile_list
true
end
end