class Serverkit::Resources::RbenvProfile

Public Instance Methods

apply() click to toggle source

@note Override

# File lib/serverkit/resources/rbenv_profile.rb, line 10
def apply
  build_resources.each(&:run_apply)
end
check() click to toggle source

@note Override

# File lib/serverkit/resources/rbenv_profile.rb, line 15
def check
  build_resources.all?(&:check)
end

Private Instance Methods

build_resources() click to toggle source

@return [Array<Serverkit::Resources::Line>]

# File lib/serverkit/resources/rbenv_profile.rb, line 22
def build_resources
  lines.map do |line|
    resource = Serverkit::Resources::Line.new(
      @recipe,
      "line" => line,
      "path" => proper_profile_path,
    )
    resource.backend = backend
    resource
  end
end
get_user_home_directory() click to toggle source

@return [String]

# File lib/serverkit/resources/rbenv_profile.rb, line 35
def get_user_home_directory
  run_command_from_identifier(:get_user_home_directory, user).stdout.rstrip
end
lines() click to toggle source

@return [Array<String>]

# File lib/serverkit/resources/rbenv_profile.rb, line 40
def lines
  [
    %<export PATH="$HOME/.rbenv/bin:$PATH">,
    %<eval "$(rbenv init -)">,
  ]
end
proper_profile_path() click to toggle source

@return [String]

# File lib/serverkit/resources/rbenv_profile.rb, line 48
def proper_profile_path
  @proper_profile_path ||= profile_path || "#{get_user_home_directory}/.bash_profile"
end