Sha256: 3d85a4c8958fd3551e8e4cc8a4a43237e5092adc655366af4c49c3d5377e0fc2
Contents?: true
Size: 1.51 KB
Versions: 4
Compression:
Stored size: 1.51 KB
Contents
require "ember_cli/command" require "ember_cli/runner" module EmberCli class Shell def initialize(paths:, env: {}, options: {}) @paths = paths @env = env @ember = Command.new( paths: paths, options: options, ) @on_exit ||= at_exit { stop } end def compile exec ember.build end def build_and_watch unless running? lock_buildfile self.pid = spawn ember.build(watch: true) detach end end def stop if pid.present? Process.kill(:INT, pid) self.pid = nil end end def install if paths.gemfile.exist? exec "#{paths.bundler} install" end exec "#{paths.npm} prune && #{paths.npm} install" exec "#{paths.bower} prune && #{paths.bower} install" end def test exec ember.test end private attr_accessor :pid attr_reader :ember, :env, :options, :paths def spawn(command) Kernel.spawn( env, command, chdir: paths.root.to_s, err: paths.build_error_file.to_s, ) || exit(1) end def exec(command) Runner.new( options: { chdir: paths.root.to_s }, out: paths.log, err: $stderr, env: env, ).run!(command) end def running? pid.present? && Process.getpgid(pid) rescue Errno::ESRCH false end def lock_buildfile FileUtils.touch(paths.lockfile) end def detach Process.detach pid end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ember-cli-rails-0.7.1 | lib/ember_cli/shell.rb |
ember-cli-rails-0.7.0 | lib/ember_cli/shell.rb |
ember-cli-rails-0.6.1 | lib/ember_cli/shell.rb |
ember-cli-rails-0.6.0 | lib/ember_cli/shell.rb |