Class: Ddenv::Goals::NodeInstalled

Inherits:
Ddenv::Goal show all
Defined in:
lib/ddenv/goals/node_installed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ddenv::Goal

#==, #eql?, #hash, #props, #with_pre_and_post_goals

Constructor Details

#initialize(node_version) ⇒ NodeInstalled

Returns a new instance of NodeInstalled.



8
9
10
11
12
# File 'lib/ddenv/goals/node_installed.rb', line 8

def initialize(node_version)
  super()

  @node_version = node_version.to_s
end

Instance Attribute Details

#node_versionObject (readonly)

Returns the value of attribute node_version.



6
7
8
# File 'lib/ddenv/goals/node_installed.rb', line 6

def node_version
  @node_version
end

Instance Method Details

#achieveObject



22
23
24
25
26
# File 'lib/ddenv/goals/node_installed.rb', line 22

def achieve
  # TODO: use :pretty when passing --verbose
  cmd = TTY::Command.new(printer: :null)
  cmd.run("node-build", node_version, node_pathname.to_s)
end

#achieved?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/ddenv/goals/node_installed.rb', line 18

def achieved?
  node_pathname.directory?
end

#messageObject



14
15
16
# File 'lib/ddenv/goals/node_installed.rb', line 14

def message
  "Installing Node v#{node_version}"
end

#post_goalsObject



34
35
36
37
38
# File 'lib/ddenv/goals/node_installed.rb', line 34

def post_goals
  [
    NodeShadowenvCreated.new(node_version, node_pathname.to_s)
  ]
end

#pre_goalsObject



28
29
30
31
32
# File 'lib/ddenv/goals/node_installed.rb', line 28

def pre_goals
  [
    NodeBuildInstalled.new
  ]
end