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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5bf18b51a540cd3579bf82622bfd45fc4f034449
4
- data.tar.gz: af91b4057463254d56c85702720fd50e7c99148c
3
+ metadata.gz: 95dcbdcf0dc439565c0e0e11fd23bbebb0af3019
4
+ data.tar.gz: 4a3d79e25f7504b737e2bf040f3c7a04573b7381
5
5
  SHA512:
6
- metadata.gz: 98700c6b8a43094637a57ba492730ba12894e213ec6cd59b30b1f6ee40d8823ad23a968147b9ecfb5e7687bad8c78cfb064a07332429b82e1d00140311f9a0d1
7
- data.tar.gz: a0ddffdf1bac4fd26f7b6cb618f887a60ef25ef70238d492777448f4e1d8bfc3183e0b09e094c752b53cb51aec0c571573cd4b75f12b8b8f0f3594a22e63d615
6
+ metadata.gz: 84e4637277a29e7522827dcfeeb6618579c4674990aa1fab55237e8f6d651470663306f125f41ffe31eae2cc986dc5445dd221ad5180532347114f0324bba0bf
7
+ data.tar.gz: 3b21fad59f6a83a2f36c2a877526a2dca37ef7661b41b58c5b7afdec262e8ae836ff7dc66a94e2e83bfadc92561a8fa2a05b808f3ee9f3df21a0210a1cfd200b
data/.travis.yml CHANGED
@@ -1,8 +1,10 @@
1
+ sudo: false
2
+
1
3
  language: ruby
2
4
 
3
5
  rvm:
4
- - 2.1.2
5
- - 2.0.0
6
- - 1.9.3
6
+ - 2.2
7
+ - 2.1
8
+ - 2.0
7
9
 
8
10
  script: "echo 'DO IT' && bundle exec rake spec"
data/lib/hanzo/base.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Hanzo
2
2
  class Base
3
+ # Accessors
3
4
  attr_accessor :options
4
5
 
5
6
  def initialize(args)
@@ -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 unless Dir.exist?('db/migrate')
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 rake db:migrate --remote #{@env}"
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
@@ -3,6 +3,7 @@ require 'hanzo/modules/installers/labs'
3
3
 
4
4
  module Hanzo
5
5
  class Install < Base
6
+ # Mixins
6
7
  include Hanzo::Installers::Remotes
7
8
  include Hanzo::Installers::Labs
8
9
 
data/lib/hanzo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hanzo
2
- VERSION = '0.4.3'
2
+ VERSION = '0.4.4'
3
3
  end
@@ -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(migration_dir).and_return(migrations_exist)
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(migration_dir).and_return(migrations_exist)
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.3
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-04-14 00:00:00.000000000 Z
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.2.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.