squasher 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0778a1404502d52c05ea708ff823f10b2b8a832
4
- data.tar.gz: 2f22c623c7b578290366930e5c325ebc1f28506e
3
+ metadata.gz: b2fce68be416351e406504bff0a9e0e8b973e3c6
4
+ data.tar.gz: 078725cc2be6f257b3b2b6523223875d4478abb2
5
5
  SHA512:
6
- metadata.gz: 502c4b9e2b6545473aa2804fda03f5d0a00f90952c11600b8c109057ed08e19a909b649a93563609bc97fd5391ce6baf6d5642a2da371d0d67c3d4e4cacfefa6
7
- data.tar.gz: 1cec4959ad6c7ac08b52fcb8be657efc0f857ab772f6e81653b58ecbd3a1e21fb935d6feea0079e71fad001ecbdbe1ac093e1f21fa07eebed5c88a29d4cbda50
6
+ metadata.gz: e62d6daf9a6b5fbc60cb9627b6eb1645db98c937fa9c0a898158828f42822dd6e3b38d8640a1e929ab6e77aab0afc22ce01632368ec8a22960153ee51598ed81
7
+ data.tar.gz: 3443e9e4ae4061224c4a4d4a8d8e1605c398d0f73aaae56e3d2269a859c5acaf96df7167af2c00f83c2854a8cd5adfeec5746a878986adbbd14218af854b17e1
@@ -1,3 +1,5 @@
1
+ before_install:
2
+ - gem update bundler
1
3
  language: ruby
2
4
  rvm:
3
5
  - 2.1.0
data/README.md CHANGED
@@ -41,6 +41,10 @@ You can tell `squasher` a more detailed date, for example:
41
41
  It works and was tested on Ruby 1.9.3+ and Rails 3.1+. It also requires a valid configuration in `config/database.yml` and using Ruby format in `db/schema.rb` (default Rails use-case).
42
42
  If an old migration inserted data (created ActiveRecord model records) you will lose this code in the squashed migration, **BUT** `squasher` will ask you to leave a tmp database which will have all data that was inserted while migrating. Using this database you could add that data as another migration, or into `config/seed.rb` (the expected place for this stuff).
43
43
 
44
+ ## Changelog
45
+ - 0.1.6
46
+ - support multiple database settings ([@ppworks](https://github.com/ppworks))
47
+
44
48
  ## Contributing
45
49
 
46
50
  1. Fork it
@@ -18,7 +18,7 @@ module Squasher
18
18
 
19
19
  def rake(command, description = nil)
20
20
  tell(description) if description
21
- system("bundle exec rake #{ command }")
21
+ system("bundle exec rake #{ command } 2>/dev/null")
22
22
  end
23
23
 
24
24
  def ask(*args)
@@ -68,18 +68,14 @@ module Squasher
68
68
  return @dbconfig = nil unless File.exists?(dbconfig_file)
69
69
 
70
70
  begin
71
- content = ERB.new(File.read(dbconfig_file)).result(binding)
72
- @dbconfig = YAML.load(content)['development']
71
+ content = File.read(dbconfig_file).gsub(/database: (.+)/, 'database: squasher')
72
+ parsed_content = ERB.new(content).result(binding)
73
+ @dbconfig = YAML.load(parsed_content)
74
+ @dbconfig = nil unless @dbconfig.keys.include?('development')
73
75
  rescue
74
76
  @dbconfig = nil
75
77
  end
76
-
77
- if @dbconfig && !@dbconfig.empty?
78
- @dbconfig['database'] = 'squasher'
79
- @dbconfig = { 'development' => @dbconfig }
80
- else
81
- @dbconfig = nil
82
- end
78
+ @dbconfig
83
79
  end
84
80
 
85
81
  def update_dbconfig_file
@@ -1,3 +1,3 @@
1
1
  module Squasher
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -7,3 +7,12 @@ test:
7
7
  database: app_test
8
8
  user: root
9
9
  password: password
10
+ another_development:
11
+ database: another_development
12
+ encoding: <%= "8-ftu".reverse %>
13
+ user: root
14
+ password: password
15
+ another_test:
16
+ database: another_test
17
+ user: root
18
+ password: password
@@ -30,6 +30,8 @@ describe Squasher::Config do
30
30
  content = YAML.load(stream.read)
31
31
  expect(content["development"]["database"]).to eq("squasher")
32
32
  expect(content["development"]["encoding"]).to eq("utf-8")
33
+ expect(content["another_development"]["database"]).to eq("squasher")
34
+ expect(content["another_development"]["encoding"]).to eq("utf-8")
33
35
  end
34
36
  end
35
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squasher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Pchelincev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-23 00:00:00.000000000 Z
11
+ date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler