herkko 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02466a5d94abfcd9340b7e69226fef74f84cce23
4
- data.tar.gz: 2ab41abc3557160b13e0a0cc2cfc8eb15ea63ab3
3
+ metadata.gz: a07efa3d7639ee60f02f9b7231eea8f8eacc4522
4
+ data.tar.gz: defb9dc4786e037893e769406bfe3d4af9d9df29
5
5
  SHA512:
6
- metadata.gz: 46878092bee911cd4986946a1eaa18228ff5e5e2e3872b98a53d14ea99e0172d72f845acb70f48a7806bf2338f26087aa4113f7fbbec68bbc441c8903b10fce3
7
- data.tar.gz: a3a4625958deab4c85cd3bb6471e8ac93cba731c307eaf4fc5de5736bd2e104071b9705ddec6624abc5f9a6f85ec034d5320e8236c672a067f346f446234f9ad
6
+ metadata.gz: 1fc451d9a11930da0b58cf9f84aabd02e00fe0144d31158d4acb12c4c9b66262b1b7ea8eeb49b7373ec24fd98458c9af35453ee3020dbdbbb4aede611a54255c
7
+ data.tar.gz: 0db1bebba339171c7feab300a456f8613a9778766fb64ed69d39914daaab357f92b9381b1f0dec014c51e12f62f52f5e7950eaf6a0d359320c5c584d76acf4c3
data/README.md CHANGED
@@ -19,7 +19,8 @@ TODO: How to setup project for Herkko
19
19
  deploy
20
20
 
21
21
  You can add a file in `doc/after_deployment.{md, txt, rdoc, whatever}` and it
22
- will be printed after a succesful deployment. It can have for example:
22
+ will be printed after a succesful deployment. It can have for example a
23
+ checklist like:
23
24
 
24
25
  * Open the site in the browser and see that it loads.
25
26
  * Stay alert for a while for exceptions.
data/lib/herkko/runner.rb CHANGED
@@ -18,14 +18,14 @@ module Herkko
18
18
  return print_version
19
19
  end
20
20
 
21
- if ["help", "--help"].include?(environment)
21
+ if ["help", "--help", "usage"].include?(environment)
22
22
  return print_usage
23
23
  end
24
24
 
25
25
  return print_usage if environment.nil? || command.nil?
26
26
 
27
27
  if respond_to?(command)
28
- send(command)
28
+ public_send(command)
29
29
  else
30
30
  Herkko.run_with_output("heroku", command, arguments, "-r#{environment}")
31
31
  end
@@ -36,31 +36,7 @@ module Herkko
36
36
  end
37
37
 
38
38
  def print_usage
39
- Herkko.puts <<END
40
- # Herkko
41
-
42
- Run `herkko [remote name] [command]` for example `herkko production deploy`.
43
-
44
- There are special commands like `deploy` is a special command that does extra checks. Other commands
45
- are just proxied to the heroku CLI tool (for example `herkko production logs`).
46
-
47
- ## Naming remotes
48
-
49
- It's recommended to name your remotes for example production & staging. Then you can always just type `herkko production deploy` to release a new version.
50
-
51
- ## Commands
52
-
53
- console | Opens Rails console
54
- deploy | Deploys new version
55
- seed | Runs seeds.rb
56
- migrate | Run migrations and restarts the app
57
- changelog | Prints the commits to be deployed
58
-
59
- ### deploy
60
-
61
- --skip-ci-check - Skips the Travis CI build status check
62
-
63
- END
39
+ Herkko.puts File.read(File.join(File.dirname(__FILE__), "..", "..", "usage.txt"))
64
40
  end
65
41
 
66
42
  def changelog
@@ -126,6 +102,14 @@ END
126
102
  puts
127
103
  end
128
104
 
105
+ def enable_maintenance_mode
106
+ Herkko.run_with_output "heroku", "maintenance:on", "-r", environment
107
+ end
108
+
109
+ def disable_maintenance_mode
110
+ Herkko.run_with_output "heroku", "maintenance:off", "-r", environment
111
+ end
112
+
129
113
  private
130
114
 
131
115
  def check_ci
@@ -136,6 +120,11 @@ END
136
120
 
137
121
  def deploy!
138
122
  run_migrations = migrations_needed?
123
+
124
+ if use_maintenace_mode?
125
+ enable_maintenance_mode
126
+ end
127
+
139
128
  push_new_code
140
129
 
141
130
  if run_migrations
@@ -148,13 +137,21 @@ END
148
137
  Herkko.info "NOTE: Seed file seem the have changed. Make sure to run it if needed."
149
138
  end
150
139
 
151
- # TODO: puts "Print the after deployment checklist from a file"
140
+ if use_maintenace_mode?
141
+ disable_maintenance_mode
142
+ end
143
+
144
+ print_after_deployment_instructions
152
145
  end
153
146
 
154
147
  def skip_ci_check?
155
148
  arguments && arguments.include?("--skip-ci-check")
156
149
  end
157
150
 
151
+ def use_maintenace_mode?
152
+ arguments && arguments.include?("--maintenance-mode")
153
+ end
154
+
158
155
  def current_branch
159
156
  Herkko.run("git", "rev-parse", "--abbrev-ref", "HEAD")[0].strip
160
157
  end
@@ -189,6 +186,18 @@ END
189
186
  Herkko.run("git", "log", "--pretty=format:%C(yellow)%h %Cblue%ad%Creset %an %Cgreen%s%Creset", "--date=short", "#{currently_deployed_to(environment)}..#{to_be_deployed_sha}")[0]
190
187
  end
191
188
 
189
+ def print_after_deployment_instructions
190
+ after_deployment_instructions = Dir.glob(File.join(Dir.pwd, "after_deployment.*"))
191
+ if after_deployment_instructions.any?
192
+ Herkko.info "After deployment instructions:"
193
+ after_deployment_instructions.each do |file_name|
194
+ puts
195
+ puts File.read(file_name)
196
+ puts
197
+ end
198
+ end
199
+ end
200
+
192
201
  def travis_client
193
202
  @travis_client ||= Herkko::Travis.new
194
203
  end
@@ -1,3 +1,3 @@
1
1
  module Herkko
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
data/usage.txt ADDED
@@ -0,0 +1,26 @@
1
+ # Herkko
2
+
3
+ Run `herkko [remote name] [command]` for example `herkko production deploy`.
4
+
5
+ There are special commands like `deploy` is a special command that does extra
6
+ checks. Other commands are just proxied to the heroku CLI tool (for example
7
+ `herkko production logs`).
8
+
9
+ ## Naming remotes
10
+
11
+ It's recommended to name your remotes for example production & staging. Then
12
+ you can always just type `herkko production deploy` to release a new version.
13
+
14
+ ## Commands
15
+
16
+ console | Opens Rails console
17
+ deploy | Deploys new version
18
+ seed | Runs seeds.rb
19
+ migrate | Run migrations and restarts the app
20
+ changelog | Prints the commits to be deployed
21
+
22
+ ### deploy
23
+
24
+ --skip-ci-check - Skips the Travis CI build status check
25
+ --maintenance-mode - Puts the application to maintenance mode for the duration
26
+ of the deployment
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: herkko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vesa Vänskä
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -59,6 +59,7 @@ files:
59
59
  - lib/herkko/runner.rb
60
60
  - lib/herkko/travis.rb
61
61
  - lib/herkko/version.rb
62
+ - usage.txt
62
63
  homepage: https://github.com/vesan/herkko
63
64
  licenses:
64
65
  - MIT
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
80
  version: '0'
80
81
  requirements: []
81
82
  rubyforge_project:
82
- rubygems_version: 2.2.2
83
+ rubygems_version: 2.4.5.1
83
84
  signing_key:
84
85
  specification_version: 4
85
86
  summary: Herkko is a deployment tool for Heroku.