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.



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

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



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

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

#compileObject



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

def compile
  run! ember.build
end

#installObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ember_cli/shell.rb', line 35

def install
  if paths.gemfile.exist?
    run! "#{paths.bundler} install"
  end

  if invalid_ember_dependencies?
    clean_ember_dependencies!
  end

  run! "#{paths.npm} prune && #{paths.npm} install"
  run! "#{paths.bower} prune && #{paths.bower} install"
end

#stopObject



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

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

#testObject



48
49
50
# File 'lib/ember_cli/shell.rb', line 48

def test
  run! ember.test
end