nilly_vanilly 0.3.0 → 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +15 -10
- data/.rspec +2 -1
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +3 -6
- data/Gemfile.lock +43 -18
- data/LICENSE.txt +21 -0
- data/README.markdown +36 -42
- data/Rakefile +0 -1
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/nilly_vanilly.rb +3 -0
- data/lib/nilly_vanilly/inspect.rb +7 -7
- data/lib/nilly_vanilly/version.rb +1 -1
- data/nilly_vanilly.gemspec +10 -1
- data/spec/nilly_vanilly/inspect_spec.rb +2 -4
- data/spec/nilly_vanilly_spec.rb +5 -7
- data/spec/spec_helper.rb +10 -4
- data/spec/support/database.rb +7 -10
- metadata +90 -14
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: f2b5272e3e32237f05d2b6e7d836a40835cba0af
|
|
4
|
+
data.tar.gz: 6cff72a1d01d1e30db61ef9bb54606ef284c5d21
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e49c828ef339685a84272c51dc02bcd602c176b8b614496da53d5593ec634d18d1cb0dd37f5c17577f5b0bf639829e5f62a63e13738affc06f9cdf65331be619
|
|
7
|
+
data.tar.gz: 986199e035615de0f4e3241cfaeca2269101bc2d957e203756d74408e50fcab889397bcf020f905a469a55ee0674181a46fd8c36edea775e4b5215a4685f96b0
|
data/.gitignore
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
doc
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.
|
|
1
|
+
/.bundle/
|
|
2
|
+
/.yardoc
|
|
3
|
+
/_yardoc/
|
|
4
|
+
/coverage/
|
|
5
|
+
/doc/
|
|
6
|
+
/pkg/
|
|
7
|
+
/spec/reports/
|
|
8
|
+
/tmp/
|
|
9
|
+
|
|
10
|
+
/nilly_vanilly.sqlite3
|
|
11
|
+
/spec/db/database.yml
|
|
12
|
+
/spec/debug.log
|
|
13
|
+
|
|
14
|
+
# rspec failure tracking
|
|
15
|
+
.rspec_status
|
data/.rspec
CHANGED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at joost@spacebabies.nl. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,32 +1,57 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
nilly_vanilly (0.
|
|
4
|
+
nilly_vanilly (1.0.0)
|
|
5
|
+
activerecord (>= 4.0.0)
|
|
5
6
|
|
|
6
7
|
GEM
|
|
7
|
-
remote:
|
|
8
|
+
remote: https://rubygems.org/
|
|
8
9
|
specs:
|
|
9
|
-
|
|
10
|
-
activesupport (=
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
activemodel (5.1.5)
|
|
11
|
+
activesupport (= 5.1.5)
|
|
12
|
+
activerecord (5.1.5)
|
|
13
|
+
activemodel (= 5.1.5)
|
|
14
|
+
activesupport (= 5.1.5)
|
|
15
|
+
arel (~> 8.0)
|
|
16
|
+
activesupport (5.1.5)
|
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
18
|
+
i18n (~> 0.7)
|
|
19
|
+
minitest (~> 5.1)
|
|
20
|
+
tzinfo (~> 1.1)
|
|
21
|
+
arel (8.0.0)
|
|
22
|
+
concurrent-ruby (1.0.5)
|
|
23
|
+
diff-lcs (1.3)
|
|
24
|
+
i18n (0.9.5)
|
|
25
|
+
concurrent-ruby (~> 1.0)
|
|
26
|
+
minitest (5.11.3)
|
|
13
27
|
rake (10.0.3)
|
|
14
|
-
rspec (
|
|
15
|
-
rspec-core (~>
|
|
16
|
-
rspec-expectations (~>
|
|
17
|
-
rspec-mocks (~>
|
|
18
|
-
rspec-core (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
rspec (3.7.0)
|
|
29
|
+
rspec-core (~> 3.7.0)
|
|
30
|
+
rspec-expectations (~> 3.7.0)
|
|
31
|
+
rspec-mocks (~> 3.7.0)
|
|
32
|
+
rspec-core (3.7.1)
|
|
33
|
+
rspec-support (~> 3.7.0)
|
|
34
|
+
rspec-expectations (3.7.0)
|
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
36
|
+
rspec-support (~> 3.7.0)
|
|
37
|
+
rspec-mocks (3.7.0)
|
|
38
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
39
|
+
rspec-support (~> 3.7.0)
|
|
40
|
+
rspec-support (3.7.1)
|
|
41
|
+
sqlite3 (1.3.13)
|
|
42
|
+
thread_safe (0.3.6)
|
|
43
|
+
tzinfo (1.2.5)
|
|
44
|
+
thread_safe (~> 0.1)
|
|
23
45
|
|
|
24
46
|
PLATFORMS
|
|
25
47
|
ruby
|
|
26
48
|
|
|
27
49
|
DEPENDENCIES
|
|
28
|
-
activerecord (
|
|
50
|
+
activerecord (= 5.1.5)
|
|
29
51
|
nilly_vanilly!
|
|
30
52
|
rake
|
|
31
|
-
rspec
|
|
32
|
-
sqlite3
|
|
53
|
+
rspec (= 3.7.0)
|
|
54
|
+
sqlite3 (= 1.3.13)
|
|
55
|
+
|
|
56
|
+
BUNDLED WITH
|
|
57
|
+
1.16.0
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Joost Baaij
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.markdown
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
NillyVanilly
|
|
2
|
-
============
|
|
1
|
+
# NillyVanilly
|
|
3
2
|
|
|
4
3
|
This Rails gem/plugin stores NULL in your database when you try to store an empty string.
|
|
5
4
|
|
|
@@ -11,47 +10,35 @@ values for which you did not mean to enter any value. This plugin makes sure
|
|
|
11
10
|
to save NULL in database varchar columns that are defined with DEFAULT NULL.
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
Example
|
|
15
|
-
=======
|
|
13
|
+
## Example
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
``` ruby
|
|
16
|
+
class Comment < ActiveRecord::Base
|
|
17
|
+
nillify :author_url
|
|
18
|
+
end
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
comment = Comment.create :author_url => ""
|
|
21
|
+
comment.author_url # -> nil
|
|
22
|
+
```
|
|
24
23
|
|
|
25
|
-
Installation
|
|
26
|
-
============
|
|
24
|
+
## Installation
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
Install this gem using Bundler:
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
``` ruby
|
|
29
|
+
gem 'nilly_vanilly'
|
|
30
|
+
```
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
and then run `bundle`.
|
|
33
33
|
|
|
34
|
-
gem 'nilly_vanilly'
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
2 apps this might still work, but is not supported. If you absolutely need the
|
|
38
|
-
Rake task in your Rails 2 app, you can:
|
|
39
|
-
|
|
40
|
-
./script/plugin install git://github.com/tilsammans/nilly_vanilly.git
|
|
41
|
-
|
|
42
|
-
Installation as a plugin in Rails 2 adds a rake task you can run to find suitable
|
|
43
|
-
columns for nillification. For Rails 3, I will add this task in a future version.
|
|
44
|
-
Until then you can find the same information by running:
|
|
45
|
-
|
|
46
|
-
./script/runner "NillyVanilly::Inspect.print"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Inspection
|
|
50
|
-
==========
|
|
35
|
+
## Inspection
|
|
51
36
|
|
|
52
37
|
To see what columns are eligible for nillification, run the following:
|
|
53
38
|
|
|
54
|
-
|
|
39
|
+
```
|
|
40
|
+
rake nilly:vanilly:inspect
|
|
41
|
+
```
|
|
55
42
|
|
|
56
43
|
This will print a list of all tables in your database, cross-referenced with
|
|
57
44
|
the models in your application. All text columns which may be NULL and are
|
|
@@ -60,9 +47,7 @@ This does not take into account any validations you might have.
|
|
|
60
47
|
|
|
61
48
|
When a column has already been nillified, it will be indicated with [OK].
|
|
62
49
|
|
|
63
|
-
|
|
64
|
-
But WHY?!!
|
|
65
|
-
==========
|
|
50
|
+
## But WHY?!!
|
|
66
51
|
|
|
67
52
|
You: who cares that empty strings are stored in the database?
|
|
68
53
|
Me: if you don't care, just move along. And would I recommend you nillify
|
|
@@ -72,18 +57,27 @@ required if you have a unique index on that column. Unique indexes are the
|
|
|
72
57
|
fastest you can have, and they deal great with NULL values. Empty strings?
|
|
73
58
|
Not so much so.
|
|
74
59
|
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
63
|
+
|
|
64
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
65
|
+
|
|
66
|
+
## Contributing
|
|
67
|
+
|
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tilsammans/nilly_vanilly. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
69
|
+
|
|
70
|
+
## License
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
============
|
|
72
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
78
73
|
|
|
79
|
-
|
|
74
|
+
## Code of Conduct
|
|
80
75
|
|
|
81
|
-
|
|
76
|
+
Everyone interacting in the NillyVanilly project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/tilsammans/nilly_vanilly/blob/master/CODE_OF_CONDUCT.md).
|
|
82
77
|
|
|
83
78
|
|
|
84
|
-
Author
|
|
85
|
-
======
|
|
79
|
+
## Author
|
|
86
80
|
|
|
87
81
|
Joost Baaij
|
|
88
82
|
<joost@spacebabies.nl>
|
|
89
|
-
[www.spacebabies.nl](http://www.spacebabies.nl/)
|
|
83
|
+
[www.spacebabies.nl](http://www.spacebabies.nl/)
|
data/Rakefile
CHANGED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "nilly_vanilly"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/nilly_vanilly.rb
CHANGED
|
@@ -4,32 +4,32 @@ module NillyVanilly
|
|
|
4
4
|
def initialize
|
|
5
5
|
@results = []
|
|
6
6
|
end
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
# A nested array with one row for each column suitable for nillification.
|
|
9
9
|
def results
|
|
10
10
|
ActiveRecord::Base.connection.tables.each do |table|
|
|
11
11
|
model = table.classify.constantize rescue next
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
model.columns.each do |column|
|
|
14
14
|
present = model.respond_to?(:nillify_attributes) && model.nillify_attributes.include?(column.name.to_sym)
|
|
15
15
|
|
|
16
16
|
@results << [present, model.name, column.name] if include_column(column)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
@results
|
|
21
21
|
end
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
# Print an inspection report to stdout.
|
|
24
24
|
def self.print
|
|
25
25
|
new.results.each do |result|
|
|
26
26
|
puts [result[0] ? "[OK]" : "[ ]", result[1].ljust(20), result[2]].join(" ")
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
private
|
|
31
31
|
def include_column(column)
|
|
32
|
-
column.
|
|
32
|
+
%i(string text).include?(column.type) && column.null && column.default.nil?
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
end
|
|
35
|
+
end
|
data/nilly_vanilly.gemspec
CHANGED
|
@@ -7,12 +7,21 @@ Gem::Specification.new do |s|
|
|
|
7
7
|
s.version = NillyVanilly::VERSION
|
|
8
8
|
s.authors = ["Joost Baaij"]
|
|
9
9
|
s.email = ["joost@spacebabies.nl"]
|
|
10
|
+
|
|
10
11
|
s.homepage = "https://github.com/tilsammans/nilly_vanilly"
|
|
11
12
|
s.summary = %q{This plugin stores NULL in your database when you try to store an empty string.}
|
|
12
13
|
s.description = %q{This plugin stores NULL in your database when you try to store an empty string.}
|
|
14
|
+
s.license = 'MIT'
|
|
13
15
|
|
|
14
16
|
s.files = `git ls-files`.split("\n")
|
|
15
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
16
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
17
19
|
s.require_paths = ["lib"]
|
|
18
|
-
|
|
20
|
+
|
|
21
|
+
s.add_dependency 'activerecord', '>= 4.0.0'
|
|
22
|
+
|
|
23
|
+
s.add_development_dependency 'activerecord', '5.1.5'
|
|
24
|
+
s.add_development_dependency 'rspec', '3.7.0'
|
|
25
|
+
s.add_development_dependency 'sqlite3', '1.3.13'
|
|
26
|
+
s.add_development_dependency 'rake'
|
|
27
|
+
end
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
describe NillyVanilly::Inspect do
|
|
1
|
+
RSpec.describe NillyVanilly::Inspect, type: :model do
|
|
4
2
|
it "returns array of models/columns" do
|
|
5
|
-
subject.results.first.
|
|
3
|
+
expect(subject.results.first).to eq([true, "Post", "title"])
|
|
6
4
|
end
|
|
7
5
|
end
|
data/spec/nilly_vanilly_spec.rb
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
describe NillyVanilly do
|
|
1
|
+
RSpec.describe NillyVanilly, type: :model do
|
|
4
2
|
describe "model with one column" do
|
|
5
3
|
it "stores class methods" do
|
|
6
|
-
Post.nillify_attributes.
|
|
4
|
+
expect(Post.nillify_attributes).to eq [:title]
|
|
7
5
|
end
|
|
8
6
|
|
|
9
7
|
it "stores nil for empty string" do
|
|
10
8
|
post = Post.create! :title => ""
|
|
11
|
-
post.title.
|
|
9
|
+
expect(post.title).to be_nil
|
|
12
10
|
end
|
|
13
11
|
end
|
|
14
|
-
|
|
12
|
+
|
|
15
13
|
describe "model with two columns" do
|
|
16
14
|
it "stores class methods" do
|
|
17
|
-
Comment.nillify_attributes.
|
|
15
|
+
expect(Comment.nillify_attributes).to eq [:author, :author_email]
|
|
18
16
|
end
|
|
19
17
|
end
|
|
20
18
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
1
|
require 'bundler/setup'
|
|
3
|
-
|
|
4
2
|
require 'nilly_vanilly'
|
|
5
3
|
|
|
6
4
|
# Requires supporting files with custom matchers and macros, etc,
|
|
@@ -8,5 +6,13 @@ require 'nilly_vanilly'
|
|
|
8
6
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
9
7
|
|
|
10
8
|
RSpec.configure do |config|
|
|
11
|
-
#
|
|
12
|
-
|
|
9
|
+
# Enable flags like --only-failures and --next-failure
|
|
10
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
|
11
|
+
|
|
12
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
|
13
|
+
config.disable_monkey_patching!
|
|
14
|
+
|
|
15
|
+
config.expect_with :rspec do |c|
|
|
16
|
+
c.syntax = :expect
|
|
17
|
+
end
|
|
18
|
+
end
|
data/spec/support/database.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'sqlite3'
|
|
1
2
|
require 'yaml'
|
|
2
3
|
|
|
3
4
|
ENV['DB'] ||= 'sqlite3'
|
|
@@ -5,17 +6,13 @@ ENV['DB'] ||= 'sqlite3'
|
|
|
5
6
|
database_yml = File.expand_path('../../db/database.yml', __FILE__)
|
|
6
7
|
if File.exists?(database_yml)
|
|
7
8
|
active_record_configuration = YAML.load_file(database_yml)[ENV['DB']]
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
ActiveRecord::Base.establish_connection(active_record_configuration)
|
|
10
11
|
ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "../debug.log"))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
load(File.dirname(__FILE__) + '/../db/schema.rb')
|
|
16
|
-
load(File.dirname(__FILE__) + '/../db/models.rb')
|
|
17
|
-
end
|
|
18
|
-
|
|
12
|
+
|
|
13
|
+
load(File.dirname(__FILE__) + '/../db/schema.rb')
|
|
14
|
+
load(File.dirname(__FILE__) + '/../db/models.rb')
|
|
15
|
+
|
|
19
16
|
else
|
|
20
17
|
raise "Please create #{database_yml} first to configure your database. Take a look at: #{database_yml}.example"
|
|
21
18
|
end
|
|
@@ -26,4 +23,4 @@ def clean_database!
|
|
|
26
23
|
end
|
|
27
24
|
end
|
|
28
25
|
|
|
29
|
-
clean_database!
|
|
26
|
+
clean_database!
|
metadata
CHANGED
|
@@ -1,31 +1,107 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nilly_vanilly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.0.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Joost Baaij
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
13
|
-
dependencies:
|
|
11
|
+
date: 2018-03-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: activerecord
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 4.0.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 4.0.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: activerecord
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 5.1.5
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 5.1.5
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - '='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 3.7.0
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - '='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 3.7.0
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: sqlite3
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 1.3.13
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 1.3.13
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rake
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
14
83
|
description: This plugin stores NULL in your database when you try to store an empty
|
|
15
84
|
string.
|
|
16
85
|
email:
|
|
17
86
|
- joost@spacebabies.nl
|
|
18
|
-
executables:
|
|
87
|
+
executables:
|
|
88
|
+
- console
|
|
89
|
+
- setup
|
|
19
90
|
extensions: []
|
|
20
91
|
extra_rdoc_files: []
|
|
21
92
|
files:
|
|
22
|
-
- .gitignore
|
|
23
|
-
- .rspec
|
|
93
|
+
- ".gitignore"
|
|
94
|
+
- ".rspec"
|
|
95
|
+
- ".travis.yml"
|
|
24
96
|
- CHANGELOG.md
|
|
97
|
+
- CODE_OF_CONDUCT.md
|
|
25
98
|
- Gemfile
|
|
26
99
|
- Gemfile.lock
|
|
100
|
+
- LICENSE.txt
|
|
27
101
|
- README.markdown
|
|
28
102
|
- Rakefile
|
|
103
|
+
- bin/console
|
|
104
|
+
- bin/setup
|
|
29
105
|
- lib/nilly_vanilly.rb
|
|
30
106
|
- lib/nilly_vanilly/inspect.rb
|
|
31
107
|
- lib/nilly_vanilly/nillify.rb
|
|
@@ -41,28 +117,28 @@ files:
|
|
|
41
117
|
- spec/spec_helper.rb
|
|
42
118
|
- spec/support/database.rb
|
|
43
119
|
homepage: https://github.com/tilsammans/nilly_vanilly
|
|
44
|
-
licenses:
|
|
120
|
+
licenses:
|
|
121
|
+
- MIT
|
|
122
|
+
metadata: {}
|
|
45
123
|
post_install_message:
|
|
46
124
|
rdoc_options: []
|
|
47
125
|
require_paths:
|
|
48
126
|
- lib
|
|
49
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
|
-
none: false
|
|
51
128
|
requirements:
|
|
52
|
-
- -
|
|
129
|
+
- - ">="
|
|
53
130
|
- !ruby/object:Gem::Version
|
|
54
131
|
version: '0'
|
|
55
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
|
-
none: false
|
|
57
133
|
requirements:
|
|
58
|
-
- -
|
|
134
|
+
- - ">="
|
|
59
135
|
- !ruby/object:Gem::Version
|
|
60
136
|
version: '0'
|
|
61
137
|
requirements: []
|
|
62
138
|
rubyforge_project:
|
|
63
|
-
rubygems_version:
|
|
139
|
+
rubygems_version: 2.6.11
|
|
64
140
|
signing_key:
|
|
65
|
-
specification_version:
|
|
141
|
+
specification_version: 4
|
|
66
142
|
summary: This plugin stores NULL in your database when you try to store an empty string.
|
|
67
143
|
test_files:
|
|
68
144
|
- spec/db/database.yml.example
|