Class: Ironment::CL
- Inherits:
-
Object
- Object
- Ironment::CL
- Defined in:
- lib/ironment/cl.rb,
lib/ironment/cl/prompter.rb
Defined Under Namespace
Classes: Prompter
Class Method Summary collapse
Instance Method Summary collapse
- #exec_with_environment(command, *args) ⇒ Object
-
#initialize(options = {}) ⇒ CL
constructor
A new instance of CL.
- #trust(file) ⇒ Object
- #untrust(file) ⇒ Object
Constructor Details
Class Method Details
.rescue_common_exceptions(method_name) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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.}: Permission denied" rescue Ironment::NoEntity=> e @err.puts "ironment: #{e.}: No such file or directory" rescue Ironment::IsDirectory=> e @err.puts "ironment: #{e.}: Is a directory" rescue Ironment::MalformedRuncom=> e @err.puts "ironment: #{e.}: Malformed runcom" end end end |
Instance Method Details
#exec_with_environment(command, *args) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# 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) ⇒ Object
47 48 49 |
# File 'lib/ironment/cl.rb', line 47 def trust(file) @ironment.trust file end |
#untrust(file) ⇒ Object
53 54 55 |
# File 'lib/ironment/cl.rb', line 53 def untrust(file) @ironment.untrust file end |