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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93d6a00e2896f8ff62dff58d34e84ea54f71a890
4
- data.tar.gz: 839677fa461fd1ba75b13167bb6ef9cd703a4fc7
3
+ metadata.gz: b40f700ae380cc1cc75ba7add3baf08646b4fdf0
4
+ data.tar.gz: 900d2ff1f03061a3b81b5091151e90ef338db30b
5
5
  SHA512:
6
- metadata.gz: ccac16c207e2766dffb85da326f78aaebd47fd8d7957ccb66f5fc4e8951f3014ae44a9cd952607d10aa00ffe84aecfc01a337ea9caa85cb33006f06809067f0f
7
- data.tar.gz: 4cdabf8e177ce1c108c63410005d9aa27eac6a2faab33f39477355e9db8f475e6fe029a32e2329e50b23d4f86596280dec9378406b227930c2341034dcecf29e
6
+ metadata.gz: 1b0fc7d71e7d32343d2d5d69abec05c811f9f0863ef8e6ba89d37d32ea3ad9a89be544a35cde264a4ea7ffbb5c7db02576f0312bbd5001cbc3be939b39d0987e
7
+ data.tar.gz: 1f09a35f138aa307e3d4bc76088710192727922c6186546c0a543ae4b7b129c4ff195e095186d02ed1cd75b86040fe0273f7d18bd2d859fd54b00d275e080fab
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.1.5
4
+ - 2.2.2
5
+ - 2.3.1
6
+
7
+ sudo: false
5
8
 
6
9
  script: "echo 'DO IT' && bundle exec rake spec"
7
10
 
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014, Mirego
1
+ Copyright (c) 2014-2016, Mirego
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
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', '>= 4', '< 5'
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
- extend ActiveSupport::Concern
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
- table_without_sane_alignment(table, stream)
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.send(:include, ActiveRecord::SaneSchemaDumper::Extension)
9
+ ActiveRecord::SchemaDumper.prepend(ActiveRecord::SaneSchemaDumper::Extension)
10
10
  end
11
11
  end
12
12
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module SaneSchemaDumper
3
- VERSION = '0.2'.freeze
3
+ VERSION = '1.0'.freeze
4
4
  end
5
5
  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.send(:include, ActiveRecord::SaneSchemaDumper::Extension)
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: true do |t|
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
- allow_any_instance_of(ActiveRecord::SchemaDumper).to receive(:table) do |instance, *args|
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: true do |t|
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.2'
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: 2014-11-28 00:00:00.000000000 Z
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: '4'
103
+ version: '5'
104
104
  - - "<"
105
105
  - !ruby/object:Gem::Version
106
- version: '5'
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: '4'
113
+ version: '5'
114
114
  - - "<"
115
115
  - !ruby/object:Gem::Version
116
- version: '5'
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: '0'
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.2.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’