Top Level Namespace
Defined Under Namespace
Modules: Wixgem Classes: AssociateExtension, File, RegistryKey, Service
Instance Method Summary collapse
- #admin? ⇒ Boolean
-
#temp_directory ⇒ Object
module Wixgem.
Instance Method Details
#admin? ⇒ Boolean
3 4 5 6 7 8 9 10 |
# File 'lib/admin.rb', line 3 def admin? cmd = Execute.new('net session') cmd[:ignore_exit_code] = true cmd[:quiet] = true cmd.execute return true if(cmd[:exit_code] == 0) return false end |
#temp_directory ⇒ Object
module Wixgem
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/temp_directory.rb', line 5 def temp_directory tmp_file = "#{ENV['TEMP'].gsub(/\\/,'/')}/#{SecureRandom.hex}" FileUtils.mkpath(tmp_file) begin yield tmp_file rescue Exception => e raise e ensure sleep(0.1) FileUtils.rm_rf(tmp_file) end end |