heroku-tagged-deploy 0.0.2.8 → 0.0.6.0
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.
- checksums.yaml +4 -4
- data/heroku-tagged-deploy.gemspec +1 -1
- data/lib/heroku/tagged/deploy/version.rb +1 -1
- data/lib/heroku/tagged/tagged_deploy.rb +68 -35
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba946db40d2aaeb1be1cbdb4a2e0cf9e01e5e592
|
4
|
+
data.tar.gz: 29f0bfcecf76a2ab5bf0ca0231ba40a186ff92da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3076b8a457f9222f3b32f1d43c3027c0436ce2707b81963914c593466dd8ee74947dd07fe9af07769198066e95a7064105138c20f526099e54b71631a8b1dce3
|
7
|
+
data.tar.gz: 6e5fead9de92cc96b0d04bde53802f58f6232c17e96ea5a1a6c788b84877de2719102f77ab1bec726809e3ee7c90e796d3e4872fbd83ad00276ed2f6be682d3f
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "heroku_san", "~> 4.3.2"
|
21
|
+
# spec.add_runtime_dependency "heroku_san", "~> 4.3.2"
|
22
22
|
spec.add_runtime_dependency 'auto_tagger', '~> 0.2.8'
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.10"
|
@@ -1,73 +1,106 @@
|
|
1
1
|
module HerokuSan
|
2
2
|
module Deploy
|
3
3
|
class Tagged < Base
|
4
|
-
|
5
4
|
def get_changes
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
puts "[#{@stage.name}] Deploying..."
|
5
|
+
say 'Getting current tags...'
|
6
|
+
`git fetch --tags`
|
7
|
+
say 'Fetching current state.'
|
8
|
+
`git fetch #{@stage.name}`
|
11
9
|
previous_sha_commit = `git rev-parse HEAD`.strip
|
12
|
-
|
10
|
+
say 'Deploying these changes:'
|
13
11
|
puts `git log --pretty=format:"* %s" #{@stage.name}/master..#{previous_sha_commit}`
|
14
|
-
puts ""
|
15
12
|
@file_changes = `git diff --name-only #{previous_sha_commit} #{@stage.name}/master`
|
16
13
|
end
|
17
14
|
|
18
15
|
def enable_maintenance_if_needed
|
19
|
-
if @file_changes.index(
|
20
|
-
|
21
|
-
@stage.
|
16
|
+
if @file_changes.index('db/migrate') || @file_changes.index('db/seeds.rb')
|
17
|
+
say 'Migrations found -- enabling maintenance mode...'
|
18
|
+
heroku("maintenance:on -a #{@stage.app}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def deploying_assets?
|
23
|
+
if @file_changes.index('app/assets')
|
24
|
+
true
|
25
|
+
else
|
26
|
+
false
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
25
30
|
def post_changes
|
26
|
-
if @file_changes.index(
|
27
|
-
|
28
|
-
@stage.
|
31
|
+
if @file_changes.index('db/migrate')
|
32
|
+
say 'Running migrations, as there are new ones added.'
|
33
|
+
heroku("run rake db:migrate -a #{@stage.app}")
|
29
34
|
end
|
30
|
-
if @file_changes.index(
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
if @file_changes.index('db/seeds.rb')
|
36
|
+
say 'It looks like you adjusted or created the seeds.rb file.'
|
37
|
+
say 'Running the rake db:seed command now...'
|
38
|
+
heroku("run rake db:seed -a #{@stage.app}")
|
34
39
|
end
|
35
|
-
if @file_changes.index(
|
36
|
-
|
37
|
-
@stage.
|
38
|
-
|
39
|
-
@stage.
|
40
|
+
if @file_changes.index('db/migrate') || @file_changes.index('db/seeds.rb')
|
41
|
+
say 'Disabling the maintenance mode.'
|
42
|
+
heroku("maintenance:off -a #{@stage.app}")
|
43
|
+
say 'Restarting...'
|
44
|
+
heroku("restart -a #{@stage.app}")
|
40
45
|
end
|
41
46
|
end
|
42
47
|
|
43
48
|
def precompile_assets
|
44
|
-
|
45
|
-
|
49
|
+
`rake RAILS_ENV=production RAILS_GROUP=assets assets:precompile`
|
50
|
+
`rake assets:clean_expired` if in_gemfile?('turbo-sprockets-rails3')
|
46
51
|
if system('git diff --cached --exit-code') == false || system('git diff --exit-code') == false
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
52
|
+
`git add -A .`
|
53
|
+
`git gc`
|
54
|
+
`git commit -m 'assets precompiled'`
|
55
|
+
`git push`
|
51
56
|
else
|
52
|
-
|
57
|
+
say 'No assets changed, no extra commit needed.'
|
53
58
|
end
|
54
59
|
end
|
55
60
|
|
61
|
+
def say(text)
|
62
|
+
puts "[#{Time.now.strftime('%H:%M:%S')}][#{@stage.name}] #{text}"
|
63
|
+
end
|
64
|
+
|
56
65
|
def deploy
|
66
|
+
get_changes
|
67
|
+
say 'Checking for precompiled assets'
|
57
68
|
if File.exist?(::Rails.root.join('public/assets/manifest.yml'))
|
58
|
-
|
69
|
+
say 'Found manifest.yml. Precompile assets.'
|
70
|
+
say 'Checking if we need to precompile'
|
71
|
+
if deploying_assets?
|
72
|
+
say 'Deploying new assets, precompiling...'
|
73
|
+
precompile_assets
|
74
|
+
else
|
75
|
+
say 'Not deploying new assets, skipped precompile.'
|
76
|
+
end
|
59
77
|
end
|
60
78
|
|
61
|
-
get_changes
|
62
79
|
enable_maintenance_if_needed
|
63
|
-
|
80
|
+
|
64
81
|
# Do the deploy
|
65
82
|
super
|
66
|
-
|
83
|
+
|
67
84
|
post_changes
|
68
85
|
|
69
86
|
@stage.tag_repo
|
87
|
+
|
88
|
+
say 'Warming up the Heroku dynos'
|
89
|
+
sh "curl -o /dev/null http://#{@stage.app}.herokuapp.com"
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def in_gemfile?(reg)
|
95
|
+
content = File.read(::Rails.root.join('Gemfile'))
|
96
|
+
|
97
|
+
!content.index(reg).nil?
|
98
|
+
end
|
99
|
+
|
100
|
+
# Executes a command in the Heroku Toolbelt
|
101
|
+
def heroku(command)
|
102
|
+
system("GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' /usr/local/heroku/bin/heroku #{command}")
|
70
103
|
end
|
71
104
|
end
|
72
105
|
end
|
73
|
-
end
|
106
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku-tagged-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Westerink
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: heroku_san
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 4.3.2
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 4.3.2
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: auto_tagger
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
112
|
version: '0'
|
127
113
|
requirements: []
|
128
114
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.6.11
|
130
116
|
signing_key:
|
131
117
|
specification_version: 4
|
132
118
|
summary: Have a deploy be tagged with the stage name and a date
|