gusteau 0.4.1 → 0.4.2
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/README.md +7 -0
- data/bin/gusteau +2 -6
- data/lib/gusteau.rb +1 -0
- data/lib/gusteau/node.rb +1 -1
- data/lib/gusteau/ssh_config.rb +33 -0
- data/lib/gusteau/version.rb +1 -1
- data/spec/lib/gusteau/node_spec.rb +1 -1
- data/spec/lib/gusteau/ssh_config_spec.rb +27 -0
- data/spec/nodes/{example.yml → production.yml} +1 -1
- data/spec/nodes/staging.yml +12 -0
- metadata +9 -4
data/README.md
CHANGED
@@ -88,6 +88,13 @@ Gusteau provides a useful shortcut that you may use to ssh into a node. If you h
|
|
88
88
|
```
|
89
89
|
gusteau ssh node-name
|
90
90
|
```
|
91
|
+
Please note that `expect` utility must be installed for `gusteau ssh` to work.
|
92
|
+
|
93
|
+
If you prefer calling ssh directly, you will find the `gusteau ssh_config` subcommand useful:
|
94
|
+
|
95
|
+
```
|
96
|
+
gusteau ssh_config >> ~/.ssh/config
|
97
|
+
```
|
91
98
|
|
92
99
|
Using with Vagrant
|
93
100
|
------------------
|
data/bin/gusteau
CHANGED
@@ -28,13 +28,9 @@ class Gusteau::CLI < Optitron::CLI
|
|
28
28
|
node(node_name).ssh
|
29
29
|
end
|
30
30
|
|
31
|
-
desc 'Generate an SSH config
|
31
|
+
desc 'Generate an SSH config'
|
32
32
|
def ssh_config
|
33
|
-
|
34
|
-
node = node(name)
|
35
|
-
puts node.name
|
36
|
-
puts node.server.host
|
37
|
-
end
|
33
|
+
puts Gusteau::SSHConfig.new
|
38
34
|
end
|
39
35
|
|
40
36
|
desc 'Generate an example project (a bureau)'
|
data/lib/gusteau.rb
CHANGED
data/lib/gusteau/node.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'gusteau/server'
|
3
|
+
|
4
|
+
module Gusteau
|
5
|
+
class SSHConfig
|
6
|
+
def initialize(root_dir = ".")
|
7
|
+
@config = Dir.glob("#{root_dir}/nodes/**/*.yml").sort.map do |n|
|
8
|
+
name = File.basename(n, '.*')
|
9
|
+
config = YAML::load_file(n)['server']
|
10
|
+
|
11
|
+
section name, Gusteau::Server.new(config)
|
12
|
+
end.join("\n")
|
13
|
+
end
|
14
|
+
|
15
|
+
def section(name, server)
|
16
|
+
<<-eos
|
17
|
+
Host #{name}
|
18
|
+
HostName #{server.host}
|
19
|
+
Port #{server.port}
|
20
|
+
User #{server.user}
|
21
|
+
eos
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
<<-eos
|
26
|
+
# BEGIN GUSTEAU NODES
|
27
|
+
|
28
|
+
#{@config}
|
29
|
+
# END GUSTEAU NODES
|
30
|
+
eos
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/gusteau/version.rb
CHANGED
@@ -6,7 +6,7 @@ describe Gusteau::Node do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "#dna" do
|
9
|
-
let(:node) { Gusteau::Node.new('spec/nodes/
|
9
|
+
let(:node) { Gusteau::Node.new('spec/nodes/production.yml') }
|
10
10
|
|
11
11
|
let(:dna) { node.send(:dna, include_all, recipes) }
|
12
12
|
let(:include_all) { true }
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require './spec/spec_helper.rb'
|
2
|
+
|
3
|
+
describe Gusteau::SSHConfig do
|
4
|
+
subject { Gusteau::SSHConfig.new('./spec') }
|
5
|
+
|
6
|
+
let(:config) do
|
7
|
+
<<-eos
|
8
|
+
# BEGIN GUSTEAU NODES
|
9
|
+
|
10
|
+
Host production
|
11
|
+
HostName www.example.com
|
12
|
+
Port 22
|
13
|
+
User root
|
14
|
+
|
15
|
+
Host staging
|
16
|
+
HostName staging.example.com
|
17
|
+
Port 2222
|
18
|
+
User devops
|
19
|
+
|
20
|
+
# END GUSTEAU NODES
|
21
|
+
eos
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should generate a valid SSH config" do
|
25
|
+
subject.to_s.must_equal config
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gusteau
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-04-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: optitron
|
@@ -156,11 +156,14 @@ files:
|
|
156
156
|
- lib/gusteau/node.rb
|
157
157
|
- lib/gusteau/server.rb
|
158
158
|
- lib/gusteau/ssh.rb
|
159
|
+
- lib/gusteau/ssh_config.rb
|
159
160
|
- lib/gusteau/version.rb
|
160
161
|
- spec/lib/gusteau/chef_spec.rb
|
161
162
|
- spec/lib/gusteau/node_spec.rb
|
162
163
|
- spec/lib/gusteau/server_spec.rb
|
163
|
-
- spec/
|
164
|
+
- spec/lib/gusteau/ssh_config_spec.rb
|
165
|
+
- spec/nodes/production.yml
|
166
|
+
- spec/nodes/staging.yml
|
164
167
|
- spec/spec_helper.rb
|
165
168
|
- template/.gitignore
|
166
169
|
- template/Cheffile
|
@@ -199,5 +202,7 @@ test_files:
|
|
199
202
|
- spec/lib/gusteau/chef_spec.rb
|
200
203
|
- spec/lib/gusteau/node_spec.rb
|
201
204
|
- spec/lib/gusteau/server_spec.rb
|
202
|
-
- spec/
|
205
|
+
- spec/lib/gusteau/ssh_config_spec.rb
|
206
|
+
- spec/nodes/production.yml
|
207
|
+
- spec/nodes/staging.yml
|
203
208
|
- spec/spec_helper.rb
|