guard-migrate 1.2.1 → 2.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 +4 -4
- data/README.rdoc +2 -2
- data/lib/guard/migrate.rb +8 -8
- data/lib/guard/migrate/version.rb +1 -1
- data/spec/guard/migrate_spec.rb +23 -23
- 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: 43814a35f99652db26289e1bf9873e687da2cb76
|
4
|
+
data.tar.gz: e5250a55709fc697336e70f165e1b0e481307699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56b9339b17108a80f8c3252788cd6fbbd1baf99931c1254d56e3dfbe552d96ebc9153d2816768a93f66a4c01dec1f7cbbb2d67c37f4fbbed2f032a487d826da8
|
7
|
+
data.tar.gz: 8bd7d5144f8e730c7c42524ae70a98ca0cc7ac8c955bdcb464c81e44cf55b7aca29aae0e721a328d13c4e5bf7145eabedc99cd7f45689236a5a47a0558908721
|
data/README.rdoc
CHANGED
@@ -33,10 +33,10 @@ Available options:
|
|
33
33
|
* :cmd - this will specify a custom command to run, you can use it to speed up migrations if you use `zeus`, `spring` or simillar in your project. Defaults to `rake`
|
34
34
|
* :bundler - this will prefix the command with `bundle exec` if a Gemfile is present. Defaults to `true`
|
35
35
|
* :run_on_start - this will run the migration task when you start, reload or run all. Defaults to false. If reset is set to true with this, then it will run a reset on the start, reload, run all instead of just a regular migrate
|
36
|
-
* :
|
36
|
+
* :test_prepare - this will run the with the additional `db:test:prepare` to update the test database. Defaults to false.
|
37
37
|
* :reset - this will run `rake db:migrate:reset` every time migrate is run. Defaults to false.
|
38
38
|
* :rails_env - passing this will add "RAILS_ENV=" together with the environment.
|
39
|
-
* :seed - setting this option to true will run seed after migrations. This will also run after test:
|
39
|
+
* :seed - setting this option to true will run seed after migrations. This will also run after test:prepare if that is set to run. Defaults to false.
|
40
40
|
|
41
41
|
== Todos
|
42
42
|
|
data/lib/guard/migrate.rb
CHANGED
@@ -12,7 +12,7 @@ module Guard
|
|
12
12
|
@bundler = true unless options[:bundler] == false
|
13
13
|
@cmd = options[:cmd].to_s unless options[:cmd].to_s.empty?
|
14
14
|
@reset = true if options[:reset] == true
|
15
|
-
@
|
15
|
+
@test_prepare = options[:test_prepare]
|
16
16
|
@run_on_start = true if options[:run_on_start] == true
|
17
17
|
@rails_env = options[:rails_env]
|
18
18
|
@seed = options[:seed]
|
@@ -30,8 +30,8 @@ module Guard
|
|
30
30
|
!!@cmd
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
!!@
|
33
|
+
def test_prepare?
|
34
|
+
!!@test_prepare
|
35
35
|
end
|
36
36
|
|
37
37
|
def reset?
|
@@ -109,7 +109,7 @@ module Guard
|
|
109
109
|
rake_command,
|
110
110
|
migrate_string(version),
|
111
111
|
seed_string,
|
112
|
-
|
112
|
+
prepare_string,
|
113
113
|
rails_env_string
|
114
114
|
].compact.join(' ')
|
115
115
|
end
|
@@ -120,7 +120,7 @@ module Guard
|
|
120
120
|
custom_command,
|
121
121
|
rake_command,
|
122
122
|
seed_string,
|
123
|
-
|
123
|
+
prepare_string,
|
124
124
|
rails_env_string
|
125
125
|
].compact.join(' ')
|
126
126
|
end
|
@@ -158,9 +158,9 @@ module Guard
|
|
158
158
|
"RAILS_ENV=#{rails_env}" if rails_env
|
159
159
|
end
|
160
160
|
|
161
|
-
def
|
162
|
-
return if !
|
163
|
-
'db:test:
|
161
|
+
def prepare_string
|
162
|
+
return if !test_prepare? || custom_command.to_s.match(/db:test:prepare/)
|
163
|
+
'db:test:prepare'
|
164
164
|
end
|
165
165
|
|
166
166
|
def seed_string
|
data/spec/guard/migrate_spec.rb
CHANGED
@@ -113,12 +113,12 @@ RSpec.describe Guard::Migrate do
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
context 'with duplication of db:test:
|
117
|
-
let(:options) { { cmd: 'custom command rake db:test:
|
116
|
+
context 'with duplication of db:test:prepare' do
|
117
|
+
let(:options) { { cmd: 'custom command rake db:test:prepare' } }
|
118
118
|
|
119
119
|
context 'rake_string' do
|
120
|
-
it "should contains 'db:test:
|
121
|
-
expect(subject.rake_string.scan('db:test:
|
120
|
+
it "should contains 'db:test:prepare' once" do
|
121
|
+
expect(subject.rake_string.scan('db:test:prepare').size).to eq(1)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
@@ -126,10 +126,10 @@ RSpec.describe Guard::Migrate do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
context 'test
|
129
|
+
context 'test prepare' do
|
130
130
|
context 'with no options passed' do
|
131
|
-
describe '#
|
132
|
-
subject { super().
|
131
|
+
describe '#test_prepare?' do
|
132
|
+
subject { super().test_prepare? }
|
133
133
|
it { is_expected.to be_falsey }
|
134
134
|
end
|
135
135
|
|
@@ -140,15 +140,15 @@ RSpec.describe Guard::Migrate do
|
|
140
140
|
|
141
141
|
describe '#rake_string' do
|
142
142
|
subject { super().rake_string }
|
143
|
-
it { is_expected.not_to match(/db:test:
|
143
|
+
it { is_expected.not_to match(/db:test:prepare/) }
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
147
|
context 'when passed false' do
|
148
|
-
let(:options) { {
|
148
|
+
let(:options) { { test_prepare: false } }
|
149
149
|
|
150
|
-
describe '#
|
151
|
-
subject { super().
|
150
|
+
describe '#test_prepare?' do
|
151
|
+
subject { super().test_prepare? }
|
152
152
|
it { is_expected.to be_falsey }
|
153
153
|
end
|
154
154
|
|
@@ -159,15 +159,15 @@ RSpec.describe Guard::Migrate do
|
|
159
159
|
|
160
160
|
describe '#rake_string' do
|
161
161
|
subject { super().rake_string }
|
162
|
-
it { is_expected.not_to match(/db:test:
|
162
|
+
it { is_expected.not_to match(/db:test:prepare/) }
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
166
|
context 'when passed true' do
|
167
|
-
let(:options) { {
|
167
|
+
let(:options) { { test_prepare: true } }
|
168
168
|
|
169
|
-
describe '#
|
170
|
-
subject { super().
|
169
|
+
describe '#test_prepare?' do
|
170
|
+
subject { super().test_prepare? }
|
171
171
|
it { is_expected.to be_truthy }
|
172
172
|
end
|
173
173
|
|
@@ -178,7 +178,7 @@ RSpec.describe Guard::Migrate do
|
|
178
178
|
|
179
179
|
describe '#rake_string' do
|
180
180
|
subject { super().rake_string }
|
181
|
-
it { is_expected.to match(/db:test:
|
181
|
+
it { is_expected.to match(/db:test:prepare/) }
|
182
182
|
end
|
183
183
|
end
|
184
184
|
end
|
@@ -322,21 +322,21 @@ RSpec.describe Guard::Migrate do
|
|
322
322
|
end
|
323
323
|
end
|
324
324
|
|
325
|
-
context 'when seed is set to true and
|
326
|
-
let(:options) { { seed: true,
|
327
|
-
it 'runs the seed option before the
|
328
|
-
expect(subject.rake_string).to match(/db:seed.*db:test:
|
325
|
+
context 'when seed is set to true and prepare is set to true' do
|
326
|
+
let(:options) { { seed: true, test_prepare: true } }
|
327
|
+
it 'runs the seed option before the prepare option' do
|
328
|
+
expect(subject.rake_string).to match(/db:seed.*db:test:prepare/)
|
329
329
|
end
|
330
330
|
end
|
331
331
|
end
|
332
332
|
|
333
333
|
context 'when the seeds file is passed as the paths' do
|
334
334
|
let(:paths) { ['db/seeds.rb'] }
|
335
|
-
let(:options) { { seed: true,
|
335
|
+
let(:options) { { seed: true, test_prepare: true } }
|
336
336
|
|
337
337
|
describe '#seed_only_string' do
|
338
338
|
subject { super().seed_only_string }
|
339
|
-
it { is_expected.to match(/db:seed db:test:
|
339
|
+
it { is_expected.to match(/db:seed db:test:prepare/) }
|
340
340
|
end
|
341
341
|
|
342
342
|
it 'runs the rake command with seed only' do
|
@@ -375,7 +375,7 @@ RSpec.describe Guard::Migrate do
|
|
375
375
|
|
376
376
|
context 'run on change when set to reset should only run migrations one time' do
|
377
377
|
let(:paths) { [create_valid_up_and_down_migration('1234_i_like_cheese').path, create_valid_change_migration('1235_i_like_cheese').path] }
|
378
|
-
let(:options) { { reset: true,
|
378
|
+
let(:options) { { reset: true, test_prepare: true } }
|
379
379
|
it 'should run the rake command' do
|
380
380
|
expect(subject).to receive(:system).with(subject.rake_string('1234'))
|
381
381
|
allow(Guard::Compat::UI).to receive(:info)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-migrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Lanotte
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: 1.3.6
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project: guard-migrate
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.6.10
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Guard gem for rails migrations
|