enum_field 1.0.1 → 1.1.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.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +7 -9
- data/Rakefile +49 -28
- data/VERSION +1 -0
- data/enum_field.gemspec +75 -0
- data/lib/enum_field.rb +2 -2
- data/spec/enumerated_attribute_spec.rb +6 -3
- data/spec/has_many_enumerated_attributes_spec.rb +96 -0
- data/spec/spec_helper.rb +11 -9
- metadata +120 -79
- data/History.txt +0 -10
- data/Manifest.txt +0 -18
- data/PostInstall.txt +0 -3
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/spec.opts +0 -5
- data/tasks/rspec.rake +0 -21
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (3.2.1)
|
5
|
+
activesupport (= 3.2.1)
|
6
|
+
builder (~> 3.0.0)
|
7
|
+
activerecord (3.2.1)
|
8
|
+
activemodel (= 3.2.1)
|
9
|
+
activesupport (= 3.2.1)
|
10
|
+
arel (~> 3.0.0)
|
11
|
+
tzinfo (~> 0.3.29)
|
12
|
+
activesupport (3.2.1)
|
13
|
+
i18n (~> 0.6)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
arel (3.0.2)
|
16
|
+
builder (3.0.0)
|
17
|
+
diff-lcs (1.1.3)
|
18
|
+
git (1.2.5)
|
19
|
+
i18n (0.6.0)
|
20
|
+
jeweler (1.8.3)
|
21
|
+
bundler (~> 1.0)
|
22
|
+
git (>= 1.2.5)
|
23
|
+
rake
|
24
|
+
rdoc
|
25
|
+
json (1.6.5)
|
26
|
+
multi_json (1.1.0)
|
27
|
+
rake (0.9.2.2)
|
28
|
+
rdoc (3.12)
|
29
|
+
json (~> 1.4)
|
30
|
+
rspec (2.8.0)
|
31
|
+
rspec-core (~> 2.8.0)
|
32
|
+
rspec-expectations (~> 2.8.0)
|
33
|
+
rspec-mocks (~> 2.8.0)
|
34
|
+
rspec-core (2.8.0)
|
35
|
+
rspec-expectations (2.8.0)
|
36
|
+
diff-lcs (~> 1.1.2)
|
37
|
+
rspec-mocks (2.8.0)
|
38
|
+
simplecov (0.6.1)
|
39
|
+
multi_json (~> 1.0)
|
40
|
+
simplecov-html (~> 0.5.3)
|
41
|
+
simplecov-html (0.5.3)
|
42
|
+
sqlite3 (1.3.5)
|
43
|
+
tzinfo (0.3.31)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
activerecord
|
50
|
+
bundler (~> 1.0.0)
|
51
|
+
jeweler (~> 1.8.3)
|
52
|
+
rdoc (~> 3.12)
|
53
|
+
rspec (~> 2.8.0)
|
54
|
+
simplecov
|
55
|
+
sqlite3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Sebastián Bernardo Galkin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
* http://github.com/paraseba/enum_field
|
4
4
|
|
5
|
-
==
|
5
|
+
== Description:
|
6
6
|
|
7
7
|
Enables Active Record attributes to point to enum like objects, by saving in your database
|
8
8
|
only an integer ID.
|
9
9
|
|
10
10
|
|
11
|
-
==
|
11
|
+
== Features:
|
12
12
|
|
13
13
|
* Allows creation of Classes with enum like behaviour.
|
14
14
|
* Allows any number of members and methods in the enum classes.
|
@@ -18,7 +18,7 @@ only an integer ID.
|
|
18
18
|
* <code>if user.role.can_edit?</code>
|
19
19
|
* Saves in your +AR+ tables, only an integer id pointing to the enumeration member.
|
20
20
|
|
21
|
-
==
|
21
|
+
== Synopsis:
|
22
22
|
|
23
23
|
When in an Active Record class, you have an attribute like role, state or country you have
|
24
24
|
several options.
|
@@ -29,7 +29,7 @@ several options.
|
|
29
29
|
|
30
30
|
If you are not confortable with any of this options, maybe +enum_field+ is an answer for you.
|
31
31
|
|
32
|
-
==
|
32
|
+
== Basic usage:
|
33
33
|
|
34
34
|
class Role
|
35
35
|
define_enum do |builder|
|
@@ -111,18 +111,16 @@ The library also mimics has_many :through behavior, for cases such as:
|
|
111
111
|
|
112
112
|
|
113
113
|
|
114
|
-
==
|
114
|
+
== Requirements:
|
115
115
|
|
116
116
|
* activerecord
|
117
|
-
* hoe
|
118
|
-
* rubyforge
|
119
117
|
|
120
118
|
|
121
|
-
==
|
119
|
+
== Install:
|
122
120
|
|
123
121
|
sudo gem install enum_field
|
124
122
|
|
125
|
-
==
|
123
|
+
== License:
|
126
124
|
|
127
125
|
(The MIT License)
|
128
126
|
|
data/Rakefile
CHANGED
@@ -1,28 +1,49 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "enum_field"
|
18
|
+
gem.homepage = "http://github.com/paraseba/enum_field"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %q{Enables Active Record attributes to point to enum like objects, by saving in your database only an integer ID.}
|
21
|
+
gem.description = %q{Enables Active Record attributes to point to enum like objects, by saving in your database only an integer ID.}
|
22
|
+
gem.email = "paraseba@gmail.com"
|
23
|
+
gem.authors = ["Sebastián Bernardo Galkin"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rdoc/task'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "enum_field #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
data/enum_field.gemspec
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "enum_field"
|
8
|
+
s.version = "1.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Sebasti\u{e1}n Bernardo Galkin"]
|
12
|
+
s.date = "2012-03-03"
|
13
|
+
s.description = "Enables Active Record attributes to point to enum like objects, by saving in your database only an integer ID."
|
14
|
+
s.email = "paraseba@gmail.com"
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"enum_field.gemspec",
|
29
|
+
"lib/enum_field.rb",
|
30
|
+
"lib/enum_field/builder.rb",
|
31
|
+
"lib/enum_field/define_enum.rb",
|
32
|
+
"lib/enum_field/enumerated_attribute.rb",
|
33
|
+
"lib/enum_field/exceptions.rb",
|
34
|
+
"spec/define_enum_spec.rb",
|
35
|
+
"spec/enumerated_attribute_spec.rb",
|
36
|
+
"spec/has_many_enumerated_attributes_spec.rb",
|
37
|
+
"spec/spec_helper.rb"
|
38
|
+
]
|
39
|
+
s.homepage = "http://github.com/paraseba/enum_field"
|
40
|
+
s.licenses = ["MIT"]
|
41
|
+
s.require_paths = ["lib"]
|
42
|
+
s.rubygems_version = "1.8.11"
|
43
|
+
s.summary = "Enables Active Record attributes to point to enum like objects, by saving in your database only an integer ID."
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_runtime_dependency(%q<activerecord>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
51
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
52
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
54
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
56
|
+
else
|
57
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
58
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
59
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
60
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
61
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
62
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
63
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
64
|
+
end
|
65
|
+
else
|
66
|
+
s.add_dependency(%q<activerecord>, [">= 0"])
|
67
|
+
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
68
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
69
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
70
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
71
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
72
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
data/lib/enum_field.rb
CHANGED
@@ -6,12 +6,12 @@ require 'enum_field/define_enum'
|
|
6
6
|
require 'enum_field/exceptions'
|
7
7
|
require 'enum_field/builder'
|
8
8
|
require 'enum_field/enumerated_attribute'
|
9
|
-
require '
|
9
|
+
require 'active_record'
|
10
10
|
|
11
11
|
Module.send(:include, EnumField::DefineEnum)
|
12
12
|
ActiveRecord::Base.send(:extend, EnumField::EnumeratedAttribute)
|
13
13
|
|
14
14
|
module EnumField
|
15
|
-
VERSION = '0.
|
15
|
+
VERSION = '1.0.2'
|
16
16
|
|
17
17
|
end
|
@@ -13,9 +13,12 @@ describe EnumField::EnumeratedAttribute do
|
|
13
13
|
enumerated_attribute :role
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
before(:
|
18
|
-
|
16
|
+
|
17
|
+
before(:all) {
|
18
|
+
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ':memory:'
|
19
|
+
ActiveRecord::Base.connection.create_table(:users) do |t|
|
20
|
+
t.belongs_to :role
|
21
|
+
end
|
19
22
|
}
|
20
23
|
|
21
24
|
it "should add enumerated_attribute class method to ActiveRecord::Base" do
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe EnumField::EnumeratedAttribute do
|
4
|
+
class Role
|
5
|
+
define_enum do |b|
|
6
|
+
b.member :admin
|
7
|
+
b.member :supervisor
|
8
|
+
b.member :manager
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Client < ActiveRecord::Base
|
13
|
+
has_many_enumerated_attributes :roles
|
14
|
+
end
|
15
|
+
|
16
|
+
class ClientRole < ActiveRecord::Base
|
17
|
+
belongs_to :client
|
18
|
+
enumerated_attribute :role
|
19
|
+
end
|
20
|
+
|
21
|
+
class Person < ActiveRecord::Base
|
22
|
+
end
|
23
|
+
|
24
|
+
class PersonRole < ActiveRecord::Base
|
25
|
+
belongs_to :person
|
26
|
+
enumerated_attribute :role
|
27
|
+
end
|
28
|
+
|
29
|
+
context "with AR objects" do
|
30
|
+
|
31
|
+
before(:all) {
|
32
|
+
ActiveRecord::Base.establish_connection :adapter => "sqlite3", :database => ':memory:'
|
33
|
+
ActiveRecord::Base.connection.create_table(:clients)
|
34
|
+
ActiveRecord::Base.connection.create_table(:people)
|
35
|
+
ActiveRecord::Base.connection.create_table(:client_roles) do |t|
|
36
|
+
t.belongs_to :client
|
37
|
+
t.belongs_to :role
|
38
|
+
end
|
39
|
+
ActiveRecord::Base.connection.create_table(:person_roles) do |t|
|
40
|
+
t.belongs_to :person
|
41
|
+
t.belongs_to :role
|
42
|
+
end
|
43
|
+
}
|
44
|
+
|
45
|
+
before(:each) {@client = Client.create}
|
46
|
+
|
47
|
+
|
48
|
+
it "should add has_many_enumerated_attribute class method to ActiveRecord::Base" do
|
49
|
+
ActiveRecord::Base.should respond_to(:has_many_enumerated_attributes)
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should define reader on the field" do
|
53
|
+
@client.should respond_to(:roles)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should define writter on the field" do
|
57
|
+
@client.should respond_to(:'roles=')
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should define has many person_roles" do
|
61
|
+
Person.should_receive(:has_many) # .with(:person_roles, {:class_name => 'PersonRole'})
|
62
|
+
Person.has_many_enumerated_attributes :roles
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should assign field ids when fields is assigned" do
|
66
|
+
@client.roles = [Role.admin]
|
67
|
+
@client.role_ids.first.should == Role.admin.id
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should return fields after field_ids is assigned" do
|
71
|
+
@client.role_ids = [Role.admin.id]
|
72
|
+
@client.roles.first.should == Role.admin
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should return empty fields for not field_ids" do
|
76
|
+
@client.role_ids = []
|
77
|
+
@client.roles.should be_empty
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return empty field ids for empty fields" do
|
81
|
+
@client.roles = []
|
82
|
+
@client.role_ids.should be_empty
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should include the roles asigned" do
|
86
|
+
@client.roles = [Role.admin, Role.manager]
|
87
|
+
@client.roles.should include(Role.admin)
|
88
|
+
@client.roles.should include(Role.manager)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should not include unassigned roles" do
|
92
|
+
@client.roles = [Role.admin, Role.manager]
|
93
|
+
@client.roles.should_not include(Role.supervisor)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
-
gem 'rspec'
|
6
|
-
require 'spec'
|
7
|
-
end
|
8
|
-
|
9
|
-
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
10
4
|
require 'enum_field'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
metadata
CHANGED
@@ -1,106 +1,147 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: enum_field
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
-
|
7
|
+
authors:
|
8
|
+
- Sebastián Bernardo Galkin
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-03-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: activerecord
|
16
|
+
requirement: &11307540 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
17
22
|
type: :runtime
|
18
|
-
|
19
|
-
version_requirements:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
-
|
26
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *11307540
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &11306900 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.8.0
|
27
33
|
type: :development
|
28
|
-
|
29
|
-
version_requirements:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
-
|
36
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *11306900
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rdoc
|
38
|
+
requirement: &11305900 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.12'
|
37
44
|
type: :development
|
38
|
-
|
39
|
-
version_requirements:
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *11305900
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: &11411380 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *11411380
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: jeweler
|
60
|
+
requirement: &11409700 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.8.3
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *11409700
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: &11408920 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *11408920
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: sqlite3
|
82
|
+
requirement: &11408280 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *11408280
|
91
|
+
description: Enables Active Record attributes to point to enum like objects, by saving
|
92
|
+
in your database only an integer ID.
|
93
|
+
email: paraseba@gmail.com
|
48
94
|
executables: []
|
49
|
-
|
50
95
|
extensions: []
|
51
|
-
|
52
|
-
|
53
|
-
- History.txt
|
54
|
-
- Manifest.txt
|
55
|
-
- PostInstall.txt
|
96
|
+
extra_rdoc_files:
|
97
|
+
- LICENSE.txt
|
56
98
|
- README.rdoc
|
57
|
-
files:
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
99
|
+
files:
|
100
|
+
- .document
|
101
|
+
- .rspec
|
102
|
+
- Gemfile
|
103
|
+
- Gemfile.lock
|
104
|
+
- LICENSE.txt
|
61
105
|
- README.rdoc
|
62
106
|
- Rakefile
|
107
|
+
- VERSION
|
108
|
+
- enum_field.gemspec
|
63
109
|
- lib/enum_field.rb
|
64
110
|
- lib/enum_field/builder.rb
|
65
111
|
- lib/enum_field/define_enum.rb
|
66
112
|
- lib/enum_field/enumerated_attribute.rb
|
67
113
|
- lib/enum_field/exceptions.rb
|
68
|
-
- script/console
|
69
|
-
- script/destroy
|
70
|
-
- script/generate
|
71
114
|
- spec/define_enum_spec.rb
|
72
115
|
- spec/enumerated_attribute_spec.rb
|
73
|
-
- spec/
|
116
|
+
- spec/has_many_enumerated_attributes_spec.rb
|
74
117
|
- spec/spec_helper.rb
|
75
|
-
- tasks/rspec.rake
|
76
|
-
has_rdoc: true
|
77
118
|
homepage: http://github.com/paraseba/enum_field
|
78
|
-
licenses:
|
79
|
-
|
80
|
-
post_install_message:
|
81
|
-
rdoc_options:
|
82
|
-
|
83
|
-
- README.rdoc
|
84
|
-
require_paths:
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
85
124
|
- lib
|
86
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
hash: 704113742870290666
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
98
140
|
requirements: []
|
99
|
-
|
100
|
-
|
101
|
-
rubygems_version: 1.3.5
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 1.8.11
|
102
143
|
signing_key:
|
103
|
-
specification_version:
|
104
|
-
summary: Enables Active Record attributes to point to enum like objects, by saving
|
144
|
+
specification_version: 3
|
145
|
+
summary: Enables Active Record attributes to point to enum like objects, by saving
|
146
|
+
in your database only an integer ID.
|
105
147
|
test_files: []
|
106
|
-
|
data/History.txt
DELETED
data/Manifest.txt
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest.txt
|
3
|
-
PostInstall.txt
|
4
|
-
README.rdoc
|
5
|
-
Rakefile
|
6
|
-
lib/enum_field.rb
|
7
|
-
lib/enum_field/builder.rb
|
8
|
-
lib/enum_field/define_enum.rb
|
9
|
-
lib/enum_field/enumerated_attribute.rb
|
10
|
-
lib/enum_field/exceptions.rb
|
11
|
-
script/console
|
12
|
-
script/destroy
|
13
|
-
script/generate
|
14
|
-
spec/define_enum_spec.rb
|
15
|
-
spec/enumerated_attribute_spec.rb
|
16
|
-
spec/spec.opts
|
17
|
-
spec/spec_helper.rb
|
18
|
-
tasks/rspec.rake
|
data/PostInstall.txt
DELETED
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/enum_field.rb'}"
|
9
|
-
puts "Loading enum_field gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/spec/spec.opts
DELETED
data/tasks/rspec.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'spec'
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
-
require 'spec'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'spec/rake/spectask'
|
9
|
-
rescue LoadError
|
10
|
-
puts <<-EOS
|
11
|
-
To use rspec for testing you must install rspec gem:
|
12
|
-
gem install rspec
|
13
|
-
EOS
|
14
|
-
exit(0)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run the specs under spec/models"
|
18
|
-
Spec::Rake::SpecTask.new do |t|
|
19
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
-
end
|