Class: Ddenv::Goals::RubyInstalled

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

Instance Method Summary collapse

Methods inherited from Ddenv::Goal

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

Constructor Details

This class inherits a constructor from Ddenv::Goal

Instance Method Details

#achieveObject



15
16
17
18
19
# File 'lib/ddenv/goals/ruby_installed.rb', line 15

def achieve
  # TODO: use :pretty when passing --verbose
  cmd = TTY::Command.new(printer: :null)
  cmd.run("ruby-install", "--cleanup", ruby_version)
end

#achieved?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/ddenv/goals/ruby_installed.rb', line 10

def achieved?
  pathname = Pathname.new(Dir.home) / ".rubies" / "ruby-#{ruby_version}"
  pathname.directory?
end

#messageObject



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

def message
  "Installing Ruby v#{ruby_version}"
end

#post_goalsObject



27
28
29
30
31
# File 'lib/ddenv/goals/ruby_installed.rb', line 27

def post_goals
  [
    RubyShadowenvCreated.new(ruby_version, ruby_pathname.to_s)
  ]
end

#pre_goalsObject



21
22
23
24
25
# File 'lib/ddenv/goals/ruby_installed.rb', line 21

def pre_goals
  [
    RubyInstallInstalled.new
  ]
end