Class: Ddenv::Goals::ShadowenvInitialized

Inherits:
Ddenv::Goal
  • Object
show all
Defined in:
lib/ddenv/goals/shadowenv_initialized.rb

Constant Summary collapse

FISH_LINE =
"shadowenv init fish | source"

Instance Method Summary collapse

Methods inherited from Ddenv::Goal

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

Constructor Details

This class inherits a constructor from Ddenv::Goal

Instance Method Details

#achieveObject



19
20
21
# File 'lib/ddenv/goals/shadowenv_initialized.rb', line 19

def achieve
  File.write(fish_config_path, "\n\n#{FISH_LINE}", mode: "a+")
end

#achieved?Boolean

TODO: support bash and zsh

Returns:

  • (Boolean)


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

def achieved?
  fish_config = File.read(fish_config_path)
  fish_config.lines.any? { _1.chomp == FISH_LINE }
end

#messageObject



8
9
10
# File 'lib/ddenv/goals/shadowenv_initialized.rb', line 8

def message
  "Initializing Shadowenv"
end