guard-migrate 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/guard/migrate.rb CHANGED
@@ -72,10 +72,11 @@ module Guard
72
72
 
73
73
  def migrate(paths = [])
74
74
  return if !reset? && paths.empty?
75
- system rake_string if reset?
76
- paths.each do |path|
77
- UI.info "Running #{rake_string(path)}"
78
- system rake_string(path)
75
+ if reset?
76
+ UI.info "Running #{rake_string}"
77
+ system rake_string
78
+ else
79
+ run_all_migrations(paths)
79
80
  end
80
81
  end
81
82
 
@@ -109,6 +110,13 @@ module Guard
109
110
 
110
111
  private
111
112
 
113
+ def run_all_migrations(paths)
114
+ paths.each do |path|
115
+ UI.info "Running #{rake_string(path)}"
116
+ system rake_string(path)
117
+ end
118
+ end
119
+
112
120
  def rake_command
113
121
  command = ""
114
122
  command += "bundle exec " if bundler?
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module MigrateVersion
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
@@ -162,4 +162,13 @@ describe Guard::Migrate do
162
162
  subject.run_on_changes paths
163
163
  end
164
164
  end
165
+
166
+ context "run on change when set to reset should only run migrations one time" do
167
+ let(:paths){ ['db/migrate/1234_i_like_cheese.rb', 'db/migrate/1235_i_really_like_cheese.rb'] }
168
+ let(:options){ {:reset => true, :test_clone => true} }
169
+ it "should run the rake command" do
170
+ subject.should_receive(:system).with(subject.rake_string('1234'))
171
+ subject.run_on_changes paths
172
+ end
173
+ end
165
174
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-migrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-16 00:00:00.000000000 Z
12
+ date: 2012-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: 4308447101882295894
94
+ hash: 4386270104378996894
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements: