squasher 0.5.1 → 0.5.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: 3d724bebcea027694c4fd7ae07faefc4e640cd9d
4
- data.tar.gz: d7b96e31bb8f2c6bf26ffbad436502e1763a27cc
3
+ metadata.gz: 1d4dc03c57562e0746d36aebe4a6a8634197d8c9
4
+ data.tar.gz: a83619cd0c416384c4a818a71350d0c589b13c57
5
5
  SHA512:
6
- metadata.gz: 576496807d697dfaf1498c6fc63f4b743a5c663efb1559ed477bae63f1b5ad7b9ee9722244fdc2cd2e7b07ee014ec6eba2f7021b56b4f5c9da1b9bff4876861d
7
- data.tar.gz: 462a6477e481b454d5eac1f723a46a37cabb4893dd63b774c34582c2f8293d89aa48c24fef88c696831d0ed6f5e34f454e3ddfc15cb82ac5df6b28fbf476e7f2
6
+ metadata.gz: 5fd8a985155c33c59d532510fe31a3986cad7aaa98584d41afecd17b4b74d0e0ce4c7f7749939a87e0e1b4c9ffc68ab5c64ec44d29e1b9953833b42c2eac091a
7
+ data.tar.gz: 6516143788c78bb5b959467282bc126981c6065fb4fab37270da8c8c274fb74a3e04d36ed2acdda6b5c5782f5296254fabc7d2ff6cbd88cc8012e5d06b90c715
@@ -16,7 +16,11 @@ parser = OptionParser.new do |config|
16
16
  options[:reuse] = true
17
17
  end
18
18
 
19
- config.on('-e', '--engine=PATH') do |value|
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, options)
31
- when 'clean' then Squasher.clean(options)
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
@@ -11,15 +11,17 @@ module Squasher
11
11
 
12
12
  @config = Config.new
13
13
 
14
- def squash(raw_date, options)
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(options)
22
- options.each { |(k, v)| config.set(k, v) }
24
+ def clean
23
25
  Cleaner.process
24
26
  end
25
27
 
@@ -1,3 +1,3 @@
1
1
  module Squasher
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
File without changes
@@ -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)
@@ -7,7 +7,7 @@ describe Squasher do
7
7
 
8
8
  def expected_covert(input, expected)
9
9
  expect(Squasher::Worker).to receive(:process).with(expected)
10
- Squasher.squash(input, [])
10
+ Squasher.squash(input)
11
11
  end
12
12
  end
13
13
 
@@ -21,4 +21,8 @@ Bundler.require
21
21
  RSpec.configure do |config|
22
22
  config.order = 'random'
23
23
  config.include SpecHelpers
24
+
25
+ config.mock_with :rspec do |mocks|
26
+ mocks.verify_partial_doubles = true
27
+ end
24
28
  end
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.1
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