auto_tagger 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/README.md +11 -18
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/auto_tagger.gemspec +5 -3
- data/lib/auto_tagger/recipes.rb +1 -1
- data/spec/auto_tagger/recipes_spec.rb +36 -0
- metadata +8 -4
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -77,10 +77,10 @@ Example `config/deploy.rb` file:
|
|
77
77
|
|
78
78
|
# The :working_directory variable is optional, and defaults to Dir.pwd
|
79
79
|
# :working_directory can be an absolute or relative path
|
80
|
-
set :
|
80
|
+
set :auto_tagger_working_directory, "../../"
|
81
81
|
|
82
82
|
task :production do
|
83
|
-
# In each of your environments that need auto-branch setting, you need to set :
|
83
|
+
# In each of your environments that need auto-branch setting, you need to set :auto_tagger_stage
|
84
84
|
set :auto_tagger_stage, :production
|
85
85
|
end
|
86
86
|
|
@@ -92,7 +92,6 @@ Example `config/deploy.rb` file:
|
|
92
92
|
# You need to add the before/ater callbacks yourself
|
93
93
|
before "deploy:update_code", "auto_tagger:set_branch"
|
94
94
|
after "deploy", "auto_tagger:create_ref"
|
95
|
-
after "deploy", "auto_tagger:write_tag_to_shared"
|
96
95
|
after "deploy", "auto_tagger:print_latest_refs"
|
97
96
|
|
98
97
|
### Capistano-ext multistage support
|
@@ -135,21 +134,21 @@ And the following stages in your capistrano file:
|
|
135
134
|
|
136
135
|
The deployments would look like this:
|
137
136
|
|
138
|
-
cap staging
|
139
|
-
cap production
|
137
|
+
cap staging auto_tagger:set_branch # => sets branch to ci/01
|
138
|
+
cap production auto_tagger:set_branch # => sets branch to staging/01
|
140
139
|
|
141
140
|
You can override with with the -Shead and -Stag options
|
142
141
|
|
143
|
-
cap staging
|
144
|
-
cap staging
|
142
|
+
cap staging auto_tagger:set_branch -Shead=true # => sets branch to master
|
143
|
+
cap staging auto_tagger:set_branch -Stag=staging/01 # => sets branch to staging/01
|
145
144
|
|
146
|
-
If you add `before "deploy:update_code", "
|
145
|
+
If you add `before "deploy:update_code", "auto_tagger:set_branch"`, you can just deploy with:
|
147
146
|
|
148
147
|
cap staging deploy
|
149
148
|
|
150
149
|
and the branch will be set for you automatically.
|
151
150
|
|
152
|
-
###
|
151
|
+
### auto_tagger:create_ref
|
153
152
|
|
154
153
|
This cap task creates a new tag, based on the latest tag from the previous environment.
|
155
154
|
|
@@ -157,21 +156,15 @@ If there is no tag from the previous stage, it creates a new tag from the latest
|
|
157
156
|
|
158
157
|
If you don't specify any `auto_tagger_stages`, auto_tagger will create a tag that starts with "production".
|
159
158
|
|
160
|
-
###
|
161
|
-
|
162
|
-
This task reads the git version from the text file in shared:
|
163
|
-
|
164
|
-
cap staging release_tagger:read_tag_from_shared
|
165
|
-
|
166
|
-
### release_tagger:print_latest_refs
|
159
|
+
### auto_tagger:print_latest_refs
|
167
160
|
|
168
161
|
This task takes the latest tag from each environment and prints it to the screen. You can add it to your deploy.rb like so:
|
169
162
|
|
170
|
-
after "deploy", "
|
163
|
+
after "deploy", "auto_tagger:print_latest_refs"
|
171
164
|
|
172
165
|
Or call it directly, like:
|
173
166
|
|
174
|
-
cap production
|
167
|
+
cap production auto_tagger:print_latest_refs
|
175
168
|
|
176
169
|
This will produce output like:
|
177
170
|
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
gem.summary = %Q{Helps you automatically create tags for each stage in a multi-stage deploment and deploy from the latest tag from the previous environment}
|
9
9
|
gem.email = "jeff@zilkey.com"
|
10
10
|
gem.homepage = "http://github.com/zilkey/auto_tagger"
|
11
|
-
gem.authors = ["Jeff Dean", "Brian Takita", "Mike Grafton", "Bruce Krysiak", "Pat Nakajima", "Jay Zeschin", "Mike Barinek", "Sarah Mei"]
|
11
|
+
gem.authors = ["Jeff Dean", "Brian Takita", "Mike Grafton", "Bruce Krysiak", "Pat Nakajima", "Jay Zeschin", "Mike Barinek", "Sarah Mei", "Mike Dalessio", "Dave Yeu"]
|
12
12
|
gem.add_dependency('capistrano', [">= 2.5.3"])
|
13
13
|
gem.require_paths = ["lib"]
|
14
14
|
gem.executables = ["autotag"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/auto_tagger.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{auto_tagger}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Jeff Dean", "Brian Takita", "Mike Grafton", "Bruce Krysiak", "Pat Nakajima", "Jay Zeschin", "Mike Barinek", "Sarah Mei"]
|
12
|
-
s.date = %q{2010-
|
11
|
+
s.authors = ["Jeff Dean", "Brian Takita", "Mike Grafton", "Bruce Krysiak", "Pat Nakajima", "Jay Zeschin", "Mike Barinek", "Sarah Mei", "Mike Dalessio", "Dave Yeu"]
|
12
|
+
s.date = %q{2010-11-16}
|
13
13
|
s.default_executable = %q{autotag}
|
14
14
|
s.email = %q{jeff@zilkey.com}
|
15
15
|
s.executables = ["autotag"]
|
@@ -59,6 +59,7 @@ Gem::Specification.new do |s|
|
|
59
59
|
"spec/auto_tagger/git/ref_spec.rb",
|
60
60
|
"spec/auto_tagger/git/repo_spec.rb",
|
61
61
|
"spec/auto_tagger/options_spec.rb",
|
62
|
+
"spec/auto_tagger/recipes_spec.rb",
|
62
63
|
"spec/spec_helper.rb"
|
63
64
|
]
|
64
65
|
s.homepage = %q{http://github.com/zilkey/auto_tagger}
|
@@ -76,6 +77,7 @@ Gem::Specification.new do |s|
|
|
76
77
|
"spec/auto_tagger/git/ref_spec.rb",
|
77
78
|
"spec/auto_tagger/git/repo_spec.rb",
|
78
79
|
"spec/auto_tagger/options_spec.rb",
|
80
|
+
"spec/auto_tagger/recipes_spec.rb",
|
79
81
|
"spec/spec_helper.rb"
|
80
82
|
]
|
81
83
|
|
data/lib/auto_tagger/recipes.rb
CHANGED
@@ -32,7 +32,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
32
32
|
|
33
33
|
desc %Q{Creates a tag using the stage variable}
|
34
34
|
task :create_ref, :roles => :app do
|
35
|
-
if
|
35
|
+
if auto_tagger_capistrano_helper.auto_tagger_options[:stage]
|
36
36
|
ref = auto_tagger.create_ref(real_revision)
|
37
37
|
log_auto_tagger "created tag #{ref.name} from #{ref.sha}"
|
38
38
|
else
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'capistrano'
|
3
|
+
|
4
|
+
describe "AutoTagger Capistrano recipes" do
|
5
|
+
|
6
|
+
describe "create_ref" do
|
7
|
+
before do
|
8
|
+
@auto_tagger = mock(AutoTagger::Base)
|
9
|
+
AutoTagger::Base.should_receive(:new).and_return(@auto_tagger)
|
10
|
+
|
11
|
+
@config = Capistrano::Configuration.instance = Capistrano::Configuration.new
|
12
|
+
@config.load "lib/auto_tagger/recipes"
|
13
|
+
@config.stub(:real_revision).and_return("REAL_REVISION")
|
14
|
+
|
15
|
+
@ref = mock(:name => "TAG", :sha => "SHA")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "creates a tag from the real_revision when :auto_tagger_stage is set" do
|
19
|
+
@auto_tagger.should_receive(:create_ref).with("REAL_REVISION").and_return(@ref)
|
20
|
+
@config.set :auto_tagger_stage, :ci
|
21
|
+
@config.auto_tagger.create_ref
|
22
|
+
end
|
23
|
+
|
24
|
+
it "creates a tag from the real_revision when :stage is set" do
|
25
|
+
@auto_tagger.should_receive(:create_ref).with("REAL_REVISION").and_return(@ref)
|
26
|
+
@config.set :stage, :ci
|
27
|
+
@config.auto_tagger.create_ref
|
28
|
+
end
|
29
|
+
|
30
|
+
it "creates a tag from HEAD when neither :auto_tagger_stage nor :stage are set" do
|
31
|
+
@auto_tagger.should_receive(:create_ref).with(no_args).and_return(@ref)
|
32
|
+
@config.auto_tagger.create_ref
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_tagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jeff Dean
|
@@ -18,11 +18,13 @@ authors:
|
|
18
18
|
- Jay Zeschin
|
19
19
|
- Mike Barinek
|
20
20
|
- Sarah Mei
|
21
|
+
- Mike Dalessio
|
22
|
+
- Dave Yeu
|
21
23
|
autorequire:
|
22
24
|
bindir: bin
|
23
25
|
cert_chain: []
|
24
26
|
|
25
|
-
date: 2010-
|
27
|
+
date: 2010-11-16 00:00:00 -07:00
|
26
28
|
default_executable: autotag
|
27
29
|
dependencies:
|
28
30
|
- !ruby/object:Gem::Dependency
|
@@ -92,6 +94,7 @@ files:
|
|
92
94
|
- spec/auto_tagger/git/ref_spec.rb
|
93
95
|
- spec/auto_tagger/git/repo_spec.rb
|
94
96
|
- spec/auto_tagger/options_spec.rb
|
97
|
+
- spec/auto_tagger/recipes_spec.rb
|
95
98
|
- spec/spec_helper.rb
|
96
99
|
has_rdoc: true
|
97
100
|
homepage: http://github.com/zilkey/auto_tagger
|
@@ -137,4 +140,5 @@ test_files:
|
|
137
140
|
- spec/auto_tagger/git/ref_spec.rb
|
138
141
|
- spec/auto_tagger/git/repo_spec.rb
|
139
142
|
- spec/auto_tagger/options_spec.rb
|
143
|
+
- spec/auto_tagger/recipes_spec.rb
|
140
144
|
- spec/spec_helper.rb
|