hanzo 0.6.2 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3fdfe4074e2f695d32dea1ced3d9543437063c2
4
- data.tar.gz: 364e464b762238cc38edb434325ec5f2a5becb6e
3
+ metadata.gz: bee1eec974365dfa0ec1f64e66e815bf1fdc12cf
4
+ data.tar.gz: 7f6232230bb005fd4d839e76f627cc1a25db4873
5
5
  SHA512:
6
- metadata.gz: 4eb468e8e684e30e2cb56e589f1577aea1c1981a904d57a77193238585b5013a70452e40bcab2ba321f50aa795e8691831696b3e74c2cf6a54a88adaf67b5c06
7
- data.tar.gz: 94f54a5a792360c4e580a879e0fb0075958b1cda8d25113beda95188438c59753a73456c37dd477cd09ebf3f74cd948e5b789f7b4dd4518f90b9eca9e966cdb2
6
+ metadata.gz: c0666923ca775c15f98f3fba16b86ca679459c8a68319420e5caada843ee16d409e4d8d41b5d264cfa3c101fcd363f64720ec06a7f73d82996506a4e22642bd3
7
+ data.tar.gz: 989a4281de8b8ec204ff0e767dd894ea43c80d429bd6f53ca6655d97057959cb7fc6d6ed96216a09d21ae5f4e1d69f88999b5a5f132ccfb9fdda8436bebc85bd
@@ -4,6 +4,9 @@ Documentation:
4
4
  Encoding:
5
5
  Enabled: false
6
6
 
7
+ BlockLength:
8
+ Max: 100
9
+
7
10
  LineLength:
8
11
  Max: 200
9
12
 
@@ -17,7 +20,7 @@ IfUnlessModifier:
17
20
  Enabled: false
18
21
 
19
22
  CaseIndentation:
20
- IndentWhenRelativeTo: case
23
+ EnforcedStyle: case
21
24
  IndentOneStep: true
22
25
 
23
26
  MethodLength:
@@ -56,3 +59,7 @@ DoubleNegation:
56
59
 
57
60
  TrivialAccessors:
58
61
  ExactNameMatch: true
62
+
63
+ Style/PercentLiteralDelimiters:
64
+ PreferredDelimiters:
65
+ '%w': '()'
data/README.md CHANGED
@@ -3,10 +3,9 @@
3
3
  <img src="http://i.imgur.com/RZbJy1u.png" alt="Hanzo" />
4
4
  </a>
5
5
  <br />
6
- Hanzo is a sharp tool to handle deployments of multiple environments of the same application on Heroku.
6
+ Hanzo is a sharp tool to handle deploying an application on Heroku on multiple environments.
7
7
  <br /><br />
8
8
  <a href="https://rubygems.org/gems/hanzo"><img src="http://img.shields.io/gem/v/hanzo.svg" /></a>
9
- <a href="https://codeclimate.com/github/mirego/hanzo"><img src="http://img.shields.io/codeclimate/github/mirego/hanzo.svg" /></a>
10
9
  <a href='https://gemnasium.com/mirego/hanzo'><img src="http://img.shields.io/gemnasium/mirego/hanzo.svg" /></a>
11
10
  <a href="https://travis-ci.org/mirego/hanzo"><img src="http://img.shields.io/travis/mirego/hanzo.svg" /></a>
12
11
  </p>
@@ -23,30 +22,35 @@ gem 'hanzo'
23
22
 
24
23
  ## Usage
25
24
 
26
- Create an `.hanzo.yml` file at the root of your app that will contain a map of
25
+ Create a `.hanzo.yml` file at the root of your app that will contain a map of
27
26
  remotes, with the remote as the key and the Heroku application name as the value.
28
27
 
29
- You can also specify commands that can be ran on the application after a
30
- successful deploy. Hanzo will prompt to run each of them, they each will be ran
31
- with `heroku run` and the application will be restarted at the end.
28
+ You can also use `after_deploy` to specify commands that will be run on the application
29
+ after a successful deployment. Hanzo will prompt you before running each command,
30
+ then use `heroku run` to execute it. The application is restarted afterwards.
32
31
 
33
32
  ```yaml
34
33
  remotes:
35
34
  qa: heroku-app-name-qa
36
35
  staging: heroku-app-name-staging
37
36
  production: heroku-app-name-production
37
+
38
38
  after_deploy:
39
39
  - rake db:migrate
40
40
  ```
41
41
 
42
- ### Install remotes
42
+ ### `hanzo install`
43
+
44
+ #### Remotes
43
45
 
44
- Whenever you add a new remote to your `.hanzo.yml` file, you'll have to install those
45
- remotes locally by running `hanzo install`.
46
+ Whenever you add new remotes to your `.hanzo.yml` file, you'll have to install
47
+ them locally by running `hanzo install remotes`.
46
48
 
47
49
  ```bash
48
- > hanzo install
50
+ $ hanzo install remotes
51
+ ```
49
52
 
53
+ ```
50
54
  -----> Creating git remotes
51
55
  Adding qa
52
56
  git remote rm qa 2>&1 > /dev/null
@@ -59,22 +63,16 @@ remotes locally by running `hanzo install`.
59
63
  git remote add production git@heroku.com:heroku-app-name-production.git
60
64
  ```
61
65
 
62
- ### Deploy a branch or a tag
66
+ #### Labs
63
67
 
64
- ```bash
65
- > hanzo deploy qa
66
-
67
- -----> Branch to deploy: |HEAD|
68
- ```
69
-
70
- ### Install labs
71
-
72
- Once all your remotes are installed, you might want to enable some
73
- Heroku labs feature for all of them.
68
+ Once all your remotes are installed, you might want to enable Heroku labs
69
+ features:
74
70
 
75
71
  ```bash
76
- > bundle exec hanzo install labs
72
+ $ hanzo install labs
73
+ ```
77
74
 
75
+ ```
78
76
  -----> Activating Heroku Labs
79
77
  Add preboot? yes
80
78
  - Enabled for qa
@@ -86,12 +84,101 @@ Heroku labs feature for all of them.
86
84
  - Enabled for production
87
85
  ```
88
86
 
87
+ ### `hanzo deploy`
88
+
89
+ You can deploy to a specific remote using `hanzo deploy <remote>` and an
90
+ optional reference to deploy. If no reference is specified, Hanzo will prompt
91
+ for one (with `HEAD` as the default value).
92
+
93
+ ```bash
94
+ $ hanzo deploy qa release/qa
95
+ ```
96
+
97
+ ```
98
+ git push -f qa release/qa:master
99
+
100
+
101
+
102
+ remote: Verifying deploy... done.
103
+ To heroku.com:heroku-app-name-qa.git
104
+ 550c719..27e3538 release/qa -> master
105
+
106
+ Run `rake db:migrate` on qa? y
107
+ heroku run rake db:migrate --remote qa
108
+
109
+ Running rake db:migrate on heroku-app-name-qa...
110
+ 15:45:26.380 [info] Already up
111
+ heroku ps:restart --remote qa
112
+
113
+ Restarting dynos on heroku-app-name-qa...
114
+ ```
115
+
116
+ ### `hanzo diff`
117
+
118
+ You can use `hanzo diff <remote>` to compare the current repository state to the code
119
+ that is currently deployed in the specified remote.
120
+
121
+ Warning: This uses Heroku’s git repository references so its output might be
122
+ wrong if the application was rollbacked.
123
+
124
+ ```
125
+ $ hanzo diff qa
126
+ git remote update qa && git diff qa/master...HEAD
127
+ ```
128
+
129
+ ```diff
130
+ ────────────────────────────────────────────────────────────────────────────────────────────
131
+ -- a/lib/my_app/router.ex
132
+ ++ b/lib/my_app/router.ex
133
+ ────────────────────────────────────────────────────────────────────────────────────────────
134
+ @@ -30,6 +30,8 @@ defmodule MyApp.Router do
135
+ plug(:fetch_flash)
136
+ + plug(:protect_from_forgery)
137
+ + plug(:put_secure_browser_headers)
138
+ ```
139
+
140
+ ### `hanzo config`
141
+
142
+ #### Compare
143
+
144
+ You can use `hanzo config compare` to find out which environment variables are
145
+ present in only some of your environments.
146
+
147
+ ```
148
+ $ hanzo config compare
149
+ ```
150
+
151
+ ```
152
+ -----> Fetching environment variables
153
+ heroku config -r qa
154
+ heroku config -r staging
155
+ heroku config -r production
156
+
157
+ -----> Comparing environment variables
158
+ Missing variables in qa
159
+ - ASSET_HOST
160
+ Missing variables in staging
161
+ - SMTP_PASSWORD
162
+ - SMTP_PORT
163
+ - SMTP_SERVER
164
+ - SMTP_USER
165
+ Missing variables in production
166
+ - SMTP_PASSWORD
167
+ - SMTP_PORT
168
+ - SMTP_SERVER
169
+ - SMTP_USER
170
+ ```
171
+
89
172
  ## License
90
173
 
91
- `Hanzo` is © 2013-2017 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/hanzo/blob/master/LICENSE.md) file.
174
+ `Hanzo` is © 2013-2018 [Mirego](http://www.mirego.com) and may be freely
175
+ distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the
176
+ [`LICENSE.md`](https://github.com/mirego/hanzo/blob/master/LICENSE.md) file.
92
177
 
93
178
  ## About Mirego
94
179
 
95
- [Mirego](http://mirego.com) is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of [talented people](http://life.mirego.com) who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://mirego.org).
180
+ [Mirego](https://www.mirego.com) is a team of passionate people who believe that
181
+ work is a place where you can innovate and have fun. We're a team of [talented people](https://life.mirego.com)
182
+ who imagine and build beautiful Web and mobile applications. We come together to share ideas and [change the world](http://mirego.org).
96
183
 
97
- We also [love open-source software](http://open.mirego.com) and we try to give back to the community as much as we can.
184
+ We also [love open-source software](https://open.mirego.com) and we try to give back to the community as much as we can.
data/bin/hanzo CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
2
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
 
4
4
  require 'hanzo'
5
5
 
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency 'bundler', '~> 1.3'
23
23
  spec.add_development_dependency 'phare', '~> 0.6'
24
- spec.add_development_dependency 'rubocop', '~> 0.24'
25
24
  spec.add_development_dependency 'rake'
26
25
  spec.add_development_dependency 'rspec', '~> 3.1'
26
+ spec.add_development_dependency 'rubocop', '~> 0.49'
27
27
 
28
28
  spec.add_dependency 'highline', '>= 1.6.19'
29
29
  end
@@ -15,11 +15,11 @@ module Hanzo
15
15
  output = true
16
16
 
17
17
  _run do
18
- if fetch_output
19
- output = `#{command}`
20
- else
21
- output = system(command)
22
- end
18
+ output = if fetch_output
19
+ `#{command}`
20
+ else
21
+ system(command)
22
+ end
23
23
  end
24
24
 
25
25
  output
@@ -68,6 +68,6 @@ end
68
68
 
69
69
  class String
70
70
  def unindent
71
- gsub(/^#{scan(/^\s*/).min_by { |l| l.length }}/, '')
71
+ gsub(/^#{scan(/^\s*/).min_by(&:length)}/, '')
72
72
  end
73
73
  end
@@ -52,7 +52,7 @@ module Hanzo
52
52
  @variables.each_pair do |env, variables|
53
53
  missing_variables = all_variables - variables
54
54
  Hanzo.print "Missing variables in #{env}", :yellow
55
- Hanzo.print missing_variables.map { |v| "- #{v}" }
55
+ Hanzo.print(missing_variables.map { |v| "- #{v}" })
56
56
  end
57
57
  end
58
58
  end
@@ -18,7 +18,7 @@ module Hanzo
18
18
  deploy && run_after_deploy_commands
19
19
  rescue UnknownEnvironment
20
20
  Hanzo.unindent_print "Environment `#{@env}` doesn't exist. Add it to .hanzo.yml and run:\n hanzo install remotes", :red
21
- Hanzo.unindent_print "\nFor more information, read https://github.com/mirego/hanzo#install-remotes", :red
21
+ Hanzo.unindent_print "\nFor more information, read https://github.com/mirego/hanzo#remotes", :red
22
22
  rescue UninstalledEnvironment
23
23
  Hanzo.unindent_print "Environment `#{@env}` has been found in your .hanzo.yml file. Before using it, you must install it:\n hanzo install remotes", :red
24
24
  end
@@ -18,7 +18,7 @@ module Hanzo
18
18
 
19
19
  method = "install_#{@type}"
20
20
 
21
- if self.respond_to?(method)
21
+ if respond_to?(method)
22
22
  send(method)
23
23
  else
24
24
  initialize_help
@@ -4,7 +4,7 @@ module Hanzo
4
4
  def install_labs
5
5
  Hanzo.title('Activating Heroku Labs')
6
6
 
7
- Hanzo::Heroku.available_labs.each do |name, _|
7
+ Hanzo::Heroku.available_labs.each_key do |name|
8
8
  next unless Hanzo.agree("Add #{name}?")
9
9
 
10
10
  Hanzo::Installers::Remotes.environments.each_pair do |env, _|
@@ -1,3 +1,3 @@
1
1
  module Hanzo
2
- VERSION = '0.6.2'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
 
3
3
  describe Hanzo::CLI do
4
4
  describe :deploy do
5
- let(:deploy!) { Hanzo::CLI.new(['deploy', 'production']) }
5
+ let(:deploy!) { Hanzo::CLI.new(%w(deploy production)) }
6
6
  let(:deploy_question) { 'Branch to deploy in production:' }
7
- let(:deploy_command) { "git push -f production 1.0.0:master" }
7
+ let(:deploy_command) { 'git push -f production 1.0.0:master' }
8
8
 
9
9
  before do
10
10
  expect(Hanzo::Installers::Remotes).to receive(:environments).and_return(['production'])
@@ -12,8 +12,8 @@ describe Hanzo::CLI do
12
12
  end
13
13
 
14
14
  context 'deploy with specific branch' do
15
- let(:deploy!) { Hanzo::CLI.new(['deploy', 'production', '2.0.0']) }
16
- let(:deploy_command) { "git push -f production 2.0.0:master" }
15
+ let(:deploy!) { Hanzo::CLI.new(%w(deploy production 2.0.0)) }
16
+ let(:deploy_command) { 'git push -f production 2.0.0:master' }
17
17
  let(:deploy_result) { true }
18
18
  let(:config) { {} }
19
19
 
@@ -18,10 +18,10 @@ describe Hanzo::CLI do
18
18
  expect(Hanzo::Heroku).to receive(:available_labs).and_return(available_labs)
19
19
  expect(Hanzo).to receive(:title).with(labs_title)
20
20
 
21
- available_labs.each do |name, _|
21
+ available_labs.each_key do |name|
22
22
  expect(Hanzo).to receive(:agree).with("Add #{name}?").and_return(true)
23
23
 
24
- heroku_remotes.each do |env, _|
24
+ heroku_remotes.each_key do |env|
25
25
  expect(Hanzo).to receive(:run).with("#{enable_labs_cmd} #{name} --remote #{env}")
26
26
  expect(Hanzo).to receive(:print).with("#{enable_labs_info} #{env}")
27
27
  end
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
2
 
3
3
  require 'hanzo'
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanzo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Garneau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-29 00:00:00.000000000 Z
11
+ date: 2018-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,47 +39,47 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.6'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rubocop
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.24'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.24'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '3.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '3.1'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec
70
+ name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.1'
75
+ version: '0.49'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.1'
82
+ version: '0.49'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: highline
85
85
  requirement: !ruby/object:Gem::Requirement