activerecord_sane_schema_dumper 0.2 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/LICENSE.md +1 -1
- data/README.md +1 -1
- data/activerecord_sane_schema_dumper.gemspec +3 -1
- data/lib/active_record/sane_schema_dumper/extension.rb +2 -8
- data/lib/active_record/sane_schema_dumper/railtie.rb +1 -1
- data/lib/active_record/sane_schema_dumper/version.rb +1 -1
- data/spec/activerecord_sane_schema_dumper_spec.rb +4 -6
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b40f700ae380cc1cc75ba7add3baf08646b4fdf0
|
4
|
+
data.tar.gz: 900d2ff1f03061a3b81b5091151e90ef338db30b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b0fc7d71e7d32343d2d5d69abec05c811f9f0863ef8e6ba89d37d32ea3ad9a89be544a35cde264a4ea7ffbb5c7db02576f0312bbd5001cbc3be939b39d0987e
|
7
|
+
data.tar.gz: 1f09a35f138aa307e3d4bc76088710192727922c6186546c0a543ae4b7b129c4ff195e095186d02ed1cd75b86040fe0273f7d18bd2d859fd54b00d275e080fab
|
data/.travis.yml
CHANGED
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -81,7 +81,7 @@ One removed column, one affected line in the table definition. Much better.
|
|
81
81
|
|
82
82
|
## License
|
83
83
|
|
84
|
-
`ActiveRecord::SaneSchemaDumper` is © 2014 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/activerecord_sane_schema_dumper/blob/master/LICENSE.md) file.
|
84
|
+
`ActiveRecord::SaneSchemaDumper` is © 2014-2016 [Mirego](http://www.mirego.com) and may be freely distributed under the [New BSD license](http://opensource.org/licenses/BSD-3-Clause). See the [`LICENSE.md`](https://github.com/mirego/activerecord_sane_schema_dumper/blob/master/LICENSE.md) file.
|
85
85
|
|
86
86
|
## About Mirego
|
87
87
|
|
@@ -25,5 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
26
26
|
spec.add_development_dependency 'pg'
|
27
27
|
|
28
|
-
spec.add_dependency 'rails', '>=
|
28
|
+
spec.add_dependency 'rails', '>= 5', '< 6'
|
29
|
+
|
30
|
+
spec.required_ruby_version = '>= 2.2.2'
|
29
31
|
end
|
@@ -1,16 +1,10 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
module SaneSchemaDumper
|
3
3
|
module Extension
|
4
|
-
|
5
|
-
|
6
|
-
included do
|
7
|
-
alias_method_chain :table, :sane_alignment
|
8
|
-
end
|
9
|
-
|
10
|
-
def table_with_sane_alignment(table, main_stream)
|
4
|
+
def table(table, main_stream)
|
11
5
|
# Call the original method to populate our custom stream
|
12
6
|
stream = StringIO.new
|
13
|
-
|
7
|
+
super(table, stream)
|
14
8
|
|
15
9
|
# Rewind the stream and remove useless whitespace
|
16
10
|
content = stream.tap(&:rewind).read.gsub(/(?<!^)(?<!\s)[ ]{2,}/, ' ')
|
@@ -6,7 +6,7 @@ module ActiveRecord
|
|
6
6
|
class Railtie < Rails::Railtie
|
7
7
|
initializer 'activerecord_sane_schema_dumper.active_record' do
|
8
8
|
ActiveSupport.on_load :active_record do
|
9
|
-
ActiveRecord::SchemaDumper.
|
9
|
+
ActiveRecord::SchemaDumper.prepend(ActiveRecord::SaneSchemaDumper::Extension)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -21,12 +21,12 @@ describe ActiveRecord::SaneSchemaDumper do
|
|
21
21
|
|
22
22
|
context 'with SaneSchemaDumper behavior' do
|
23
23
|
before do
|
24
|
-
ActiveRecord::SchemaDumper.
|
24
|
+
ActiveRecord::SchemaDumper.prepend(ActiveRecord::SaneSchemaDumper::Extension)
|
25
25
|
end
|
26
26
|
|
27
27
|
let(:expected_table) do
|
28
28
|
<<EOF
|
29
|
-
create_table "users", force:
|
29
|
+
create_table "users", force: :cascade do |t|
|
30
30
|
t.string "name", limit: 100
|
31
31
|
t.text "profile"
|
32
32
|
t.datetime "created_at", null: false
|
@@ -40,14 +40,12 @@ EOF
|
|
40
40
|
|
41
41
|
context 'without SaneSchemaDumper behavior' do
|
42
42
|
before do
|
43
|
-
|
44
|
-
instance.send :table_without_sane_alignment, *args
|
45
|
-
end
|
43
|
+
ActiveRecord::SaneSchemaDumper::Extension.send(:remove_method, :table)
|
46
44
|
end
|
47
45
|
|
48
46
|
let(:expected_table) do
|
49
47
|
<<EOF
|
50
|
-
create_table "users", force:
|
48
|
+
create_table "users", force: :cascade do |t|
|
51
49
|
t.string "name", limit: 100
|
52
50
|
t.text "profile"
|
53
51
|
t.datetime "created_at", null: false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_sane_schema_dumper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0
|
4
|
+
version: '1.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémi Prévost
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,20 +100,20 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '5'
|
104
104
|
- - "<"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: '
|
106
|
+
version: '6'
|
107
107
|
type: :runtime
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
113
|
+
version: '5'
|
114
114
|
- - "<"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '6'
|
117
117
|
description: ActiveRecord::SaneSchemaDumper removes useless/harmful whitespace from
|
118
118
|
Rails’ generated `db/schema.rb` files.
|
119
119
|
email:
|
@@ -150,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
150
|
requirements:
|
151
151
|
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
153
|
+
version: 2.2.2
|
154
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - ">="
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.5.1
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: ActiveRecord::SaneSchemaDumper removes useless/harmful whitespace from Rails’
|