auto_tagger 0.2.5 → 0.2.6
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.
- data/README.md +11 -7
- data/lib/auto_tagger/base.rb +9 -10
- data/lib/auto_tagger/version.rb +1 -1
- data/spec/auto_tagger/base_spec.rb +13 -0
- metadata +51 -34
data/README.md
CHANGED
@@ -193,19 +193,23 @@ To ensure that this has worked, try this:
|
|
193
193
|
|
194
194
|
If it asks you for a password, you've done something wrong.
|
195
195
|
|
196
|
-
To run the specs,
|
196
|
+
To run the specs, do the following:
|
197
197
|
|
198
198
|
gem install bundler
|
199
199
|
bundle install
|
200
|
-
|
201
|
-
Then execute:
|
202
|
-
|
203
200
|
rspec spec
|
204
|
-
|
205
|
-
To run the cucumber features, execute:
|
206
|
-
|
207
201
|
cucumber features
|
208
202
|
|
203
|
+
## Releasing
|
204
|
+
|
205
|
+
* run rspec and cucumber and make sure that things are green
|
206
|
+
* update the changelog to say what you've done
|
207
|
+
* update the version
|
208
|
+
* commit your changes
|
209
|
+
* run `rake build`
|
210
|
+
* run `rake install` and then open the gem and make sure everything looks ok
|
211
|
+
* run `rake release`
|
212
|
+
|
209
213
|
## Acknowledgments
|
210
214
|
|
211
215
|
Special thanks to:
|
data/lib/auto_tagger/base.rb
CHANGED
@@ -25,7 +25,7 @@ module AutoTagger
|
|
25
25
|
|
26
26
|
def last_ref_from_previous_stage
|
27
27
|
return unless previous_stage
|
28
|
-
|
28
|
+
refs_for_stage(previous_stage).last
|
29
29
|
end
|
30
30
|
|
31
31
|
def create_ref(commit = nil)
|
@@ -103,17 +103,9 @@ module AutoTagger
|
|
103
103
|
|
104
104
|
def refs_for_stage(stage)
|
105
105
|
raise StageCannotBeBlankError if stage.to_s.strip == ""
|
106
|
-
ref_path = Regexp.escape(configuration.ref_path)
|
107
|
-
matcher = /refs\/#{ref_path}\/#{Regexp.escape(stage)}\/.*/
|
108
|
-
repo.refs.all.select do |ref|
|
109
|
-
(ref.name =~ matcher) ? ref : nil
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def ordered_refs_for_stage(stage)
|
114
106
|
ref_path = Regexp.escape(configuration.ref_path)
|
115
107
|
matcher = /refs\/#{ref_path}\/#{Regexp.escape(stage)}\/(.*)/
|
116
|
-
|
108
|
+
select_refs_for_stage(stage).sort do |ref1, ref2|
|
117
109
|
name1 = ref1.name.match(matcher)[1].gsub(configuration.date_separator, "")
|
118
110
|
name2 = ref2.name.match(matcher)[1].gsub(configuration.date_separator, "")
|
119
111
|
name1.to_i <=> name2.to_i
|
@@ -121,6 +113,13 @@ module AutoTagger
|
|
121
113
|
end
|
122
114
|
|
123
115
|
private
|
116
|
+
def select_refs_for_stage(stage)
|
117
|
+
ref_path = Regexp.escape(configuration.ref_path)
|
118
|
+
matcher = /refs\/#{ref_path}\/#{Regexp.escape(stage)}\/.*/
|
119
|
+
repo.refs.all.select do |ref|
|
120
|
+
(ref.name =~ matcher) ? ref : nil
|
121
|
+
end
|
122
|
+
end
|
124
123
|
|
125
124
|
def refs_to_remove
|
126
125
|
self.class.items_to_remove(refs_for_stage(configuration.stage), configuration.refs_to_keep)
|
data/lib/auto_tagger/version.rb
CHANGED
@@ -257,6 +257,19 @@ describe AutoTagger::Base do
|
|
257
257
|
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/ci/2009")
|
258
258
|
]
|
259
259
|
end
|
260
|
+
|
261
|
+
it "orders refs based on last part of tag" do
|
262
|
+
base = AutoTagger::Base.new :stage => "ci"
|
263
|
+
base.repo.stub(:exec) { true }
|
264
|
+
refs = [
|
265
|
+
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/ci/1001"),
|
266
|
+
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/ci/999"),
|
267
|
+
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/ci/1002"),
|
268
|
+
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/heads/master")
|
269
|
+
]
|
270
|
+
base.repo.stub(:refs) { mock("RefSet", :all => refs) }
|
271
|
+
base.refs_for_stage("ci").map(&:name).should == [ "refs/tags/ci/999", "refs/tags/ci/1001", "refs/tags/ci/1002" ]
|
272
|
+
end
|
260
273
|
end
|
261
274
|
|
262
275
|
describe "#list" do
|
metadata
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_tagger
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Jeff Dean
|
9
14
|
- Brian Takita
|
10
15
|
- Mike Grafton
|
@@ -20,28 +25,34 @@ authors:
|
|
20
25
|
autorequire:
|
21
26
|
bindir: bin
|
22
27
|
cert_chain: []
|
23
|
-
|
24
|
-
|
25
|
-
dependencies:
|
26
|
-
- !ruby/object:Gem::Dependency
|
28
|
+
|
29
|
+
date: 2011-09-15 00:00:00 Z
|
30
|
+
dependencies:
|
31
|
+
- !ruby/object:Gem::Dependency
|
27
32
|
name: capistrano
|
28
|
-
|
33
|
+
prerelease: false
|
34
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
29
35
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
hash: 29
|
40
|
+
segments:
|
41
|
+
- 2
|
42
|
+
- 5
|
43
|
+
- 3
|
33
44
|
version: 2.5.3
|
34
45
|
type: :runtime
|
35
|
-
|
36
|
-
version_requirements: *2153208460
|
46
|
+
version_requirements: *id001
|
37
47
|
description:
|
38
48
|
email: jeff@zilkey.com
|
39
|
-
executables:
|
49
|
+
executables:
|
40
50
|
- autotag
|
41
51
|
extensions: []
|
42
|
-
|
52
|
+
|
53
|
+
extra_rdoc_files:
|
43
54
|
- README.md
|
44
|
-
files:
|
55
|
+
files:
|
45
56
|
- bin/autotag
|
46
57
|
- lib/auto_tagger/base.rb
|
47
58
|
- lib/auto_tagger/capistrano_helper.rb
|
@@ -70,34 +81,40 @@ files:
|
|
70
81
|
- spec/auto_tagger/options_spec.rb
|
71
82
|
- spec/auto_tagger/recipes_spec.rb
|
72
83
|
- spec/spec_helper.rb
|
73
|
-
has_rdoc: true
|
74
84
|
homepage: http://github.com/zilkey/auto_tagger
|
75
85
|
licenses: []
|
86
|
+
|
76
87
|
post_install_message:
|
77
|
-
rdoc_options:
|
88
|
+
rdoc_options:
|
78
89
|
- --charset=UTF-8
|
79
|
-
require_paths:
|
90
|
+
require_paths:
|
80
91
|
- lib
|
81
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
93
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
version: "0"
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
102
|
none: false
|
89
|
-
requirements:
|
90
|
-
- -
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
93
110
|
requirements: []
|
111
|
+
|
94
112
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.6
|
113
|
+
rubygems_version: 1.8.6
|
96
114
|
signing_key:
|
97
115
|
specification_version: 3
|
98
|
-
summary: Helps you automatically create tags for each stage in a multi-stage deploment
|
99
|
-
|
100
|
-
test_files:
|
116
|
+
summary: Helps you automatically create tags for each stage in a multi-stage deploment and deploy from the latest tag from the previous environment
|
117
|
+
test_files:
|
101
118
|
- spec/auto_tagger/base_spec.rb
|
102
119
|
- spec/auto_tagger/capistrano_helper_spec.rb
|
103
120
|
- spec/auto_tagger/command_line_spec.rb
|