sshkg 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile ADDED
File without changes
data/bin/sshkg ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift( File.join( File.dirname( __FILE__ ), "..", "lib" ) )
4
+ require 'sshkg'
5
+
6
+ ##
7
+ # ::Main::
8
+ if( Choice.choices[:config] && Choice.choices[:user] )
9
+
10
+ SSHKeyGenerator::Config.load( Choice.choices[:user], Choice.choices[:config] )
11
+ SSHKeyGenerator::generate( )
12
+ end
@@ -0,0 +1,24 @@
1
+ require 'yaml'
2
+
3
+ module SSHKeyGenerator
4
+
5
+ class Config
6
+ class << self
7
+
8
+ def load( user, file_name )
9
+ @config = YAML.load_file( file_name )
10
+ @config[:user] = user
11
+ end
12
+
13
+ def [] key
14
+ @config[key] ? @config[key] : @config[key.to_s] if @config
15
+ end
16
+
17
+ def to_h()
18
+ { :type =>Config[:type],
19
+ :file =>"id_#{Config[:type]}.#{Config[:user]}",
20
+ :comment =>"#{Config[:user]}@#{Config[:comment]}" } if @config
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,10 @@
1
+ module SSHKeyGenerator
2
+ extend self
3
+
4
+ SSH_KEYGEN = "/usr/bin/ssh-keygen"
5
+
6
+ def self.generate( options=Config.to_h )
7
+
8
+ `#{SSH_KEYGEN} -t #{options[:type]} -f #{options[:file]} -C "#{options[:comment]}" 2>/dev/null </dev/null` if options
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ module SSHKeyGenerator
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 1
5
+ PATCH = 0
6
+
7
+ STRING = [MAJOR, MINOR, PATCH ].compact.join(".")
8
+ end
9
+
10
+ NAME = "sshkg"
11
+ VERSION = Version::STRING
12
+ end
data/lib/sshkg.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'util/opt_parser'
3
+ require 'sshkg/version'
4
+ require 'sshkg/config'
5
+ require 'sshkg/generator'
@@ -0,0 +1,29 @@
1
+ require 'choice'
2
+
3
+ Choice.options do
4
+ header ''
5
+ header ' Specific options:'
6
+
7
+ option :config do
8
+ short '-c'
9
+ long '--config=DOMAIN'
10
+ desc 'The yaml config file'
11
+ end
12
+
13
+ option :user do
14
+ short '-u'
15
+ long '--user=USER_ID'
16
+ desc 'The user identificator'
17
+ end
18
+
19
+ separator ''
20
+ separator ' Common options:'
21
+
22
+ option :help do
23
+ short '-h'
24
+ long '--help'
25
+ desc "Show this screen"
26
+ end
27
+
28
+ separator ''
29
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sshkg
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Javier Juarez
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-04 00:00:00 +02:00
19
+ default_executable: sshkg
20
+ dependencies: []
21
+
22
+ description: A wrapper over ssh-keygem for rubyists
23
+ email: javier.juarez@gmail.com
24
+ executables:
25
+ - sshkg
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README.textile
30
+ files:
31
+ - bin/sshkg
32
+ - lib/sshkg.rb
33
+ - lib/sshkg/config.rb
34
+ - lib/sshkg/generator.rb
35
+ - lib/sshkg/version.rb
36
+ - lib/util/opt_parser.rb
37
+ - README.textile
38
+ has_rdoc: true
39
+ homepage: http://github.com/jjuarez/sshkg
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options:
44
+ - --charset=UTF-8
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ hash: 3
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.3.7
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: A very simple gem that helps to automate the generation of SSH Keys
72
+ test_files: []
73
+