lib/ember_cli/shell.rb in ember-cli-rails-0.5.6 vs lib/ember_cli/shell.rb in ember-cli-rails-0.5.7
- old
+ new
@@ -1,6 +1,7 @@
require "ember_cli/command"
+require "ember_cli/runner"
module EmberCli
class Shell
def initialize(paths:, env: {}, options: {})
@paths = paths
@@ -11,11 +12,11 @@
)
@on_exit ||= at_exit { stop }
end
def compile
- silence_build { exec ember.build }
+ exec ember.build
end
def build_and_watch
unless running?
lock_buildfile
@@ -48,24 +49,23 @@
attr_accessor :pid
attr_reader :ember, :env, :options, :paths
def spawn(command)
- Kernel.spawn(env, command, process_options) || exit(1)
+ Kernel.spawn(env, command, chdir: paths.root.to_s, out: paths.log.to_s) ||
+ exit(1)
end
def exec(command)
- Kernel.system(env, command, process_options) || exit(1)
+ Runner.new(
+ options: { chdir: paths.root.to_s },
+ out: paths.log,
+ err: $stderr,
+ env: env,
+ ).run!(command)
end
- def process_options
- {
- chdir: paths.root.to_s,
- out: paths.log.to_s,
- }
- end
-
def running?
pid.present? && Process.getpgid(pid)
rescue Errno::ESRCH
false
end
@@ -74,16 +74,8 @@
FileUtils.touch(paths.lockfile)
end
def detach
Process.detach pid
- end
-
- def silence_build(&block)
- if ENV.fetch("EMBER_CLI_RAILS_VERBOSE") { EmberCli.env.production? }
- yield
- else
- silence_stream(STDOUT, &block)
- end
end
end
end