enumify 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -1
- data/Appraisals +29 -0
- data/CHANGELOG.md +4 -1
- data/Gemfile +5 -0
- data/enumify.gemspec +0 -1
- data/gemfiles/rails30.gemfile +5 -0
- data/gemfiles/rails31.gemfile +5 -0
- data/gemfiles/rails32.gemfile +5 -0
- data/gemfiles/rails40.gemfile +5 -0
- data/gemfiles/rails41.gemfile +12 -0
- data/lib/enumify/model.rb +2 -1
- data/lib/enumify/version.rb +1 -1
- data/spec/enumify/enum_spec.rb +10 -1
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e07e879db1b0841f3709bb38a18a6e1ebf6ca9d
|
4
|
+
data.tar.gz: 16564aef554f7f9b5ec758ebc05c8773b0491255
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25f74bc2d96ac0c98113836d512193afc297b5f00ef2e7f342749cd5a4a0390449e5b59e55f67bd8f04542e10e80c11f6db6bc405007ce53f68d3509b3b6f601
|
7
|
+
data.tar.gz: ab1a202e1104bd2d7dd84e6bfadae9e40a46b310664ca73152e2c859a1bedb3a7955e530ee25453a0f3f762cd974a096fb3011ff5ea48fdb671f831b9cf40b23
|
data/.travis.yml
CHANGED
@@ -3,12 +3,21 @@ rvm:
|
|
3
3
|
- 1.8.7
|
4
4
|
- 1.9.3
|
5
5
|
- 2.0.0
|
6
|
+
- 2.1.0
|
7
|
+
- rbx
|
8
|
+
- jruby-19mode
|
6
9
|
gemfile:
|
7
10
|
- gemfiles/rails30.gemfile
|
8
11
|
- gemfiles/rails31.gemfile
|
9
12
|
- gemfiles/rails32.gemfile
|
10
13
|
- gemfiles/rails40.gemfile
|
14
|
+
- gemfiles/rails41.gemfile
|
11
15
|
matrix:
|
12
16
|
exclude:
|
13
17
|
- rvm: 1.8.7
|
14
|
-
gemfile: gemfiles/rails40.gemfile
|
18
|
+
gemfile: gemfiles/rails40.gemfile
|
19
|
+
- rvm: 1.8.7
|
20
|
+
gemfile: gemfiles/rails41.gemfile
|
21
|
+
allow_failures:
|
22
|
+
- rvm: jruby-19mode
|
23
|
+
gemfile: gemfiles/rails41.gemfile
|
data/Appraisals
CHANGED
@@ -1,15 +1,44 @@
|
|
1
1
|
appraise "rails30" do
|
2
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
3
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
4
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
5
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
6
|
+
|
2
7
|
gem "activerecord", "~> 3.0.11"
|
3
8
|
end
|
4
9
|
|
5
10
|
appraise "rails31" do
|
11
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
12
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
13
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
14
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
15
|
+
|
6
16
|
gem "activerecord", "~> 3.1.12"
|
7
17
|
end
|
8
18
|
|
9
19
|
appraise "rails32" do
|
20
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
21
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
22
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
23
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
24
|
+
|
10
25
|
gem "activerecord", "~> 3.2.14"
|
11
26
|
end
|
12
27
|
|
13
28
|
appraise "rails40" do
|
29
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
30
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
31
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
32
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
33
|
+
|
14
34
|
gem "activerecord", "~> 4.0.0"
|
35
|
+
end
|
36
|
+
|
37
|
+
appraise "rails41" do
|
38
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
39
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
40
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
41
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
42
|
+
|
43
|
+
gem "activerecord", "~> 4.1.0.beta1"
|
15
44
|
end
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
4
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
5
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
6
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
7
|
+
|
3
8
|
# Specify your gem's dependencies in enumify.gemspec
|
4
9
|
gemspec
|
data/enumify.gemspec
CHANGED
@@ -32,6 +32,5 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_development_dependency "rake"
|
33
33
|
s.add_development_dependency "rspec"
|
34
34
|
s.add_development_dependency "activerecord", '>= 3.0'
|
35
|
-
s.add_development_dependency "sqlite3"
|
36
35
|
s.add_development_dependency 'appraisal', '>= 0.3.8'
|
37
36
|
end
|
data/gemfiles/rails30.gemfile
CHANGED
@@ -4,4 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gem "activerecord", "~> 3.0.11"
|
6
6
|
|
7
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
8
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
9
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
10
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
11
|
+
|
7
12
|
gemspec :path=>"../"
|
data/gemfiles/rails31.gemfile
CHANGED
@@ -4,4 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gem "activerecord", "~> 3.1.12"
|
6
6
|
|
7
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
8
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
9
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
10
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
11
|
+
|
7
12
|
gemspec :path=>"../"
|
data/gemfiles/rails32.gemfile
CHANGED
@@ -4,4 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gem "activerecord", "~> 3.2.14"
|
6
6
|
|
7
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
8
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
9
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
10
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
11
|
+
|
7
12
|
gemspec :path=>"../"
|
data/gemfiles/rails40.gemfile
CHANGED
@@ -4,4 +4,9 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gem "activerecord", "~> 4.0.0"
|
6
6
|
|
7
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
8
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
9
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
10
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
11
|
+
|
7
12
|
gemspec :path=>"../"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "activerecord", "~> 4.1.0.beta1"
|
6
|
+
|
7
|
+
gem 'rubysl', '~> 2.0', :platforms => :rbx
|
8
|
+
gem 'rubinius-developer_tools', :platforms => :rbx
|
9
|
+
gem 'sqlite3', :platforms => [:ruby, :rbx]
|
10
|
+
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
|
11
|
+
|
12
|
+
gemspec :path=>"../"
|
data/lib/enumify/model.rb
CHANGED
@@ -23,9 +23,10 @@ module Enumify
|
|
23
23
|
|
24
24
|
value = value.to_sym
|
25
25
|
old = read_attribute(parameter) ? read_attribute(parameter).to_sym : nil
|
26
|
+
return value if old == value
|
26
27
|
write_attribute(parameter, value.to_s)
|
27
28
|
save if should_save
|
28
|
-
send("#{parameter.to_s}_changed", old, value) if respond_to?("#{parameter.to_s}_changed", true) and
|
29
|
+
send("#{parameter.to_s}_changed", old, value) if respond_to?("#{parameter.to_s}_changed", true) and !old.nil?
|
29
30
|
return value
|
30
31
|
end
|
31
32
|
|
data/lib/enumify/version.rb
CHANGED
data/spec/enumify/enum_spec.rb
CHANGED
@@ -79,6 +79,15 @@ describe :Enumify do
|
|
79
79
|
@obj.canceled!
|
80
80
|
@obj.status.should == :canceled
|
81
81
|
end
|
82
|
+
|
83
|
+
context 'trying to set the value to the same value' do
|
84
|
+
before { @obj.available! }
|
85
|
+
it 'should not save the object again' do
|
86
|
+
@obj.should_not_receive(:save)
|
87
|
+
@obj.available!
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
82
91
|
end
|
83
92
|
|
84
93
|
it "should have two shorthand methods for each possible value" do
|
@@ -179,4 +188,4 @@ describe :Enumify do
|
|
179
188
|
Model::STATUSES.should == [:available, :canceled, :completed]
|
180
189
|
end
|
181
190
|
|
182
|
-
end
|
191
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enumify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.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: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: appraisal
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +94,7 @@ files:
|
|
108
94
|
- gemfiles/rails31.gemfile
|
109
95
|
- gemfiles/rails32.gemfile
|
110
96
|
- gemfiles/rails40.gemfile
|
97
|
+
- gemfiles/rails41.gemfile
|
111
98
|
- lib/enumify.rb
|
112
99
|
- lib/enumify/model.rb
|
113
100
|
- lib/enumify/railtie.rb
|
@@ -134,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
121
|
version: '0'
|
135
122
|
requirements: []
|
136
123
|
rubyforge_project: enumify
|
137
|
-
rubygems_version: 2.0.
|
124
|
+
rubygems_version: 2.0.3
|
138
125
|
signing_key:
|
139
126
|
specification_version: 4
|
140
127
|
summary: enumify adds an enum command to all ActiveRecord models which enables you
|