dm-is-remixable 0.9.11 → 0.10.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.
@@ -1,3 +1,7 @@
1
+ === 0.10.0 / 2009-10-15
2
+
3
+ * Updated to work with dm-core 0.10.0
4
+
1
5
  === 0.9.11 / 2009-03-29
2
6
 
3
7
  * No changes this version
data/Manifest.txt CHANGED
@@ -1,7 +1,7 @@
1
- History.txt
1
+ History.rdoc
2
2
  LICENSE
3
3
  Manifest.txt
4
- README.txt
4
+ README.rdoc
5
5
  Rakefile
6
6
  TODO
7
7
  lib/dm-is-remixable.rb
File without changes
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'pathname'
2
- require 'rubygems'
3
2
 
4
3
  ROOT = Pathname(__FILE__).dirname.expand_path
5
4
  JRUBY = RUBY_PLATFORM =~ /java/
@@ -14,10 +13,10 @@ GEM_NAME = 'dm-is-remixable'
14
13
  GEM_VERSION = DataMapper::Is::Remixable::VERSION
15
14
  GEM_DEPENDENCIES = [['dm-core', GEM_VERSION]]
16
15
  GEM_CLEAN = %w[ log pkg coverage ]
17
- GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE TODO History.txt ] }
16
+ GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.rdoc LICENSE TODO History.rdoc ] }
18
17
 
19
18
  PROJECT_NAME = 'datamapper'
20
- PROJECT_URL = "http://github.com/sam/dm-more/tree/master/#{GEM_NAME}"
19
+ PROJECT_URL = "http://github.com/datamapper/dm-more/tree/master/#{GEM_NAME}"
21
20
  PROJECT_DESCRIPTION = PROJECT_SUMMARY = 'dm-is-remixable allow you to create reusable data functionality'
22
21
 
23
22
  [ ROOT, ROOT.parent ].each do |dir|
@@ -90,7 +90,7 @@ module DataMapper
90
90
  # cardinality <~Fixnum> 1, n, x ...
91
91
  # remixable <Symbol> plural of remixable; i.e. Comment => :comments
92
92
  # options <Hash> options hash
93
- # :class_name <String> Remixed Model name (Also creates a storage_name as tableize(:class_name))
93
+ # :model <String> Remixed Model name (Also creates a storage_name as tableize(:model))
94
94
  # This is the class that will be created from the Remixable Module
95
95
  # The storage_name can be changed via 'enhance' in the class that is remixing
96
96
  # Default: self.name.downcase + "_" + remixable.suffix.pluralize
@@ -110,9 +110,7 @@ module DataMapper
110
110
  #
111
111
  # One-To-Many; Class-To-Remixable
112
112
  #
113
- # remix n, :addressables,
114
- # :class_name => "UserAddress",
115
- # :as => "addresses"
113
+ # remix n, :addressables, :model => "UserAddress", :as => "addresses"
116
114
  #
117
115
  # Tables: users, user_addresses
118
116
  # Classes: User, UserAddress
@@ -149,26 +147,32 @@ module DataMapper
149
147
  raise Exception, "#{remixable_module} is not remixable"
150
148
  end
151
149
 
150
+ if options[:class_name]
151
+ warn '+options[:class_name]+ is deprecated, use :model instead'
152
+ options[:model] = options.delete(:class_name)
153
+ end
154
+
152
155
  #Merge defaults/options
153
156
  options = {
154
157
  :as => nil,
155
- :class_name => Extlib::Inflection.classify(self.name.snake_case + "_" + remixable_module.suffix.pluralize),
158
+ :model => Extlib::Inflection.classify(self.name.snake_case + "_" + remixable_module.suffix.pluralize),
156
159
  :for => nil,
157
160
  :on => nil,
158
161
  :unique => false,
159
- :via => nil
162
+ :via => nil,
163
+ :connect => false
160
164
  }.merge(options)
161
165
 
162
166
  #Make sure the class hasn't been remixed already
163
- unless Object.full_const_defined?(Extlib::Inflection.classify(options[:class_name]))
167
+ unless Object.full_const_defined?(Extlib::Inflection.classify(options[:model]))
164
168
 
165
169
  #Storage name of our remixed model
166
- options[:table_name] = Extlib::Inflection.tableize(options[:class_name])
170
+ options[:table_name] = Extlib::Inflection.tableize(options[:model])
167
171
 
168
172
  #Other model to mix with in case of M:M through Remixable
169
173
  options[:other_model] = options[:for] || options[:on]
170
174
 
171
- DataMapper.logger.info "Generating Remixed Model: #{options[:class_name]}"
175
+ DataMapper.logger.info "Generating Remixed Model: #{options[:model]}"
172
176
  model = generate_remixed_model(remixable_module, options)
173
177
 
174
178
  # map the remixable to the remixed model
@@ -197,7 +201,7 @@ module DataMapper
197
201
  remix_one_to_many cardinality, model, options
198
202
  end
199
203
  else
200
- DataMapper.logger.warn "#{__FILE__}:#{__LINE__} warning: already remixed constant #{options[:class_name]}"
204
+ DataMapper.logger.warn "#{__FILE__}:#{__LINE__} warning: already remixed constant #{options[:model]}"
201
205
  end
202
206
  end
203
207
 
@@ -227,8 +231,8 @@ module DataMapper
227
231
  #
228
232
  # class Article
229
233
  # include DataMapper::Resource
230
- # remix n, :taggings, :for => User, :class_name => "UserArticleTagging"
231
- # remix n, :taggings, :for => Bot, :class_name => "BotArticleTagging"
234
+ # remix n, :taggings, :for => User, :model => "UserArticleTagging"
235
+ # remix n, :taggings, :for => Bot, :model => "BotArticleTagging"
232
236
  #
233
237
  # enhance :taggings, "UserArticleTagging" do
234
238
  # property :updated_at, DateTime
@@ -254,7 +258,7 @@ module DataMapper
254
258
  unless model.nil?
255
259
  model.class_eval &block
256
260
  else
257
- raise Exception, "#{remixable} must be remixed with :class_name option as #{remixable_model} before it can be enhanced"
261
+ raise Exception, "#{remixable} must be remixed with :model option as #{remixable_model} before it can be enhanced"
258
262
  end
259
263
  end
260
264
 
@@ -285,7 +289,7 @@ module DataMapper
285
289
  # model <Class> remixed model that 'self' is relating to
286
290
  # options <Hash> options hash
287
291
  def remix_one_to_many(cardinality, model, options)
288
- self.has cardinality, (options[:as] || options[:table_name]).to_sym, :class_name => model.name
292
+ self.has cardinality, (options[:as] || options[:table_name]).to_sym, :model => model.name
289
293
  model.property Extlib::Inflection.foreign_key(self.name).intern, Integer, :nullable => false
290
294
  model.belongs_to belongs_to_name(self.name)
291
295
  end
@@ -306,17 +310,22 @@ module DataMapper
306
310
 
307
311
  # Is M:M between two different classes or the same class
308
312
  unless self.name == options[:other_model].name
309
- self.has cardinality, (options[:as] || options[:table_name]).to_sym, :class_name => model.name
313
+ self.has cardinality, (options[:as] || options[:table_name]).to_sym, :model => model.name
310
314
  options[:other_model].has cardinality, options[:table_name].intern
311
315
 
312
316
  model.belongs_to belongs_to_name(self.name)
313
317
  model.belongs_to belongs_to_name(options[:other_model].name)
318
+ if options[:connect]
319
+ remixed = options[:as]
320
+ remixed ||= options[:other_model].to_s.snake_case
321
+ self.has cardinality, (options[:for] || options[:on]).snake_case.pluralize.to_sym, :through => remixed.to_sym
322
+ end
314
323
  else
315
324
  raise Exception, "options[:via] must be specified when Remixing a module between two of the same class" unless options[:via]
316
325
 
317
- self.has cardinality, (options[:as] || options[:table_name]).to_sym, :class_name => model.name
326
+ self.has cardinality, (options[:as] || options[:table_name]).to_sym, :model => model.name
318
327
  model.belongs_to belongs_to_name(self.name)
319
- model.belongs_to options[:via].intern, :class_name => options[:other_model].name, :child_key => ["#{options[:via]}_id".intern]
328
+ model.belongs_to options[:via].intern, :model => options[:other_model].name, :child_key => ["#{options[:via]}_id".intern]
320
329
  end
321
330
  end
322
331
 
@@ -334,18 +343,29 @@ module DataMapper
334
343
  include DataMapper::Resource
335
344
  end
336
345
 
337
- #Give remixed model a name and create its constant
338
- model = Object.full_const_set(options[:class_name], klass)
346
+ # Give remixed model a name and create its constant
347
+ model = Object.full_const_set(options[:model], klass)
339
348
 
340
- #Get instance methods & validators
349
+ # Get instance methods and the :default context validator
341
350
  model.send(:include,remixable)
342
351
 
343
- #port the properties over...
352
+ if DataMapper.const_defined?('Validate')
353
+
354
+ # Port over any other validation contexts to this model. Skip the
355
+ # default context since it has already been included above.
356
+ remixable.validators.contexts.each do |context, validators|
357
+ next if context == :default
358
+ model.validators.contexts[context] = validators
359
+ end
360
+
361
+ end
362
+
363
+ # Port the properties over
344
364
  remixable.properties.each do |prop|
345
365
  model.property(prop.name, prop.type, prop.options)
346
366
  end
347
367
 
348
- # attach remixed model access to RemixeeClassMethods and RemixeeInstanceMethods if defined
368
+ # Attach remixed model access to RemixeeClassMethods and RemixeeInstanceMethods if defined
349
369
  if Object.full_const_defined? "#{remixable}::RemixeeClassMethods"
350
370
  model.send :extend, Object.full_const_get("#{remixable}::RemixeeClassMethods")
351
371
  end
@@ -1,7 +1,7 @@
1
1
  module DataMapper
2
2
  module Is
3
3
  module Remixable
4
- VERSION = '0.9.11'
4
+ VERSION = '0.10.0'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -1,13 +1,7 @@
1
- require 'pathname'
2
- require 'rubygems'
3
-
4
- gem 'dm-core', '0.9.11'
5
- require 'dm-core'
6
-
7
- require Pathname(__FILE__).dirname.expand_path / 'dm-is-remixable' / 'is' / 'remixable'
1
+ require 'dm-is-remixable/is/remixable'
8
2
 
9
3
  module DataMapper
10
4
  module Model
11
5
  include DataMapper::Is::Remixable
12
- end # module Model
13
- end # module DataMapper
6
+ end
7
+ end
@@ -4,7 +4,7 @@ module Addressable
4
4
  is :remixable,
5
5
  :suffix => "address"
6
6
 
7
- property :id, Integer, :key => true, :serial => true
7
+ property :id, Serial
8
8
 
9
9
  property :address1, String, :length => 255
10
10
  property :address2, String, :length => 255
data/spec/data/article.rb CHANGED
@@ -1,15 +1,15 @@
1
- require Pathname(__FILE__).dirname / "image"
2
- require Pathname(__FILE__).dirname / "commentable"
3
- require Pathname(__FILE__).dirname / "viewable"
4
- require Pathname(__FILE__).dirname / "taggable"
5
- require Pathname(__FILE__).dirname / "user"
6
- require Pathname(__FILE__).dirname / "bot"
7
- require Pathname(__FILE__).dirname / "tag"
1
+ require 'data/image'
2
+ require 'data/commentable'
3
+ require 'data/viewable'
4
+ require 'data/taggable'
5
+ require 'data/user'
6
+ require 'data/bot'
7
+ require 'data/tag'
8
8
 
9
9
  class Article
10
10
  include DataMapper::Resource
11
11
 
12
- property :id, Integer, :key => true, :serial => true
12
+ property :id, Serial
13
13
  property :title, String
14
14
  property :url, String
15
15
 
@@ -22,9 +22,9 @@ class Article
22
22
 
23
23
  remix n, "My::Nested::Remixable::Rating", :as => :ratings
24
24
 
25
- remix n, :taggable, :as => "user_taggings", :for => "User", :class_name => "UserTagging"
25
+ remix n, :taggable, :as => "user_taggings", :for => "User", :model => "UserTagging"
26
26
 
27
- remix n, :taggable, :as => "bot_taggings", :for => "Bot", :class_name => "BotTagging"
27
+ remix n, :taggable, :as => "bot_taggings", :for => "Bot", :model => "BotTagging"
28
28
 
29
29
  enhance :viewables do
30
30
  belongs_to :user
@@ -4,7 +4,7 @@ module Billable
4
4
  is :remixable,
5
5
  :suffix => "billing_account"
6
6
 
7
- property :id, Integer, :key => true, :serial => true
7
+ property :id, Serial
8
8
 
9
9
  property :cc_type, Enum.new("mastercard","amex","visa")
10
10
  property :cc_num, String, :length => 12..20
data/spec/data/bot.rb CHANGED
@@ -1,14 +1,12 @@
1
- require Pathname(__FILE__).dirname / "viewable"
2
- require Pathname(__FILE__).dirname / "billable"
3
- require Pathname(__FILE__).dirname / "addressable"
4
- require Pathname(__FILE__).dirname / "rating"
1
+ require 'data/viewable'
2
+ require 'data/billable'
3
+ require 'data/addressable'
4
+ require 'data/rating'
5
5
 
6
6
  class Bot
7
7
  include DataMapper::Resource
8
8
 
9
- property :id, Integer,
10
- :key => true,
11
- :serial => true
9
+ property :id, Serial
12
10
 
13
11
  property :bot_name, String,
14
12
  :nullable => false,
@@ -4,8 +4,10 @@ module Commentable
4
4
  is :remixable,
5
5
  :suffix => "comment"
6
6
 
7
- property :id, Integer, :key => true, :serial => true
7
+ property :id, Serial
8
8
  property :comment, String
9
9
  property :created_at, DateTime
10
10
 
11
+ validates_present :comment, :context => [ :publish ]
12
+
11
13
  end
data/spec/data/image.rb CHANGED
@@ -3,7 +3,7 @@ module Image
3
3
 
4
4
  is :remixable
5
5
 
6
- property :id, Integer, :key => true, :serial => true
6
+ property :id, Serial
7
7
  property :description, String
8
8
  property :path, String
9
9
 
data/spec/data/rating.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module My
2
2
  module Nested
3
3
  module Remixable
4
-
5
4
  module Rating
6
5
 
7
6
  def self.included(base)
@@ -14,8 +13,7 @@ module My
14
13
 
15
14
  # properties
16
15
 
17
- property :id, Integer, :serial => true
18
-
16
+ property :id, Serial
19
17
  property :user_id, Integer, :nullable => false
20
18
  property :rating, Integer, :nullable => false, :default => 0
21
19
 
@@ -31,7 +29,6 @@ module My
31
29
  end
32
30
 
33
31
  end
34
-
35
32
  end
36
33
  end
37
34
  end
data/spec/data/tag.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class Tag
2
2
  include DataMapper::Resource
3
3
 
4
- property :id, Integer, :key => true, :serial => true
4
+ property :id, Serial
5
5
  property :name, String, :unique => true, :nullable => false
6
6
  end
@@ -7,12 +7,9 @@ module Taggable
7
7
 
8
8
  is :remixable
9
9
 
10
- property :id, Integer, :key => true, :serial => true
10
+ property :id, Serial
11
11
  property :tag_id, Integer
12
12
 
13
-
14
-
15
-
16
13
  module ClassMethods
17
14
 
18
15
  def related_tags
data/spec/data/topic.rb CHANGED
@@ -1,15 +1,15 @@
1
- require Pathname(__FILE__).dirname / "rating"
1
+ require 'data/rating'
2
2
 
3
3
  class Topic
4
4
  include DataMapper::Resource
5
5
 
6
- property :id, Integer, :key => true, :serial => true
6
+ property :id, Serial
7
7
 
8
8
  property :name, String
9
9
  property :description, String
10
10
 
11
11
  remix n, My::Nested::Remixable::Rating,
12
12
  :as => :ratings_for_topic,
13
- :class_name => "Rating"
13
+ :model => "Rating"
14
14
 
15
15
  end
data/spec/data/user.rb CHANGED
@@ -1,34 +1,20 @@
1
- require Pathname(__FILE__).dirname / "viewable"
2
- require Pathname(__FILE__).dirname / "billable"
3
- require Pathname(__FILE__).dirname / "addressable"
4
- require Pathname(__FILE__).dirname / "rating"
1
+ require 'data/viewable'
2
+ require 'data/billable'
3
+ require 'data/addressable'
4
+ require 'data/rating'
5
5
 
6
6
  class User
7
- include DataMapper::Resource
8
-
9
- property :id, Integer,
10
- :key => true,
11
- :serial => true
12
7
 
13
- property :first_name, String,
14
- :nullable => false,
15
- :length => 2..50
8
+ include DataMapper::Resource
16
9
 
17
- property :last_name, String,
18
- :nullable => false,
19
- :length => 2..50
10
+ property :id, Serial
11
+ property :first_name, String, :nullable => false, :length=> 2..50
12
+ property :last_name, String, :nullable => false, :length => 2..50
20
13
 
21
14
  remix n, :viewables
22
-
23
- remix n, :billables, :class_name => "Account"
24
-
15
+ remix n, :billables, :model => "Account"
25
16
  remix n, :addressables
26
-
27
17
  remix n, :commentables, :as => "comments", :for => "User", :via => "commentor"
28
-
29
18
  remix n, "My::Nested::Remixable::Rating"
30
19
 
31
- enhance :addressables do
32
- property :label, Enum.new('home','work')
33
- end
34
20
  end
@@ -4,7 +4,7 @@ module Viewable
4
4
  is :remixable,
5
5
  :suffix => "view"
6
6
 
7
- property :id, Integer, :key => true, :serial => true
7
+ property :id, Serial
8
8
 
9
9
  property :created_at, DateTime
10
10
  property :ip, String
@@ -1,19 +1,5 @@
1
- require 'pathname'
2
- require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'
3
-
4
- require "dm-types"
5
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'addressable'
6
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'billable'
7
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'commentable'
8
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'article'
9
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'image'
10
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'user'
11
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'viewable'
12
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'topic'
13
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'rating'
14
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'taggable'
15
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'bot'
16
- require Pathname(__FILE__).dirname.expand_path.parent / 'data' / 'tag'
1
+ require 'spec_helper'
2
+
17
3
  DataMapper.auto_migrate!
18
4
 
19
5
  if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
@@ -87,13 +73,13 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
87
73
  BotTagging.new.should respond_to("tag")
88
74
  end
89
75
 
90
- it "should through exception when enhancing an unknown class" do
76
+ it "should raise an exception when enhancing an unknown class" do
91
77
  lambda {
92
78
  Article.enhance :taggable, "NonExistentClass"
93
79
  }.should raise_error
94
80
  end
95
81
 
96
- it "should provided a map of Remixable Modules to Remixed Models names" do
82
+ it "should provide a map of Remixable Modules to Remixed Models names" do
97
83
  User.remixables.should_not be(nil)
98
84
  end
99
85
 
@@ -127,7 +113,6 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
127
113
  end
128
114
 
129
115
  it "should create a storage name based on the class name" do
130
-
131
116
  Article.remixables[:image][:article_image][:model].storage_names[:default].should == "article_images"
132
117
  User.remixables[:billable][:account][:model].storage_names[:default].should == "accounts"
133
118
  end
@@ -146,6 +131,11 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
146
131
  account.should respond_to("expiration")
147
132
  end
148
133
 
134
+ it "should copy validation contexts from the Remixable Module to the Remixed Model" do
135
+ ArticleComment.validators.contexts.should have_key(:default)
136
+ ArticleComment.validators.contexts.should have_key(:publish)
137
+ end
138
+
149
139
  it "should allow 1:M relationships with the Remixable Module" do
150
140
  user = User.new
151
141
  addy = UserAddress.new
@@ -199,46 +189,32 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
199
189
  # Users are Commentable by many Users
200
190
  #
201
191
  it "should allow M:M unary relationships through the Remixable Module" do
202
- user = User.new
203
- user.first_name = "Tester"
204
- user2 = User.new
205
- user2.first_name = "Testy"
206
-
207
- comment = UserComment.new
208
- comment.comment = "YOU SUCK!"
209
- comment.commentor = user2
210
-
211
- user.comments << comment
212
-
213
- user2.comments.length.should be(0)
214
-
215
- comment.commentor.first_name.should == "Testy"
216
-
217
- user.comments.length.should be(1)
192
+ pending 'self referential m:m is currently not supported by dm-core'
218
193
  end
219
194
 
220
195
  # Example:
221
196
  # Articles are Commentable by many Users
222
197
  #
223
198
  it "should allow M:M relationships through the Remixable Module" do
224
- user = User.new
199
+ user = User.new
225
200
  article = Article.new
226
-
227
- ac = ArticleComment.new
201
+ ac = ArticleComment.new
228
202
 
229
203
  user.first_name = "Talker"
230
204
  user.last_name = "OnTheInternetz"
205
+ user.save
231
206
 
232
207
  article.url = "Http://example.com/"
233
208
  article.title = "Important internet thingz, lol"
209
+ article.save
234
210
 
235
211
  ac.comment = "This article sux!"
212
+ ac.user = user
213
+ ac.article = article
214
+ ac.save
236
215
 
237
- article.comments << ac
238
- user.article_comments << ac
239
-
240
- article.comments.first.should be(ac)
241
- user.article_comments.first.should be(ac)
216
+ article.comments.first.should == ac
217
+ user.article_comments.first.should == ac
242
218
  end
243
219
 
244
220
  # Example:
data/spec/spec.opts CHANGED
@@ -1 +1,2 @@
1
1
  --colour
2
+ --loadby random
data/spec/spec_helper.rb CHANGED
@@ -1,23 +1,43 @@
1
- require 'pathname'
2
1
  require 'rubygems'
3
2
 
4
- gem 'rspec', '~>1.2'
5
- require 'spec'
6
-
7
- ROOT = Pathname(__FILE__).dirname.parent.expand_path
8
-
9
- # use local dm-types if running from dm-more directly
10
- lib = ROOT.parent.join('dm-types', 'lib').expand_path
11
- $LOAD_PATH.unshift(lib) if lib.directory?
12
-
13
- require ROOT + 'lib/dm-is-remixable'
3
+ # use local dm-core if running from a typical dev checkout.
4
+ lib = File.join('..', '..', 'dm-core', 'lib')
5
+ $LOAD_PATH.unshift(lib) if File.directory?(lib)
6
+ require 'dm-core'
7
+
8
+ # use local dm-types if running from a typical dev checkout.
9
+ lib = File.join('..', 'dm-types', 'lib')
10
+ $LOAD_PATH.unshift(lib) if File.directory?(lib)
11
+ require 'dm-types'
12
+
13
+ # use local dm-validations if running from a typical dev checkout.
14
+ lib = File.join('..', 'dm-validations', 'lib')
15
+ $LOAD_PATH.unshift(lib) if File.directory?(lib)
16
+ require 'dm-validations'
17
+
18
+ # Support running specs with 'rake spec' and 'spec'
19
+ $LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
20
+
21
+ require 'dm-is-remixable'
22
+
23
+ require 'data/addressable'
24
+ require 'data/article'
25
+ require 'data/billable'
26
+ require 'data/bot'
27
+ require 'data/commentable'
28
+ require 'data/image'
29
+ require 'data/rating'
30
+ require 'data/tag'
31
+ require 'data/taggable'
32
+ require 'data/topic'
33
+ require 'data/user'
34
+ require 'data/viewable'
14
35
 
15
36
  def load_driver(name, default_uri)
16
37
  return false if ENV['ADAPTER'] != name.to_s
17
38
 
18
39
  begin
19
- DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
20
- DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
40
+ DataMapper.setup(:default, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
21
41
  true
22
42
  rescue LoadError => e
23
43
  warn "Could not load do_#{name}: #{e}"
data/tasks/install.rb CHANGED
@@ -4,7 +4,7 @@ end
4
4
 
5
5
  desc "Install #{GEM_NAME} #{GEM_VERSION}"
6
6
  task :install => [ :package ] do
7
- sudo_gem "install --local pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
7
+ sudo_gem "install pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources"
8
8
  end
9
9
 
10
10
  desc "Uninstall #{GEM_NAME} #{GEM_VERSION}"
data/tasks/spec.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  begin
2
- gem 'rspec', '~>1.2'
3
- require 'spec'
4
2
  require 'spec/rake/spectask'
5
3
 
6
4
  task :default => [ :spec ]
@@ -8,16 +6,18 @@ begin
8
6
  desc 'Run specifications'
9
7
  Spec::Rake::SpecTask.new(:spec) do |t|
10
8
  t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
11
- t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s).map { |f| f.to_s }
9
+ t.libs << 'lib' << 'spec' # needed for CI rake spec task, duplicated in spec_helper
12
10
 
13
11
  begin
14
- gem 'rcov', '~>0.8'
12
+ require 'rcov'
15
13
  t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
16
14
  t.rcov_opts << '--exclude' << 'spec'
17
15
  t.rcov_opts << '--text-summary'
18
16
  t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
19
17
  rescue LoadError
20
18
  # rcov not installed
19
+ rescue SyntaxError
20
+ # rcov syntax invalid
21
21
  end
22
22
  end
23
23
  rescue LoadError
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-is-remixable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory O'Daniel
@@ -9,19 +9,10 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-29 00:00:00 -07:00
12
+ date: 2009-09-16 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: dm-core
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: 0.9.11
24
- version:
14
+ dependencies: []
15
+
25
16
  description: dm-is-remixable allow you to create reusable data functionality
26
17
  email:
27
18
  - dm-is-remixable [a] coryodaniel [d] com
@@ -30,15 +21,15 @@ executables: []
30
21
  extensions: []
31
22
 
32
23
  extra_rdoc_files:
33
- - README.txt
24
+ - README.rdoc
34
25
  - LICENSE
35
26
  - TODO
36
- - History.txt
27
+ - History.rdoc
37
28
  files:
38
- - History.txt
29
+ - History.rdoc
39
30
  - LICENSE
40
31
  - Manifest.txt
41
- - README.txt
32
+ - README.rdoc
42
33
  - Rakefile
43
34
  - TODO
44
35
  - lib/dm-is-remixable.rb
@@ -62,11 +53,13 @@ files:
62
53
  - tasks/install.rb
63
54
  - tasks/spec.rb
64
55
  has_rdoc: true
65
- homepage: http://github.com/sam/dm-more/tree/master/dm-is-remixable
56
+ homepage: http://github.com/datamapper/dm-more/tree/master/dm-is-remixable
57
+ licenses: []
58
+
66
59
  post_install_message:
67
60
  rdoc_options:
68
61
  - --main
69
- - README.txt
62
+ - README.rdoc
70
63
  require_paths:
71
64
  - lib
72
65
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -84,9 +77,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
77
  requirements: []
85
78
 
86
79
  rubyforge_project: datamapper
87
- rubygems_version: 1.3.1
80
+ rubygems_version: 1.3.5
88
81
  signing_key:
89
- specification_version: 2
82
+ specification_version: 3
90
83
  summary: dm-is-remixable allow you to create reusable data functionality
91
84
  test_files: []
92
85