db-migrate 0.2.1 → 0.2.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: 6ae6c6492a442ab6fa756c01499bc6fc81d2aa2e
4
- data.tar.gz: 3cf19498e617936ffa92e44f6ac1f78ca7cf8e72
3
+ metadata.gz: 42acbadfd251338d4cc0057c37ea5a26ebfe8ccb
4
+ data.tar.gz: bc59c6d021cdbd64afa73194798f418079faad35
5
5
  SHA512:
6
- metadata.gz: 515868059766ce618c04f031cd336a7f7335718dab876660224d643b2c3e87217bb47f18904010233df7181e8f791af82363e1c02f772deed123be2470acd4de
7
- data.tar.gz: 757b86fea6a8c192599057930f93fbb76083550f575a46b5e4010c00cdbfea9f87170b693f1092f866f350540aa127914db9092b8903aa3bfdf5c17bfaa10af9
6
+ metadata.gz: 6888cfd65e6ea9fbe5665dc7e8358d3ff18e4f29b0444935497a1ce105014bc88b9b38fbd5f39aa14da3d7ff203579112b9e6c23fdd8423e377b4ae75ca5e56e
7
+ data.tar.gz: 1c9a64b485ffbe5cc8c5ea81d781961c0263a100fe196dec0f6b45864f6088cb01588359cebb4d8b0954629289cd13278563f7082c32b9821c6927a5769975e2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- db-migrate (0.2.1)
4
+ db-migrate (0.2.2)
5
5
  colorize (= 0.7.7)
6
6
  highline (= 1.7.8)
7
7
  json (= 1.8.3)
@@ -24,7 +24,7 @@ GEM
24
24
  rspec-core (~> 3.4.0)
25
25
  rspec-expectations (~> 3.4.0)
26
26
  rspec-mocks (~> 3.4.0)
27
- rspec-core (3.4.2)
27
+ rspec-core (3.4.3)
28
28
  rspec-support (~> 3.4.0)
29
29
  rspec-expectations (3.4.0)
30
30
  diff-lcs (>= 1.2.0, < 2.0)
data/README.md CHANGED
@@ -10,6 +10,7 @@ gem install db-migrate
10
10
  ```
11
11
 
12
12
  If you are going to use for example Postgres with **migrate**, make sure that you have Postgresql server running.
13
+ **migrate** is using lazy installation of database specific gems, so it will install `pg` or `mysql2` (if they are not installed already) gem when you choose database type. It is recommended that you install them manually ([officialy-supported-versions](https://github.com/ivpusic/migrate/blob/master/bin/migrate#L13)).
13
14
 
14
15
  ## Demo
15
16
  ![img](http://i.giphy.com/26tPaeasgQYU2mCoE.gif)
@@ -30,6 +30,7 @@ class CLI < Thor
30
30
 
31
31
  if @config.exists?
32
32
  @config.load!
33
+ CLI.install_deps(@config.storage)
33
34
  @migrator = Migrator.new(@config)
34
35
  elsif not init_invoked
35
36
  Log.error("Configuration not found in `#{Pathname.new(@config.root).expand_path}`. " \
@@ -39,6 +40,31 @@ class CLI < Thor
39
40
  end
40
41
  end
41
42
 
43
+ def self.install_deps(storage)
44
+ install_dep = ""
45
+ case storage
46
+ when "pg"
47
+ if `gem list -i pg`.to_b != true
48
+ install_dep = "gem install pg -v #{@@pg_version}"
49
+ Log.info "pg package not installed. Will install it."
50
+ end
51
+ when "mysql"
52
+ if `gem list -i mysql2`.to_b != "true"
53
+ install_dep = "gem install mysql2 -v #{@@mysql_version}"
54
+ Log.info "mysql2 package not installed. Will install it."
55
+ end
56
+ end
57
+
58
+ unless install_dep.empty?
59
+ Log.info "Running '#{install_dep}'"
60
+ unless system(install_dep)
61
+ raise "Wrror while install dependencies. Please try to run '#{install_dep}' manually and try running 'init' again."
62
+ else
63
+ Log.info "Missing dependencies installed"
64
+ end
65
+ end
66
+ end
67
+
42
68
  desc "init", "make configuration file"
43
69
  def init
44
70
  generated_config = false
@@ -55,28 +81,7 @@ class CLI < Thor
55
81
  menu.choices(:pg) { storage = "pg" }
56
82
  end
57
83
 
58
- install_dep = ""
59
- case storage
60
- when "pg"
61
- if `gem list -i pg`.to_b != true
62
- install_dep = "gem install pg -v #{@@pg_version}"
63
- Log.info "pg package not installed. Will install it."
64
- end
65
- when "mysql"
66
- if `gem list -i mysql2`.to_b != "true"
67
- install_dep = "gem install mysql2 -v #{@@mysql_version}"
68
- Log.info "mysql2 package not installed. Will install it."
69
- end
70
- end
71
-
72
- unless install_dep.empty?
73
- Log.info "Running '#{install_dep}'"
74
- unless system(install_dep)
75
- raise "Wrror while install dependencies. Please try to run '#{install_dep}' manually and try running 'init' again."
76
- else
77
- Log.info "Missing dependencies installed"
78
- end
79
- end
84
+ CLI.install_deps(storage)
80
85
 
81
86
  db_defaults = case storage
82
87
  when "mysql"
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'db-migrate'
3
- s.version = '0.2.1'
3
+ s.version = '0.2.2'
4
4
  s.licenses = ['MIT']
5
5
  s.summary = "Tool for managing and executing your database migrations."
6
6
  s.description = "#{s.summary} It supports multiple databases and multiple languages for writing migration scripts."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db-migrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Pusic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-14 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor