Class: EmberCli::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/ember_cli/shell.rb

Instance Method Summary collapse

Constructor Details

#initialize(paths:, env: {}, options: {}) ⇒ Shell

Returns a new instance of Shell.



5
6
7
8
9
10
11
12
13
# File 'lib/ember_cli/shell.rb', line 5

def initialize(paths:, env: {}, options: {})
  @paths = paths
  @env = env
  @ember = Command.new(
    paths: paths,
    options: options,
  )
  @on_exit ||= at_exit { stop }
end

Instance Method Details

#build_and_watchObject



19
20
21
22
23
24
25
# File 'lib/ember_cli/shell.rb', line 19

def build_and_watch
  unless running?
    lock_buildfile
    self.pid = spawn ember.build(watch: true)
    detach
  end
end

#compileObject



15
16
17
# File 'lib/ember_cli/shell.rb', line 15

def compile
  silence_build { exec ember.build }
end

#installObject



34
35
36
37
38
39
40
41
# File 'lib/ember_cli/shell.rb', line 34

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

#stopObject



27
28
29
30
31
32
# File 'lib/ember_cli/shell.rb', line 27

def stop
  if pid.present?
    Process.kill(:INT, pid)
    self.pid = nil
  end
end

#testObject



43
44
45
# File 'lib/ember_cli/shell.rb', line 43

def test
  exec ember.test
end