auto_tagger 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -1
- data/CHANGELOG +26 -2
- data/Gemfile +4 -4
- data/Gemfile.lock +60 -0
- data/README.md +90 -36
- data/Rakefile +1 -26
- data/VERSION +1 -1
- data/auto_tagger.gemspec +24 -14
- data/bin/autotag +14 -29
- data/features/autotag.feature +43 -2
- data/features/deployment.feature +4 -0
- data/features/step_definitions/autotag_steps.rb +27 -22
- data/features/step_definitions/deployment_steps.rb +41 -33
- data/features/support/env.rb +45 -2
- data/features/support/step_helpers.rb +36 -12
- data/features/templates/deploy.erb +1 -1
- data/lib/auto_tagger/base.rb +150 -19
- data/lib/auto_tagger/capistrano_helper.rb +38 -17
- data/lib/auto_tagger/command_line.rb +65 -0
- data/lib/auto_tagger/commander.rb +22 -11
- data/lib/auto_tagger/configuration.rb +88 -0
- data/lib/auto_tagger/deprecator.rb +11 -0
- data/lib/auto_tagger/git/ref.rb +34 -0
- data/lib/auto_tagger/git/ref_set.rb +35 -0
- data/lib/auto_tagger/git/repo.rb +76 -0
- data/lib/auto_tagger/options.rb +170 -0
- data/lib/auto_tagger/recipes.rb +67 -27
- data/lib/auto_tagger.rb +9 -4
- data/spec/auto_tagger/base_spec.rb +236 -52
- data/spec/auto_tagger/capistrano_helper_spec.rb +82 -112
- data/spec/auto_tagger/command_line_spec.rb +110 -0
- data/spec/auto_tagger/commander_spec.rb +33 -7
- data/spec/auto_tagger/configuration_spec.rb +275 -0
- data/spec/auto_tagger/git/ref_set_spec.rb +61 -0
- data/spec/auto_tagger/git/ref_spec.rb +46 -0
- data/spec/auto_tagger/git/repo_spec.rb +108 -0
- data/spec/auto_tagger/options_spec.rb +157 -0
- data/spec/spec_helper.rb +1 -6
- metadata +32 -15
- data/geminstaller.yml +0 -7
- data/lib/auto_tagger/repository.rb +0 -43
- data/lib/auto_tagger/stage_manager.rb +0 -23
- data/lib/auto_tagger/tag.rb +0 -43
- data/spec/auto_tagger/repository_spec.rb +0 -72
- data/spec/auto_tagger/stage_manager_spec.rb +0 -34
- data/spec/auto_tagger/tag_spec.rb +0 -66
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
2010-08-10
|
2
|
+
|
3
|
+
- Added the following commands
|
4
|
+
- help
|
5
|
+
- version
|
6
|
+
- create STAGE
|
7
|
+
- list STAGE
|
8
|
+
- cleanup STAGE
|
9
|
+
- delete_locally STAGE
|
10
|
+
- delete_on_remote STAGE
|
11
|
+
- Added the following options to autotag
|
12
|
+
--date-separator - the character used to separate parts of the timestamp
|
13
|
+
--fetch-refs - whether to fetch refs before creating or listing them
|
14
|
+
--push-refs - whether to push refs after creating them
|
15
|
+
--remote - specify a custom remote (defaults to "origin")
|
16
|
+
--ref-path - use a different ref directory, other than "tags"
|
17
|
+
--stages - specify all of the stages
|
18
|
+
--offline - don't push or fetch refs (is ignored with delete_on_remote command)
|
19
|
+
--dry-run - don't execute anything, but print the commands
|
20
|
+
--verbose - prints all commands as they run
|
21
|
+
--refs-to-keep - when using any clean commans, specify how many refs to keep
|
22
|
+
--executable - specify the full path to the git executable
|
23
|
+
--opts-file - the location of an additional opts file
|
24
|
+
|
1
25
|
2010-05-15
|
2
26
|
|
3
27
|
- Fixed the exit status in autotag executable (thank you Sarah Mei)
|
@@ -19,7 +43,7 @@
|
|
19
43
|
|
20
44
|
2009-04-20
|
21
45
|
|
22
|
-
- `release_tagger:
|
46
|
+
- `release_tagger:create_ref` creates a production tag if you don't set any stages
|
23
47
|
|
24
48
|
2009-04-05
|
25
49
|
|
@@ -31,7 +55,7 @@
|
|
31
55
|
|
32
56
|
- Capistrano bases new tags off of old tags from the previous environment when tagging if there is a tag from the previous environment
|
33
57
|
- Added the following cap tasks:
|
34
|
-
-
|
58
|
+
- print_latest_refs
|
35
59
|
- read_tag_from_shared
|
36
60
|
- write_tag_to_shared
|
37
61
|
|
data/Gemfile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
source :gemcutter
|
2
2
|
|
3
|
-
gem "
|
3
|
+
gem "rake", "0.8.7"
|
4
|
+
gem "rspec", "2.0.0.beta.19"
|
5
|
+
gem "cucumber", "0.8.5"
|
4
6
|
gem "capistrano", "2.5.18"
|
5
7
|
gem "capistrano-ext", "1.2.1"
|
6
|
-
gem "
|
7
|
-
gem "rr", "0.8.1"
|
8
|
-
gem "activesupport", "2.3.5"
|
8
|
+
gem "jeweler", "1.4.0"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (2.1.2)
|
5
|
+
capistrano (2.5.18)
|
6
|
+
highline
|
7
|
+
net-scp (>= 1.0.0)
|
8
|
+
net-sftp (>= 2.0.0)
|
9
|
+
net-ssh (>= 2.0.14)
|
10
|
+
net-ssh-gateway (>= 1.0.0)
|
11
|
+
capistrano-ext (1.2.1)
|
12
|
+
capistrano (>= 1.0.0)
|
13
|
+
cucumber (0.8.5)
|
14
|
+
builder (~> 2.1.2)
|
15
|
+
diff-lcs (~> 1.1.2)
|
16
|
+
gherkin (~> 2.1.4)
|
17
|
+
json_pure (~> 1.4.3)
|
18
|
+
term-ansicolor (~> 1.0.4)
|
19
|
+
diff-lcs (1.1.2)
|
20
|
+
gemcutter (0.6.1)
|
21
|
+
gherkin (2.1.5)
|
22
|
+
trollop (~> 1.16.2)
|
23
|
+
git (1.2.5)
|
24
|
+
highline (1.6.1)
|
25
|
+
jeweler (1.4.0)
|
26
|
+
gemcutter (>= 0.1.0)
|
27
|
+
git (>= 1.2.5)
|
28
|
+
rubyforge (>= 2.0.0)
|
29
|
+
json_pure (1.4.3)
|
30
|
+
net-scp (1.0.2)
|
31
|
+
net-ssh (>= 1.99.1)
|
32
|
+
net-sftp (2.0.4)
|
33
|
+
net-ssh (>= 2.0.9)
|
34
|
+
net-ssh (2.0.23)
|
35
|
+
net-ssh-gateway (1.0.1)
|
36
|
+
net-ssh (>= 1.99.1)
|
37
|
+
rake (0.8.7)
|
38
|
+
rspec (2.0.0.beta.19)
|
39
|
+
rspec-core (= 2.0.0.beta.19)
|
40
|
+
rspec-expectations (= 2.0.0.beta.19)
|
41
|
+
rspec-mocks (= 2.0.0.beta.19)
|
42
|
+
rspec-core (2.0.0.beta.19)
|
43
|
+
rspec-expectations (2.0.0.beta.19)
|
44
|
+
diff-lcs (>= 1.1.2)
|
45
|
+
rspec-mocks (2.0.0.beta.19)
|
46
|
+
rubyforge (2.0.4)
|
47
|
+
json_pure (>= 1.1.7)
|
48
|
+
term-ansicolor (1.0.5)
|
49
|
+
trollop (1.16.2)
|
50
|
+
|
51
|
+
PLATFORMS
|
52
|
+
ruby
|
53
|
+
|
54
|
+
DEPENDENCIES
|
55
|
+
capistrano (= 2.5.18)
|
56
|
+
capistrano-ext (= 1.2.1)
|
57
|
+
cucumber (= 0.8.5)
|
58
|
+
jeweler (= 1.4.0)
|
59
|
+
rake (= 0.8.7)
|
60
|
+
rspec (= 2.0.0.beta.19)
|
data/README.md
CHANGED
@@ -24,31 +24,56 @@ You can use the `autotag` command to tag releases on your CI box, then use the c
|
|
24
24
|
|
25
25
|
## The autotag executable
|
26
26
|
|
27
|
-
Installing the gem creates an executable file named autotag, which takes
|
28
|
-
|
29
|
-
$ autotag demo # => creates a tag like demo/200804041234 in the current directory
|
30
|
-
$ autotag demo . # => same as above
|
31
|
-
$ autotag demo /Users/me/foo # => cd's to /Users/me/foo before creating the tag
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
$ git fetch origin
|
36
|
-
$ git
|
37
|
-
$ git push origin
|
27
|
+
Installing the gem creates an executable file named autotag, which takes the stage, optionally the path to the git repo, and options:
|
28
|
+
|
29
|
+
$ autotag create demo # => creates a tag like demo/200804041234 in the current directory
|
30
|
+
$ autotag create demo . # => same as above
|
31
|
+
$ autotag create demo /Users/me/foo # => cd's to /Users/me/foo before creating the tag
|
32
|
+
|
33
|
+
By default, running autotag does the following:
|
34
|
+
|
35
|
+
$ git fetch origin refs/tags/*:refs/tags/*
|
36
|
+
$ git update-ref refs/tags/demo/20100910051459 1242b283208d06661b2a916097c41c046510af68
|
37
|
+
$ git push origin refs/tags/*:refs/tags/*
|
38
|
+
|
39
|
+
The autotag executable has the following commands:
|
40
|
+
|
41
|
+
help
|
42
|
+
version
|
43
|
+
create STAGE
|
44
|
+
list STAGE
|
45
|
+
cleanup STAGE
|
46
|
+
delete_locally STAGE
|
47
|
+
delete_on_remote STAGE
|
48
|
+
|
49
|
+
The autotag executable accepts the following options:
|
50
|
+
|
51
|
+
--date-separator - the character used to separate parts of the timestamp
|
52
|
+
--fetch-refs - whether to fetch refs before creating or listing them
|
53
|
+
--push-refs - whether to push refs after creating them
|
54
|
+
--remote - specify a custom remote (defaults to "origin")
|
55
|
+
--ref-path - use a different ref directory, other than "tags"
|
56
|
+
--stages - specify all of the stages
|
57
|
+
--offline - don't push or fetch refs (is ignored with delete_on_remote command)
|
58
|
+
--dry-run - don't execute anything, but print the commands
|
59
|
+
--verbose - prints all commands as they run
|
60
|
+
--refs-to-keep - when using any clean commans, specify how many refs to keep
|
61
|
+
--executable - specify the full path to the git executable
|
62
|
+
--opts-file - the location of a custom options file
|
38
63
|
|
39
64
|
## Capistrano Integration
|
40
65
|
|
41
66
|
AutoTagger comes with 2 capistrano tasks:
|
42
67
|
|
43
|
-
* `
|
44
|
-
* `
|
68
|
+
* `auto_tagger:set_branch` tries to set the branch to the last tag from the previous environment.
|
69
|
+
* `auto_tagger:create_ref` runs autotag for the current stage
|
45
70
|
|
46
71
|
Example `config/deploy.rb` file:
|
47
72
|
|
48
|
-
require '
|
73
|
+
require 'auto_tagger/recipes'
|
49
74
|
|
50
|
-
# The :
|
51
|
-
set :
|
75
|
+
# The :auto_tagger_stages variable is required
|
76
|
+
set :auto_tagger_stages, [:ci, :staging, :production]
|
52
77
|
|
53
78
|
# The :working_directory variable is optional, and defaults to Dir.pwd
|
54
79
|
# :working_directory can be an absolute or relative path
|
@@ -56,32 +81,47 @@ Example `config/deploy.rb` file:
|
|
56
81
|
|
57
82
|
task :production do
|
58
83
|
# In each of your environments that need auto-branch setting, you need to set :stage
|
59
|
-
set :
|
84
|
+
set :auto_tagger_stage, :production
|
60
85
|
end
|
61
86
|
|
62
87
|
task :staging do
|
63
88
|
# If you do not set stage, it will not auto-set your branch
|
64
|
-
# set :
|
89
|
+
# set :auto_tagger_stage, :staging
|
65
90
|
end
|
66
91
|
|
67
92
|
# You need to add the before/ater callbacks yourself
|
68
|
-
before "deploy:update_code", "
|
69
|
-
after "deploy", "
|
70
|
-
after "deploy", "
|
71
|
-
after "deploy", "
|
93
|
+
before "deploy:update_code", "auto_tagger:set_branch"
|
94
|
+
after "deploy", "auto_tagger:create_ref"
|
95
|
+
after "deploy", "auto_tagger:write_tag_to_shared"
|
96
|
+
after "deploy", "auto_tagger:print_latest_refs"
|
72
97
|
|
73
|
-
###
|
98
|
+
### Capistano-ext multistage support
|
74
99
|
|
75
100
|
If you use capistano-ext multistage, you can use auto_tagger.
|
76
101
|
|
77
|
-
set :
|
102
|
+
set :auto_tagger_stages, [:ci, :staging, :production]
|
78
103
|
set :stages, [:staging, :production]
|
79
104
|
set :default_stage, :staging
|
80
105
|
require 'capistrano/ext/multistage'
|
81
106
|
|
82
|
-
When you deploy,
|
107
|
+
When you deploy, auto_tagger will auto-detect your current stage.
|
108
|
+
|
109
|
+
You can specify the following capistrano variables that correspond to the autotag options:
|
110
|
+
|
111
|
+
:auto_tagger_date_separator
|
112
|
+
:auto_tagger_push_refs
|
113
|
+
:auto_tagger_fetch_refs
|
114
|
+
:auto_tagger_remote
|
115
|
+
:auto_tagger_ref_path
|
116
|
+
:auto_tagger_offline
|
117
|
+
:auto_tagger_dry_run
|
118
|
+
:auto_tagger_verbose
|
119
|
+
:auto_tagger_refs_to_keep
|
120
|
+
:auto_tagger_executable
|
121
|
+
:auto_tagger_opts_file
|
122
|
+
:auto_tagger_working_directory
|
83
123
|
|
84
|
-
###
|
124
|
+
### auto_tagger:set_branch
|
85
125
|
|
86
126
|
This task sets the git branch to the latest tag from the previous stage. Assume you have the following tags in your git repository:
|
87
127
|
|
@@ -91,7 +131,7 @@ This task sets the git branch to the latest tag from the previous stage. Assume
|
|
91
131
|
|
92
132
|
And the following stages in your capistrano file:
|
93
133
|
|
94
|
-
set :
|
134
|
+
set :auto_tagger_stages, [:ci, :staging, :production]
|
95
135
|
|
96
136
|
The deployments would look like this:
|
97
137
|
|
@@ -109,29 +149,29 @@ If you add `before "deploy:update_code", "release_tagger:set_branch"`, you can j
|
|
109
149
|
|
110
150
|
and the branch will be set for you automatically.
|
111
151
|
|
112
|
-
### release_tagger:
|
152
|
+
### release_tagger:create_ref
|
113
153
|
|
114
154
|
This cap task creates a new tag, based on the latest tag from the previous environment.
|
115
155
|
|
116
156
|
If there is no tag from the previous stage, it creates a new tag from the latest commit in your _working directory_.
|
117
157
|
|
118
|
-
If you don't specify any `
|
158
|
+
If you don't specify any `auto_tagger_stages`, auto_tagger will create a tag that starts with "production".
|
119
159
|
|
120
|
-
### release_tagger:
|
160
|
+
### release_tagger:print_latest_refs
|
121
161
|
|
122
162
|
This task reads the git version from the text file in shared:
|
123
163
|
|
124
164
|
cap staging release_tagger:read_tag_from_shared
|
125
165
|
|
126
|
-
### release_tagger:
|
166
|
+
### release_tagger:print_latest_refs
|
127
167
|
|
128
168
|
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:
|
129
169
|
|
130
|
-
after "deploy", "release_tagger:
|
170
|
+
after "deploy", "release_tagger:print_latest_refs"
|
131
171
|
|
132
172
|
Or call it directly, like:
|
133
173
|
|
134
|
-
cap production release_tagger:
|
174
|
+
cap production release_tagger:print_latest_refs
|
135
175
|
|
136
176
|
This will produce output like:
|
137
177
|
|
@@ -140,6 +180,14 @@ This will produce output like:
|
|
140
180
|
** staging staging/20090331050908 8031807feb5f4f99dd83257cdc07081fa6080cba some commit message
|
141
181
|
** production production/20090331050917 8031807feb5f4f99dd83257cdc07081fa6080cba some commit message
|
142
182
|
|
183
|
+
## Configuration
|
184
|
+
|
185
|
+
You can store options in an options file, which is .auto_tagger by default. You can set options in this file like so:
|
186
|
+
|
187
|
+
--date-separator=-
|
188
|
+
--ref-path=autotags
|
189
|
+
--refs-to-keep=5
|
190
|
+
|
143
191
|
## Running tests:
|
144
192
|
|
145
193
|
You must be able to ssh into your box via localhost (remote login). To make this easier, add your own key to your own account:
|
@@ -152,13 +200,18 @@ To ensure that this has worked, try this:
|
|
152
200
|
|
153
201
|
If it asks you for a password, you've done something wrong.
|
154
202
|
|
155
|
-
To run the specs,
|
203
|
+
To run the specs, first make sure you have the required gems:
|
204
|
+
|
205
|
+
gem install bundler
|
206
|
+
bundle install
|
207
|
+
|
208
|
+
Then execute:
|
156
209
|
|
157
|
-
|
210
|
+
rspec spec
|
158
211
|
|
159
212
|
To run the cucumber features, execute:
|
160
213
|
|
161
|
-
cucumber features
|
214
|
+
cucumber features
|
162
215
|
|
163
216
|
## Acknowledgments
|
164
217
|
|
@@ -169,6 +222,7 @@ Special thanks to:
|
|
169
222
|
* Chad Wooley for his feature ideas
|
170
223
|
* Tim Holahan for his QA
|
171
224
|
* Pat Nakajima for making auto_tagger a better ruby citizen
|
225
|
+
* Josh Susser for recommending the date format changes
|
172
226
|
|
173
227
|
## Links
|
174
228
|
|
data/Rakefile
CHANGED
@@ -13,34 +13,9 @@ begin
|
|
13
13
|
gem.require_paths = ["lib"]
|
14
14
|
gem.executables = ["autotag"]
|
15
15
|
gem.default_executable = %q{autotag}
|
16
|
-
gem.date = %q{2010-
|
16
|
+
gem.date = %q{2010-09-10}
|
17
17
|
end
|
18
18
|
Jeweler::GemcutterTasks.new
|
19
19
|
rescue LoadError
|
20
20
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
21
21
|
end
|
22
|
-
|
23
|
-
require 'spec/rake/spectask'
|
24
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
-
end
|
28
|
-
|
29
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
task :default => :spec
|
37
|
-
|
38
|
-
require 'rake/rdoctask'
|
39
|
-
Rake::RDocTask.new do |rdoc|
|
40
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
-
|
42
|
-
rdoc.rdoc_dir = 'rdoc'
|
43
|
-
rdoc.title = "the-perfect-gem #{version}"
|
44
|
-
rdoc.rdoc_files.include('README*')
|
45
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
-
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
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.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeff Dean", "Brian Takita", "Mike Grafton", "Bruce Krysiak", "Pat Nakajima", "Jay Zeschin", "Mike Barinek", "Sarah Mei"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-10}
|
13
13
|
s.default_executable = %q{autotag}
|
14
14
|
s.email = %q{jeff@zilkey.com}
|
15
15
|
s.executables = ["autotag"]
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
".gitignore",
|
22
22
|
"CHANGELOG",
|
23
23
|
"Gemfile",
|
24
|
+
"Gemfile.lock",
|
24
25
|
"MIT-LICENSE",
|
25
26
|
"README.md",
|
26
27
|
"Rakefile",
|
@@ -36,35 +37,44 @@ Gem::Specification.new do |s|
|
|
36
37
|
"features/templates/cap_ext_deploy.erb",
|
37
38
|
"features/templates/deploy.erb",
|
38
39
|
"features/templates/stage.erb",
|
39
|
-
"geminstaller.yml",
|
40
40
|
"lib/auto_tagger.rb",
|
41
41
|
"lib/auto_tagger/base.rb",
|
42
42
|
"lib/auto_tagger/capistrano_helper.rb",
|
43
|
+
"lib/auto_tagger/command_line.rb",
|
43
44
|
"lib/auto_tagger/commander.rb",
|
45
|
+
"lib/auto_tagger/configuration.rb",
|
46
|
+
"lib/auto_tagger/deprecator.rb",
|
47
|
+
"lib/auto_tagger/git/ref.rb",
|
48
|
+
"lib/auto_tagger/git/ref_set.rb",
|
49
|
+
"lib/auto_tagger/git/repo.rb",
|
50
|
+
"lib/auto_tagger/options.rb",
|
44
51
|
"lib/auto_tagger/recipes.rb",
|
45
|
-
"lib/auto_tagger/repository.rb",
|
46
|
-
"lib/auto_tagger/stage_manager.rb",
|
47
|
-
"lib/auto_tagger/tag.rb",
|
48
52
|
"spec/auto_tagger/base_spec.rb",
|
49
53
|
"spec/auto_tagger/capistrano_helper_spec.rb",
|
54
|
+
"spec/auto_tagger/command_line_spec.rb",
|
50
55
|
"spec/auto_tagger/commander_spec.rb",
|
51
|
-
"spec/auto_tagger/
|
52
|
-
"spec/auto_tagger/
|
53
|
-
"spec/auto_tagger/
|
56
|
+
"spec/auto_tagger/configuration_spec.rb",
|
57
|
+
"spec/auto_tagger/git/ref_set_spec.rb",
|
58
|
+
"spec/auto_tagger/git/ref_spec.rb",
|
59
|
+
"spec/auto_tagger/git/repo_spec.rb",
|
60
|
+
"spec/auto_tagger/options_spec.rb",
|
54
61
|
"spec/spec_helper.rb"
|
55
62
|
]
|
56
63
|
s.homepage = %q{http://github.com/zilkey/auto_tagger}
|
57
64
|
s.rdoc_options = ["--charset=UTF-8"]
|
58
65
|
s.require_paths = ["lib"]
|
59
|
-
s.rubygems_version = %q{1.3.
|
66
|
+
s.rubygems_version = %q{1.3.7}
|
60
67
|
s.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}
|
61
68
|
s.test_files = [
|
62
69
|
"spec/auto_tagger/base_spec.rb",
|
63
70
|
"spec/auto_tagger/capistrano_helper_spec.rb",
|
71
|
+
"spec/auto_tagger/command_line_spec.rb",
|
64
72
|
"spec/auto_tagger/commander_spec.rb",
|
65
|
-
"spec/auto_tagger/
|
66
|
-
"spec/auto_tagger/
|
67
|
-
"spec/auto_tagger/
|
73
|
+
"spec/auto_tagger/configuration_spec.rb",
|
74
|
+
"spec/auto_tagger/git/ref_set_spec.rb",
|
75
|
+
"spec/auto_tagger/git/ref_spec.rb",
|
76
|
+
"spec/auto_tagger/git/repo_spec.rb",
|
77
|
+
"spec/auto_tagger/options_spec.rb",
|
68
78
|
"spec/spec_helper.rb"
|
69
79
|
]
|
70
80
|
|
@@ -72,7 +82,7 @@ Gem::Specification.new do |s|
|
|
72
82
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
73
83
|
s.specification_version = 3
|
74
84
|
|
75
|
-
if Gem::Version.new(Gem::
|
85
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
76
86
|
s.add_runtime_dependency(%q<capistrano>, [">= 2.5.3"])
|
77
87
|
else
|
78
88
|
s.add_dependency(%q<capistrano>, [">= 2.5.3"])
|
data/bin/autotag
CHANGED
@@ -1,35 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "auto_tagger"))
|
3
|
-
require 'getoptlong'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
puts ' repository sets the repository to act on - defualts to the current directory'
|
11
|
-
puts
|
12
|
-
puts ' examples: autotag'
|
13
|
-
puts ' autotag .'
|
14
|
-
puts ' autotag ../'
|
15
|
-
puts ' autotag /data/myrepo'
|
16
|
-
puts ' autotag demo'
|
17
|
-
puts
|
18
|
-
puts
|
19
|
-
exit 0
|
20
|
-
end
|
21
|
-
|
22
|
-
if ARGV[0] && ["-h", "--help", "-?", "--?"].include?(ARGV[0])
|
23
|
-
usage
|
24
|
-
elsif ARGV[0]
|
25
|
-
begin
|
26
|
-
AutoTagger::Runner.new(ARGV[0], ARGV[1]).create_tag
|
27
|
-
rescue Exception => e
|
28
|
-
puts "Error occured: #{e}"
|
29
|
-
exit 1
|
4
|
+
begin
|
5
|
+
success, message = AutoTagger::CommandLine.new(ARGV.dup).execute
|
6
|
+
if success
|
7
|
+
puts message
|
8
|
+
Kernel.exit 0
|
30
9
|
else
|
31
|
-
|
10
|
+
puts "Error occured: #{message}"
|
11
|
+
Kernel.exit 1
|
32
12
|
end
|
33
|
-
|
34
|
-
|
13
|
+
rescue SystemExit => e
|
14
|
+
Kernel.exit(e.status)
|
15
|
+
rescue Exception => e
|
16
|
+
STDERR.puts("Error occured:")
|
17
|
+
STDERR.puts(" #{e.message} (#{e.class})")
|
18
|
+
STDERR.puts(e.backtrace.join("\n "))
|
19
|
+
Kernel.exit(1)
|
35
20
|
end
|
data/features/autotag.feature
CHANGED
@@ -9,7 +9,7 @@ Feature: Deployment
|
|
9
9
|
And I should see "USAGE:"
|
10
10
|
And no tags should be created
|
11
11
|
And exit code should be 0
|
12
|
-
|
12
|
+
|
13
13
|
Scenario: user runs autotag with "--help"
|
14
14
|
Given a repo
|
15
15
|
When I run autotag with "--help"
|
@@ -31,21 +31,62 @@ Feature: Deployment
|
|
31
31
|
And no tags should be created
|
32
32
|
And exit code should be 0
|
33
33
|
|
34
|
+
@deprecated
|
34
35
|
Scenario: user runs autotag with "demo"
|
35
36
|
Given a repo
|
36
37
|
When I run autotag with "demo"
|
37
38
|
Then a "demo" tag should be created
|
38
39
|
And exit code should be 0
|
39
40
|
|
41
|
+
@deprecated
|
40
42
|
Scenario: user runs autotag with "demo ."
|
41
43
|
Given a repo
|
42
44
|
When I run autotag with "demo"
|
43
45
|
Then a "demo" tag should be created
|
44
46
|
And exit code should be 0
|
45
47
|
|
48
|
+
@deprecated
|
46
49
|
Scenario: autotag cannot successfully complete
|
47
50
|
Given a repo
|
48
51
|
When I run autotag with "demo /no/such/path"
|
49
52
|
Then I should see "Error occured:"
|
50
53
|
And exit code should be 1
|
51
|
-
And no tags should be created
|
54
|
+
And no tags should be created
|
55
|
+
|
56
|
+
@deprecated
|
57
|
+
Scenario: path is incorrect
|
58
|
+
Given a repo
|
59
|
+
When I run autotag with "create demo /no/such/path"
|
60
|
+
Then I should see "Error occured:"
|
61
|
+
And exit code should be 1
|
62
|
+
And no tags should be created
|
63
|
+
|
64
|
+
@1.0.0
|
65
|
+
Scenario: user runs autotag with "help"
|
66
|
+
Given a repo
|
67
|
+
When I run autotag with "help"
|
68
|
+
And I should see "USAGE:"
|
69
|
+
And no tags should be created
|
70
|
+
And the exit code should be 0
|
71
|
+
|
72
|
+
@1.0.0
|
73
|
+
Scenario: user runs autotag with "version"
|
74
|
+
Given a repo
|
75
|
+
When I run autotag with "version"
|
76
|
+
And I should see "AutoTagger version"
|
77
|
+
And no tags should be created
|
78
|
+
And the exit code should be 0
|
79
|
+
|
80
|
+
@1.0.0
|
81
|
+
Scenario: user runs autotag with "create demo . --date-separator -"
|
82
|
+
Given a repo
|
83
|
+
When I run autotag with "create demo --date-separator -"
|
84
|
+
Then a hyphen-delimited "demo" tag should be created
|
85
|
+
And the exit code should be 0
|
86
|
+
|
87
|
+
@1.0.0
|
88
|
+
Scenario: user runs autotag with "cleanup" with no stage
|
89
|
+
Given a repo
|
90
|
+
When I run autotag with "cleanup"
|
91
|
+
Then I should see "Error occured: You must provide a stage"
|
92
|
+
And the exit code should be 1
|
data/features/deployment.feature
CHANGED
@@ -3,18 +3,21 @@ Feature: Deployment
|
|
3
3
|
As a ruby and git ninja
|
4
4
|
I want cap to do all the work for me
|
5
5
|
|
6
|
+
@0.1.5
|
6
7
|
Scenario: user deploys with single file deploy.rb with 3 stages
|
7
8
|
Given a three-stage app using single deploy file
|
8
9
|
And a ci tag
|
9
10
|
When I deploy to staging
|
10
11
|
Then a tag should be added to git
|
11
12
|
|
13
|
+
@0.1.5
|
12
14
|
Scenario: user deploys with single file deploy.rb with no stages
|
13
15
|
Given a one-stage app using single deploy file with the following environments:
|
14
16
|
|production |
|
15
17
|
When I deploy
|
16
18
|
Then a "production" tag should be added to git
|
17
19
|
|
20
|
+
@0.1.5
|
18
21
|
Scenario: user deploys with single file deploy.rb stages with dashes in the name
|
19
22
|
Given a one-stage app using single deploy file with the following environments:
|
20
23
|
|staging |
|
@@ -22,6 +25,7 @@ Feature: Deployment
|
|
22
25
|
When I deploy to secret-production
|
23
26
|
Then a "secret-production" tag should be added to git
|
24
27
|
|
28
|
+
@0.1.5
|
25
29
|
Scenario: user deploys with cap-ext multistage
|
26
30
|
Given a three-stage app using cap-multistage
|
27
31
|
And a ci tag
|