bigrecord 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/{MIT-LICENSE → LICENSE} +0 -0
  2. data/README.rdoc +3 -3
  3. data/Rakefile +1 -2
  4. data/VERSION +1 -1
  5. data/doc/bigrecord_specs.rdoc +0 -0
  6. data/doc/getting_started.rdoc +4 -0
  7. data/examples/bigrecord.yml +0 -0
  8. data/generators/bigrecord/bigrecord_generator.rb +0 -0
  9. data/generators/bigrecord/templates/bigrecord.rake +0 -0
  10. data/generators/bigrecord_migration/bigrecord_migration_generator.rb +0 -0
  11. data/generators/bigrecord_migration/templates/migration.rb +0 -0
  12. data/generators/bigrecord_model/bigrecord_model_generator.rb +0 -0
  13. data/generators/bigrecord_model/templates/migration.rb +0 -0
  14. data/generators/bigrecord_model/templates/model.rb +0 -0
  15. data/generators/bigrecord_model/templates/model_spec.rb +0 -0
  16. data/init.rb +1 -9
  17. data/install.rb +0 -0
  18. data/lib/big_record/abstract_base.rb +0 -1
  19. data/lib/big_record/action_view_extensions.rb +0 -0
  20. data/lib/big_record/ar_associations/association_collection.rb +0 -0
  21. data/lib/big_record/ar_associations/association_proxy.rb +0 -0
  22. data/lib/big_record/ar_associations/belongs_to_association.rb +0 -0
  23. data/lib/big_record/ar_associations/belongs_to_many_association.rb +0 -0
  24. data/lib/big_record/ar_associations/has_and_belongs_to_many_association.rb +0 -0
  25. data/lib/big_record/ar_associations/has_many_association.rb +0 -0
  26. data/lib/big_record/ar_associations/has_one_association.rb +0 -0
  27. data/lib/big_record/ar_associations.rb +8 -6
  28. data/lib/big_record/ar_reflection.rb +1 -1
  29. data/lib/big_record/attribute_methods.rb +1 -1
  30. data/lib/big_record/base.rb +35 -24
  31. data/lib/big_record/br_associations/association_collection.rb +0 -0
  32. data/lib/big_record/br_associations/association_proxy.rb +0 -0
  33. data/lib/big_record/br_associations/belongs_to_association.rb +0 -0
  34. data/lib/big_record/br_associations/belongs_to_many_association.rb +0 -0
  35. data/lib/big_record/br_associations/cached_item_proxy.rb +0 -0
  36. data/lib/big_record/br_associations/cached_item_proxy_factory.rb +0 -0
  37. data/lib/big_record/br_associations/has_and_belongs_to_many_association.rb +0 -0
  38. data/lib/big_record/br_associations/has_one_association.rb +0 -0
  39. data/lib/big_record/br_associations.rb +8 -6
  40. data/lib/big_record/br_reflection.rb +0 -0
  41. data/lib/big_record/callbacks.rb +0 -0
  42. data/lib/big_record/connection_adapters/abstract/connection_specification.rb +0 -0
  43. data/lib/big_record/connection_adapters/abstract/database_statements.rb +0 -0
  44. data/lib/big_record/connection_adapters/abstract/quoting.rb +0 -0
  45. data/lib/big_record/connection_adapters/abstract_adapter.rb +0 -0
  46. data/lib/big_record/connection_adapters/column.rb +0 -0
  47. data/lib/big_record/connection_adapters/hbase_adapter.rb +0 -0
  48. data/lib/big_record/connection_adapters/view.rb +13 -1
  49. data/lib/big_record/connection_adapters.rb +0 -0
  50. data/lib/big_record/deletion.rb +0 -0
  51. data/lib/big_record/dynamic_schema.rb +3 -6
  52. data/lib/big_record/embedded.rb +0 -0
  53. data/lib/big_record/embedded_associations/association_proxy.rb +0 -0
  54. data/lib/big_record/family_span_columns.rb +0 -0
  55. data/lib/big_record/fixtures.rb +0 -0
  56. data/lib/big_record/migration.rb +1 -16
  57. data/lib/big_record/routing_ext.rb +1 -27
  58. data/lib/big_record/timestamp.rb +3 -3
  59. data/lib/big_record/validations.rb +1 -1
  60. data/lib/big_record.rb +35 -47
  61. data/lib/bigrecord.rb +0 -0
  62. data/rails/init.rb +8 -2
  63. data/spec/connections/bigrecord.yml +0 -0
  64. data/spec/connections/cassandra/connection.rb +0 -0
  65. data/spec/connections/hbase/connection.rb +0 -0
  66. data/spec/debug.log +40722 -246
  67. data/spec/integration/br_associations_spec.rb +0 -0
  68. data/spec/lib/animal.rb +10 -5
  69. data/spec/lib/book.rb +0 -0
  70. data/spec/lib/broken_migrations/duplicate_name/20090706182535_add_animals_table.rb +0 -0
  71. data/spec/lib/broken_migrations/duplicate_name/20090706193019_add_animals_table.rb +0 -0
  72. data/spec/lib/broken_migrations/duplicate_version/20090706190623_add_books_table.rb +0 -0
  73. data/spec/lib/broken_migrations/duplicate_version/20090706190623_add_companies_table.rb +0 -0
  74. data/spec/lib/company.rb +0 -0
  75. data/spec/lib/embedded/web_link.rb +0 -0
  76. data/spec/lib/employee.rb +0 -0
  77. data/spec/lib/migrations/20090706182535_add_animals_table.rb +0 -0
  78. data/spec/lib/migrations/20090706190623_add_books_table.rb +0 -0
  79. data/spec/lib/migrations/20090706193019_add_companies_table.rb +0 -0
  80. data/spec/lib/migrations/20090706194512_add_employees_table.rb +0 -0
  81. data/spec/lib/migrations/20090706195741_add_zoos_table.rb +0 -0
  82. data/spec/lib/novel.rb +0 -0
  83. data/spec/lib/zoo.rb +0 -0
  84. data/spec/spec.opts +0 -0
  85. data/spec/spec_helper.rb +0 -0
  86. data/spec/unit/abstract_base_spec.rb +0 -56
  87. data/spec/unit/adapters/abstract_adapter_spec.rb +0 -0
  88. data/spec/unit/adapters/adapter_shared_spec.rb +0 -0
  89. data/spec/unit/adapters/hbase_adapter_spec.rb +0 -0
  90. data/spec/unit/ar_associations_spec.rb +0 -0
  91. data/spec/unit/base_spec.rb +101 -0
  92. data/spec/unit/br_associations_spec.rb +0 -0
  93. data/spec/unit/embedded_spec.rb +0 -0
  94. data/spec/unit/find_spec.rb +0 -0
  95. data/spec/unit/hash_helper_spec.rb +0 -0
  96. data/spec/unit/migration_spec.rb +0 -0
  97. data/spec/unit/model_spec.rb +0 -0
  98. data/spec/unit/validations_spec.rb +0 -0
  99. data/tasks/bigrecord_tasks.rake +0 -0
  100. data/tasks/data_store.rb +0 -0
  101. data/tasks/gem.rb +4 -3
  102. data/tasks/rdoc.rb +0 -0
  103. data/tasks/spec.rb +1 -1
  104. metadata +24 -4
File without changes
data/spec/lib/animal.rb CHANGED
@@ -1,12 +1,17 @@
1
1
  class Animal < BigRecord::Base
2
2
 
3
- column 'attribute:name', 'string'
4
- column 'attribute:type', 'integer'
5
- column :description, :string
3
+ column :name, :string
4
+ column :type, :integer
5
+ column :description, :string
6
6
 
7
- column 'attribute:zoo_id', 'string'
8
- column 'attribute:book_ids', 'string', :collection => true
7
+ column :zoo_id, :string
8
+ column :book_ids, :string, :collection => true
9
9
 
10
10
  belongs_to_big_record :zoo, :foreign_key => 'attribute:zoo_id'
11
11
  belongs_to_many :books, :foreign_key => 'attribute:book_ids'
12
+
13
+
14
+ view :brief, :name
15
+ view :summary, [:name, :description, :zoo_id]
16
+ view :full, :name, :type, :description
12
17
  end
data/spec/lib/book.rb CHANGED
File without changes
data/spec/lib/company.rb CHANGED
File without changes
File without changes
data/spec/lib/employee.rb CHANGED
File without changes
File without changes
data/spec/lib/novel.rb CHANGED
File without changes
data/spec/lib/zoo.rb CHANGED
File without changes
data/spec/spec.opts CHANGED
File without changes
data/spec/spec_helper.rb CHANGED
File without changes
@@ -5,62 +5,6 @@ describe "BigRecord::AbstractBase", :shared => true do
5
5
  Book.should respond_to(:primary_key)
6
6
  end
7
7
 
8
- describe '#columns' do
9
-
10
- before(:all) do
11
- # Grab the columns from a simple BigRecord model
12
- @columns = Book.columns
13
- end
14
-
15
- it 'should return a hash of Column objects describing the columns in the model' do
16
- # Verify that each entry is a Column object
17
- @columns.each do |column|
18
- column.should be_a_kind_of(BigRecord::ConnectionAdapters::Column)
19
- end
20
-
21
- # Map the names of each of the columns
22
- column_names = @columns.map{ |column| column.name }
23
-
24
- # Verify that each attribute we defined in the Book model is present
25
- expected_names = %w( attribute:title attribute:author attribute:description family2: log:change )
26
- (column_names & expected_names).sort.should == expected_names.sort
27
- end
28
-
29
- it 'should save a default alias name for each column (e.g. attribute:name become alias name automatically)' do
30
- lookup = { 'attribute:id' => 'id',
31
- 'attribute:title' => 'title',
32
- 'attribute:author' => 'author',
33
- 'attribute:description' => 'description'}
34
-
35
- # Go through each column and if an attribute name is found that matches the lookup table above,
36
- # verify that the alias name it creates is the one we expect.
37
- @columns.each do |column|
38
- if lookup.has_key?(column.name)
39
- column.alias.should == lookup[column.name]
40
- end
41
- end
42
- end
43
-
44
- end
45
-
46
- describe 'column families' do
47
-
48
- it 'should respond to #default_family with a default value, or with the value defined in the model' do
49
- Book.should respond_to(:default_family)
50
- Book.default_family.should == "attribute"
51
-
52
- Zoo.should respond_to(:default_family)
53
- Zoo.default_family.should == "attr"
54
- end
55
-
56
- it 'should automatically append the #default_family to columns without one defined' do
57
- Zoo.columns.map{|column| column.name}.should include("attr:description")
58
- Zoo.new.should respond_to(:description)
59
- Zoo.new.should respond_to(:description=)
60
- end
61
-
62
- end
63
-
64
8
  describe '.attributes' do
65
9
 
66
10
  before(:each) do
File without changes
File without changes
File without changes
File without changes
@@ -3,4 +3,105 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'abstract_base_spec')
3
3
 
4
4
  describe BigRecord::Base do
5
5
  it_should_behave_like "BigRecord::AbstractBase"
6
+
7
+ describe '#columns' do
8
+
9
+ before(:all) do
10
+ # Grab the columns from a simple BigRecord model
11
+ @columns = Book.columns
12
+ end
13
+
14
+ it 'should return a hash of Column objects describing the columns in the model' do
15
+ # Verify that each entry is a Column object
16
+ @columns.each do |column|
17
+ column.should be_a_kind_of(BigRecord::ConnectionAdapters::Column)
18
+ end
19
+
20
+ # Map the names of each of the columns
21
+ column_names = @columns.map{ |column| column.name }
22
+
23
+ # Verify that each attribute we defined in the Book model is present
24
+ expected_names = %w( attribute:title attribute:author attribute:description family2: log:change )
25
+ (column_names & expected_names).sort.should == expected_names.sort
26
+ end
27
+
28
+ it 'should save a default alias name for each column (e.g. attribute:name become alias name automatically)' do
29
+ lookup = { 'attribute:id' => 'id',
30
+ 'attribute:title' => 'title',
31
+ 'attribute:author' => 'author',
32
+ 'attribute:description' => 'description'}
33
+
34
+ # Go through each column and if an attribute name is found that matches the lookup table above,
35
+ # verify that the alias name it creates is the one we expect.
36
+ @columns.each do |column|
37
+ if lookup.has_key?(column.name)
38
+ column.alias.should == lookup[column.name]
39
+ end
40
+ end
41
+ end
42
+
43
+ it "#columns_to_find should return full column names, even when alias names are passed to it" do
44
+ options = {:columns => [:name, :type, 'attribute:description']}
45
+
46
+ # Check that it resolves the alias to full column names
47
+ Animal.columns_to_find(options).should == ['attribute:name', 'attribute:type', 'attribute:description']
48
+ end
49
+ end
50
+
51
+ describe 'column views' do
52
+
53
+ before(:all) do
54
+ # Grab the columns from a simple BigRecord model
55
+ @columns = Animal.columns
56
+ end
57
+
58
+ it "#view_names should return a list of view names" do
59
+ [:brief, :summary, :full].each do |view|
60
+ Animal.view_names.should include(view)
61
+ end
62
+ end
63
+
64
+ it "#views_hash should return a list of View objects" do
65
+ Animal.views_hash.each do |name,view|
66
+ view.should be_a_kind_of(BigRecord::ConnectionAdapters::View)
67
+ end
68
+ end
69
+
70
+ it "should return all the columns for a given view name" do
71
+ Animal.views_hash[:brief].columns.size.should == 1
72
+ Animal.views_hash[:summary].columns.size.should == 3
73
+ Animal.views_hash[:full].columns.size.should == 3
74
+
75
+ Animal.views_hash[:brief].columns.each do |column|
76
+ ['attribute:name'].should include(column.name)
77
+ end
78
+
79
+ Animal.views_hash[:summary].columns.each do |column|
80
+ ['attribute:name','attribute:description','attribute:zoo_id'].should include(column.name)
81
+ end
82
+
83
+ Animal.views_hash[:full].columns.each do |column|
84
+ ['attribute:name','attribute:type','attribute:description'].should include(column.name)
85
+ end
86
+ end
87
+ end
88
+
89
+ describe 'column families' do
90
+
91
+ it 'should respond to #default_family with a default value, or with the value defined in the model' do
92
+ Book.should respond_to(:default_family)
93
+ Book.default_family.should == "attribute"
94
+
95
+ Zoo.should respond_to(:default_family)
96
+ Zoo.default_family.should == "attr"
97
+ end
98
+
99
+ it 'should automatically append the #default_family to columns without one defined' do
100
+ Zoo.columns.map{|column| column.name}.should include("attr:description")
101
+ Zoo.new.should respond_to(:description)
102
+ Zoo.new.should respond_to(:description=)
103
+ end
104
+
105
+ end
106
+
6
107
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/tasks/data_store.rb CHANGED
File without changes
data/tasks/gem.rb CHANGED
@@ -9,14 +9,15 @@ begin
9
9
  gemspec.summary = "Object mapper for supporting column-oriented data stores (supports #{DATA_STORES.join(" ")}) in Ruby on Rails."
10
10
  gemspec.description = "BigRecord is built from ActiveRecord, and intended to seamlessly integrate into your Ruby on Rails applications."
11
11
  gemspec.files = FileList["{doc,examples,generators,lib,rails,spec,tasks}/**/*","init.rb","install.rb","Rakefile","VERSION"].to_a
12
- gemspec.extra_rdoc_files = FileList["doc/**/*","MIT-LICENSE","README.rdoc"].to_a
12
+ gemspec.extra_rdoc_files = FileList["doc/**/*","LICENSE","README.rdoc"].to_a
13
13
 
14
14
  gemspec.add_development_dependency "rspec"
15
15
  gemspec.add_dependency "uuidtools", ">= 2.0.0"
16
16
  gemspec.add_dependency "bigrecord-driver"
17
+ gemspec.add_dependency "activesupport"
18
+ gemspec.add_dependency "activerecord"
17
19
  end
18
20
  Jeweler::GemcutterTasks.new
19
21
  rescue LoadError
20
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
22
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
21
23
  end
22
-
data/tasks/rdoc.rb CHANGED
File without changes
data/tasks/spec.rb CHANGED
@@ -9,7 +9,7 @@ namespace :spec do
9
9
  def run_spec(name, adapter, files, rcov)
10
10
  Spec::Rake::SpecTask.new(name) do |t|
11
11
  t.spec_opts << File.open("spec/spec.opts").readlines.map{|x| x.chomp}
12
- t.spec_files = Pathname.glob(files.to_s).map { |f| f.to_s }
12
+ t.spec_files = Dir[files.to_s].map { |f| f.to_s }
13
13
  connection_path = "spec/connections/#{adapter}"
14
14
  t.libs << "spec" << connection_path
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigrecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - openplaces.org
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-12 00:00:00 -04:00
12
+ date: 2009-10-27 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,6 +42,26 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: "0"
44
44
  version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: activesupport
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: activerecord
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
45
65
  description: BigRecord is built from ActiveRecord, and intended to seamlessly integrate into your Ruby on Rails applications.
46
66
  email: bigrecord@openplaces.org
47
67
  executables: []
@@ -49,7 +69,7 @@ executables: []
49
69
  extensions: []
50
70
 
51
71
  extra_rdoc_files:
52
- - MIT-LICENSE
72
+ - LICENSE
53
73
  - README.rdoc
54
74
  - doc/bigrecord_specs.rdoc
55
75
  - doc/getting_started.rdoc
@@ -155,7 +175,7 @@ files:
155
175
  - tasks/gem.rb
156
176
  - tasks/rdoc.rb
157
177
  - tasks/spec.rb
158
- - MIT-LICENSE
178
+ - LICENSE
159
179
  - README.rdoc
160
180
  has_rdoc: true
161
181
  homepage: http://www.bigrecord.org