class Ironment::CL
Public Class Methods
new(options = {})
click to toggle source
# File lib/ironment/cl.rb, line 25 def initialize(options = {}) @ironment = options[:ironment] || Ironment.new(options) @prompter = options[:prompter] || Prompter.new @err = options[:err] || $stderr end
rescue_common_exceptions(method_name)
click to toggle source
# File lib/ironment/cl.rb, line 4 def rescue_common_exceptions(method_name) new_name = "original_#{method_name}" alias_method new_name, method_name define_method method_name do |*args| begin send new_name, *args rescue Ironment::AccessDenied => e @err.puts "ironment: #{e.message}: Permission denied" rescue Ironment::NoEntity=> e @err.puts "ironment: #{e.message}: No such file or directory" rescue Ironment::IsDirectory=> e @err.puts "ironment: #{e.message}: Is a directory" rescue Ironment::MalformedRuncom=> e @err.puts "ironment: #{e.message}: Malformed runcom" end end end
Public Instance Methods
exec_with_environment(command, *args)
click to toggle source
# File lib/ironment/cl.rb, line 31 def exec_with_environment(command, *args) begin @ironment.exec_with_environment command, *args rescue Truster::NotTrusted => e if @prompter.not_trusted e.runcom exec_with_environment command, *args end rescue Truster::Modified => e if @prompter.modified e.runcom exec_with_environment command, *args end end end
trust(file)
click to toggle source
# File lib/ironment/cl.rb, line 47 def trust(file) @ironment.trust file end
untrust(file)
click to toggle source
# File lib/ironment/cl.rb, line 53 def untrust(file) @ironment.untrust file end