nilify_blanks 1.1.0 → 1.2.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 147eedddbcf8457a7c757412cce81940c86d1fb6
4
+ data.tar.gz: 450434dcb83a650cdd55888ade81446cdfbd83e5
5
+ SHA512:
6
+ metadata.gz: bb52fe0798a8626942bd7838001e14b645566f0b2c75698b5cd54e76962c6ebb2bf2bf0bcf7a0eb8c68c7686b679a76701f12e2917e89d15d0bcfa243a2dea4c
7
+ data.tar.gz: 86251ee4ce3b7972fab0890891092ff3fa4c2d5f8201cfc3e4e2a4e0f0ba5bda870ebbb2e06b19f54b1b36c7559c37f1f375f0b59dca02c2b9f272c9c41c5333
data/Appraisals CHANGED
@@ -11,5 +11,13 @@ appraise "3.2" do
11
11
  end
12
12
 
13
13
  appraise "4.0" do
14
- gem "rails", "~> 4.0.0"
14
+ gem "rails", "~> 4.0.12"
15
+ end
16
+
17
+ appraise "4.1" do
18
+ gem "rails", "~> 4.1.8"
19
+ end
20
+
21
+ appraise "4.2" do
22
+ gem "rails", "~> 4.2.0"
15
23
  end
@@ -1,3 +1,16 @@
1
+ == [2014-07-04] 1.2.0
2
+
3
+ * Drop support for ruby 1.8.7 and 1.9.2 - too many issues with backwards-compatibility
4
+ * Explicit support for Rails 4.1 and 4.2
5
+ * Up-to-date Appraisals and dependencies
6
+
7
+ == [2014-07-04] 1.1.0
8
+
9
+ * Implement new mechanism to allow for global usage at ActiveRecord::Base level (or namespaced base model)
10
+ * Make define_nilify_blanks thread safe
11
+ * New rspec matchers with: require "nilify_blanks/matchers"
12
+ * Only consider string and text columns, and allow types option to configure
13
+
1
14
  == [2013-11-09] 1.0.4
2
15
 
3
16
  * Fix issues with wrapping define_attribute_methods in jruby on Rails 4 (Thanks, tank157)
@@ -1,36 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nilify_blanks (1.1.0)
4
+ nilify_blanks (1.2.0)
5
5
  activerecord (>= 3.0.0)
6
6
  activesupport (>= 3.0.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- activemodel (4.1.1)
12
- activesupport (= 4.1.1)
11
+ activemodel (4.2.0)
12
+ activesupport (= 4.2.0)
13
13
  builder (~> 3.1)
14
- activerecord (4.1.1)
15
- activemodel (= 4.1.1)
16
- activesupport (= 4.1.1)
17
- arel (~> 5.0.0)
18
- activesupport (4.1.1)
19
- i18n (~> 0.6, >= 0.6.9)
14
+ activerecord (4.2.0)
15
+ activemodel (= 4.2.0)
16
+ activesupport (= 4.2.0)
17
+ arel (~> 6.0)
18
+ activesupport (4.2.0)
19
+ i18n (~> 0.7)
20
20
  json (~> 1.7, >= 1.7.7)
21
21
  minitest (~> 5.1)
22
- thread_safe (~> 0.1)
22
+ thread_safe (~> 0.3, >= 0.3.4)
23
23
  tzinfo (~> 1.1)
24
- appraisal (0.5.2)
24
+ appraisal (1.0.2)
25
25
  bundler
26
26
  rake
27
- arel (5.0.1.20140414130214)
27
+ thor (>= 0.14.0)
28
+ arel (6.0.0)
28
29
  builder (3.2.2)
29
30
  diff-lcs (1.2.1)
30
31
  ffi2-generators (0.1.1)
31
- i18n (0.6.9)
32
+ i18n (0.7.0)
32
33
  json (1.8.1)
33
- minitest (5.3.4)
34
+ minitest (5.5.0)
34
35
  rake (10.0.3)
35
36
  rspec (2.13.0)
36
37
  rspec-core (~> 2.13.0)
@@ -243,8 +244,9 @@ GEM
243
244
  rubysl-yaml (2.0.4)
244
245
  rubysl-zlib (2.0.1)
245
246
  sqlite3 (1.3.7)
247
+ thor (0.19.1)
246
248
  thread_safe (0.3.4)
247
- tzinfo (1.2.1)
249
+ tzinfo (1.2.2)
248
250
  thread_safe (~> 0.1)
249
251
 
250
252
  PLATFORMS
@@ -252,7 +254,7 @@ PLATFORMS
252
254
 
253
255
  DEPENDENCIES
254
256
  activerecord-jdbcsqlite3-adapter
255
- appraisal (~> 0.5.2)
257
+ appraisal (~> 1.0.2)
256
258
  nilify_blanks!
257
259
  rake (~> 10.0.3)
258
260
  rspec (~> 2.13)
@@ -8,6 +8,13 @@ In Rails when saving a model from a form and values are not provided by the user
8
8
 
9
9
  Only attributes responding to empty? with a value of true will be converted to nil. Therefore, this does not work with integer fields with the value of 0, for example. Usage is best shown through examples:
10
10
 
11
+ == Requirements
12
+
13
+ Rails 3.0 or later is required (ActiveRecord implementation is very different in Rails 2 and not easy to support both).
14
+
15
+ Due to issues maintaining backwards compatibility, as of v1.2.0 this gem requires ruby 1.9.3 or higher.
16
+ If you are still using 1.8.7 or 1.9.2, please use the v1.1.0 release.
17
+
11
18
  == Install
12
19
 
13
20
  Include the gem using bundler in your Gemfile:
data/Rakefile CHANGED
@@ -2,7 +2,6 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
4
  require 'rake'
5
- require 'appraisal'
6
5
  require 'rspec/core/rake_task'
7
6
 
8
7
  desc 'Default: run unit tests.'
@@ -14,16 +13,6 @@ end
14
13
 
15
14
  task :test => :spec
16
15
 
17
- desc 'Test the paperclip plugin under all supported Rails versions.'
18
- task :all do |t|
19
- if ENV['BUNDLE_GEMFILE']
20
- exec('rake test')
21
- else
22
- Rake::Task["appraisal:install"].execute
23
- exec('rake appraisal test')
24
- end
25
- end
26
-
27
16
  desc "Clean up files."
28
17
  task :clean do |t|
29
18
  FileUtils.rm_rf "tmp"
@@ -1,5 +1,21 @@
1
1
  rspec_module = defined?(RSpec::Core) ? 'RSpec' : 'Spec' # for RSpec 1 compatability
2
2
 
3
+ def failure_message_method
4
+ rspec_major_version >= 3 ? :failure_message : :failure_message_for_should
5
+ rescue
6
+ :failure_message_for_should
7
+ end
8
+
9
+ def negated_failure_message_method
10
+ rspec_major_version >= 3 ? :failure_message_when_negated : :failure_message_for_should_not
11
+ rescue
12
+ :failure_message_for_should_not
13
+ end
14
+
15
+ def rspec_major_version
16
+ RSpec::Core::Version::STRING.split('.').first.to_i
17
+ end
18
+
3
19
  Kernel.const_get(rspec_module)::Matchers.define :nilify_blanks_for do |column_name, options = {}|
4
20
  match do |model_instance|
5
21
  model_class = model_instance.class
@@ -10,11 +26,11 @@ Kernel.const_get(rspec_module)::Matchers.define :nilify_blanks_for do |column_na
10
26
  options.all? {|k, v| model_class.instance_variable_get(:@_nilify_blanks_options)[k] == v }
11
27
  end
12
28
 
13
- failure_message_for_should do |ability|
29
+ send(failure_message_method) do |_|
14
30
  "expected to nilify blanks for #{column_name} #{options.inspect unless options.empty?}"
15
31
  end
16
32
 
17
- failure_message_for_should_not do |ability|
33
+ send(negated_failure_message_method) do |_|
18
34
  "expected to not nilify blanks for #{column_name} #{options.inspect unless options.empty?}"
19
35
  end
20
36
  end
@@ -29,12 +45,11 @@ Kernel.const_get(rspec_module)::Matchers.define :nilify_blanks do |options = {}|
29
45
  options.all? {|k, v| model_class.instance_variable_get(:@_nilify_blanks_options)[k] == v }
30
46
  end
31
47
 
32
- failure_message_for_should do |ability|
48
+ send(failure_message_method) do |_|
33
49
  "expected to nilify blanks #{options.inspect unless options.empty?}"
34
50
  end
35
51
 
36
- failure_message_for_should_not do |ability|
52
+ send(negated_failure_message_method) do |_|
37
53
  "expected to not nilify blanks #{options.inspect unless options.empty?}"
38
54
  end
39
55
  end
40
-
@@ -1,3 +1,3 @@
1
1
  module NilifyBlanks
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
Binary file
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nilify_blanks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ben Hughes
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-04 00:00:00.000000000 Z
11
+ date: 2015-01-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: activerecord
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: 3.0.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: 3.0.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: 10.0.3
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: 10.0.3
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: '2.13'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: '2.13'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: appraisal
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
- version: 0.5.2
75
+ version: 1.0.2
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
- version: 0.5.2
82
+ version: 1.0.2
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: sqlite3
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ~>
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
89
  version: 1.3.6
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ~>
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
96
  version: 1.3.6
110
97
  description: Often times you'll end up with empty strings where you really want nil
@@ -115,46 +102,45 @@ executables: []
115
102
  extensions: []
116
103
  extra_rdoc_files: []
117
104
  files:
105
+ - Appraisals
106
+ - CHANGELOG.rdoc
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE
110
+ - README.rdoc
111
+ - Rakefile
112
+ - init.rb
113
+ - lib/nilify_blanks.rb
118
114
  - lib/nilify_blanks/matchers.rb
119
115
  - lib/nilify_blanks/railtie.rb
120
116
  - lib/nilify_blanks/version.rb
121
- - lib/nilify_blanks.rb
122
117
  - spec/db/database.yml
123
118
  - spec/db/schema.rb
124
119
  - spec/db/test.sqlite3
125
120
  - spec/nilify_blanks_spec.rb
126
121
  - spec/spec_helper.rb
127
- - Appraisals
128
- - CHANGELOG.rdoc
129
- - Gemfile
130
- - Gemfile.lock
131
- - LICENSE
132
- - Rakefile
133
- - README.rdoc
134
- - init.rb
135
122
  homepage: http://github.com/rubiety/nilify_blanks
136
123
  licenses: []
124
+ metadata: {}
137
125
  post_install_message:
138
126
  rdoc_options: []
139
127
  require_paths:
140
128
  - lib
141
129
  required_ruby_version: !ruby/object:Gem::Requirement
142
- none: false
143
130
  requirements:
144
- - - ! '>='
131
+ - - ">="
145
132
  - !ruby/object:Gem::Version
146
133
  version: '0'
147
134
  required_rubygems_version: !ruby/object:Gem::Requirement
148
- none: false
149
135
  requirements:
150
- - - ! '>='
136
+ - - ">="
151
137
  - !ruby/object:Gem::Version
152
138
  version: 1.3.4
153
139
  requirements: []
154
140
  rubyforge_project: nilify_blanks
155
- rubygems_version: 1.8.23
141
+ rubygems_version: 2.2.2
156
142
  signing_key:
157
- specification_version: 3
143
+ specification_version: 4
158
144
  summary: Auto-convert blank fields to nil.
159
145
  test_files: []
160
146
  has_rdoc: