rake-stretcher 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb200b9a100a9469597ab888486e69f9ca0b7e42
4
- data.tar.gz: 34bdfee5f82ada8cd95df6fdeee4ced60874263f
3
+ metadata.gz: cf852652d01fd138c90721cfcbfe0b0d056e82c9
4
+ data.tar.gz: b14befb9b9beaa48611fd6c5a14ff58d879d2c1a
5
5
  SHA512:
6
- metadata.gz: 7c3d9cac4b127afbfe83ac5a9ef2e8b5d488215bd82cc01dd0bbd1f7690685a90ff5ee803c8240bf0b96f5f75fd669ba7539c8f44c9ca3f314d59bb63851975e
7
- data.tar.gz: aec64ec474f8591b8c9e9897e41dd808d4868ba442f0a65d86812e508e3a928ada210dc2cd957f04df5e61bc5c2066a27c2bab204be03b4e881477cbfe47fedd
6
+ metadata.gz: a2ee5db89b8204a962a79391cc0fe8b50d8ed9dc76f2c1084df206ddfcfac1c78d6d7f7aacfd92ea87253b6e43fcd192311d4372d20624f7e6342d7a66408674
7
+ data.tar.gz: 8722c6ddc4ce3c21dc27fb7234119467e5f0ebf4232b6c7bf87f442b15f2611bacdb673c57af14fa8884996aac22904e6e3281bbf0d26ddd12205d1c64834b3f
@@ -38,7 +38,7 @@ namespace :stretcher do
38
38
  end
39
39
 
40
40
  def branch
41
- ENV['CIRCLE_BRANCH'] ||= 'master'
41
+ config['branch'] ||= 'master'
42
42
  end
43
43
 
44
44
  def current_version
@@ -49,12 +49,12 @@ namespace :stretcher do
49
49
  '--exclude tmp'
50
50
  end
51
51
 
52
- def rails_env
53
- config['rails_env'] ||= ENV['RAILS_ENV']
52
+ def environment
53
+ config['environment'] ||= ENV['environment']
54
54
  end
55
55
 
56
- def local_tarball_name
57
- config['local_tarball_name']
56
+ def tarball_name
57
+ config['tarball_name']
58
58
  end
59
59
 
60
60
  def stretcher_path
@@ -62,11 +62,11 @@ namespace :stretcher do
62
62
  end
63
63
 
64
64
  def stretcher_src
65
- "#{stretcher_path}/rails-application-#{time_now}.tgz"
65
+ "#{stretcher_path}/#{remote_tarball_name}-#{time_now}.tgz"
66
66
  end
67
67
 
68
68
  def checksum
69
- %x(openssl sha256 #{local_tarball_path}/current/#{local_tarball_name} | awk -F' ' '{print $2}').chomp
69
+ %x(openssl sha256 #{local_tarball_path}/current/#{tarball_name} | awk -F' ' '{print $2}').chomp
70
70
  end
71
71
 
72
72
  def deploy_to
@@ -130,7 +130,7 @@ namespace :stretcher do
130
130
  cd #{local_build_path}
131
131
  mkdir -p "#{local_tarball_path}/#{time_now}"
132
132
  tar -cf - --exclude tmp --exclude spec ./ | gzip -9 > \
133
- #{local_tarball_path}/#{time_now}/#{local_tarball_name}
133
+ #{local_tarball_path}/#{time_now}/#{tarball_name}
134
134
  EOC
135
135
  sh <<-EOC
136
136
  cd #{local_tarball_path}
@@ -142,7 +142,7 @@ namespace :stretcher do
142
142
  desc "upload tarball to s3"
143
143
  task :upload_tarball do
144
144
  sh <<-EOC
145
- aws s3 cp #{local_tarball_path}/current/#{local_tarball_name} #{stretcher_src}
145
+ aws s3 cp #{local_tarball_path}/current/#{tarball_name} #{stretcher_src}
146
146
  EOC
147
147
  end
148
148
 
@@ -159,10 +159,10 @@ namespace :stretcher do
159
159
  end
160
160
  p tempfile_path
161
161
  sh <<-EOC
162
- mv #{tempfile_path} "#{local_tarball_path}/current/manifest_#{role}_#{rails_env}_#{time_now}.yml"
162
+ mv #{tempfile_path} "#{local_tarball_path}/current/manifest_#{role}_#{environment}_#{time_now}.yml"
163
163
  EOC
164
164
  sh <<-EOC
165
- aws s3 cp "#{local_tarball_path}/current/manifest_#{role}_#{rails_env}_#{time_now}.yml" "#{manifest_path}/manifest_#{role}_#{rails_env}_#{time_now}.yml"
165
+ aws s3 cp "#{local_tarball_path}/current/manifest_#{role}_#{environment}_#{time_now}.yml" "#{manifest_path}/manifest_#{role}_#{environment}_#{time_now}.yml"
166
166
  EOC
167
167
  end
168
168
  end
@@ -170,11 +170,11 @@ namespace :stretcher do
170
170
  desc "kick start consul event"
171
171
  task :kick_start do
172
172
  deploy_roles.each do |role|
173
- o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{rails_env} | awk -F' ' '{print $4}' | tail -1")
173
+ o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{environment} | awk -F' ' '{print $4}' | tail -1")
174
174
  current_manifest = o.chomp
175
175
  puts "kick start -> #{current_manifest}"
176
176
  sh <<-EOC
177
- curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{rails_env}\?pretty
177
+ curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{environment}\?pretty
178
178
  EOC
179
179
  end
180
180
  end
@@ -182,11 +182,11 @@ namespace :stretcher do
182
182
  desc "rollback consul event"
183
183
  task :rollback do
184
184
  deploy_roles.each do |role|
185
- o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{rails_env} | awk -F' ' '{print $4}' | tail -2 | head -1")
185
+ o, e, s = Open3.capture3("aws s3 ls #{manifest_path}/manifest_#{role}_#{environment} | awk -F' ' '{print $4}' | tail -2 | head -1")
186
186
  current_manifest = o.chomp
187
187
  puts "kick start -> #{current_manifest}"
188
188
  sh <<-EOC
189
- curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{rails_env}\?pretty
189
+ curl -X PUT -d "#{manifest_path}/#{current_manifest}" http://#{consul_host}:8500/v1/event/fire/deploy_#{role}_#{environment}\?pretty
190
190
  EOC
191
191
  end
192
192
  end
@@ -1,5 +1,5 @@
1
1
  module Rake
2
2
  module Stretcher
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-stretcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tjinjin