hanzo 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -3
- data/lib/hanzo/base.rb +1 -0
- data/lib/hanzo/modules/deploy.rb +18 -3
- data/lib/hanzo/modules/install.rb +1 -0
- data/lib/hanzo/version.rb +1 -1
- data/spec/cli/deploy_spec.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95dcbdcf0dc439565c0e0e11fd23bbebb0af3019
|
4
|
+
data.tar.gz: 4a3d79e25f7504b737e2bf040f3c7a04573b7381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84e4637277a29e7522827dcfeeb6618579c4674990aa1fab55237e8f6d651470663306f125f41ffe31eae2cc986dc5445dd221ad5180532347114f0324bba0bf
|
7
|
+
data.tar.gz: 3b21fad59f6a83a2f36c2a877526a2dca37ef7661b41b58c5b7afdec262e8ae836ff7dc66a94e2e83bfadc92561a8fa2a05b808f3ee9f3df21a0210a1cfd200b
|
data/.travis.yml
CHANGED
data/lib/hanzo/base.rb
CHANGED
data/lib/hanzo/modules/deploy.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
module Hanzo
|
2
2
|
class Deploy < Base
|
3
|
+
# Classes
|
3
4
|
UnknownEnvironment = Class.new(StandardError)
|
4
5
|
UninstalledEnvironment = Class.new(StandardError)
|
5
6
|
|
7
|
+
# Constants
|
8
|
+
MIGRATION_COMMANDS = {
|
9
|
+
'db/migrate' => 'rake db:migrate',
|
10
|
+
'priv/repo/migrations' => 'mix ecto.migrate'
|
11
|
+
}
|
12
|
+
|
6
13
|
protected
|
7
14
|
|
8
15
|
def initialize_variables
|
@@ -42,10 +49,10 @@ module Hanzo
|
|
42
49
|
end
|
43
50
|
|
44
51
|
def run_migrations
|
45
|
-
return
|
46
|
-
return unless Hanzo.agree('Run migrations?')
|
52
|
+
return if migration_directory.nil?
|
53
|
+
return unless Hanzo.agree('Run database migrations?')
|
47
54
|
|
48
|
-
Hanzo.run "heroku run
|
55
|
+
Hanzo.run "heroku run #{migration_command} --remote #{@env}"
|
49
56
|
Hanzo.run "heroku ps:restart --remote #{@env}"
|
50
57
|
end
|
51
58
|
|
@@ -57,5 +64,13 @@ module Hanzo
|
|
57
64
|
def fetcher
|
58
65
|
@fetcher ||= Hanzo::Fetchers::Environment.new(@env)
|
59
66
|
end
|
67
|
+
|
68
|
+
def migration_directory
|
69
|
+
MIGRATION_COMMANDS.keys.find { |directory| Dir.exist?(directory) }
|
70
|
+
end
|
71
|
+
|
72
|
+
def migration_command
|
73
|
+
MIGRATION_COMMANDS[migration_directory]
|
74
|
+
end
|
60
75
|
end
|
61
76
|
end
|
data/lib/hanzo/version.rb
CHANGED
data/spec/cli/deploy_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Hanzo::CLI do
|
|
8
8
|
let(:heroku_remotes) { { 'production' => 'heroku-app-production' } }
|
9
9
|
let(:migration_dir) { 'db/migrate' }
|
10
10
|
|
11
|
-
let(:migration_question) { 'Run migrations?' }
|
11
|
+
let(:migration_question) { 'Run database migrations?' }
|
12
12
|
let(:deploy_question) { "Branch to deploy in #{env}:" }
|
13
13
|
|
14
14
|
let(:migration_cmd) { "heroku run rake db:migrate --remote #{env}" }
|
@@ -25,7 +25,7 @@ describe Hanzo::CLI do
|
|
25
25
|
let(:deploy_result) { true }
|
26
26
|
|
27
27
|
before do
|
28
|
-
expect(Dir).to receive(:exist?).with(
|
28
|
+
expect(Dir).to receive(:exist?).with(instance_of(String)).at_least(:once).and_return(migrations_exist)
|
29
29
|
expect(Hanzo).to receive(:ask).with(deploy_question).and_return(branch)
|
30
30
|
expect(Hanzo).to receive(:run).with(deploy_cmd).once.and_return(deploy_result)
|
31
31
|
end
|
@@ -47,7 +47,7 @@ describe Hanzo::CLI do
|
|
47
47
|
let(:deploy_result) { true }
|
48
48
|
|
49
49
|
before do
|
50
|
-
expect(Dir).to receive(:exist?).with(
|
50
|
+
expect(Dir).to receive(:exist?).with(instance_of(String)).at_least(:once).and_return(migrations_exist)
|
51
51
|
end
|
52
52
|
|
53
53
|
context 'and migrations that should be ran' do
|
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.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Garneau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.4.5
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Hanzo is a tool to handle deployments in multiple environments on Heroku.
|