ghost 0.2.8 → 0.3.0
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.
- data/LICENSE +1 -1
- data/{README → README.md} +20 -11
- data/Rakefile +6 -6
- data/bin/ghost +101 -92
- data/bin/ghost-ssh +132 -0
- data/lib/ghost.rb +16 -2
- data/lib/ghost/linux-host.rb +146 -80
- data/lib/ghost/mac-host.rb +101 -99
- data/lib/ghost/ssh_config.rb +110 -0
- data/spec/etc_hosts_spec.rb +100 -65
- data/spec/ghost_spec.rb +89 -89
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/ssh_config_spec.rb +80 -0
- data/spec/ssh_config_template +11 -0
- metadata +29 -43
data/spec/spec.opts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--colour
|
1
|
+
--colour
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'ghost/ssh_config'
|
2
|
+
|
3
|
+
$ssh_config_template = File.expand_path(File.join(File.dirname(__FILE__), "ssh_config_template"))
|
4
|
+
$ssh_config_file = File.expand_path(File.join(File.dirname(__FILE__), "ssh_config"))
|
5
|
+
|
6
|
+
describe Ghost::SshConfig do
|
7
|
+
before(:all) do
|
8
|
+
class Ghost::SshConfig
|
9
|
+
@@ssh_config = $ssh_config_file
|
10
|
+
end
|
11
|
+
end
|
12
|
+
before { `cp #{$ssh_config_template.inspect} #{$ssh_config_file.inspect}` }
|
13
|
+
after { `rm -f #{$ssh_config_file.inspect}` }
|
14
|
+
|
15
|
+
subject do
|
16
|
+
Ghost::SshConfig
|
17
|
+
end
|
18
|
+
|
19
|
+
it "has an Host" do
|
20
|
+
subject.empty!
|
21
|
+
|
22
|
+
host = "miami-b01"
|
23
|
+
hostname = "192.168.227.128"
|
24
|
+
user = "root"
|
25
|
+
port = "389"
|
26
|
+
|
27
|
+
subject.add(
|
28
|
+
:host => host,
|
29
|
+
:hostname => hostname,
|
30
|
+
:user => user,
|
31
|
+
:port => port)
|
32
|
+
|
33
|
+
config = subject.list.first
|
34
|
+
config.host.should eql(host)
|
35
|
+
config.hostname.should eql(hostname)
|
36
|
+
config.user.should eql(user)
|
37
|
+
config.port.should eql(port)
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#list' do
|
41
|
+
it "returns an array" do
|
42
|
+
subject.list.should be_instance_of(Array)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "contains instances of Ghost::SshConfig" do
|
46
|
+
subject.empty!
|
47
|
+
subject.add(
|
48
|
+
:host => "miami-b01",
|
49
|
+
:hostname => "192.168.227.128",
|
50
|
+
:user => "root",
|
51
|
+
:port => "39")
|
52
|
+
|
53
|
+
config = subject.list
|
54
|
+
|
55
|
+
(config = subject.list.first).should be_instance_of(Ghost::SshConfig)
|
56
|
+
|
57
|
+
config.host.should eql("miami-b01")
|
58
|
+
config.hostname.should eql("192.168.227.128")
|
59
|
+
config.user.should eql("root")
|
60
|
+
config.port.should eql("39")
|
61
|
+
end
|
62
|
+
|
63
|
+
it "parses the .ssh/config format" do
|
64
|
+
configs = Ghost::SshConfig.list
|
65
|
+
configs.should have(3).items
|
66
|
+
|
67
|
+
configs[0].host.should eql("example1")
|
68
|
+
configs[0].hostname.should eql("192.168.227.128")
|
69
|
+
configs[0].user.should eql("root")
|
70
|
+
|
71
|
+
configs[1].host.should eql("example2")
|
72
|
+
configs[1].hostname.should eql("example2.webbynode.com")
|
73
|
+
configs[1].user.should eql("root")
|
74
|
+
configs[1].port.should eql("2022")
|
75
|
+
|
76
|
+
configs[2].host.should eql("example3")
|
77
|
+
configs[2].hostname.should eql("10.0.0.1")
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
metadata
CHANGED
@@ -1,80 +1,66 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghost
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 8
|
10
|
-
version: 0.2.8
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Bodaniel Jeanes
|
14
9
|
autorequire: ghost
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-05-25 00:00:00 +10:00
|
19
|
-
default_executable:
|
12
|
+
date: 2012-04-18 00:00:00.000000000Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
14
|
description: Allows you to create, list, and modify local hostnames
|
23
15
|
email: me@bjeanes.com
|
24
|
-
executables:
|
16
|
+
executables:
|
25
17
|
- ghost
|
18
|
+
- ghost-ssh
|
26
19
|
extensions: []
|
27
|
-
|
28
|
-
|
29
|
-
- README
|
20
|
+
extra_rdoc_files:
|
21
|
+
- README.md
|
30
22
|
- LICENSE
|
31
23
|
- TODO
|
32
|
-
files:
|
24
|
+
files:
|
33
25
|
- LICENSE
|
34
|
-
- README
|
26
|
+
- README.md
|
35
27
|
- Rakefile
|
36
28
|
- TODO
|
37
29
|
- bin/ghost
|
30
|
+
- bin/ghost-ssh
|
38
31
|
- lib/ghost/linux-host.rb
|
39
32
|
- lib/ghost/mac-host.rb
|
33
|
+
- lib/ghost/ssh_config.rb
|
40
34
|
- lib/ghost.rb
|
41
35
|
- spec/etc_hosts_spec.rb
|
42
36
|
- spec/ghost_spec.rb
|
43
37
|
- spec/spec.opts
|
44
38
|
- spec/spec_helper.rb
|
45
|
-
|
39
|
+
- spec/ssh_config_spec.rb
|
40
|
+
- spec/ssh_config_template
|
46
41
|
homepage: http://github.com/bjeanes/ghost
|
47
42
|
licenses: []
|
48
|
-
|
49
43
|
post_install_message:
|
50
|
-
rdoc_options:
|
44
|
+
rdoc_options:
|
51
45
|
- --line-numbers
|
52
|
-
require_paths:
|
46
|
+
require_paths:
|
53
47
|
- lib
|
54
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
49
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
55
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
69
|
-
segments:
|
70
|
-
- 0
|
71
|
-
version: "0"
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
72
60
|
requirements: []
|
73
|
-
|
74
61
|
rubyforge_project: ghost
|
75
|
-
rubygems_version: 1.
|
62
|
+
rubygems_version: 1.8.10
|
76
63
|
signing_key:
|
77
64
|
specification_version: 3
|
78
65
|
summary: Allows you to create, list, and modify local hostnames
|
79
66
|
test_files: []
|
80
|
-
|