gitofigure 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
data/gitofigure.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gitofigure"
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nikhil Mungel"]
data/lib/gitofigure.rb CHANGED
@@ -19,13 +19,22 @@ class GitoFigure
19
19
  yield git
20
20
  git.repo.push
21
21
  else
22
- git
22
+ return git
23
+ end
24
+ end
25
+
26
+ def authorize_keys(hsh)
27
+ hsh.each do |name, key|
28
+ filename = File.join('/', 'tmp', name.to_s + '.pub')
29
+ File.open(filename, "w") {|f| f.write(key.to_s)}
30
+ authorize_keyfile(filename)
23
31
  end
24
32
  end
25
33
 
26
- def authorize_key(keyfile)
27
- FileUtils.mv(keyfile, repo.dir.to_s + '/keydir')
34
+ def authorize_keyfile(filename, msg=nil)
35
+ msg = ["Added #{File.basename(filename)}", msg].join("\n")
36
+ FileUtils.mv(filename, repo.dir.to_s + '/keydir')
28
37
  repo.add 'keydir'
29
- repo.commit("Added #{File.basename(keyfile)}")
38
+ repo.commit(msg)
30
39
  end
31
40
  end
@@ -53,16 +53,29 @@ describe GitoFigure do
53
53
  end
54
54
  end
55
55
 
56
- it "should push a given key.pub file upstream" do
56
+ it "should push a given key upstream" do
57
+ git = Git.open(TEST_REPO_PATH)
58
+
59
+ GitoFigure.administer('test.git.tw.com') do |admin|
60
+ admin.authorize_keys(:alpha => "xxxyyyzzz= alpha")
61
+ end
62
+
63
+ git.log.first.diff_parent.stats[:files].key?('keydir/alpha.pub').should be_true
64
+ git.log.first.message.should == 'Added alpha.pub'
65
+ end
66
+
67
+ it "should push a given keyfile.pub file upstream" do
57
68
  FileUtils.touch('/tmp/key.pub')
58
69
  git = Git.open(TEST_REPO_PATH)
59
70
 
60
71
  GitoFigure.administer('test.git.tw.com') do |admin|
61
- admin.authorize_key('/tmp/key.pub')
72
+ admin.authorize_keyfile('/tmp/key.pub')
62
73
  end
63
74
 
64
75
  git.log.first.diff_parent.stats[:files].key?('keydir/key.pub').should be_true
65
76
  git.log.first.message.should == 'Added key.pub'
66
77
  end
78
+
67
79
  end
68
80
 
81
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitofigure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: git
16
- requirement: &84775020 !ruby/object:Gem::Requirement
16
+ requirement: &77731460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *84775020
24
+ version_requirements: *77731460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &84774760 !ruby/object:Gem::Requirement
27
+ requirement: &77731200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *84774760
35
+ version_requirements: *77731200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &84774460 !ruby/object:Gem::Requirement
38
+ requirement: &77730940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *84774460
46
+ version_requirements: *77730940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &84774160 !ruby/object:Gem::Requirement
49
+ requirement: &77730640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.4
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *84774160
57
+ version_requirements: *77730640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &84773860 !ruby/object:Gem::Requirement
60
+ requirement: &77730340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *84773860
68
+ version_requirements: *77730340
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
- requirement: &84773620 !ruby/object:Gem::Requirement
71
+ requirement: &77730040 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 2.6.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *84773620
79
+ version_requirements: *77730040
80
80
  description: Manage a remote gitolite-admin repository.
81
81
  email: nikhilm@thoughtworks.com
82
82
  executables: []
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: 900794765
116
+ hash: -434796547
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements: