active_hash 0.8.7 → 0.9.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/CHANGELOG +6 -0
- data/Gemfile +5 -6
- data/Gemfile.lock +30 -21
- data/VERSION +1 -1
- data/active_hash.gemspec +33 -41
- data/lib/active_hash.rb +12 -0
- data/lib/active_hash/base.rb +30 -6
- data/spec/active_file/base_spec.rb +1 -1
- data/spec/active_hash/base_spec.rb +24 -4
- data/spec/active_yaml/base_spec.rb +1 -1
- data/spec/associations/associations_spec.rb +17 -12
- data/spec/enum/enum_spec.rb +1 -1
- data/spec/lint_spec.rb +36 -0
- data/spec/spec_helper.rb +3 -11
- metadata +14 -18
- data/.document +0 -5
- data/.gitignore +0 -9
- data/Rakefile +0 -57
- data/spec/fixtures/array_rows.yml +0 -4
- data/spec/fixtures/boroughs.yml +0 -16
- data/spec/fixtures/cities.yml +0 -8
- data/spec/fixtures/countries.yml +0 -15
- data/spec/fixtures/states.yml +0 -6
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
2010-12-06
|
|
2
|
+
- added dependency on ActiveModel
|
|
3
|
+
- add persisted? method to ActiveHash::Base
|
|
4
|
+
- ActiveHash::Base#save takes *args to be compatible with ActiveModel
|
|
5
|
+
- ActiveHash::Base#to_param returns nil if the object hasn't been saved
|
|
6
|
+
|
|
1
7
|
2010-11-09
|
|
2
8
|
- Use Ruby's definition of "word character" (numbers, underscores) when forming ActiveHash::Enum constants (tstuart)
|
|
3
9
|
|
data/Gemfile
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
source :gemcutter
|
|
2
2
|
|
|
3
|
-
gem "activerecord", "
|
|
4
|
-
gem "activesupport", "
|
|
5
|
-
gem "
|
|
6
|
-
gem "
|
|
7
|
-
gem "
|
|
8
|
-
gem "sqlite3-ruby", ">= 1.2.5"
|
|
3
|
+
gem "activerecord", "3.0.3"
|
|
4
|
+
gem "activesupport", "3.0.3"
|
|
5
|
+
gem "fixjour", "0.5.3"
|
|
6
|
+
gem "rspec", "2.2.0"
|
|
7
|
+
gem "sqlite3-ruby", ">= 1.3.2"
|
|
9
8
|
gem 'rake'
|
data/Gemfile.lock
CHANGED
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
activesupport (=
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
activemodel (3.0.3)
|
|
5
|
+
activesupport (= 3.0.3)
|
|
6
|
+
builder (~> 2.1.2)
|
|
7
|
+
i18n (~> 0.4)
|
|
8
|
+
activerecord (3.0.3)
|
|
9
|
+
activemodel (= 3.0.3)
|
|
10
|
+
activesupport (= 3.0.3)
|
|
11
|
+
arel (~> 2.0.2)
|
|
12
|
+
tzinfo (~> 0.3.23)
|
|
13
|
+
activesupport (3.0.3)
|
|
14
|
+
arel (2.0.6)
|
|
15
|
+
builder (2.1.2)
|
|
16
|
+
diff-lcs (1.1.2)
|
|
17
|
+
fixjour (0.5.3)
|
|
8
18
|
activerecord
|
|
9
|
-
|
|
10
|
-
git (1.2.5)
|
|
11
|
-
jeweler (1.4.0)
|
|
12
|
-
gemcutter (>= 0.1.0)
|
|
13
|
-
git (>= 1.2.5)
|
|
14
|
-
rubyforge (>= 2.0.0)
|
|
15
|
-
json_pure (1.4.6)
|
|
19
|
+
i18n (0.5.0)
|
|
16
20
|
rake (0.8.7)
|
|
17
|
-
rspec (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
rspec (2.2.0)
|
|
22
|
+
rspec-core (~> 2.2)
|
|
23
|
+
rspec-expectations (~> 2.2)
|
|
24
|
+
rspec-mocks (~> 2.2)
|
|
25
|
+
rspec-core (2.2.1)
|
|
26
|
+
rspec-expectations (2.2.0)
|
|
27
|
+
diff-lcs (~> 1.1.2)
|
|
28
|
+
rspec-mocks (2.2.0)
|
|
29
|
+
sqlite3-ruby (1.3.2)
|
|
30
|
+
tzinfo (0.3.23)
|
|
21
31
|
|
|
22
32
|
PLATFORMS
|
|
23
33
|
ruby
|
|
24
34
|
|
|
25
35
|
DEPENDENCIES
|
|
26
|
-
activerecord (=
|
|
27
|
-
activesupport (=
|
|
28
|
-
fixjour (= 0.
|
|
29
|
-
jeweler (= 1.4.0)
|
|
36
|
+
activerecord (= 3.0.3)
|
|
37
|
+
activesupport (= 3.0.3)
|
|
38
|
+
fixjour (= 0.5.3)
|
|
30
39
|
rake
|
|
31
|
-
rspec (
|
|
32
|
-
sqlite3-ruby (>= 1.2
|
|
40
|
+
rspec (= 2.2.0)
|
|
41
|
+
sqlite3-ruby (>= 1.3.2)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.9.0
|
data/active_hash.gemspec
CHANGED
|
@@ -1,61 +1,53 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
1
|
# -*- encoding: utf-8 -*-
|
|
5
2
|
|
|
6
3
|
Gem::Specification.new do |s|
|
|
7
4
|
s.name = %q{active_hash}
|
|
8
|
-
s.version = "0.
|
|
5
|
+
s.version = "0.9.0"
|
|
9
6
|
|
|
10
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
-
s.authors = [
|
|
12
|
-
|
|
8
|
+
s.authors = [
|
|
9
|
+
"Jeff Dean",
|
|
10
|
+
"Mike Dalessio",
|
|
11
|
+
"Corey Innis",
|
|
12
|
+
"Peter Jaros",
|
|
13
|
+
"Brandon Keene",
|
|
14
|
+
"Brian Takita",
|
|
15
|
+
"Pat Nakajima",
|
|
16
|
+
"John Pignata",
|
|
17
|
+
"Michael Schubert",
|
|
18
|
+
"Jeremy Weiskotten",
|
|
19
|
+
"Ryan Garver",
|
|
20
|
+
"Tom Stuart",
|
|
21
|
+
"Joel Chippindale"
|
|
22
|
+
]
|
|
23
|
+
s.date = %q{2010-12-06}
|
|
13
24
|
s.email = %q{jeff@zilkey.com}
|
|
14
25
|
s.extra_rdoc_files = [
|
|
15
26
|
"LICENSE",
|
|
16
|
-
|
|
27
|
+
"README.md"
|
|
17
28
|
]
|
|
18
29
|
s.files = [
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"Rakefile",
|
|
27
|
-
"VERSION",
|
|
28
|
-
"active_hash.gemspec",
|
|
29
|
-
"lib/active_file/base.rb",
|
|
30
|
-
"lib/active_hash.rb",
|
|
31
|
-
"lib/active_hash/base.rb",
|
|
32
|
-
"lib/active_yaml/base.rb",
|
|
33
|
-
"lib/associations/associations.rb",
|
|
34
|
-
"lib/enum/enum.rb",
|
|
35
|
-
"spec/active_file/base_spec.rb",
|
|
36
|
-
"spec/active_hash/base_spec.rb",
|
|
37
|
-
"spec/active_yaml/base_spec.rb",
|
|
38
|
-
"spec/associations/associations_spec.rb",
|
|
39
|
-
"spec/enum/enum_spec.rb",
|
|
40
|
-
"spec/fixtures/array_rows.yml",
|
|
41
|
-
"spec/fixtures/boroughs.yml",
|
|
42
|
-
"spec/fixtures/cities.yml",
|
|
43
|
-
"spec/fixtures/countries.yml",
|
|
44
|
-
"spec/fixtures/states.yml",
|
|
45
|
-
"spec/spec_helper.rb"
|
|
46
|
-
]
|
|
30
|
+
"CHANGELOG",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"README.md",
|
|
33
|
+
"VERSION",
|
|
34
|
+
"active_hash.gemspec",
|
|
35
|
+
Dir.glob("lib/**/*")
|
|
36
|
+
].flatten
|
|
47
37
|
s.homepage = %q{http://github.com/zilkey/active_hash}
|
|
48
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
|
49
38
|
s.require_paths = ["lib"]
|
|
50
39
|
s.rubygems_version = %q{1.3.7}
|
|
51
40
|
s.summary = %q{An ActiveRecord-like model that uses a hash or file as a datasource}
|
|
52
41
|
s.test_files = [
|
|
42
|
+
"Gemfile",
|
|
43
|
+
"Gemfile.lock",
|
|
53
44
|
"spec/active_file/base_spec.rb",
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
"spec/active_hash/base_spec.rb",
|
|
46
|
+
"spec/active_yaml/base_spec.rb",
|
|
47
|
+
"spec/associations/associations_spec.rb",
|
|
48
|
+
"spec/enum/enum_spec.rb",
|
|
49
|
+
"spec/lint_spec.rb",
|
|
50
|
+
"spec/spec_helper.rb"
|
|
59
51
|
]
|
|
60
52
|
|
|
61
53
|
if s.respond_to? :specification_version then
|
data/lib/active_hash.rb
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
require 'active_support'
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'active_support/all'
|
|
5
|
+
rescue MissingSourceFile
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
begin
|
|
9
|
+
require 'active_model'
|
|
10
|
+
require 'active_model/naming'
|
|
11
|
+
rescue MissingSourceFile
|
|
12
|
+
end
|
|
13
|
+
|
|
2
14
|
require 'active_hash/base'
|
|
3
15
|
require 'active_file/base'
|
|
4
16
|
require 'active_yaml/base'
|
data/lib/active_hash/base.rb
CHANGED
|
@@ -5,6 +5,16 @@ module ActiveHash
|
|
|
5
5
|
|
|
6
6
|
class Base
|
|
7
7
|
class_inheritable_accessor :data, :dirty
|
|
8
|
+
|
|
9
|
+
if Object.const_defined?(:ActiveModel)
|
|
10
|
+
extend ActiveModel::Naming
|
|
11
|
+
include ActiveModel::Conversion
|
|
12
|
+
else
|
|
13
|
+
def to_param
|
|
14
|
+
id.present? ? id.to_s : nil
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
8
18
|
class << self
|
|
9
19
|
attr_reader :field_names
|
|
10
20
|
|
|
@@ -143,7 +153,7 @@ module ActiveHash
|
|
|
143
153
|
else
|
|
144
154
|
result = matches.first
|
|
145
155
|
if config[:bang?]
|
|
146
|
-
result || raise(RecordNotFound, "Couldn\'t find #{name} with #{attribute_pairs.collect {|pair| "#{pair
|
|
156
|
+
result || raise(RecordNotFound, "Couldn\'t find #{name} with #{attribute_pairs.collect {|pair| "#{pair[0]} = #{pair[1]}"}.join(', ')}")
|
|
147
157
|
else
|
|
148
158
|
result
|
|
149
159
|
end
|
|
@@ -304,12 +314,12 @@ module ActiveHash
|
|
|
304
314
|
false
|
|
305
315
|
end
|
|
306
316
|
|
|
307
|
-
def
|
|
308
|
-
|
|
317
|
+
def persisted?
|
|
318
|
+
self.class.all.map(&:id).include?(id)
|
|
309
319
|
end
|
|
310
320
|
|
|
311
|
-
def
|
|
312
|
-
|
|
321
|
+
def readonly?
|
|
322
|
+
true
|
|
313
323
|
end
|
|
314
324
|
|
|
315
325
|
def eql?(other)
|
|
@@ -333,7 +343,21 @@ module ActiveHash
|
|
|
333
343
|
end
|
|
334
344
|
end
|
|
335
345
|
|
|
336
|
-
def
|
|
346
|
+
def errors
|
|
347
|
+
obj = Object.new
|
|
348
|
+
|
|
349
|
+
def obj.[](key)
|
|
350
|
+
[]
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
def obj.full_messages()
|
|
354
|
+
[]
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
obj
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
def save(*args)
|
|
337
361
|
self.class.insert(self)
|
|
338
362
|
true
|
|
339
363
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveHash, "Base" do
|
|
4
4
|
|
|
@@ -241,7 +241,7 @@ describe ActiveHash, "Base" do
|
|
|
241
241
|
|
|
242
242
|
context "with :all" do
|
|
243
243
|
it "returns all records" do
|
|
244
|
-
Country.find(:all).should
|
|
244
|
+
Country.find(:all).should == [Country.new(:id => 1), Country.new(:id => 2)]
|
|
245
245
|
end
|
|
246
246
|
end
|
|
247
247
|
|
|
@@ -262,7 +262,7 @@ describe ActiveHash, "Base" do
|
|
|
262
262
|
end
|
|
263
263
|
|
|
264
264
|
it "returns all matching ids" do
|
|
265
|
-
Country.find([1, 3]).should
|
|
265
|
+
Country.find([1, 3]).should == [Country.new(:id => 1), Country.new(:id => 3)]
|
|
266
266
|
end
|
|
267
267
|
end
|
|
268
268
|
end
|
|
@@ -567,7 +567,27 @@ describe ActiveHash, "Base" do
|
|
|
567
567
|
|
|
568
568
|
describe "#to_param" do
|
|
569
569
|
it "should return id as a string" do
|
|
570
|
-
Country.
|
|
570
|
+
Country.create(:id => 2).to_param.should == "2"
|
|
571
|
+
end
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
describe "#persisted" do
|
|
575
|
+
it "should return true if the object has been saved" do
|
|
576
|
+
Country.create(:id => 2).should be_persisted
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
it "should return false if the object has not been saved" do
|
|
580
|
+
Country.new(:id => 2).should_not be_persisted
|
|
581
|
+
end
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
describe "#persisted" do
|
|
585
|
+
it "should return true if the object has been saved" do
|
|
586
|
+
Country.create(:id => 2).should be_persisted
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
it "should return false if the object has not been saved" do
|
|
590
|
+
Country.new(:id => 2).should_not be_persisted
|
|
571
591
|
end
|
|
572
592
|
end
|
|
573
593
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveHash::Base, "associations" do
|
|
4
4
|
|
|
@@ -29,7 +29,12 @@ describe ActiveHash::Base, "associations" do
|
|
|
29
29
|
t.integer :author_id
|
|
30
30
|
t.boolean :published
|
|
31
31
|
end
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
if Object.const_defined?(:ActiveModel)
|
|
34
|
+
scope :published, {:conditions => {:published => true}}
|
|
35
|
+
else
|
|
36
|
+
named_scope :published, {:conditions => {:published => true}}
|
|
37
|
+
end
|
|
33
38
|
end
|
|
34
39
|
end
|
|
35
40
|
|
|
@@ -45,42 +50,42 @@ describe ActiveHash::Base, "associations" do
|
|
|
45
50
|
|
|
46
51
|
context "with ActiveRecord children" do
|
|
47
52
|
before do
|
|
48
|
-
@included_book_1
|
|
49
|
-
@included_book_2
|
|
50
|
-
@excluded_book
|
|
53
|
+
@included_book_1 = Book.create! :author_id => 1, :published => true
|
|
54
|
+
@included_book_2 = Book.create! :author_id => 1, :published => false
|
|
55
|
+
@excluded_book = Book.create! :author_id => 2, :published => true
|
|
51
56
|
end
|
|
52
57
|
|
|
53
58
|
it "find the correct records" do
|
|
54
59
|
Author.has_many :books
|
|
55
60
|
author = Author.create :id => 1
|
|
56
|
-
author.books.should
|
|
61
|
+
author.books.should == [@included_book_1, @included_book_2]
|
|
57
62
|
end
|
|
58
63
|
|
|
59
64
|
it "return a scope so that we can apply further scopes" do
|
|
60
65
|
Author.has_many :books
|
|
61
66
|
author = Author.create :id => 1
|
|
62
|
-
author.books.published.should
|
|
67
|
+
author.books.published.should == [@included_book_1]
|
|
63
68
|
end
|
|
64
69
|
end
|
|
65
70
|
|
|
66
71
|
context "with ActiveHash children" do
|
|
67
72
|
before do
|
|
68
73
|
Author.field :city_id
|
|
69
|
-
@included_author_1
|
|
70
|
-
@included_author_2
|
|
71
|
-
@excluded_author
|
|
74
|
+
@included_author_1 = Author.create :city_id => 1
|
|
75
|
+
@included_author_2 = Author.create :city_id => 1
|
|
76
|
+
@excluded_author = Author.create :city_id => 2
|
|
72
77
|
end
|
|
73
78
|
|
|
74
79
|
it "find the correct records" do
|
|
75
80
|
City.has_many :authors
|
|
76
81
|
city = City.create :id => 1
|
|
77
|
-
city.authors.should
|
|
82
|
+
city.authors.should == [@included_author_1, @included_author_2]
|
|
78
83
|
end
|
|
79
84
|
|
|
80
85
|
it "uses the correct class name when passed" do
|
|
81
86
|
City.has_many :writers, :class_name => "Author"
|
|
82
87
|
city = City.create :id => 1
|
|
83
|
-
city.writers.should
|
|
88
|
+
city.writers.should == [@included_author_1, @included_author_2]
|
|
84
89
|
end
|
|
85
90
|
end
|
|
86
91
|
|
data/spec/enum/enum_spec.rb
CHANGED
data/spec/lint_spec.rb
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
if Object.const_defined?(:ActiveModel)
|
|
4
|
+
|
|
5
|
+
require 'test/unit'
|
|
6
|
+
require 'test/unit/assertions'
|
|
7
|
+
require 'active_model/lint'
|
|
8
|
+
|
|
9
|
+
describe ActiveModel::Lint do
|
|
10
|
+
include Test::Unit::Assertions
|
|
11
|
+
include ActiveModel::Lint::Tests
|
|
12
|
+
|
|
13
|
+
before do
|
|
14
|
+
class Category < ActiveHash::Base
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
after do
|
|
19
|
+
Object.send(:remove_const, :Category)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# to_s is to support ruby-1.9
|
|
23
|
+
ActiveModel::Lint::Tests.public_instance_methods.map { |m| m.to_s }.grep(/^test/).each do |m|
|
|
24
|
+
example m.gsub('_', ' ') do
|
|
25
|
+
send m
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def model
|
|
30
|
+
Category.new
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require '
|
|
2
|
-
require '
|
|
1
|
+
require 'rspec'
|
|
2
|
+
require 'rspec/autorun'
|
|
3
3
|
require 'active_record'
|
|
4
4
|
require 'fixjour'
|
|
5
5
|
|
|
@@ -7,14 +7,6 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
|
7
7
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
8
8
|
require 'active_hash'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
def self.to_ary
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.to_str
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Spec::Runner.configure do |config|
|
|
10
|
+
RSpec.configure do |config|
|
|
19
11
|
config.include Fixjour
|
|
20
12
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_hash
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 59
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 0.
|
|
8
|
+
- 9
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.9.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Jeff Dean
|
|
@@ -27,7 +27,7 @@ autorequire:
|
|
|
27
27
|
bindir: bin
|
|
28
28
|
cert_chain: []
|
|
29
29
|
|
|
30
|
-
date: 2010-
|
|
30
|
+
date: 2010-12-06 00:00:00 -07:00
|
|
31
31
|
default_executable:
|
|
32
32
|
dependencies:
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
@@ -56,40 +56,33 @@ extra_rdoc_files:
|
|
|
56
56
|
- LICENSE
|
|
57
57
|
- README.md
|
|
58
58
|
files:
|
|
59
|
-
- .document
|
|
60
|
-
- .gitignore
|
|
61
59
|
- CHANGELOG
|
|
62
|
-
- Gemfile
|
|
63
|
-
- Gemfile.lock
|
|
64
60
|
- LICENSE
|
|
65
61
|
- README.md
|
|
66
|
-
- Rakefile
|
|
67
62
|
- VERSION
|
|
68
63
|
- active_hash.gemspec
|
|
69
64
|
- lib/active_file/base.rb
|
|
70
|
-
- lib/active_hash.rb
|
|
71
65
|
- lib/active_hash/base.rb
|
|
66
|
+
- lib/active_hash.rb
|
|
72
67
|
- lib/active_yaml/base.rb
|
|
73
68
|
- lib/associations/associations.rb
|
|
74
69
|
- lib/enum/enum.rb
|
|
70
|
+
- Gemfile
|
|
71
|
+
- Gemfile.lock
|
|
75
72
|
- spec/active_file/base_spec.rb
|
|
76
73
|
- spec/active_hash/base_spec.rb
|
|
77
74
|
- spec/active_yaml/base_spec.rb
|
|
78
75
|
- spec/associations/associations_spec.rb
|
|
79
76
|
- spec/enum/enum_spec.rb
|
|
80
|
-
- spec/
|
|
81
|
-
- spec/fixtures/boroughs.yml
|
|
82
|
-
- spec/fixtures/cities.yml
|
|
83
|
-
- spec/fixtures/countries.yml
|
|
84
|
-
- spec/fixtures/states.yml
|
|
77
|
+
- spec/lint_spec.rb
|
|
85
78
|
- spec/spec_helper.rb
|
|
86
79
|
has_rdoc: true
|
|
87
80
|
homepage: http://github.com/zilkey/active_hash
|
|
88
81
|
licenses: []
|
|
89
82
|
|
|
90
83
|
post_install_message:
|
|
91
|
-
rdoc_options:
|
|
92
|
-
|
|
84
|
+
rdoc_options: []
|
|
85
|
+
|
|
93
86
|
require_paths:
|
|
94
87
|
- lib
|
|
95
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -118,9 +111,12 @@ signing_key:
|
|
|
118
111
|
specification_version: 3
|
|
119
112
|
summary: An ActiveRecord-like model that uses a hash or file as a datasource
|
|
120
113
|
test_files:
|
|
114
|
+
- Gemfile
|
|
115
|
+
- Gemfile.lock
|
|
121
116
|
- spec/active_file/base_spec.rb
|
|
122
117
|
- spec/active_hash/base_spec.rb
|
|
123
118
|
- spec/active_yaml/base_spec.rb
|
|
124
119
|
- spec/associations/associations_spec.rb
|
|
125
120
|
- spec/enum/enum_spec.rb
|
|
121
|
+
- spec/lint_spec.rb
|
|
126
122
|
- spec/spec_helper.rb
|
data/.document
DELETED
data/.gitignore
DELETED
data/Rakefile
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'rake'
|
|
3
|
-
|
|
4
|
-
begin
|
|
5
|
-
require 'jeweler'
|
|
6
|
-
Jeweler::Tasks.new do |gem|
|
|
7
|
-
gem.name = "active_hash"
|
|
8
|
-
gem.summary = %Q{An ActiveRecord-like model that uses a hash or file as a datasource}
|
|
9
|
-
gem.email = "jeff@zilkey.com"
|
|
10
|
-
gem.homepage = "http://github.com/zilkey/active_hash"
|
|
11
|
-
gem.authors = [
|
|
12
|
-
"Jeff Dean",
|
|
13
|
-
"Mike Dalessio",
|
|
14
|
-
"Corey Innis",
|
|
15
|
-
"Peter Jaros",
|
|
16
|
-
"Brandon Keene",
|
|
17
|
-
"Brian Takita",
|
|
18
|
-
"Pat Nakajima",
|
|
19
|
-
"John Pignata",
|
|
20
|
-
"Michael Schubert",
|
|
21
|
-
"Jeremy Weiskotten",
|
|
22
|
-
"Ryan Garver",
|
|
23
|
-
"Tom Stuart",
|
|
24
|
-
"Joel Chippindale"
|
|
25
|
-
]
|
|
26
|
-
gem.add_dependency('activesupport', [">= 2.2.2"])
|
|
27
|
-
# gem.post_install_message = ""
|
|
28
|
-
end
|
|
29
|
-
Jeweler::GemcutterTasks.new
|
|
30
|
-
rescue LoadError
|
|
31
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
require 'spec/rake/spectask'
|
|
35
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
|
36
|
-
spec.libs << 'lib' << 'spec'
|
|
37
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
|
41
|
-
spec.libs << 'lib' << 'spec'
|
|
42
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
|
43
|
-
spec.rcov = true
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
task :default => :spec
|
|
48
|
-
|
|
49
|
-
require 'rake/rdoctask'
|
|
50
|
-
Rake::RDocTask.new do |rdoc|
|
|
51
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
52
|
-
|
|
53
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
54
|
-
rdoc.title = "the-perfect-gem #{version}"
|
|
55
|
-
rdoc.rdoc_files.include('README*')
|
|
56
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
57
|
-
end
|
data/spec/fixtures/boroughs.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
- id: 1
|
|
2
|
-
name: Manhattan
|
|
3
|
-
county: New York
|
|
4
|
-
population: 1634795
|
|
5
|
-
- id: 2
|
|
6
|
-
name: Brooklyn
|
|
7
|
-
county: Kings
|
|
8
|
-
population: 2556598
|
|
9
|
-
- id: 3
|
|
10
|
-
name: Queens
|
|
11
|
-
county: Queens
|
|
12
|
-
population: 2293007
|
|
13
|
-
- id: 4
|
|
14
|
-
name: Staten Island
|
|
15
|
-
county: Richmond
|
|
16
|
-
population: 487407
|
data/spec/fixtures/cities.yml
DELETED
data/spec/fixtures/countries.yml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
- id: 1
|
|
2
|
-
name: US
|
|
3
|
-
independence_date: 1776-07-04
|
|
4
|
-
created_at: Wed Jul 22 22:41:44 -0400 2009
|
|
5
|
-
custom_field_1: value1
|
|
6
|
-
- id: 2
|
|
7
|
-
name: Canada
|
|
8
|
-
independence_date: 1867-07-01
|
|
9
|
-
created_at: Wed Jul 22 22:41:44 -0400 2009
|
|
10
|
-
custom_field_2: value2
|
|
11
|
-
- id: 3
|
|
12
|
-
name: Mexico
|
|
13
|
-
independence_date: 1810-09-16
|
|
14
|
-
created_at: Wed Jul 22 22:41:44 -0400 2009
|
|
15
|
-
custom_field_3: value3
|