scripto 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +6 -5
- data/.travis.yml +5 -3
- data/README.md +14 -5
- data/Rakefile +14 -9
- data/Vagrantfile +15 -120
- data/lib/scripto.rb +7 -7
- data/lib/scripto/csv_commands.rb +19 -15
- data/lib/scripto/file_commands.rb +45 -37
- data/lib/scripto/main.rb +1 -1
- data/lib/scripto/misc_commands.rb +7 -9
- data/lib/scripto/print_commands.rb +7 -7
- data/lib/scripto/run_commands.rb +18 -19
- data/lib/scripto/version.rb +1 -1
- data/scripto.gemspec +13 -13
- data/test/helper.rb +7 -7
- data/test/test_csv.rb +27 -17
- data/test/test_file.rb +51 -31
- data/test/test_misc.rb +16 -16
- data/test/test_print.rb +9 -9
- data/test/test_run.rb +20 -20
- metadata +25 -13
- data/vagrant_provision +0 -50
data/lib/scripto/main.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require 'digest/md5'
|
|
2
|
+
require 'etc'
|
|
3
3
|
|
|
4
4
|
module Scripto
|
|
5
5
|
module MiscCommands
|
|
6
|
-
BASE_62 = (
|
|
6
|
+
BASE_62 = ('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a
|
|
7
7
|
|
|
8
8
|
# Who is the current user?
|
|
9
9
|
def whoami
|
|
@@ -12,16 +12,14 @@ module Scripto
|
|
|
12
12
|
|
|
13
13
|
# Return true if the current user is "root".
|
|
14
14
|
def root?
|
|
15
|
-
whoami ==
|
|
15
|
+
whoami == 'root'
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# Return the md5 checksum for the file at +path+.
|
|
19
19
|
def md5_file(path)
|
|
20
20
|
File.open(path) do |f|
|
|
21
|
-
digest, buf = Digest::MD5.new,
|
|
22
|
-
while f.read(4096, buf)
|
|
23
|
-
digest.update(buf)
|
|
24
|
-
end
|
|
21
|
+
digest, buf = Digest::MD5.new, ''
|
|
22
|
+
digest.update(buf) while f.read(4096, buf)
|
|
25
23
|
digest.hexdigest
|
|
26
24
|
end
|
|
27
25
|
end
|
|
@@ -44,4 +42,4 @@ module Scripto
|
|
|
44
42
|
(1..len).map { BASE_62.sample }.join
|
|
45
43
|
end
|
|
46
44
|
end
|
|
47
|
-
end
|
|
45
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module Scripto
|
|
2
2
|
module PrintCommands
|
|
3
|
-
RESET = "\e[0m"
|
|
4
|
-
GREEN = "\e[1;37;42m"
|
|
5
|
-
YELLOW = "\e[1;37;43m"
|
|
6
|
-
RED = "\e[1;37;41m"
|
|
3
|
+
RESET = "\e[0m".freeze
|
|
4
|
+
GREEN = "\e[1;37;42m".freeze
|
|
5
|
+
YELLOW = "\e[1;37;43m".freeze
|
|
6
|
+
RED = "\e[1;37;41m".freeze
|
|
7
7
|
|
|
8
8
|
attr_accessor :verbose
|
|
9
9
|
|
|
@@ -35,8 +35,8 @@ module Scripto
|
|
|
35
35
|
|
|
36
36
|
# Print a colored banner to $stderr in green.
|
|
37
37
|
def banner(str, color: GREEN)
|
|
38
|
-
now = Time.new.strftime(
|
|
39
|
-
s = "#{str} ".ljust(72,
|
|
38
|
+
now = Time.new.strftime('%H:%M:%S')
|
|
39
|
+
s = "#{str} ".ljust(72, ' ')
|
|
40
40
|
$stderr.puts "#{color}[#{now}] #{s}#{RESET}"
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -51,4 +51,4 @@ module Scripto
|
|
|
51
51
|
exit(1)
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
|
-
end
|
|
54
|
+
end
|
data/lib/scripto/run_commands.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require 'English'
|
|
2
|
+
require 'shellwords'
|
|
3
3
|
|
|
4
4
|
module Scripto
|
|
5
5
|
module RunCommands
|
|
@@ -34,12 +34,10 @@ module Scripto
|
|
|
34
34
|
|
|
35
35
|
# Returns true if the command succeeds. See #run for details.
|
|
36
36
|
def run_succeeds?(command, args = nil)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
false
|
|
42
|
-
end
|
|
37
|
+
run_quietly(command, args)
|
|
38
|
+
true
|
|
39
|
+
rescue Error
|
|
40
|
+
false
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
# Returns true if the command fails. See #run for details.
|
|
@@ -52,18 +50,18 @@ module Scripto
|
|
|
52
50
|
Shellwords.escape(str)
|
|
53
51
|
end
|
|
54
52
|
|
|
55
|
-
protected
|
|
56
|
-
|
|
57
53
|
# :nodoc:
|
|
58
54
|
class CommandLine
|
|
59
55
|
attr_accessor :command, :args
|
|
60
56
|
|
|
61
57
|
def initialize(command, args)
|
|
62
58
|
self.command = command
|
|
63
|
-
self.args =
|
|
64
|
-
args
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
self.args = begin
|
|
60
|
+
if args
|
|
61
|
+
args.map(&:to_s)
|
|
62
|
+
else
|
|
63
|
+
[]
|
|
64
|
+
end
|
|
67
65
|
end
|
|
68
66
|
end
|
|
69
67
|
|
|
@@ -74,7 +72,7 @@ module Scripto
|
|
|
74
72
|
|
|
75
73
|
def capture
|
|
76
74
|
begin
|
|
77
|
-
captured = `#{
|
|
75
|
+
captured = `#{self}`
|
|
78
76
|
rescue Errno::ENOENT
|
|
79
77
|
raise Error, "#{self} failed : ENOENT (No such file or directory)"
|
|
80
78
|
end
|
|
@@ -83,20 +81,21 @@ module Scripto
|
|
|
83
81
|
end
|
|
84
82
|
|
|
85
83
|
def raise!(status)
|
|
86
|
-
if status.termsig == Signal.list[
|
|
84
|
+
if status.termsig == Signal.list['INT']
|
|
87
85
|
raise "#{self} interrupted"
|
|
88
86
|
end
|
|
87
|
+
|
|
89
88
|
raise Error, "#{self} failed : #{status.to_i / 256}"
|
|
90
89
|
end
|
|
91
90
|
|
|
92
91
|
def to_s
|
|
93
|
-
if args.
|
|
92
|
+
if !args.empty?
|
|
94
93
|
escaped = args.map { |i| Shellwords.escape(i) }
|
|
95
|
-
"#{command} #{escaped.join(
|
|
94
|
+
"#{command} #{escaped.join(' ')}"
|
|
96
95
|
else
|
|
97
96
|
command
|
|
98
97
|
end
|
|
99
98
|
end
|
|
100
99
|
end
|
|
101
100
|
end
|
|
102
|
-
end
|
|
101
|
+
end
|
data/lib/scripto/version.rb
CHANGED
data/scripto.gemspec
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
3
|
require 'scripto/version'
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
6
|
+
spec.name = 'scripto'
|
|
8
7
|
spec.version = Scripto::VERSION
|
|
9
8
|
spec.platform = Gem::Platform::RUBY
|
|
10
|
-
spec.required_ruby_version =
|
|
11
|
-
spec.authors = [
|
|
12
|
-
spec.email = [
|
|
13
|
-
spec.summary =
|
|
14
|
-
spec.homepage =
|
|
15
|
-
spec.license =
|
|
9
|
+
spec.required_ruby_version = '>= 2.0.0'
|
|
10
|
+
spec.authors = [ 'Adam Doppelt' ]
|
|
11
|
+
spec.email = [ 'amd@gurge.com' ]
|
|
12
|
+
spec.summary = 'Helpers for writing command line scripts. An extraction from Dwellable.'
|
|
13
|
+
spec.homepage = 'http://github.com/gurgeous/scripto'
|
|
14
|
+
spec.license = 'MIT'
|
|
16
15
|
|
|
17
16
|
spec.files = `git ls-files -z`.split("\x0")
|
|
18
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
20
|
-
spec.require_paths = [
|
|
19
|
+
spec.require_paths = [ 'lib' ]
|
|
21
20
|
|
|
22
|
-
spec.add_development_dependency
|
|
23
|
-
spec.add_development_dependency
|
|
24
|
-
spec.add_development_dependency
|
|
21
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
|
22
|
+
spec.add_development_dependency 'minitest', '~> 5.14'
|
|
23
|
+
spec.add_development_dependency 'rake'
|
|
24
|
+
spec.add_development_dependency 'rubocop'
|
|
25
25
|
end
|
data/test/helper.rb
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
1
|
+
require 'fileutils'
|
|
2
|
+
require 'minitest/autorun'
|
|
3
|
+
require 'minitest/pride'
|
|
4
4
|
|
|
5
|
-
$LOAD_PATH << File.expand_path(
|
|
6
|
-
require
|
|
5
|
+
$LOAD_PATH << File.expand_path('../lib', __dir__)
|
|
6
|
+
require 'scripto'
|
|
7
7
|
|
|
8
8
|
module Helper
|
|
9
|
-
TMP_DIR =
|
|
9
|
+
TMP_DIR = '/tmp/_scripto_test'.freeze
|
|
10
10
|
|
|
11
11
|
# attr_accessor :main
|
|
12
12
|
|
|
@@ -23,4 +23,4 @@ module Helper
|
|
|
23
23
|
FileUtils.rm_rf(TMP_DIR)
|
|
24
24
|
Dir.chdir(@pwd)
|
|
25
25
|
end
|
|
26
|
-
end
|
|
26
|
+
end
|
data/test/test_csv.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative 'helper'
|
|
2
2
|
|
|
3
3
|
class TestCsv < Minitest::Test
|
|
4
4
|
include Helper
|
|
5
5
|
|
|
6
|
-
FILE =
|
|
6
|
+
FILE = 'test.csv'.freeze
|
|
7
7
|
|
|
8
|
-
ROWS = [ { a:
|
|
9
|
-
ROWS_EXP = "a,b,c\n1,2,3\n4,5,6\n"
|
|
10
|
-
ROWS_REVERSED_EXP = "c,b,a\n3,2,1\n6,5,4\n"
|
|
8
|
+
ROWS = [ { a: '1', b: '2', c: '3' }, { a: '4', b: '5', c: '6' } ].freeze
|
|
9
|
+
ROWS_EXP = "a,b,c\n1,2,3\n4,5,6\n".freeze
|
|
10
|
+
ROWS_REVERSED_EXP = "c,b,a\n3,2,1\n6,5,4\n".freeze
|
|
11
11
|
|
|
12
12
|
def test_types
|
|
13
13
|
assert_equal(ROWS_EXP, Scripto.csv_to_s(ROWS))
|
|
@@ -16,9 +16,9 @@ class TestCsv < Minitest::Test
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def test_cols
|
|
19
|
-
assert_equal(ROWS_REVERSED_EXP, Scripto.csv_to_s(ROWS, cols: %i
|
|
20
|
-
assert_equal(ROWS_REVERSED_EXP, Scripto.csv_to_s(structs, cols: %i
|
|
21
|
-
assert_equal(ROWS_REVERSED_EXP, Scripto.csv_to_s(ostructs, cols: %i
|
|
19
|
+
assert_equal(ROWS_REVERSED_EXP, Scripto.csv_to_s(ROWS, cols: %i[c b a]))
|
|
20
|
+
assert_equal(ROWS_REVERSED_EXP, Scripto.csv_to_s(structs, cols: %i[c b a]))
|
|
21
|
+
assert_equal(ROWS_REVERSED_EXP, Scripto.csv_to_s(ostructs, cols: %i[c b a]))
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def test_csv_stdout
|
|
@@ -37,14 +37,15 @@ class TestCsv < Minitest::Test
|
|
|
37
37
|
assert_equal(ROWS, Scripto.csv_read("#{FILE}.gz").map(&:to_h))
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
def
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
def test_bom
|
|
41
|
+
assert_equal('apple', Scripto.csv_read(write_bom).first.fruit)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_gz_with_bom
|
|
45
|
+
skip # this doesn't work yet
|
|
46
|
+
path = write_bom
|
|
47
|
+
Scripto.run("gzip #{path}")
|
|
48
|
+
assert_equal('apple', Scripto.csv_read("#{path}.gz").first.fruit)
|
|
48
49
|
end
|
|
49
50
|
|
|
50
51
|
protected
|
|
@@ -57,4 +58,13 @@ class TestCsv < Minitest::Test
|
|
|
57
58
|
def ostructs
|
|
58
59
|
ROWS.map { |i| OpenStruct.new(i) }
|
|
59
60
|
end
|
|
60
|
-
|
|
61
|
+
|
|
62
|
+
def write_bom
|
|
63
|
+
CSV.open(FILE, 'w') do |csv|
|
|
64
|
+
csv.to_io.write "\uFEFF" # bom
|
|
65
|
+
csv << %w[fruit]
|
|
66
|
+
csv << %w[apple]
|
|
67
|
+
end
|
|
68
|
+
FILE
|
|
69
|
+
end
|
|
70
|
+
end
|
data/test/test_file.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative 'helper'
|
|
2
2
|
|
|
3
3
|
class TestFile < Minitest::Test
|
|
4
4
|
include Helper
|
|
5
5
|
|
|
6
|
-
DIR =
|
|
7
|
-
SRC, DST =
|
|
8
|
-
SRC2, DST2 =
|
|
6
|
+
DIR = 'dir'.freeze
|
|
7
|
+
SRC, DST = 'src.txt', 'dst.txt'
|
|
8
|
+
SRC2, DST2 = 'src2.txt', 'dst2.txt'
|
|
9
9
|
|
|
10
10
|
def setup
|
|
11
11
|
super
|
|
12
|
-
File.write(SRC,
|
|
13
|
-
File.write(SRC2,
|
|
12
|
+
File.write(SRC, 'something')
|
|
13
|
+
File.write(SRC2, 'another thing')
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
#
|
|
@@ -23,8 +23,8 @@ class TestFile < Minitest::Test
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def test_mkdir_mode
|
|
26
|
-
Scripto.mkdir(DIR, mode:
|
|
27
|
-
assert_equal(
|
|
26
|
+
Scripto.mkdir(DIR, mode: 0o644)
|
|
27
|
+
assert_equal(0o644, File.stat(DIR).mode & 0o644)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def test_cp
|
|
@@ -33,8 +33,8 @@ class TestFile < Minitest::Test
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def test_cp_mode
|
|
36
|
-
Scripto.cp(SRC, DST, mode:
|
|
37
|
-
assert_equal(
|
|
36
|
+
Scripto.cp(SRC, DST, mode: 0o644)
|
|
37
|
+
assert_equal(0o644, File.stat(DST).mode & 0o644)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def test_cp_mkdir
|
|
@@ -45,13 +45,13 @@ class TestFile < Minitest::Test
|
|
|
45
45
|
|
|
46
46
|
def test_mv
|
|
47
47
|
Scripto.mv(SRC, DST)
|
|
48
|
-
assert_equal(
|
|
48
|
+
assert_equal('something', File.read(DST))
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def test_mv_mkdir
|
|
52
52
|
in_dir = "#{DIR}/in_dir"
|
|
53
53
|
Scripto.mv(SRC, in_dir, mkdir: true)
|
|
54
|
-
assert_equal(
|
|
54
|
+
assert_equal('something', File.read(in_dir))
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def test_ln
|
|
@@ -62,7 +62,7 @@ class TestFile < Minitest::Test
|
|
|
62
62
|
def test_rm
|
|
63
63
|
Scripto.rm(SRC)
|
|
64
64
|
assert(!File.exist?(SRC))
|
|
65
|
-
Scripto.rm(
|
|
65
|
+
Scripto.rm('this_file_doesnt_exist') # shouldn't complain
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
#
|
|
@@ -80,7 +80,7 @@ class TestFile < Minitest::Test
|
|
|
80
80
|
assert_equal(SRC, File.readlink(DST2))
|
|
81
81
|
|
|
82
82
|
# should be silent
|
|
83
|
-
assert_fu_output(nil,
|
|
83
|
+
assert_fu_output(nil, '') do
|
|
84
84
|
assert_nil Scripto.mkdir_if_necessary(DIR)
|
|
85
85
|
assert_nil Scripto.cp_if_necessary(SRC, DST)
|
|
86
86
|
assert_nil Scripto.ln_if_necessary(SRC, DST2)
|
|
@@ -88,7 +88,7 @@ class TestFile < Minitest::Test
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def test_cp_if_necessary_differs
|
|
91
|
-
File.write(DST,
|
|
91
|
+
File.write(DST, 'this is different')
|
|
92
92
|
assert_fu_output(nil, "cp -rp #{SRC} #{DST}\n") do
|
|
93
93
|
assert Scripto.cp_if_necessary(SRC, DST)
|
|
94
94
|
end
|
|
@@ -103,23 +103,23 @@ class TestFile < Minitest::Test
|
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def test_chmod
|
|
106
|
-
Scripto.chmod(SRC,
|
|
107
|
-
assert_equal(
|
|
106
|
+
Scripto.chmod(SRC, 0o644)
|
|
107
|
+
assert_equal(0o644, File.stat(SRC).mode & 0o644)
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
def test_rm_and_mkdir
|
|
111
111
|
Dir.mkdir(DIR)
|
|
112
|
-
File.write("#{DIR}/file",
|
|
112
|
+
File.write("#{DIR}/file", 'this is a test')
|
|
113
113
|
assert Dir["#{DIR}/*"].length == 1
|
|
114
114
|
Scripto.rm_and_mkdir(DIR)
|
|
115
|
-
assert Dir["#{DIR}/*"].
|
|
115
|
+
assert Dir["#{DIR}/*"].empty?
|
|
116
116
|
end
|
|
117
117
|
|
|
118
118
|
def test_copy_metadata
|
|
119
|
-
File.chmod(
|
|
119
|
+
File.chmod(0o644, SRC)
|
|
120
120
|
File.utime(1234, 5678, SRC)
|
|
121
121
|
Scripto.copy_metadata(SRC, SRC2)
|
|
122
|
-
assert_equal(
|
|
122
|
+
assert_equal(0o644, File.stat(SRC2).mode & 0o644)
|
|
123
123
|
assert_equal(1234, File.stat(SRC2).atime.to_i)
|
|
124
124
|
assert_equal(5678, File.stat(SRC2).mtime.to_i)
|
|
125
125
|
end
|
|
@@ -130,20 +130,40 @@ class TestFile < Minitest::Test
|
|
|
130
130
|
|
|
131
131
|
def test_mkdir_owner
|
|
132
132
|
skip if !root?
|
|
133
|
-
Scripto.mkdir(DIR, owner:
|
|
134
|
-
assert(Etc.getpwnam(
|
|
133
|
+
Scripto.mkdir(DIR, owner: 'nobody')
|
|
134
|
+
assert(Etc.getpwnam('nobody').uid, File.stat(DIR).uid)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
def test_cp_owner
|
|
138
138
|
skip if !root?
|
|
139
|
-
Scripto.cp(SRC, DST, owner:
|
|
140
|
-
assert(Etc.getpwnam(
|
|
139
|
+
Scripto.cp(SRC, DST, owner: 'nobody')
|
|
140
|
+
assert(Etc.getpwnam('nobody').uid, File.stat(DST).uid)
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
def test_chown
|
|
144
144
|
skip if !root?
|
|
145
|
-
Scripto.chown(SRC,
|
|
146
|
-
assert(Etc.getpwnam(
|
|
145
|
+
Scripto.chown(SRC, 'nobody')
|
|
146
|
+
assert(Etc.getpwnam('nobody').uid, File.stat(SRC).uid)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
#
|
|
150
|
+
# atomic
|
|
151
|
+
#
|
|
152
|
+
|
|
153
|
+
def test_atomic
|
|
154
|
+
Scripto.atomic_write(SRC) { |f| f.write('xyzzy') }
|
|
155
|
+
assert_equal 'xyzzy', File.read(SRC)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def test_atomic_fail
|
|
159
|
+
assert_raises do
|
|
160
|
+
Scripto.atomic_write(SRC) do |f|
|
|
161
|
+
f.write('xyzzy')
|
|
162
|
+
raise 'uh oh'
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
# SRC should be unscathed
|
|
166
|
+
assert_equal 'something', File.read(SRC)
|
|
147
167
|
end
|
|
148
168
|
|
|
149
169
|
#
|
|
@@ -184,17 +204,17 @@ class TestFile < Minitest::Test
|
|
|
184
204
|
|
|
185
205
|
def root?
|
|
186
206
|
if !defined?(@root)
|
|
187
|
-
@root = `whoami`.strip ==
|
|
207
|
+
@root = `whoami`.strip == 'root'
|
|
188
208
|
end
|
|
189
209
|
@root
|
|
190
210
|
end
|
|
191
211
|
|
|
192
|
-
def assert_fu_output(stdout = nil, stderr = nil
|
|
212
|
+
def assert_fu_output(stdout = nil, stderr = nil)
|
|
193
213
|
Scripto.verbose!
|
|
194
214
|
assert_output(stdout, stderr) do
|
|
195
215
|
# FileUtils squirrels this away so we have to set it manually
|
|
196
|
-
FileUtils.instance_eval(
|
|
216
|
+
FileUtils.instance_eval('@fileutils_output = $stderr')
|
|
197
217
|
yield
|
|
198
218
|
end
|
|
199
219
|
end
|
|
200
|
-
end
|
|
220
|
+
end
|