rhosts 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rhosts/commands/console.rb +1 -1
- data/lib/rhosts/version.rb +1 -1
- data/spec/lib/rhosts/command/console_spec.rb +74 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db4ba4428886c8f9fe4d11e51f131d86efa69c6
|
4
|
+
data.tar.gz: a76f82230f04c1269d1cc56e8dc732567497b4ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ca5644a45aa76007213c2d5f9e2b613e2479a74da3edddd83f05e53350180b58ed73bcdfeeca58398ee22e6d279c8c65f82e59b6e0b9d07e1fb3ae346cea08
|
7
|
+
data.tar.gz: 910bad25e9eb459c2c9f4d07c39e2819768c672a5484e5d38f1d2946ff643b9e803832307faab1565d45452d66abe14e35a7e1db6ca6e244658375b12e6c3355
|
@@ -17,7 +17,7 @@ module RHosts
|
|
17
17
|
load_default_rules
|
18
18
|
load_run_command
|
19
19
|
|
20
|
-
unless File.writable?(RHosts.config.hosts_file_path)
|
20
|
+
unless File.writable?(RHosts.config.hosts_file_path) or RHosts.config.sudo?
|
21
21
|
warn "Hosts file is not writable. Please check permission"
|
22
22
|
exit 1
|
23
23
|
end
|
data/lib/rhosts/version.rb
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rhosts/commands/console'
|
3
|
+
|
4
|
+
describe 'Console' do
|
5
|
+
include_context 'capture_stderr'
|
6
|
+
|
7
|
+
before do
|
8
|
+
RHosts::Console.any_instance.stub(:start).and_return(nil)
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'hosts file is not writable' do
|
12
|
+
before do
|
13
|
+
RHosts::Filer::Mock.writable(false)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'and sudo flag is false' do
|
17
|
+
before do
|
18
|
+
RHosts::Console.stub(:load_run_command) do
|
19
|
+
RHosts.configure{ |c| c.sudo = false }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should display error message and exit' do
|
24
|
+
err = capture_stderr do
|
25
|
+
expect{ RHosts::Console.start }.to raise_error(SystemExit)
|
26
|
+
end
|
27
|
+
|
28
|
+
expect(err.chomp).to eq('Hosts file is not writable. Please check permission')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'and sudo flag is true' do
|
33
|
+
before do
|
34
|
+
RHosts::Console.stub(:load_run_command) do
|
35
|
+
RHosts.configure{ |c| c.sudo = true }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should not display error message and exit' do
|
40
|
+
expect{ RHosts::Console.start }.not_to raise_error(SystemExit)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'hosts file is writable' do
|
46
|
+
before do
|
47
|
+
RHosts::Filer::Mock.writable(true)
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'and sudo flag is false' do
|
51
|
+
before do
|
52
|
+
RHosts::Console.stub(:load_run_command) do
|
53
|
+
RHosts.configure{ |c| c.sudo = false }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should not display error message and exit' do
|
58
|
+
expect{ RHosts::Console.start }.not_to raise_error(SystemExit)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'and sudo flag is true' do
|
63
|
+
before do
|
64
|
+
RHosts::Console.stub(:load_run_command) do
|
65
|
+
RHosts.configure{ |c| c.sudo = true }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should not display error message and exit' do
|
70
|
+
expect{ RHosts::Console.start }.not_to raise_error(SystemExit)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takeshi Takizawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ipaddress
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/rhosts/version.rb
|
45
45
|
- License.txt
|
46
46
|
- README.md
|
47
|
+
- spec/lib/rhosts/command/console_spec.rb
|
47
48
|
- spec/lib/rhosts/console/app_spec.rb
|
48
49
|
- spec/lib/rhosts/filer_spec.rb
|
49
50
|
- spec/spec_helper.rb
|
@@ -76,8 +77,9 @@ rubyforge_project: rhosts
|
|
76
77
|
rubygems_version: 2.0.3
|
77
78
|
signing_key:
|
78
79
|
specification_version: 4
|
79
|
-
summary: rhosts-0.1.
|
80
|
+
summary: rhosts-0.1.1
|
80
81
|
test_files:
|
82
|
+
- spec/lib/rhosts/command/console_spec.rb
|
81
83
|
- spec/lib/rhosts/console/app_spec.rb
|
82
84
|
- spec/lib/rhosts/filer_spec.rb
|
83
85
|
- spec/spec_helper.rb
|