squasher 0.1.5 → 0.1.6
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/.travis.yml +2 -0
- data/README.md +4 -0
- data/lib/squasher.rb +1 -1
- data/lib/squasher/config.rb +5 -9
- data/lib/squasher/version.rb +1 -1
- data/spec/fake_app/config/database.yml +9 -0
- data/spec/lib/squasher/config_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2fce68be416351e406504bff0a9e0e8b973e3c6
|
4
|
+
data.tar.gz: 078725cc2be6f257b3b2b6523223875d4478abb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e62d6daf9a6b5fbc60cb9627b6eb1645db98c937fa9c0a898158828f42822dd6e3b38d8640a1e929ab6e77aab0afc22ce01632368ec8a22960153ee51598ed81
|
7
|
+
data.tar.gz: 3443e9e4ae4061224c4a4d4a8d8e1605c398d0f73aaae56e3d2269a859c5acaf96df7167af2c00f83c2854a8cd5adfeec5746a878986adbbd14218af854b17e1
|
data/.travis.yml
CHANGED
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
|
data/lib/squasher.rb
CHANGED
data/lib/squasher/config.rb
CHANGED
@@ -68,18 +68,14 @@ module Squasher
|
|
68
68
|
return @dbconfig = nil unless File.exists?(dbconfig_file)
|
69
69
|
|
70
70
|
begin
|
71
|
-
content =
|
72
|
-
|
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
|
data/lib/squasher/version.rb
CHANGED
@@ -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.
|
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:
|
11
|
+
date: 2016-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|