heroku_san 4.2.3 → 4.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,9 +18,10 @@
18
18
 
19
19
  STAGES = %w[ci staging production]
20
20
 
21
- def create_and_push(stage)
21
+ def create_and_push(stage, revision = nil)
22
22
  auto_tag = AutoTagger::Base.new(stages: STAGES, stage: stage, verbose: true, push_refs: false, refs_to_keep: 100)
23
- tag = auto_tag.create_ref(auto_tag.last_ref_from_previous_stage.try(:sha))
23
+ sha = revision || auto_tag.last_ref_from_previous_stage.try(:sha)
24
+ tag = auto_tag.create_ref(sha)
24
25
  sh "git push origin #{tag.name}"
25
26
  auto_tag.delete_locally
26
27
  auto_tag.delete_on_remote
@@ -32,7 +33,7 @@ end
32
33
 
33
34
  task :after_deploy do
34
35
  each_heroku_app do |stage|
35
- create_and_push(stage.name)
36
+ create_and_push(stage.name, stage.revision)
36
37
  end
37
38
  Rake::Task['autotag:list'].invoke
38
39
  end
@@ -58,5 +59,4 @@ namespace :autotag do
58
59
  puts " ** %-12s %s" % [stage, log]
59
60
  end
60
61
  end
61
- end
62
62
  end
@@ -1,5 +1,5 @@
1
1
  require File.join(File.dirname(__FILE__), 'railtie.rb') if defined?(Rails) && Rails::VERSION::MAJOR >= 3
2
- require 'git'
2
+ require 'heroku_san/git'
3
3
  require 'heroku_san/api'
4
4
  require 'heroku_san/stage'
5
5
  require 'heroku_san/parser'
@@ -0,0 +1,51 @@
1
+ require 'rake'
2
+ require 'rake/dsl_definition'
3
+
4
+ module HerokuSan
5
+ module Git
6
+ class NoTagFoundError < Exception; end
7
+
8
+ include Rake::DSL
9
+
10
+ def git_clone(repos, dir)
11
+ sh "git clone #{repos} #{dir}"
12
+ end
13
+
14
+ def git_active_branch
15
+ %x{git branch}.split("\n").select { |b| b =~ /^\*/ }.first.split(" ").last.strip
16
+ end
17
+
18
+ def git_push(commit, repo, options = [])
19
+ commit ||= "HEAD"
20
+ options ||= []
21
+ begin
22
+ sh "git update-ref refs/heroku_san/deploy #{commit}^{commit}"
23
+ sh "git push #{repo} #{options.join(' ')} refs/heroku_san/deploy:refs/heads/master"
24
+ ensure
25
+ sh "git update-ref -d refs/heroku_san/deploy"
26
+ end
27
+ end
28
+
29
+ def git_parsed_tag(tag)
30
+ git_rev_parse(git_tag(tag))
31
+ end
32
+
33
+ def git_rev_parse(ref)
34
+ return nil if ref.nil?
35
+ %x{git rev-parse #{ref}}.split("\n").first
36
+ end
37
+
38
+ def git_tag(glob)
39
+ return nil if glob.nil?
40
+ %x{git tag -l '#{glob}'}.split("\n").last || (raise NoTagFoundError, "No tag found [#{glob}]")
41
+ end
42
+
43
+ def git_revision(repo)
44
+ %x{git ls-remote --heads #{repo} master}.split.first
45
+ end
46
+
47
+ def git_named_rev(ref)
48
+ %x{git name-rev #{ref}}.chomp
49
+ end
50
+ end
51
+ end
@@ -1,6 +1,6 @@
1
1
  module HerokuSan
2
2
  class Parser
3
- include Git
3
+ include HerokuSan::Git
4
4
  attr_accessor :settings
5
5
  def parse(parseable)
6
6
  @settings = parse_yaml(parseable.config_file)
@@ -1,6 +1,6 @@
1
1
  module HerokuSan
2
2
  class Project
3
- include Git
3
+ include HerokuSan::Git
4
4
  attr_reader :config_file
5
5
  attr_reader :options
6
6
  attr_writer :configuration
@@ -5,7 +5,7 @@ MOCK = false unless defined?(MOCK)
5
5
 
6
6
  module HerokuSan
7
7
  class Stage
8
- include Git
8
+ include HerokuSan::Git
9
9
  attr_reader :name
10
10
  attr_reader :options
11
11
 
@@ -1,6 +1,6 @@
1
1
  require 'heroku_san'
2
- require 'git'
3
- include Git
2
+ require 'heroku_san/git'
3
+ include HerokuSan::Git
4
4
 
5
5
  if defined?(Rails)
6
6
  HerokuSan.project ||= HerokuSan::Project.new(
@@ -1,3 +1,3 @@
1
1
  module HerokuSan
2
- VERSION = "4.2.3"
2
+ VERSION = "4.2.5"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'git'
2
+ require 'heroku_san/git'
3
3
 
4
- class GitTest; include Git; end
4
+ class GitTest; include HerokuSan::Git; end
5
5
 
6
6
  describe GitTest do
7
7
  describe "#git_push" do
@@ -44,7 +44,7 @@ describe GitTest do
44
44
  subject.should_receive("`").with("git tag -l 'pattern*'") { "\n" }
45
45
  expect {
46
46
  subject.git_tag('pattern*')
47
- }.to raise_error(Git::NoTagFoundError)
47
+ }.to raise_error(HerokuSan::Git::NoTagFoundError)
48
48
  end
49
49
 
50
50
  it "returns nil for a nil glob" do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe HerokuSan::Stage do
4
- include Git
4
+ include HerokuSan::Git
5
5
  subject { HerokuSan::Stage.new('production', {"deploy" => HerokuSan::Deploy::Rails, "app" => "awesomeapp", "stack" => "cedar"})}
6
6
  STOCK_CONFIG = {"BUNDLE_WITHOUT"=>"development:test", "LANG"=>"en_US.UTF-8", "RACK_ENV"=>"production"}
7
7
  before do
metadata CHANGED
@@ -1,15 +1,10 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: heroku_san
3
- version: !ruby/object:Gem::Version
4
- hash: 49
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.2.5
5
5
  prerelease:
6
- segments:
7
- - 4
8
- - 2
9
- - 3
10
- version: 4.2.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Elijah Miller
14
9
  - Glenn Roberts
15
10
  - Ryan Ahearn
@@ -17,161 +12,175 @@ authors:
17
12
  autorequire:
18
13
  bindir: bin
19
14
  cert_chain: []
20
-
21
- date: 2013-02-09 00:00:00 Z
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
24
- requirement: &id001 !ruby/object:Gem::Requirement
15
+ date: 2013-02-12 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: heroku-api
19
+ requirement: !ruby/object:Gem::Requirement
25
20
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 31
30
- segments:
31
- - 0
32
- - 1
33
- - 2
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
34
24
  version: 0.1.2
35
- version_requirements: *id001
36
- name: heroku-api
37
25
  type: :runtime
38
26
  prerelease: false
39
- - !ruby/object:Gem::Dependency
40
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ version_requirements: !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
49
- version_requirements: *id002
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.2
33
+ - !ruby/object:Gem::Dependency
50
34
  name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
51
41
  type: :runtime
52
42
  prerelease: false
53
- - !ruby/object:Gem::Dependency
54
- requirement: &id003 !ruby/object:Gem::Requirement
43
+ version_requirements: !ruby/object:Gem::Requirement
55
44
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 7
60
- segments:
61
- - 2
62
- version: "2"
63
- version_requirements: *id003
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ - !ruby/object:Gem::Dependency
64
50
  name: rails
51
+ requirement: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '2'
65
57
  type: :development
66
58
  prerelease: false
67
- - !ruby/object:Gem::Dependency
68
- requirement: &id004 !ruby/object:Gem::Requirement
59
+ version_requirements: !ruby/object:Gem::Requirement
69
60
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
77
- version_requirements: *id004
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '2'
65
+ - !ruby/object:Gem::Dependency
78
66
  name: rspec
67
+ requirement: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
79
73
  type: :development
80
74
  prerelease: false
81
- - !ruby/object:Gem::Dependency
82
- requirement: &id005 !ruby/object:Gem::Requirement
75
+ version_requirements: !ruby/object:Gem::Requirement
83
76
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
91
- version_requirements: *id005
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
92
82
  name: aruba
83
+ requirement: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
93
89
  type: :development
94
90
  prerelease: false
95
- - !ruby/object:Gem::Dependency
96
- requirement: &id006 !ruby/object:Gem::Requirement
91
+ version_requirements: !ruby/object:Gem::Requirement
97
92
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
105
- version_requirements: *id006
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
106
98
  name: cucumber
99
+ requirement: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
107
105
  type: :development
108
106
  prerelease: false
109
- - !ruby/object:Gem::Dependency
110
- requirement: &id007 !ruby/object:Gem::Requirement
107
+ version_requirements: !ruby/object:Gem::Requirement
111
108
  none: false
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
119
- version_requirements: *id007
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ - !ruby/object:Gem::Dependency
120
114
  name: rake
115
+ requirement: !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- - !ruby/object:Gem::Dependency
124
- requirement: &id008 !ruby/object:Gem::Requirement
123
+ version_requirements: !ruby/object:Gem::Requirement
125
124
  none: false
126
- requirements:
127
- - - ~>
128
- - !ruby/object:Gem::Version
129
- hash: 13
130
- segments:
131
- - 1
132
- - 1
133
- version: "1.1"
134
- version_requirements: *id008
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ - !ruby/object:Gem::Dependency
135
130
  name: bundler
131
+ requirement: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ~>
135
+ - !ruby/object:Gem::Version
136
+ version: '1.1'
136
137
  type: :development
137
138
  prerelease: false
138
- - !ruby/object:Gem::Dependency
139
- requirement: &id009 !ruby/object:Gem::Requirement
139
+ version_requirements: !ruby/object:Gem::Requirement
140
140
  none: false
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- hash: 3
145
- segments:
146
- - 0
147
- version: "0"
148
- version_requirements: *id009
141
+ requirements:
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ version: '1.1'
145
+ - !ruby/object:Gem::Dependency
149
146
  name: git-smart
147
+ requirement: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
150
153
  type: :development
151
154
  prerelease: false
152
- - !ruby/object:Gem::Dependency
153
- requirement: &id010 !ruby/object:Gem::Requirement
155
+ version_requirements: !ruby/object:Gem::Requirement
154
156
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- hash: 3
159
- segments:
160
- - 0
161
- version: "0"
162
- version_requirements: *id010
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ - !ruby/object:Gem::Dependency
163
162
  name: godot
163
+ requirement: !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ! '>='
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
164
169
  type: :development
165
170
  prerelease: false
171
+ version_requirements: !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
166
177
  description: Manage multiple Heroku instances/apps for a single Rails app using Rake
167
178
  email: elijah.miller@gmail.com
168
179
  executables: []
169
-
170
180
  extensions: []
171
-
172
- extra_rdoc_files:
181
+ extra_rdoc_files:
173
182
  - README.md
174
- files:
183
+ files:
175
184
  - .gitignore
176
185
  - .travis.yml
177
186
  - CHANGELOG.md
@@ -191,7 +200,6 @@ files:
191
200
  - features/support/env.rb
192
201
  - heroku_san.gemspec
193
202
  - lib/generators/heroku_san_generator.rb
194
- - lib/git.rb
195
203
  - lib/heroku_san.rb
196
204
  - lib/heroku_san/api.rb
197
205
  - lib/heroku_san/configuration.rb
@@ -199,6 +207,7 @@ files:
199
207
  - lib/heroku_san/deploy/noop.rb
200
208
  - lib/heroku_san/deploy/rails.rb
201
209
  - lib/heroku_san/deploy/sinatra.rb
210
+ - lib/heroku_san/git.rb
202
211
  - lib/heroku_san/parser.rb
203
212
  - lib/heroku_san/project.rb
204
213
  - lib/heroku_san/stage.rb
@@ -222,39 +231,35 @@ files:
222
231
  - spec/support/heroku.rb
223
232
  - spec/support/mocks.rb
224
233
  homepage: http://github.com/fastestforward/heroku_san
225
- licenses:
234
+ licenses:
226
235
  - MIT
227
236
  post_install_message:
228
237
  rdoc_options: []
229
-
230
- require_paths:
238
+ require_paths:
231
239
  - lib
232
- required_ruby_version: !ruby/object:Gem::Requirement
240
+ required_ruby_version: !ruby/object:Gem::Requirement
233
241
  none: false
234
- requirements:
235
- - - ">="
236
- - !ruby/object:Gem::Version
237
- hash: 3
238
- segments:
242
+ requirements:
243
+ - - ! '>='
244
+ - !ruby/object:Gem::Version
245
+ version: '0'
246
+ segments:
239
247
  - 0
240
- version: "0"
241
- required_rubygems_version: !ruby/object:Gem::Requirement
248
+ hash: 4414701449810336455
249
+ required_rubygems_version: !ruby/object:Gem::Requirement
242
250
  none: false
243
- requirements:
244
- - - ">="
245
- - !ruby/object:Gem::Version
246
- hash: 3
247
- segments:
248
- - 0
249
- version: "0"
251
+ requirements:
252
+ - - ! '>='
253
+ - !ruby/object:Gem::Version
254
+ version: '0'
250
255
  requirements: []
251
-
252
256
  rubyforge_project:
253
- rubygems_version: 1.8.17
257
+ rubygems_version: 1.8.24
254
258
  signing_key:
255
259
  specification_version: 3
256
- summary: "A bunch of useful Rake tasks for managing your Heroku apps. NOTE: The Heroku Toolbelt must be installed to use this gem. https://toolbelt.heroku.com/"
257
- test_files:
260
+ summary: ! 'A bunch of useful Rake tasks for managing your Heroku apps. NOTE: The
261
+ Heroku Toolbelt must be installed to use this gem. https://toolbelt.heroku.com/'
262
+ test_files:
258
263
  - features/config.feature
259
264
  - features/extended-config.feature
260
265
  - features/issue_113.feature
data/lib/git.rb DELETED
@@ -1,49 +0,0 @@
1
- require 'rake'
2
- require 'rake/dsl_definition'
3
-
4
- module Git
5
- class NoTagFoundError < Exception; end
6
-
7
- include Rake::DSL
8
-
9
- def git_clone(repos, dir)
10
- sh "git clone #{repos} #{dir}"
11
- end
12
-
13
- def git_active_branch
14
- %x{git branch}.split("\n").select { |b| b =~ /^\*/ }.first.split(" ").last.strip
15
- end
16
-
17
- def git_push(commit, repo, options = [])
18
- commit ||= "HEAD"
19
- options ||= []
20
- begin
21
- sh "git update-ref refs/heroku_san/deploy #{commit}^{commit}"
22
- sh "git push #{repo} #{options.join(' ')} refs/heroku_san/deploy:refs/heads/master"
23
- ensure
24
- sh "git update-ref -d refs/heroku_san/deploy"
25
- end
26
- end
27
-
28
- def git_parsed_tag(tag)
29
- git_rev_parse(git_tag(tag))
30
- end
31
-
32
- def git_rev_parse(ref)
33
- return nil if ref.nil?
34
- %x{git rev-parse #{ref}}.split("\n").first
35
- end
36
-
37
- def git_tag(glob)
38
- return nil if glob.nil?
39
- %x{git tag -l '#{glob}'}.split("\n").last || (raise NoTagFoundError, "No tag found [#{glob}]")
40
- end
41
-
42
- def git_revision(repo)
43
- %x{git ls-remote --heads #{repo} master}.split.first
44
- end
45
-
46
- def git_named_rev(ref)
47
- %x{git name-rev #{ref}}.chomp
48
- end
49
- end