squasher 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/squasher +8 -3
- data/lib/squasher.rb +6 -4
- data/lib/squasher/version.rb +1 -1
- data/spec/fake_app/config/application.rb +0 -0
- data/spec/lib/cleaner_spec.rb +2 -2
- data/spec/lib/squasher_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d4dc03c57562e0746d36aebe4a6a8634197d8c9
|
4
|
+
data.tar.gz: a83619cd0c416384c4a818a71350d0c589b13c57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fd8a985155c33c59d532510fe31a3986cad7aaa98584d41afecd17b4b74d0e0ce4c7f7749939a87e0e1b4c9ffc68ab5c64ec44d29e1b9953833b42c2eac091a
|
7
|
+
data.tar.gz: 6516143788c78bb5b959467282bc126981c6065fb4fab37270da8c8c274fb74a3e04d36ed2acdda6b5c5782f5296254fabc7d2ff6cbd88cc8012e5d06b90c715
|
data/bin/squasher
CHANGED
@@ -16,7 +16,11 @@ parser = OptionParser.new do |config|
|
|
16
16
|
options[:reuse] = true
|
17
17
|
end
|
18
18
|
|
19
|
-
config.on('-e'
|
19
|
+
config.on('-e') do
|
20
|
+
options[:engine] = nil
|
21
|
+
end
|
22
|
+
|
23
|
+
config.on('--engine=PATH') do |value|
|
20
24
|
options[:engine] = value
|
21
25
|
end
|
22
26
|
|
@@ -26,9 +30,10 @@ parser = OptionParser.new do |config|
|
|
26
30
|
end
|
27
31
|
parser.parse!
|
28
32
|
|
33
|
+
Squasher.setup(options)
|
29
34
|
case ARGV.first
|
30
|
-
when /\A\d{4}/ then Squasher.squash(ARGV.first
|
31
|
-
when 'clean' then Squasher.clean
|
35
|
+
when /\A\d{4}/ then Squasher.squash(ARGV.first)
|
36
|
+
when 'clean' then Squasher.clean
|
32
37
|
else
|
33
38
|
Squasher.tell(:usage, version: Squasher::VERSION)
|
34
39
|
end
|
data/lib/squasher.rb
CHANGED
@@ -11,15 +11,17 @@ module Squasher
|
|
11
11
|
|
12
12
|
@config = Config.new
|
13
13
|
|
14
|
-
def
|
14
|
+
def setup(options)
|
15
|
+
options.each { |(k, v)| config.set(k, v) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def squash(raw_date)
|
15
19
|
parts = raw_date.to_s.split('/').map(&:to_i)
|
16
20
|
date = Time.new(*parts)
|
17
|
-
options.each { |(k, v)| config.set(k, v) }
|
18
21
|
Worker.process(date)
|
19
22
|
end
|
20
23
|
|
21
|
-
def clean
|
22
|
-
options.each { |(k, v)| config.set(k, v) }
|
24
|
+
def clean
|
23
25
|
Cleaner.process
|
24
26
|
end
|
25
27
|
|
data/lib/squasher/version.rb
CHANGED
File without changes
|
data/spec/lib/cleaner_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Squasher::Cleaner do
|
|
15
15
|
|
16
16
|
it 'create a new migration' do
|
17
17
|
allow_any_instance_of(Squasher::Cleaner).to receive(:prev_migration).and_return(nil)
|
18
|
-
Squasher.clean
|
18
|
+
Squasher.clean
|
19
19
|
|
20
20
|
expect(clean_migrations).to include(expected_file)
|
21
21
|
File.open(expected_file) do |stream|
|
@@ -25,7 +25,7 @@ describe Squasher::Cleaner do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'update an existing migration' do
|
28
|
-
Squasher.clean
|
28
|
+
Squasher.clean
|
29
29
|
|
30
30
|
expect(clean_migrations.size).to be(1)
|
31
31
|
expect(clean_migrations.first).to eq(expected_file)
|
data/spec/lib/squasher_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squasher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Pchelintsev
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/squasher/templates/squasher_clean.rb.erb
|
77
77
|
- lib/squasher/version.rb
|
78
78
|
- lib/squasher/worker.rb
|
79
|
+
- spec/fake_app/config/application.rb
|
79
80
|
- spec/fake_app/config/database.yml
|
80
81
|
- spec/fake_app/config/invalid_database.yml
|
81
82
|
- spec/fake_app/db/migrate/20131205160936_first_migration.rb
|
@@ -114,6 +115,7 @@ signing_key:
|
|
114
115
|
specification_version: 4
|
115
116
|
summary: Squash your old migrations
|
116
117
|
test_files:
|
118
|
+
- spec/fake_app/config/application.rb
|
117
119
|
- spec/fake_app/config/database.yml
|
118
120
|
- spec/fake_app/config/invalid_database.yml
|
119
121
|
- spec/fake_app/db/migrate/20131205160936_first_migration.rb
|