forte 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 43a3df028232e9e46b0500ffd3c02c3e4320052b
4
+ data.tar.gz: a14f82c2552c2b92e09e6ee41864ec5255604fe3
5
+ SHA512:
6
+ metadata.gz: 37d1807895f31c0856daf289e1ac1c9f12df75242545418286b4e6ce9ab7668fd02eb156d22cb907f971607153e74a9bc144e377c763d5f71838897449e1ef9b
7
+ data.tar.gz: 4cf4007589bcce4a137d6c2164c2c5880634670cd0427a781fe7010a47a45d24cf8811e4a6efd32d2cfb81bfa9662f3893672a0387a2701843119faeffde58b9
data/bin/forte ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'forte'
3
+ Base.start(ARGV)
@@ -0,0 +1,11 @@
1
+ class AuthorizedKeys
2
+ def self.build(dir)
3
+ out = ''
4
+ Dir.glob(File.join(dir, '**', '*.pub')) do |file|
5
+ keyfile = Keyfile.new(file)
6
+ out << "##{keyfile.description}\n"
7
+ out << "#{keyfile.body}\n"
8
+ end
9
+ out
10
+ end
11
+ end
data/lib/forte/base.rb ADDED
@@ -0,0 +1,7 @@
1
+ class Base < Thor
2
+ desc "print", "Prints the public keys to STDOUT"
3
+ def print(uri)
4
+ dir = Git.clone(uri)
5
+ puts AuthorizedKeys.build(dir)
6
+ end
7
+ end
data/lib/forte/git.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'fileutils'
2
+ class Git
3
+ class << self
4
+ TMP_DIR = File.join(Dir.pwd, '.tmp', 'forte')
5
+
6
+ def clone(uri)
7
+ FileUtils.mkdir_p(TMP_DIR)
8
+ cmd = "git clone #{uri} #{TMP_DIR}"
9
+ system(cmd)
10
+ TMP_DIR
11
+ end
12
+
13
+ def cleanup
14
+ FileUtils.rm_rf(TMP_DIR)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ class Keyfile
2
+ attr_accessor :path
3
+ def initialize(path)
4
+ @path = path
5
+ end
6
+
7
+ def description
8
+ File.basename(path, '.*')
9
+ end
10
+
11
+ def body
12
+ IO.read(path)
13
+ end
14
+
15
+ end
data/lib/forte.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'thor'
2
+ require 'forte/git'
3
+ require 'forte/authorized_keys'
4
+ require 'forte/base'
5
+ require 'forte/keyfile'
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: forte
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Yockey
8
+ - Ryan Cromwell
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-01-03 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description:
15
+ email:
16
+ - mike@heysparkbox.com
17
+ - ryan@heysparkbox.com
18
+ executables:
19
+ - forte
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - bin/forte
24
+ - lib/forte.rb
25
+ - lib/forte/authorized_keys.rb
26
+ - lib/forte/base.rb
27
+ - lib/forte/git.rb
28
+ - lib/forte/keyfile.rb
29
+ homepage:
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 2.2.0
50
+ signing_key:
51
+ specification_version: 4
52
+ summary: Create an authorized_keys file for a shared shell account from a repository
53
+ of public key files
54
+ test_files: []