auto_tagger 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 2011-09-15
2
+ - Fixed broken gemspec that mistakenly included all development dependencies as live dependencies
3
+ - Removed dependency on jeweler for creating the gemspec
4
+
5
+ 2011-09-14
6
+ - Order the tags from the previous stage such that you can use auto-incrementing build numbers for refs (thanks Rachel Heaton, Oren Weichselbaum!)
7
+
1
8
  2010-11-16
2
9
  - Setting :auto_tagger_stage or :stage should tag the specified ref (Dave Yeu)
3
10
 
@@ -6,7 +13,7 @@
6
13
 
7
14
  2010-09-16
8
15
  - fixed bug where capistrano task set_branch would not set the proper branch
9
- - fixed bug where capistratno task print_latest_tags would blow up (thanks to Ian Zabel for help in debugging)
16
+ - fixed bug where capistrano task print_latest_tags would blow up (thanks to Ian Zabel for help in debugging)
10
17
  - fixed bug where capistrano would not write the text file to the server if an explicit branch was not set
11
18
  - fixed bug where passing -v to autotag would show the help, not the version
12
19
 
@@ -1,9 +1,5 @@
1
1
  module AutoTagger
2
2
 
3
- def self.version
4
- File.read(File.expand_path(File.join(__FILE__, "/../../../VERSION")))
5
- end
6
-
7
3
  class Base
8
4
  class StageCannotBeBlankError < StandardError;
9
5
  end
@@ -164,4 +160,4 @@ module AutoTagger
164
160
  raise StageCannotBeBlankError if configuration.stage.to_s.strip == ""
165
161
  end
166
162
  end
167
- end
163
+ end
@@ -8,7 +8,7 @@ module AutoTagger
8
8
  def execute
9
9
  case options[:command]
10
10
  when :version
11
- [true, "AutoTagger version #{AutoTagger.version}"]
11
+ [true, "AutoTagger version #{AutoTagger::VERSION}"]
12
12
  when :help
13
13
  [true, options[:help_text]]
14
14
  when :cleanup
@@ -62,4 +62,4 @@ module AutoTagger
62
62
  end
63
63
 
64
64
  end
65
- end
65
+ end
@@ -0,0 +1,3 @@
1
+ module AutoTagger
2
+ VERSION = "0.2.5"
3
+ end
data/lib/auto_tagger.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'optparse'
2
2
  [
3
+ 'version',
3
4
  'deprecator',
4
5
  'git/ref',
5
6
  'git/ref_set',
@@ -6,7 +6,7 @@ describe AutoTagger::CommandLine do
6
6
  it "runs the version command" do
7
7
  command_line = AutoTagger::CommandLine.new ["version"]
8
8
  command_line.execute.first.should be_true
9
- command_line.execute.last.should include(AutoTagger.version)
9
+ command_line.execute.last.should include(AutoTagger::VERSION)
10
10
  end
11
11
 
12
12
  it "runs the help command" do
@@ -107,4 +107,4 @@ describe AutoTagger::CommandLine do
107
107
 
108
108
  end
109
109
 
110
- end
110
+ end
metadata CHANGED
@@ -1,15 +1,10 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: auto_tagger
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 4
10
- version: 0.2.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeff Dean
14
9
  - Brian Takita
15
10
  - Mike Grafton
@@ -20,156 +15,34 @@ authors:
20
15
  - Sarah Mei
21
16
  - Mike Dalessio
22
17
  - Dave Yeu
18
+ - Rachel Heaton
19
+ - Oren Weichselbaum
23
20
  autorequire:
24
21
  bindir: bin
25
22
  cert_chain: []
26
-
27
- date: 2010-09-10 00:00:00 Z
28
- dependencies:
29
- - !ruby/object:Gem::Dependency
30
- requirement: &id001 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - "="
34
- - !ruby/object:Gem::Version
35
- hash: 49
36
- segments:
37
- - 0
38
- - 8
39
- - 7
40
- version: 0.8.7
41
- version_requirements: *id001
42
- name: rake
43
- prerelease: false
44
- type: :runtime
45
- - !ruby/object:Gem::Dependency
46
- requirement: &id002 !ruby/object:Gem::Requirement
47
- none: false
48
- requirements:
49
- - - "="
50
- - !ruby/object:Gem::Version
51
- hash: 62196421
52
- segments:
53
- - 2
54
- - 0
55
- - 0
56
- - beta
57
- - 19
58
- version: 2.0.0.beta.19
59
- version_requirements: *id002
60
- name: rspec
61
- prerelease: false
62
- type: :runtime
63
- - !ruby/object:Gem::Dependency
64
- requirement: &id003 !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - "="
68
- - !ruby/object:Gem::Version
69
- hash: 53
70
- segments:
71
- - 0
72
- - 8
73
- - 5
74
- version: 0.8.5
75
- version_requirements: *id003
76
- name: cucumber
77
- prerelease: false
78
- type: :runtime
79
- - !ruby/object:Gem::Dependency
80
- requirement: &id004 !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - "="
84
- - !ruby/object:Gem::Version
85
- hash: 63
86
- segments:
87
- - 2
88
- - 5
89
- - 18
90
- version: 2.5.18
91
- version_requirements: *id004
23
+ date: 2011-09-15 00:00:00.000000000 -06:00
24
+ default_executable: autotag
25
+ dependencies:
26
+ - !ruby/object:Gem::Dependency
92
27
  name: capistrano
93
- prerelease: false
94
- type: :runtime
95
- - !ruby/object:Gem::Dependency
96
- requirement: &id005 !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - "="
100
- - !ruby/object:Gem::Version
101
- hash: 29
102
- segments:
103
- - 1
104
- - 2
105
- - 1
106
- version: 1.2.1
107
- version_requirements: *id005
108
- name: capistrano-ext
109
- prerelease: false
110
- type: :runtime
111
- - !ruby/object:Gem::Dependency
112
- requirement: &id006 !ruby/object:Gem::Requirement
28
+ requirement: &2153208460 !ruby/object:Gem::Requirement
113
29
  none: false
114
- requirements:
115
- - - "="
116
- - !ruby/object:Gem::Version
117
- hash: 7
118
- segments:
119
- - 1
120
- - 4
121
- - 0
122
- version: 1.4.0
123
- version_requirements: *id006
124
- name: jeweler
125
- prerelease: false
126
- type: :runtime
127
- - !ruby/object:Gem::Dependency
128
- requirement: &id007 !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- hash: 29
134
- segments:
135
- - 2
136
- - 5
137
- - 3
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
138
33
  version: 2.5.3
139
- version_requirements: *id007
140
- name: capistrano
141
- prerelease: false
142
34
  type: :runtime
35
+ prerelease: false
36
+ version_requirements: *2153208460
143
37
  description:
144
38
  email: jeff@zilkey.com
145
- executables:
39
+ executables:
146
40
  - autotag
147
41
  extensions: []
148
-
149
- extra_rdoc_files:
150
- - README.md
151
- files:
152
- - .document
153
- - CHANGELOG
154
- - Gemfile
155
- - Gemfile.lock
156
- - MIT-LICENSE
42
+ extra_rdoc_files:
157
43
  - README.md
158
- - Rakefile
159
- - VERSION
160
- - auto_tagger.gemspec
44
+ files:
161
45
  - bin/autotag
162
- - features/autotag.feature
163
- - features/deployment.feature
164
- - features/step_definitions/autotag_steps.rb
165
- - features/step_definitions/deployment_steps.rb
166
- - features/step_definitions/shared_steps.rb
167
- - features/support/env.rb
168
- - features/support/step_helpers.rb
169
- - features/templates/cap_ext_deploy.erb
170
- - features/templates/deploy.erb
171
- - features/templates/stage.erb
172
- - lib/auto_tagger.rb
173
46
  - lib/auto_tagger/base.rb
174
47
  - lib/auto_tagger/capistrano_helper.rb
175
48
  - lib/auto_tagger/command_line.rb
@@ -181,6 +54,11 @@ files:
181
54
  - lib/auto_tagger/git/repo.rb
182
55
  - lib/auto_tagger/options.rb
183
56
  - lib/auto_tagger/recipes.rb
57
+ - lib/auto_tagger/version.rb
58
+ - lib/auto_tagger.rb
59
+ - MIT-LICENSE
60
+ - README.md
61
+ - CHANGELOG
184
62
  - spec/auto_tagger/base_spec.rb
185
63
  - spec/auto_tagger/capistrano_helper_spec.rb
186
64
  - spec/auto_tagger/command_line_spec.rb
@@ -192,40 +70,34 @@ files:
192
70
  - spec/auto_tagger/options_spec.rb
193
71
  - spec/auto_tagger/recipes_spec.rb
194
72
  - spec/spec_helper.rb
73
+ has_rdoc: true
195
74
  homepage: http://github.com/zilkey/auto_tagger
196
75
  licenses: []
197
-
198
76
  post_install_message:
199
- rdoc_options: []
200
-
201
- require_paths:
77
+ rdoc_options:
78
+ - --charset=UTF-8
79
+ require_paths:
202
80
  - lib
203
- required_ruby_version: !ruby/object:Gem::Requirement
81
+ required_ruby_version: !ruby/object:Gem::Requirement
204
82
  none: false
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- hash: 3
209
- segments:
210
- - 0
211
- version: "0"
212
- required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
213
88
  none: false
214
- requirements:
215
- - - ">="
216
- - !ruby/object:Gem::Version
217
- hash: 3
218
- segments:
219
- - 0
220
- version: "0"
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
221
93
  requirements: []
222
-
223
94
  rubyforge_project:
224
- rubygems_version: 1.8.8
95
+ rubygems_version: 1.6.2
225
96
  signing_key:
226
97
  specification_version: 3
227
- summary: Helps you automatically create tags for each stage in a multi-stage deploment and deploy from the latest tag from the previous environment
228
- test_files:
98
+ summary: Helps you automatically create tags for each stage in a multi-stage deploment
99
+ and deploy from the latest tag from the previous environment
100
+ test_files:
229
101
  - spec/auto_tagger/base_spec.rb
230
102
  - spec/auto_tagger/capistrano_helper_spec.rb
231
103
  - spec/auto_tagger/command_line_spec.rb
data/.document DELETED
@@ -1,6 +0,0 @@
1
- README.md
2
- CHANGELOG
3
- MIT-LICENSE
4
- bin/*
5
- lib/**/*
6
- recipes/**/*
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source :gemcutter
2
-
3
- gem "rake", "0.8.7"
4
- gem "rspec", "2.0.0.beta.19"
5
- gem "cucumber", "0.8.5"
6
- gem "capistrano", "2.5.18"
7
- gem "capistrano-ext", "1.2.1"
8
- gem "jeweler", "1.4.0"
data/Gemfile.lock DELETED
@@ -1,60 +0,0 @@
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/Rakefile DELETED
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "auto_tagger"
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
- gem.email = "jeff@zilkey.com"
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", "Mike Dalessio", "Dave Yeu"]
12
- gem.add_dependency('capistrano', [">= 2.5.3"])
13
- gem.require_paths = ["lib"]
14
- gem.executables = ["autotag"]
15
- gem.default_executable = %q{autotag}
16
- gem.date = %q{2010-09-10}
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
21
- end
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.4
data/auto_tagger.gemspec DELETED
@@ -1,111 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{auto_tagger}
8
- s.version = "0.2.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Jeff Dean}, %q{Brian Takita}, %q{Mike Grafton}, %q{Bruce Krysiak}, %q{Pat Nakajima}, %q{Jay Zeschin}, %q{Mike Barinek}, %q{Sarah Mei}, %q{Mike Dalessio}, %q{Dave Yeu}]
12
- s.date = %q{2010-09-10}
13
- s.email = %q{jeff@zilkey.com}
14
- s.executables = [%q{autotag}]
15
- s.extra_rdoc_files = [
16
- "README.md"
17
- ]
18
- s.files = [
19
- ".document",
20
- "CHANGELOG",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "MIT-LICENSE",
24
- "README.md",
25
- "Rakefile",
26
- "VERSION",
27
- "auto_tagger.gemspec",
28
- "bin/autotag",
29
- "features/autotag.feature",
30
- "features/deployment.feature",
31
- "features/step_definitions/autotag_steps.rb",
32
- "features/step_definitions/deployment_steps.rb",
33
- "features/step_definitions/shared_steps.rb",
34
- "features/support/env.rb",
35
- "features/support/step_helpers.rb",
36
- "features/templates/cap_ext_deploy.erb",
37
- "features/templates/deploy.erb",
38
- "features/templates/stage.erb",
39
- "lib/auto_tagger.rb",
40
- "lib/auto_tagger/base.rb",
41
- "lib/auto_tagger/capistrano_helper.rb",
42
- "lib/auto_tagger/command_line.rb",
43
- "lib/auto_tagger/commander.rb",
44
- "lib/auto_tagger/configuration.rb",
45
- "lib/auto_tagger/deprecator.rb",
46
- "lib/auto_tagger/git/ref.rb",
47
- "lib/auto_tagger/git/ref_set.rb",
48
- "lib/auto_tagger/git/repo.rb",
49
- "lib/auto_tagger/options.rb",
50
- "lib/auto_tagger/recipes.rb",
51
- "spec/auto_tagger/base_spec.rb",
52
- "spec/auto_tagger/capistrano_helper_spec.rb",
53
- "spec/auto_tagger/command_line_spec.rb",
54
- "spec/auto_tagger/commander_spec.rb",
55
- "spec/auto_tagger/configuration_spec.rb",
56
- "spec/auto_tagger/git/ref_set_spec.rb",
57
- "spec/auto_tagger/git/ref_spec.rb",
58
- "spec/auto_tagger/git/repo_spec.rb",
59
- "spec/auto_tagger/options_spec.rb",
60
- "spec/auto_tagger/recipes_spec.rb",
61
- "spec/spec_helper.rb"
62
- ]
63
- s.homepage = %q{http://github.com/zilkey/auto_tagger}
64
- s.require_paths = [%q{lib}]
65
- s.rubygems_version = %q{1.8.8}
66
- 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}
67
- s.test_files = [
68
- "spec/auto_tagger/base_spec.rb",
69
- "spec/auto_tagger/capistrano_helper_spec.rb",
70
- "spec/auto_tagger/command_line_spec.rb",
71
- "spec/auto_tagger/commander_spec.rb",
72
- "spec/auto_tagger/configuration_spec.rb",
73
- "spec/auto_tagger/git/ref_set_spec.rb",
74
- "spec/auto_tagger/git/ref_spec.rb",
75
- "spec/auto_tagger/git/repo_spec.rb",
76
- "spec/auto_tagger/options_spec.rb",
77
- "spec/auto_tagger/recipes_spec.rb",
78
- "spec/spec_helper.rb"
79
- ]
80
-
81
- if s.respond_to? :specification_version then
82
- s.specification_version = 3
83
-
84
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
85
- s.add_runtime_dependency(%q<rake>, ["= 0.8.7"])
86
- s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.19"])
87
- s.add_runtime_dependency(%q<cucumber>, ["= 0.8.5"])
88
- s.add_runtime_dependency(%q<capistrano>, ["= 2.5.18"])
89
- s.add_runtime_dependency(%q<capistrano-ext>, ["= 1.2.1"])
90
- s.add_runtime_dependency(%q<jeweler>, ["= 1.4.0"])
91
- s.add_runtime_dependency(%q<capistrano>, [">= 2.5.3"])
92
- else
93
- s.add_dependency(%q<rake>, ["= 0.8.7"])
94
- s.add_dependency(%q<rspec>, ["= 2.0.0.beta.19"])
95
- s.add_dependency(%q<cucumber>, ["= 0.8.5"])
96
- s.add_dependency(%q<capistrano>, ["= 2.5.18"])
97
- s.add_dependency(%q<capistrano-ext>, ["= 1.2.1"])
98
- s.add_dependency(%q<jeweler>, ["= 1.4.0"])
99
- s.add_dependency(%q<capistrano>, [">= 2.5.3"])
100
- end
101
- else
102
- s.add_dependency(%q<rake>, ["= 0.8.7"])
103
- s.add_dependency(%q<rspec>, ["= 2.0.0.beta.19"])
104
- s.add_dependency(%q<cucumber>, ["= 0.8.5"])
105
- s.add_dependency(%q<capistrano>, ["= 2.5.18"])
106
- s.add_dependency(%q<capistrano-ext>, ["= 1.2.1"])
107
- s.add_dependency(%q<jeweler>, ["= 1.4.0"])
108
- s.add_dependency(%q<capistrano>, [">= 2.5.3"])
109
- end
110
- end
111
-
@@ -1,92 +0,0 @@
1
- Feature: Deployment
2
- In order to get auto-tagging goodness on ci boxes
3
- As a ruby and git ninja
4
- I want to be able to easily create a tag from the command line with the same name format as the one created by the cap tasks
5
-
6
- Scenario: user runs autotag with no args
7
- Given a repo
8
- When I run autotag with no arguments
9
- And I should see "USAGE:"
10
- And no tags should be created
11
- And exit code should be 0
12
-
13
- Scenario: user runs autotag with "--help"
14
- Given a repo
15
- When I run autotag with "--help"
16
- And I should see "USAGE:"
17
- And no tags should be created
18
- And exit code should be 0
19
-
20
- Scenario: user runs autotag with "-h"
21
- Given a repo
22
- When I run autotag with "-h"
23
- And I should see "USAGE:"
24
- And no tags should be created
25
- And exit code should be 0
26
-
27
- Scenario: user runs autotag with "-?"
28
- Given a repo
29
- When I run autotag with "-?"
30
- And I should see "USAGE:"
31
- And no tags should be created
32
- And exit code should be 0
33
-
34
- @deprecated
35
- Scenario: user runs autotag with "demo"
36
- Given a repo
37
- When I run autotag with "demo"
38
- Then a "demo" tag should be created
39
- And exit code should be 0
40
-
41
- @deprecated
42
- Scenario: user runs autotag with "demo ."
43
- Given a repo
44
- When I run autotag with "demo"
45
- Then a "demo" tag should be created
46
- And exit code should be 0
47
-
48
- @deprecated
49
- Scenario: autotag cannot successfully complete
50
- Given a repo
51
- When I run autotag with "demo /no/such/path"
52
- Then I should see "Error occured:"
53
- And exit code should be 1
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
@@ -1,41 +0,0 @@
1
- Feature: Deployment
2
- In order to get auto-tagging goodness
3
- As a ruby and git ninja
4
- I want cap to do all the work for me
5
-
6
- @0.1.5
7
- Scenario: user deploys with single file deploy.rb with 3 stages
8
- Given a three-stage app using single deploy file
9
- And a ci tag
10
- When I deploy to staging
11
- Then a tag should be added to git
12
-
13
- @0.1.5
14
- Scenario: user deploys with single file deploy.rb with no stages
15
- Given a one-stage app using single deploy file with the following environments:
16
- |production |
17
- When I deploy
18
- Then a "production" tag should be added to git
19
- But I should not see "no branch available"
20
-
21
- @0.1.5
22
- Scenario: user deploys with single file deploy.rb stages with dashes in the name
23
- Given a one-stage app using single deploy file with the following environments:
24
- |staging |
25
- |secret-production |
26
- When I deploy to secret-production
27
- Then a "secret-production" tag should be added to git
28
-
29
- @0.1.5
30
- Scenario: user deploys with cap-ext multistage
31
- Given a three-stage app using cap-multistage
32
- And a ci tag
33
- When I deploy to staging
34
- Then a tag should be added to git
35
-
36
- @0.1.5
37
- Scenario: user sees latest tags
38
- Given a three-stage app using cap-multistage
39
- And a ci tag
40
- When I deploy to staging
41
- Then I should see "release tag history is:"
@@ -1,52 +0,0 @@
1
- Given /^a repo$/ do
2
- with_or_without_debugging do
3
- helpers = StepHelpers.new
4
- helpers.create_git_repo
5
- helpers.create_app
6
- @refs = helpers.refs
7
- end
8
- end
9
-
10
- When /^I run autotag with no arguments$/ do
11
- with_or_without_debugging do
12
- helpers = StepHelpers.new
13
- @output, @exit_code = helpers.run_autotag
14
- @refs = helpers.refs
15
- @exit_code = helpers.exit_code
16
- end
17
- end
18
-
19
- When /^I run autotag with "([^\"]*)"$/ do |args|
20
- with_or_without_debugging do
21
- helpers = StepHelpers.new
22
- @output = helpers.run_autotag(args)
23
- @refs = helpers.refs
24
- @exit_code = helpers.exit_code
25
- end
26
- end
27
-
28
- Then /^the exit code should be "(\d+)"$/ do |code|
29
- @exit_code.exitstatus.should == code.to_i
30
- end
31
-
32
- Then /^no tags should be created$/ do
33
- @refs.strip.should == ""
34
- end
35
-
36
- Then /^a "([^\"]*)" tag should be added to git$/ do |stage|
37
- helpers = StepHelpers.new
38
- helpers.refs.split("\n").last.should match(/\/#{stage}\//)
39
- end
40
-
41
- Then /^a "([^\"]*)" tag should be created$/ do |prefix|
42
- @refs.strip.split("\n").any? { |ref| ref =~ /\/demo\// }.should be_true
43
- end
44
-
45
- Then /^a hyphen-delimited "([^\"]*)" tag should be created$/ do |prefix|
46
- tag = @refs.strip.split("\n").detect { |ref| ref =~ /\/demo\// }
47
- tag.split(" ").last.split("/").last.split("-").first.should == Date.today.year.to_s
48
- end
49
-
50
- Then /^(?:the )?exit code should be (\d*)$/ do |exit_code|
51
- @exit_code.should == exit_code.to_i
52
- end
@@ -1,61 +0,0 @@
1
- Given /^a three-stage app using single deploy file$/ do
2
- with_or_without_debugging do
3
- helpers = StepHelpers.new
4
- helpers.create_app_with_single_deploy_file([:ci, :staging, :production])
5
- @refs = helpers.refs
6
- end
7
- end
8
-
9
- Given /^a one\-stage app using single deploy file with the following environments:$/ do |table|
10
- with_or_without_debugging do
11
- helpers = StepHelpers.new
12
- helpers.create_app_with_single_deploy_file table.raw.map{|item| item.first}
13
- @refs = helpers.refs
14
- end
15
- end
16
-
17
- Given /^a three-stage app using cap-multistage$/ do
18
- with_or_without_debugging do
19
- helpers = StepHelpers.new
20
- helpers.create_app_with_cap_ext_multistage
21
- @refs = helpers.refs
22
- end
23
- end
24
-
25
- Given /^an app with deploy file that uses the dsl$/ do
26
- with_or_without_debugging do
27
- helpers = StepHelpers.new
28
- helpers.create_app_with_dsl
29
- @refs = helpers.refs
30
- end
31
- end
32
-
33
- Given /^a ci tag$/ do
34
- with_or_without_debugging do
35
- helpers = StepHelpers.new
36
- helpers.autotag("ci")
37
- @refs = helpers.refs
38
- end
39
- end
40
-
41
- When /^I deploy to (.*)$/ do |environment|
42
- with_or_without_debugging do
43
- helpers = StepHelpers.new
44
- @output = helpers.deploy(environment)
45
- end
46
- end
47
-
48
- When /^I deploy$/ do
49
- with_or_without_debugging do
50
- helpers = StepHelpers.new
51
- @output = helpers.deploy
52
- end
53
- end
54
-
55
- Then /^a tag should be added to git$/ do
56
- with_or_without_debugging do
57
- helpers = StepHelpers.new
58
- new_tags = helpers.refs
59
- @refs.length.should < new_tags.length
60
- end
61
- end
@@ -1,8 +0,0 @@
1
- Then /^I should see "([^\"]*)"$/ do |text|
2
- @output.should =~ /#{Regexp.escape(text)}/
3
- end
4
-
5
- Then /^I should not see "([^\"]*)"$/ do |text|
6
- @output.should_not =~ /#{Regexp.escape(text)}/
7
- end
8
-
@@ -1,51 +0,0 @@
1
- require 'rspec'
2
- require 'erb'
3
- require 'etc'
4
-
5
- class String
6
- def starts_with?(prefix)
7
- self[0, prefix.length] == prefix
8
- end
9
- end
10
-
11
- module Silencers
12
-
13
- def with_or_without_debugging
14
- if ENV['AUTO_TAGGER_DEBUG'] == "true"
15
- puts
16
- yield
17
- puts
18
- else
19
- silence_stream(STDOUT) do
20
- silence_stream(STDERR) do
21
- silence_warnings do
22
- yield
23
- end
24
- end
25
- end
26
- end
27
- end
28
-
29
- def silence_stream(stream)
30
- old_stream = stream.dup
31
- stream.reopen(RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'NUL:' : '/dev/null')
32
- stream.sync = true
33
- yield
34
- ensure
35
- stream.reopen(old_stream)
36
- end
37
-
38
- def silence_warnings
39
- old_verbose, $VERBOSE = $VERBOSE, nil
40
- yield
41
- ensure
42
- $VERBOSE = old_verbose
43
- end
44
-
45
- end
46
-
47
- World(Silencers)
48
-
49
- Before do
50
- StepHelpers.new.reset
51
- end
@@ -1,163 +0,0 @@
1
- class StepHelpers
2
- attr_reader :test_files_dir, :app_dir, :repo_dir, :exit_code
3
-
4
- def initialize
5
- @test_files_dir = File.join(Dir.pwd, "test_files")
6
- @app_dir = File.join(test_files_dir, "app")
7
- @repo_dir = File.join(test_files_dir, "repo")
8
- end
9
-
10
- def reset
11
- FileUtils.rm_r(test_files_dir) if File.exists?(test_files_dir)
12
- FileUtils.mkdir_p(test_files_dir)
13
- end
14
-
15
- def create_git_repo
16
- FileUtils.mkdir_p repo_dir
17
- `cd #{repo_dir} && git --bare init`
18
- end
19
-
20
- def create_app_with_single_deploy_file(environments)
21
- create_git_repo
22
- create_app
23
- capify_app
24
- create_single_deploy_file(environments)
25
- end
26
-
27
- def create_app_with_dsl
28
- create_git_repo
29
- create_app
30
- capify_app
31
- create_dsl_deploy_file
32
- end
33
-
34
- def run_autotag(args = nil)
35
- cmd = "cd #{app_dir} && ../../bin/autotag"
36
- cmd += " #{args}" if args
37
- cmd += " 2>&1"
38
- output = `#{cmd}`
39
- puts output
40
- @exit_code = $?.exitstatus
41
- return output
42
- end
43
-
44
- def create_app_with_cap_ext_multistage
45
- create_git_repo
46
- create_app
47
- capify_app
48
- create_cap_ext_multistage_deploy_files
49
- end
50
-
51
- def deploy(stage = nil)
52
- deploy_command = "cap "
53
- deploy_command += "#{stage} " if stage
54
- deploy_command += "deploy"
55
-
56
- run_commands [
57
- "cd #{app_dir}",
58
- "cap deploy:setup",
59
- deploy_command
60
- ]
61
- end
62
-
63
- def autotag(stage)
64
- system "cd #{app_dir} && git tag #{stage}/#{Time.now.utc.strftime('%Y%m%d%H%M%S')} && git push origin --tags"
65
- end
66
-
67
- def refs(namespace = "tags")
68
- system "cd #{app_dir} && git fetch origin refs/#{namespace}/*:refs/#{namespace}/*"
69
- refs = `cd #{app_dir} && git show-ref | grep #{namespace}`
70
- puts refs
71
- refs
72
- end
73
-
74
- def create_app
75
- FileUtils.mkdir_p app_dir
76
- run_commands [
77
- "cd #{app_dir}",
78
- "touch README",
79
- "git init",
80
- "git add .",
81
- %Q{git commit -m "first commit"},
82
- "git remote add origin file://#{repo_dir}",
83
- "git push origin master"
84
- ]
85
- end
86
-
87
- private
88
-
89
- def capify_app
90
- run_commands [
91
- "cd #{app_dir}",
92
- "mkdir config",
93
- "capify ."
94
- ]
95
- end
96
-
97
- def create_single_deploy_file(environments)
98
-
99
- # ERB variables
100
- repository = repo_dir
101
- deploy_to = File.join(test_files_dir, "deployed")
102
- git_location = `which git`.strip
103
- user = Etc.getlogin
104
-
105
- path = File.expand_path(File.join(__FILE__, "..", "..", "templates", "deploy.erb"))
106
- template = ERB.new File.read(path)
107
- output = template.result(binding)
108
- File.open(File.join(app_dir, "config", "deploy.rb"), 'w') {|f| f.write(output) }
109
- end
110
-
111
- def create_dsl_deploy_file
112
-
113
- # ERB variables
114
- repository = repo_dir
115
- deploy_to = File.join(test_files_dir, "deployed")
116
- git_location = `which git`.strip
117
- user = Etc.getlogin
118
- environments = ["ci", "staging"]
119
-
120
- path = File.expand_path(File.join(__FILE__, "..", "..", "templates", "deploy_dsl.erb"))
121
- template = ERB.new File.read(path)
122
- output = template.result(binding)
123
-
124
- puts "#{__FILE__}:#{__LINE__}"
125
- p output
126
-
127
- File.open(File.join(app_dir, "config", "deploy.rb"), 'w') {|f| f.write(output) }
128
- end
129
-
130
- def create_cap_ext_multistage_deploy_files
131
-
132
- # ERB variables
133
- repository = repo_dir
134
- deploy_to = File.join(test_files_dir, "deployed")
135
- git_location = `which git`.strip
136
- user = Etc.getlogin
137
- environments = [:ci, :staging, :production]
138
-
139
- path = File.expand_path(File.join(__FILE__, "..", "..", "templates", "cap_ext_deploy.erb"))
140
- template = ERB.new File.read(path)
141
- output = template.result(binding)
142
- File.open(File.join(app_dir, "config", "deploy.rb"), 'w') {|f| f.write(output) }
143
- %w(staging production).each do |stage|
144
- create_cap_ext_multistage_deploy_stage_file(stage)
145
- end
146
- end
147
-
148
- def create_cap_ext_multistage_deploy_stage_file(stage)
149
- deploy_subdir = File.join(app_dir, "config", "deploy")
150
- FileUtils.mkdir_p deploy_subdir
151
- template_path = File.expand_path(File.join(__FILE__, "..", "..", "templates", "stage.erb"))
152
- template = ERB.new File.read(template_path)
153
- output = template.result(binding)
154
- File.open(File.join(deploy_subdir, "#{stage}.rb"), 'w') {|f| f.write(output) }
155
- end
156
-
157
- def run_commands(commands)
158
- output = `#{commands.join(" && ")} 2>&1`
159
- puts output
160
- output
161
- end
162
-
163
- end
@@ -1,32 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "auto_tagger", "recipes"))
2
-
3
- set :autotagger_stages, [:ci, :staging, :production]
4
- set :stages, [:staging, :production]
5
- set :default_stage, :staging
6
-
7
- require 'capistrano/ext/multistage'
8
-
9
- set :application, "deployed"
10
- set :user, "<%= user %>"
11
- set :repository, "file://<%= repository %>"
12
- set :scm, :git
13
- set :scm_command, "<%= git_location %>"
14
-
15
- set :deploy_to, "<%= deploy_to %>"
16
-
17
- set :run_method, :run
18
- set :ssh_options, { :forward_agent => true }
19
- default_run_options[:pty] = true
20
-
21
- role :app, "localhost" # => this must be mapped
22
-
23
- namespace :deploy do
24
- task :restart do
25
- puts "restarting..."
26
- end
27
- end
28
-
29
- before "deploy:update_code", "release_tagger:set_branch"
30
- after "deploy", "release_tagger:create_tag"
31
- after "deploy", "release_tagger:write_tag_to_shared"
32
- after "deploy", "release_tagger:print_latest_tags"
@@ -1,34 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "auto_tagger", "recipes"))
2
-
3
- set :autotagger_stages, ["<%= environments.join('", "') %>"]
4
-
5
- set :application, "deployed"
6
- set :user, "<%= user %>"
7
- set :repository, "file://<%= repository %>"
8
- set :deploy_to, "<%= deploy_to %>"
9
- set :scm, :git
10
- set :scm_command, "<%= git_location %>"
11
-
12
- set :run_method, :run
13
- set :ssh_options, { :forward_agent => true }
14
- default_run_options[:pty] = true
15
-
16
- role :app, "localhost" # => this must be mapped
17
-
18
-
19
- namespace :deploy do
20
- task :restart do
21
- puts "restarting..."
22
- end
23
- end
24
-
25
- <% environments.each do |environment| %>
26
- task "<%= environment %>" do
27
- set :stage, "<%= environment %>"
28
- end
29
- <% end %>
30
-
31
- before "deploy:update_code", "release_tagger:set_branch"
32
- after "deploy", "release_tagger:create_tag"
33
- after "deploy", "release_tagger:write_tag_to_shared"
34
- after "deploy", "release_tagger:print_latest_tag"
@@ -1 +0,0 @@
1
- # nothing to see here...