nilly_vanilly 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -5,5 +5,6 @@ rdoc
5
5
  doc
6
6
  .yardoc
7
7
  .bundle
8
- pkg
9
8
  spec/db/database.yml
9
+ *.gem
10
+ .ruby-version
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.3.0 (February 2013)
2
+
3
+ Add the Rake tasks to Rails 3 apps via a Railtie
4
+
5
+
1
6
  ## 0.1.0 (January 2011)
2
7
 
3
8
  Initial release
data/Gemfile CHANGED
@@ -5,3 +5,4 @@ gemspec
5
5
  gem 'activerecord', '>= 2'
6
6
  gem 'rspec'
7
7
  gem 'sqlite3'
8
+ gem 'rake'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nilly_vanilly (0.2.0)
4
+ nilly_vanilly (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -10,6 +10,7 @@ GEM
10
10
  activesupport (= 2.3.12)
11
11
  activesupport (2.3.12)
12
12
  diff-lcs (1.1.2)
13
+ rake (10.0.3)
13
14
  rspec (2.6.0)
14
15
  rspec-core (~> 2.6.0)
15
16
  rspec-expectations (~> 2.6.0)
@@ -26,5 +27,6 @@ PLATFORMS
26
27
  DEPENDENCIES
27
28
  activerecord (>= 2)
28
29
  nilly_vanilly!
30
+ rake
29
31
  rspec
30
32
  sqlite3
@@ -1,23 +1,28 @@
1
1
  module NillyVanilly
2
+ # Inject the nillifcation process in ActiveRecord
2
3
  module Nillify
3
4
  def self.included(base)
4
5
  base.extend ClassMethods
5
6
  end
6
7
 
7
8
  module ClassMethods
9
+
10
+ # Register a before_save hook to nillify attributes defined by nillify_attributes accessor
8
11
  def nillify(*attributes)
9
12
  class_eval do
10
13
  before_save :nillification
11
14
  end
12
-
15
+
13
16
  cattr_accessor :nillify_attributes
14
- self.nillify_attributes = attributes
17
+ self.nillify_attributes = attributes
15
18
 
16
19
  include InstanceMethods
17
20
  end
18
21
  end
19
-
22
+
20
23
  module InstanceMethods
24
+
25
+ # Nillify attribute if it is a empty string
21
26
  def nillification
22
27
  for attribute in self.class.nillify_attributes
23
28
  self.send("#{attribute}=", nil) if self.send(attribute) == ""
@@ -0,0 +1,7 @@
1
+ module NillyVanilly
2
+ class Railtie < Rails::Railtie
3
+ rake_tasks do
4
+ load File.dirname(__FILE__) + "/../tasks/nilly_vanilly.rake"
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module NillyVanilly
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/nilly_vanilly.rb CHANGED
@@ -5,3 +5,5 @@ require 'nilly_vanilly/inspect'
5
5
  if defined?(ActiveRecord::Base)
6
6
  ActiveRecord::Base.send :include, NillyVanilly::Nillify
7
7
  end
8
+
9
+ require "nilly_vanilly/railtie" if defined?(Rails)
metadata CHANGED
@@ -1,29 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: nilly_vanilly
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
4
5
  prerelease:
5
- version: 0.2.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Joost Baaij
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-12 00:00:00 +02:00
14
- default_executable:
12
+ date: 2013-02-12 00:00:00.000000000 Z
15
13
  dependencies: []
16
-
17
- description: This plugin stores NULL in your database when you try to store an empty string.
18
- email:
14
+ description: This plugin stores NULL in your database when you try to store an empty
15
+ string.
16
+ email:
19
17
  - joost@spacebabies.nl
20
18
  executables: []
21
-
22
19
  extensions: []
23
-
24
20
  extra_rdoc_files: []
25
-
26
- files:
21
+ files:
27
22
  - .gitignore
28
23
  - .rspec
29
24
  - CHANGELOG.md
@@ -34,6 +29,7 @@ files:
34
29
  - lib/nilly_vanilly.rb
35
30
  - lib/nilly_vanilly/inspect.rb
36
31
  - lib/nilly_vanilly/nillify.rb
32
+ - lib/nilly_vanilly/railtie.rb
37
33
  - lib/nilly_vanilly/version.rb
38
34
  - lib/tasks/nilly_vanilly.rake
39
35
  - nilly_vanilly.gemspec
@@ -44,35 +40,31 @@ files:
44
40
  - spec/nilly_vanilly_spec.rb
45
41
  - spec/spec_helper.rb
46
42
  - spec/support/database.rb
47
- has_rdoc: true
48
43
  homepage: https://github.com/tilsammans/nilly_vanilly
49
44
  licenses: []
50
-
51
45
  post_install_message:
52
46
  rdoc_options: []
53
-
54
- require_paths:
47
+ require_paths:
55
48
  - lib
56
- required_ruby_version: !ruby/object:Gem::Requirement
49
+ required_ruby_version: !ruby/object:Gem::Requirement
57
50
  none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: "0"
62
- required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
56
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
68
61
  requirements: []
69
-
70
62
  rubyforge_project:
71
- rubygems_version: 1.6.2
63
+ rubygems_version: 1.8.23
72
64
  signing_key:
73
65
  specification_version: 3
74
66
  summary: This plugin stores NULL in your database when you try to store an empty string.
75
- test_files:
67
+ test_files:
76
68
  - spec/db/database.yml.example
77
69
  - spec/db/models.rb
78
70
  - spec/db/schema.rb