rubyment 0.4.25421155 → 0.4.25421159
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubyment.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8db412f7ffa002c3c790bf5fe2d00e97d4301166
|
4
|
+
data.tar.gz: 9d5ea274e0dd6cc852b5f628a6bc994f9d901719
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7cc5f28c22e5c8326bfe514e7c2b16593a266a309a609c1500cc133daf3797ca4eaa8e918f2ee0f06032b1c08c071627f861a053932df98aa759ca3c29bfd00
|
7
|
+
data.tar.gz: a553496ab70250016db9989637e2be513374b0ccb8095c0ed47826e3152ae61922e987c6a4a19ba3a84a500e60056ee1770b2aeaf7c02ef4eb16a50a9f831f67
|
data/lib/rubyment.rb
CHANGED
@@ -120,6 +120,7 @@ class Rubyment
|
|
120
120
|
# file can be a url, if 'open-uri' is available.
|
121
121
|
def file_backup file = __FILE__ , dir = '/tmp/', append = ('-' + Time.now.hash.abs.to_s), prepend='/'
|
122
122
|
stderr = @memory[:stderr]
|
123
|
+
debug = @memory[:debug]
|
123
124
|
(require 'open-uri') && open_uri = true
|
124
125
|
require 'fileutils'
|
125
126
|
file_is_filename = true
|
@@ -128,9 +129,9 @@ class Rubyment
|
|
128
129
|
) || (
|
129
130
|
contents = File.read file rescue (file_is_filename = false) || file
|
130
131
|
)
|
131
|
-
stderr.puts "location = dir:#{dir} + prepend:#{prepend} + (#{file_is_filename} && #{file} || '' ) + #{append}"
|
132
|
+
debug && (stderr.puts "location = dir:#{dir} + prepend:#{prepend} + (#{file_is_filename} && #{file} || '' ) + #{append}")
|
132
133
|
location = dir + prepend + (file_is_filename && file || '' ) + append
|
133
|
-
stderr.puts "FileUtils.mkdir_p File.dirname #{location}"
|
134
|
+
debug && (stderr.puts "FileUtils.mkdir_p File.dirname #{location}")
|
134
135
|
FileUtils.mkdir_p File.dirname location # note "~" doesn't work
|
135
136
|
File.write location, contents
|
136
137
|
contents
|