bovem 2.2.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -6
- data/README.md +1 -0
- data/bovem.gemspec +1 -1
- data/doc/Bovem.html +5 -5
- data/doc/Bovem/Configuration.html +21 -157
- data/doc/Bovem/Console.html +39 -39
- data/doc/Bovem/ConsoleMethods.html +5 -5
- data/doc/Bovem/ConsoleMethods/Interactions.html +21 -21
- data/doc/Bovem/ConsoleMethods/Interactions/ClassMethods.html +9 -9
- data/doc/Bovem/ConsoleMethods/Logging.html +71 -73
- data/doc/Bovem/ConsoleMethods/Logging/ClassMethods.html +9 -9
- data/doc/Bovem/ConsoleMethods/Output.html +20 -28
- data/doc/Bovem/ConsoleMethods/StyleHandling.html +5 -5
- data/doc/Bovem/ConsoleMethods/StyleHandling/ClassMethods.html +7 -7
- data/doc/Bovem/Errors.html +5 -5
- data/doc/Bovem/Errors/InvalidConfiguration.html +5 -5
- data/doc/Bovem/Errors/InvalidLogger.html +5 -5
- data/doc/Bovem/Logger.html +126 -69
- data/doc/Bovem/Shell.html +16 -16
- data/doc/Bovem/ShellMethods.html +5 -5
- data/doc/Bovem/ShellMethods/Directories.html +10 -12
- data/doc/Bovem/ShellMethods/Execute.html +7 -7
- data/doc/Bovem/ShellMethods/General.html +7 -7
- data/doc/Bovem/ShellMethods/Read.html +7 -7
- data/doc/Bovem/ShellMethods/Write.html +7 -7
- data/doc/Bovem/Version.html +7 -7
- data/doc/_index.html +6 -6
- data/doc/class_list.html +3 -2
- data/doc/file.README.html +7 -6
- data/doc/file_list.html +2 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +7 -6
- data/doc/js/full_list.js +7 -2
- data/doc/method_list.html +72 -183
- data/doc/top-level-namespace.html +5 -5
- data/lib/bovem.rb +1 -1
- data/lib/bovem/configuration.rb +11 -33
- data/lib/bovem/console.rb +34 -39
- data/lib/bovem/logger.rb +6 -9
- data/lib/bovem/shell.rb +25 -26
- data/lib/bovem/version.rb +2 -2
- data/spec/bovem/configuration_spec.rb +7 -22
- data/spec/bovem/console_spec.rb +1 -1
- data/spec/bovem/shell_spec.rb +9 -10
- data/spec/coverage_helper.rb +3 -0
- metadata +5 -5
data/lib/bovem/version.rb
CHANGED
@@ -16,7 +16,7 @@ describe Bovem::Configuration do
|
|
16
16
|
|
17
17
|
describe "#parse" do
|
18
18
|
it "reads a valid configuration file" do
|
19
|
-
|
19
|
+
::File.open(test_prefix, "w") {|f| f.write("config.property = 1234") }
|
20
20
|
|
21
21
|
config = BaseConfiguration.new(test_prefix)
|
22
22
|
expect(config.property).to eq(1234)
|
@@ -24,22 +24,22 @@ describe Bovem::Configuration do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "reject a missing or unreadable file" do
|
27
|
-
expect {
|
27
|
+
expect { BaseConfiguration.new("/non-existing")}.to raise_error(::Bovem::Errors::InvalidConfiguration)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "reject an invalid configuration" do
|
31
|
-
|
32
|
-
|
31
|
+
::File.open("#{test_prefix}-1", "w") {|f| f.write("config.property = ") }
|
32
|
+
::File.open("#{test_prefix}-2", "w") {|f| f.write("config.non_property = 1234") }
|
33
33
|
|
34
|
-
expect {
|
35
|
-
expect {
|
34
|
+
expect { BaseConfiguration.new("#{test_prefix}-1")}.to raise_error(::Bovem::Errors::InvalidConfiguration)
|
35
|
+
expect { BaseConfiguration.new("#{test_prefix}-2")}.to raise_error(::Bovem::Errors::InvalidConfiguration)
|
36
36
|
|
37
37
|
File.unlink("#{test_prefix}-1")
|
38
38
|
File.unlink("#{test_prefix}-2")
|
39
39
|
end
|
40
40
|
|
41
41
|
it "allows overrides" do
|
42
|
-
|
42
|
+
::File.open("#{test_prefix}", "w") {|f| f.write("config.property = 1234") }
|
43
43
|
|
44
44
|
config = BaseConfiguration.new(test_prefix, {property: 5678, non_property: 1234})
|
45
45
|
expect(config.property).to eq(5678)
|
@@ -47,19 +47,4 @@ describe Bovem::Configuration do
|
|
47
47
|
File.unlink(test_prefix)
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
51
|
-
describe ".property" do
|
52
|
-
it "add the property to the object" do
|
53
|
-
subject = BaseConfiguration.new
|
54
|
-
|
55
|
-
expect(subject.respond_to?(:new_property)).to be_false
|
56
|
-
expect(subject.respond_to?(:new_property=)).to be_false
|
57
|
-
BaseConfiguration.property(:new_property, default: "VALUE")
|
58
|
-
expect(subject.respond_to?(:new_property)).to be_true
|
59
|
-
expect(subject.respond_to?(:new_property=)).to be_true
|
60
|
-
expect(subject.new_property).to eq("VALUE")
|
61
|
-
subject.new_property = "NEW VALUE"
|
62
|
-
expect(subject.new_property).to eq("NEW VALUE")
|
63
|
-
end
|
64
|
-
end
|
65
50
|
end
|
data/spec/bovem/console_spec.rb
CHANGED
@@ -184,7 +184,7 @@ describe Bovem::Console do
|
|
184
184
|
console.stub(:line_width).and_return(80)
|
185
185
|
|
186
186
|
expect(console.format_right(message)).to eq("\e[A\e[0G\e[#{75}CABCDE")
|
187
|
-
expect(console.format_right(message, 10)).to eq("\e[A\e[0G\e[#{5}CABCDE")
|
187
|
+
expect(console.format_right(message, 10)).to eq("\e[A\e[0G\e[#{-5}CABCDE")
|
188
188
|
expect(console.format_right(extended_message)).to eq("\e[A\e[0G\e[#{75}CABC\e[AD\e[3mE")
|
189
189
|
expect(console.format_right(message, nil, false)).to eq("\e[0G\e[#{75}CABCDE")
|
190
190
|
console.stub(:line_width).and_return(10)
|
data/spec/bovem/shell_spec.rb
CHANGED
@@ -37,7 +37,7 @@ describe Bovem::Shell do
|
|
37
37
|
|
38
38
|
describe "#run" do
|
39
39
|
before(:each) do
|
40
|
-
::Open4::stub(:popen4) do |
|
40
|
+
::Open4::stub(:popen4) do |_, _, _, _| OpenStruct.new(exitstatus: 0) end
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should show a message" do
|
@@ -65,7 +65,7 @@ describe Bovem::Shell do
|
|
65
65
|
|
66
66
|
it "should show a exit message" do
|
67
67
|
i = -1
|
68
|
-
::Open4::stub(:popen4) do |
|
68
|
+
::Open4::stub(:popen4) do |_, _, _, _|
|
69
69
|
i += 1
|
70
70
|
OpenStruct.new(exitstatus: i)
|
71
71
|
end
|
@@ -87,8 +87,8 @@ describe Bovem::Shell do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should raise a exception for failures" do
|
90
|
-
::Open4::stub(:popen4) {|
|
91
|
-
expect { shell.run("echo1 OK", nil, true, false, false, false, false) }.
|
90
|
+
::Open4::stub(:popen4) {|_, _, _, _| OpenStruct.new(exitstatus: 1) }
|
91
|
+
expect { shell.run("echo1 OK", nil, true, false, false, false, false) }.not_to raise_error
|
92
92
|
expect { shell.run("echo1 OK", nil, true, false, false) }.to raise_error(SystemExit)
|
93
93
|
end
|
94
94
|
end
|
@@ -333,7 +333,6 @@ describe Bovem::Shell do
|
|
333
333
|
let(:target){ File.expand_path("~") }
|
334
334
|
|
335
335
|
it "should execute block in other directory and return true" do
|
336
|
-
owd = Dir.pwd
|
337
336
|
dir = ""
|
338
337
|
|
339
338
|
shell.within_directory(target) do
|
@@ -341,7 +340,7 @@ describe Bovem::Shell do
|
|
341
340
|
dir = "OK"
|
342
341
|
end
|
343
342
|
|
344
|
-
expect(
|
343
|
+
expect(dir).to eq("OK")
|
345
344
|
end
|
346
345
|
|
347
346
|
it "should change and restore directory" do
|
@@ -357,11 +356,11 @@ describe Bovem::Shell do
|
|
357
356
|
it "should change but not restore directory" do
|
358
357
|
owd = Dir.pwd
|
359
358
|
|
360
|
-
shell.within_directory(target) do
|
359
|
+
shell.within_directory(target, false) do
|
361
360
|
expect(Dir.pwd).to eq(target)
|
362
361
|
end
|
363
362
|
|
364
|
-
expect(Dir.pwd).not_to eq(
|
363
|
+
expect(Dir.pwd).not_to eq(owd)
|
365
364
|
end
|
366
365
|
|
367
366
|
it "should show messages" do
|
@@ -376,11 +375,11 @@ describe Bovem::Shell do
|
|
376
375
|
expect(dir).to eq("")
|
377
376
|
|
378
377
|
Dir.stub(:chdir).and_raise(ArgumentError)
|
379
|
-
expect(shell.within_directory("/") {
|
378
|
+
expect(shell.within_directory("/") { true }).to be_false
|
380
379
|
|
381
380
|
Dir.unstub(:chdir)
|
382
381
|
Dir.stub(:pwd).and_return("/invalid")
|
383
|
-
expect(shell.within_directory("/") {
|
382
|
+
expect(shell.within_directory("/") { true }).to be_false
|
384
383
|
end
|
385
384
|
end
|
386
385
|
|
data/spec/coverage_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bovem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: lazier
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
21
|
+
version: 3.2.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.
|
29
|
+
version: 3.2.2
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: open4
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
segments:
|
132
132
|
- 0
|
133
|
-
hash: -
|
133
|
+
hash: -290835472069004173
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project: bovem
|
136
136
|
rubygems_version: 1.8.25
|