Module: GemOnDemand::Utils
- Defined in:
- lib/gem_on_demand/utils.rb
Class Method Summary collapse
- .ensure_directory(dir) ⇒ Object
- .remove_directory(dir) ⇒ Object
-
.remove_signing(gemspec) ⇒ Object
ERROR: While executing gem …
- .sh(command, options = { }) ⇒ Object
Class Method Details
.ensure_directory(dir) ⇒ Object
16 17 18 |
# File 'lib/gem_on_demand/utils.rb', line 16 def ensure_directory(dir) FileUtils.mkdir_p(dir) unless File.directory?(dir) end |
.remove_directory(dir) ⇒ Object
20 21 22 |
# File 'lib/gem_on_demand/utils.rb', line 20 def remove_directory(dir) FileUtils.rm_rf(dir) if File.exist?(dir) end |
.remove_signing(gemspec) ⇒ Object
ERROR: While executing gem … (Gem::Security::Exception) certificate /CN=michael/DC=grosser/DC=it not valid after 2014-02-03 18:13:11 UTC
26 27 28 |
# File 'lib/gem_on_demand/utils.rb', line 26 def remove_signing(gemspec) File.write(gemspec, File.read(gemspec).gsub(/.*\.(signing_key|cert_chain).*/, "")) end |
.sh(command, options = { }) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/gem_on_demand/utils.rb', line 4 def sh(command, = { }) puts command result = `#{command}` if $?.success? result elsif [:fail] == :allow false else raise "Command failed: #{result}" end end |