forte 0.0.2 → 0.0.4

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: 877ec9d6eee6d9b7c328cdb1d7703446ebe39190
4
- data.tar.gz: 97d852ccfdee9469fc78ac9fe28f2add71a0f69a
3
+ metadata.gz: 58d433c71298a72b1720bfbf938efaa6dea5c913
4
+ data.tar.gz: 595e45330f7cd8d022ce9717cc5b25877f8d484a
5
5
  SHA512:
6
- metadata.gz: e7cb46d4601cc855e86828e8b493d7609eb3602ecd0b2f42f887bd03a528c908940e14a57722e149450235ec3304ecf04b481eae48eac932878c5280b90c8558
7
- data.tar.gz: 55a069eff3cf0e37028be4de61424a47bdd73a252840611c2a484fdf547adfc9dd2347b782ce05721bb8095d73667540305ef49e0957cf320dbb8a335d3a468f
6
+ metadata.gz: 3c9916214685f5334bfef7495ef8af861b035432b9367bde998e3e14a84423a584d8b255b598d3acb25841f80665629b7dc24914574a95145715d4ed40ad296d
7
+ data.tar.gz: c6401450d0e0a85ed1a68e1d608f78a036b7903de22f711468076e317c43a3fb326319f87351622608880e29e3b6b8816bb5d8373bb687a0f34c074bfa3e868f
data/lib/forte.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require 'thor'
2
- require 'forte/git'
2
+ require 'git'
3
+ require 'fileutils'
3
4
  require 'forte/authorized_keys'
4
5
  require 'forte/base'
5
6
  require 'forte/keyfile'
7
+ require 'forte/repo_location'
data/lib/forte/base.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  class Base < Thor
2
2
  desc "print", "Prints the public keys to STDOUT"
3
3
  def print(uri)
4
- dir = Git.clone(uri)
5
- puts AuthorizedKeys.build(dir)
6
- Git.cleanup
4
+ loc = RepoLocation.new(uri)
5
+ repo = Git.clone(loc.uri, File.join(Dir.pwd, './.tmp'))
6
+ puts AuthorizedKeys.build(repo.dir.path)
7
+ FileUtils.rm_rf(repo.dir.path)
7
8
  end
8
9
  end
@@ -0,0 +1,14 @@
1
+ class RepoLocation
2
+ attr_accessor :path
3
+
4
+ def initialize(path)
5
+ @path = path
6
+ end
7
+
8
+ def uri
9
+ return path if path.start_with?('http')
10
+ return path if Dir.exists?(File.join(path, '.git'))
11
+ "https://github.com/#{path}.git"
12
+ end
13
+
14
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Yockey
@@ -9,9 +9,38 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-10 00:00:00.000000000 Z
13
- dependencies: []
14
- description:
12
+ date: 2014-01-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '0.18'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '0.18'
28
+ - !ruby/object:Gem::Dependency
29
+ name: git
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: '1.2'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: '1.2'
42
+ description: 'Create an authorized_keys file for a shared shell account from a repository
43
+ of public key files '
15
44
  email:
16
45
  - mike@heysparkbox.com
17
46
  - ryan@heysparkbox.com
@@ -24,9 +53,9 @@ files:
24
53
  - lib/forte.rb
25
54
  - lib/forte/authorized_keys.rb
26
55
  - lib/forte/base.rb
27
- - lib/forte/git.rb
28
56
  - lib/forte/keyfile.rb
29
- homepage:
57
+ - lib/forte/repo_location.rb
58
+ homepage: https://github.com/yock/forte
30
59
  licenses:
31
60
  - MIT
32
61
  metadata: {}
data/lib/forte/git.rb DELETED
@@ -1,25 +0,0 @@
1
- require 'fileutils'
2
- class Git
3
- class << self
4
- TMP_DIR = File.join(Dir.pwd, '.forte')
5
-
6
- def clone(uri)
7
- FileUtils.mkdir_p(TMP_DIR)
8
- cmd = "git clone -q #{complete_uri(uri)} #{TMP_DIR}"
9
- system(cmd)
10
- TMP_DIR
11
- end
12
-
13
- def cleanup
14
- FileUtils.rm_rf(TMP_DIR)
15
- end
16
-
17
- private
18
-
19
- def complete_uri(uri)
20
- return uri if Dir.exist?("#{uri}/.git")
21
- return uri if uri.start_with?('http')
22
- "https://github.com/#{uri}.git"
23
- end
24
- end
25
- end