sconb 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed851f7d1f6dee675df9cb3f6f54db7390b4842d
4
- data.tar.gz: 31fbd7a45d6c75a41dc07f623ccf394217ed3336
3
+ metadata.gz: f88cb24b5285cca8d688119f8a9a6217493fd2e3
4
+ data.tar.gz: cb2dd6cc3eabae63dbcbd04f083203fc8249b86b
5
5
  SHA512:
6
- metadata.gz: 0edb1530624633d53f4a5b06c75c201948755679237272f0b665dd2027bd90c0bb646bc8cbba2f150c6f4f500e8645e585f2a665d3dfd7782dcf78c3a7ed7a1d
7
- data.tar.gz: ae9f091236ce84509063ab6d67b0d5a346f3e4b55ca11cda016ceb01e30be6237e22a00cabe1bd388f6e17fdd26e91f6bfd7c2afb8ec0d1742c945c81129efc1
6
+ metadata.gz: 7876687af79814571d614dd49192e5711e5e212ec7830173e817f188a228b761aa6320c28f9fe198f565932b788cb723d3398e26d8833268933549cc9179a97e
7
+ data.tar.gz: 5c81ad21ebe15a89aa5cfd8c31e1ab67fe309134c907933036effc2f52ed011aea8a6c05c4723f5764b9c6635b2ba27eb3e114455c36bcf2525e9a45531d2954
data/.tachikoma.yml ADDED
@@ -0,0 +1 @@
1
+ strategy: 'bundler'
data/lib/sconb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sconb
2
- VERSION = "0.0.7"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/sconb.rb CHANGED
@@ -2,7 +2,6 @@ require "sconb/version"
2
2
  require "thor"
3
3
  require "net/ssh"
4
4
  require "json"
5
- require "pp"
6
5
 
7
6
  module Sconb
8
7
  class CLI < Thor
@@ -89,7 +88,7 @@ module Sconb
89
88
  method_option :force, :type => :boolean, :aliases => '-f', :default => false, :banner => 'force generate'
90
89
  desc "keyregen < dump.json", "Regenerate private keys from JSON"
91
90
  def keyregen()
92
- json = $stdin.read
91
+ json = stdin_read
93
92
  configs = JSON.parse(json)
94
93
  configs.each do |host, config|
95
94
  config.each do |key, value|
data/spec/sconb_spec.rb CHANGED
@@ -153,8 +153,9 @@ OUT
153
153
  }
154
154
  }
155
155
  INN
156
- )
156
+ )
157
157
  end
158
+
158
159
  it "should convert from JSON to config" do
159
160
  expect(capture(:stdout) {
160
161
  @cli.restore
@@ -180,4 +181,51 @@ Match exec "nmcli connection status id <ap-name> 2> /dev/null"
180
181
  OUT
181
182
  end
182
183
  end
184
+
185
+ context '`keyregen` command' do
186
+ before do
187
+ @cli = Sconb::CLI.new
188
+ allow(@cli).to receive_messages(:stdin_read => <<INN
189
+ {
190
+ "github.com": {
191
+ "Host": "github.com",
192
+ "User": "git",
193
+ "Port": "22",
194
+ "Hostname": "github.com",
195
+ "IdentityFile": [
196
+ "/tmp/sconb_spec_github_rsa"
197
+ ],
198
+ "IdentityFileContent": [
199
+ "This is github_rsa"
200
+ ]
201
+ },
202
+ "gist": {
203
+ "Host": "gist",
204
+ "User": "git",
205
+ "Port": "22",
206
+ "Hostname": "gist.github.com",
207
+ "IdentityFile": [
208
+ "/tmp/sconb_spec_gist_rsa"
209
+ ],
210
+ "IdentityFileContent": [
211
+ "This is gist_rsa"
212
+ ]
213
+ }
214
+ }
215
+ INN
216
+ )
217
+ end
218
+
219
+ it "should generate private keys from JSON to config" do
220
+ @cli.keyregen
221
+ expect(File.open('/tmp/sconb_spec_github_rsa').read).to eq "This is github_rsa"
222
+ expect(File.open('/tmp/sconb_spec_gist_rsa').read).to eq "This is gist_rsa"
223
+ end
224
+
225
+ after do
226
+ File.unlink('/tmp/sconb_spec_github_rsa')
227
+ File.unlink('/tmp/sconb_spec_gist_rsa')
228
+ end
229
+
230
+ end
183
231
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sconb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-02 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -119,6 +119,7 @@ files:
119
119
  - ".coveralls.yml"
120
120
  - ".gitignore"
121
121
  - ".rspec"
122
+ - ".tachikoma.yml"
122
123
  - ".travis.yml"
123
124
  - Gemfile
124
125
  - LICENSE.txt