class ConfigmonkeyCli::Application::ManifestAction::Chmod

Public Instance Methods

destructive() click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/chmod.rb, line 26
def destructive
  if File.exist?(@path)
    if @mode == File.stat(@path).mode - 0100000
      status :identical, :blue, "#{@args[0]} (#{@args[1].to_s(8)})"
    else
      thor.chmod(@path, @mode)
    end
  else
    status :noexist, :red, "#{@args[0]} (#{@args[1].to_s(8)})"
  end
end
init(path, mode, opts = {}) click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/chmod.rb, line 5
def init path, mode, opts = {}
  @opts = opts.reverse_merge({
    #_p: true
  })

  @args = [path, mode]
end
prepare() click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/chmod.rb, line 13
def prepare
  @path = expand_dst(@args[0])
  @mode = @args[1]
end
simulate() click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/chmod.rb, line 18
def simulate
  if thor.options[:pretend]
    destructive
  else
    status :fake, :black, "#{@args[0]} (#{@args[1].to_s(8)})"
  end
end