sconb 0.0.1 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ac47823d457985b4cebb46e6d51f439212b4ab1
4
- data.tar.gz: 285e07d5da7a6b3ad0a282f85c52948ded36cfac
3
+ metadata.gz: ab15c974a46c152ef806e7ea30ce5d3c5487b500
4
+ data.tar.gz: f8538c2ffae34e027871e0dc841029d3de2acdb3
5
5
  SHA512:
6
- metadata.gz: d6edb836b3cd30bfee1b297b7d3f6dac6dd7471a2ff25716a44ce5a395f4dab71d9c76785db75e99ccf59eb7f7979ebcae53400c5760c139a235dd15b5b0ad93
7
- data.tar.gz: fd8b3d6b4773168919e8c07051235403ae0daa681bde20b7a1387667a6a4fd5d28a8ece0afff658a4559224db0fb1aef02836d44da6b146d541aae65ded406e5
6
+ metadata.gz: 130982289d2a3f22b73aa3832043f0df33c32b07bba3389ec3e127c0b5189d4200d08ae1b856596f239c4b4c26a12d3ce53d5f53f0497768bd6c2820e0f68533
7
+ data.tar.gz: 42ae881be7e5489d8a3cd6ab4ad12f2c50c7db97c6619be897abe344c9721d21e1b483750c977959c0c5f59a60a235532401107bef1a05bc5888f4b1516e198c
data/README.md CHANGED
@@ -4,17 +4,19 @@ Ssh CONfig Buckup tool.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
7
+ Install it yourself as:
8
8
 
9
- ```ruby
10
- gem 'sconb'
11
- ```
9
+ $ gem install sconb
12
10
 
13
- And then execute:
11
+ ## Usage
14
12
 
15
- $ bundle
13
+ $ sconb
16
14
 
17
- ## Usage
15
+ Commands:
16
+ sconb dump > dump.json # Dump .ssh/config to JSON
17
+ sconb help [COMMAND] # Describe available commands or one specific command
18
+ sconb keyregen < dump.json # Regenerate private keys from JSON
19
+ sconb restore < dump.json > .ssh/config # Restore .ssh/config from JSON
18
20
 
19
21
  ### Backup .ssh/config to JSON
20
22
 
@@ -32,6 +34,22 @@ And then execute:
32
34
 
33
35
  $ sconb keyregen < ssh_config.json
34
36
 
37
+ ## Advanced Tips
38
+
39
+ ### Select host
40
+
41
+ Dump github.com config only.
42
+
43
+ $ sconb dump | jq '{"github.com"}' > github.json
44
+
45
+ And append github.com config to .ssh/config
46
+
47
+ $ sconb restore < github.json >> ~/.ssh/config
48
+
49
+ ### Merge config
50
+
51
+ $ jq -s '.[0] + .[1]' a.json b.json | sconb restore > ~/.ssh/config
52
+
35
53
  ## Contributing
36
54
 
37
55
  1. Fork it ( https://github.com/[my-github-username]/sconb/fork )
@@ -39,3 +57,7 @@ And then execute:
39
57
  3. Commit your changes (`git commit -am 'Add some feature'`)
40
58
  4. Push to the branch (`git push origin my-new-feature`)
41
59
  5. Create a new Pull Request
60
+
61
+ ## TODO
62
+
63
+ - Make test
data/lib/sconb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sconb
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/sconb.rb CHANGED
@@ -43,13 +43,13 @@ module Sconb
43
43
 
44
44
  desc "restore < dump.json > .ssh/config", "Restore .ssh/config from JSON"
45
45
  def restore()
46
- ssh_config = ''
47
46
  json = ''
48
47
  while str = $stdin.gets
49
48
  json << str
50
49
  end
51
50
  configs = JSON.parse(json)
52
51
  configs.each do |host, config|
52
+ ssh_config << "\n"
53
53
  ssh_config << 'Host ' + host + "\n"
54
54
  config.each do |key, value|
55
55
  next if key.downcase == 'host' || key.downcase == 'identityfilecontent'
@@ -61,7 +61,6 @@ module Sconb
61
61
  ssh_config << ' ' + key + ' ' + value + "\n"
62
62
  end
63
63
  end
64
- ssh_config << "\n"
65
64
  end
66
65
  puts ssh_config
67
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sconb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.2.2
120
+ rubygems_version: 2.2.0
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Ssh CONfig Buckup tool.