dm-is-friendly 0.10.25 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,29 +11,26 @@ If you're building an app that require this type of relation then it will probab
11
11
 
12
12
  $ [sudo] gem install dm-is-friendly.
13
13
 
14
- Create a file for the friendship (or whatever you want to call it) class.
15
-
16
14
  ## Example DataMapper model ##
17
15
 
18
- class Friendship
19
- include DataMapper::Resource
20
- property :person_id, Integer, :key => true
21
- property :friend_id, Integer, :key => true
22
- property :accepted_at, DateTime
23
-
24
- belongs_to :person
25
- belongs_to :friend, :model => "Person", :child_key => [:friend_id]
26
-
27
- end
28
-
29
16
  class Person
30
17
  include DataMapper::Resource
31
18
  property :id, Serial
32
19
  property :name, String
33
20
 
34
- is :friendly #, :friendship_class => "Friendship", :require_acceptance => true
21
+ is :friendly
35
22
  end
36
23
 
24
+ A model called "Friendship" will be created for you and will include the association. Several helper methods (shown below) are added as well. Documentation of these methods is [here](http://rubydoc.info/github/RipTheJacker/dm-is-friendly/master/DataMapper/Is/Friendly/InstanceMethods).
25
+
26
+ ### Options ###
27
+
28
+ **:require_acceptance**
29
+ Set this if friendships should be accepted before showing up in the query of friends: Default: true
30
+
31
+ **:friendship_class**
32
+ Set this to something other than "Friendship" if you want: Default: "Friendship"
33
+
37
34
  ## Use It ##
38
35
 
39
36
  @quentin = Person.create(:name => "quentin")
@@ -60,16 +57,27 @@ Create a file for the friendship (or whatever you want to call it) class.
60
57
  # End friendships :(
61
58
  @quentin.end_friendship_with(@joe) # => true
62
59
 
63
- ### Options ###
60
+ Or without requiring acceptance
61
+
62
+ class Person
63
+ include DataMapper::Resource
64
+ property :id, Serial
65
+ property :name, String
64
66
 
65
- **:require_acceptance**
66
- Set this if friendships should be accepted before showing up in the query of friends.
67
- Default: true
68
- **Must provide the :accepted_at Property*
67
+ is :friendly, :require_acceptance => false
68
+ end
69
+
70
+ @sue = Person.create(:name => "Sue")
71
+ @julie = Person.create(:name => "Julie")
72
+
73
+ @sue.request_friendship(@julie)
74
+ @julie.is_friends_with?(@sue) # => 'true' since friendships don't need to be accepted
75
+
76
+ ## Contributing ##
69
77
 
70
- **:friendship_class**
71
- Set this to something other than "Friendship" if you want.
72
- Default: "Friendship"
78
+ If you want to contribute to this project, just fork it and make changes/pull requests in the **next** branch. Please run tests against ruby 1.8.7 and 1.9.2 before submitting! Everything else you need is in the Gemfile :)
73
79
 
80
+ There are also a few roadmap items in the #issues section on github.
74
81
 
82
+ Thanks!
75
83
 
data/Rakefile CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'rake/rdoctask'
3
4
 
4
5
  begin
5
6
  require 'jeweler'
@@ -7,41 +8,64 @@ begin
7
8
  gemspec.name = "dm-is-friendly"
8
9
  gemspec.summary = %Q{DataMapper plugin that adds self-referential friendship functionality to your models.}
9
10
  gemspec.email = "kabari@gmail.com"
10
- gemspec.homepage = "http://github.com/kabari/dm-is-friendly"
11
- gemspec.authors = ["Kabari Hendrick"]
12
- gemspec.add_dependency("extlib", "~> 0.9.14")
13
- gemspec.add_dependency("dm-core", "~> 0.10.2")
14
- gemspec.add_dependency("dm-aggregates", "~> 0.10.2")
11
+ gemspec.homepage = "http://github.com/RipTheJacker/dm-is-friendly"
12
+ gemspec.authors = ["RipTheJacker"]
13
+
14
+ gemspec.has_rdoc = 'yard'
15
+ gemspec.files = Dir['Rakefile', '{lib,spec}/**/*', 'README*', 'LICENSE*', 'VERSION'] - ['spec/log/dm.log']
16
+
17
+ gemspec.add_development_dependency("rspec", "~> 2.1.0")
18
+ gemspec.add_development_dependency("jeweler")
19
+ gemspec.add_dependency("dm-core", "~> 1.0.2")
15
20
  end
16
21
  Jeweler::GemcutterTasks.new
17
- rescue LoadError
22
+ rescue LoadError => e
18
23
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
24
+ puts "-"*40
25
+ puts e.backtrace
19
26
  end
20
27
 
21
- require 'spec/rake/spectask'
22
- Spec::Rake::SpecTask.new(:spec) do |spec|
23
- spec.libs << 'lib' << 'spec'
24
- spec.spec_files = FileList['spec/**/*_spec.rb']
25
- end
28
+ begin
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec)
26
31
 
27
- Spec::Rake::SpecTask.new(:rcov) do |spec|
28
- spec.libs << 'lib' << 'spec'
29
- spec.pattern = 'spec/**/*_spec.rb'
30
- spec.rcov = true
32
+ RSpec::Core::RakeTask.new(:rcov) do |t|
33
+ t.rcov = true
34
+ t.rcov_opts = %[-Ilib -Ispec --exclude "spec/spec_helper.rb"]
35
+ t.rcov_opts << %[--no-html --aggregate coverage.data]
36
+ end
37
+ rescue LoadError
38
+ task :spec do
39
+ abort "RSpec gem is not available. In order to test use: bundle install"
40
+ end
31
41
  end
32
42
 
33
43
 
44
+
34
45
  task :default => :spec
35
46
 
36
- require 'rake/rdoctask'
37
47
 
38
48
  Rake::RDocTask.new do |rdoc|
39
49
  rdoc.rdoc_dir = 'rdoc'
40
- rdoc.title = "dm-is-friendly 0.10.21"
50
+ rdoc.title = "dm-is-friendly 1.0.2"
41
51
  rdoc.rdoc_files.include('README*')
42
52
  rdoc.rdoc_files.include('lib/**/*.rb')
43
53
  end
44
54
 
55
+ begin
56
+ require 'reek/adapters/rake_task'
57
+
58
+ Reek::RakeTask.new do |t|
59
+ t.fail_on_error = true
60
+ t.verbose = false
61
+ t.source_files = 'lib/**/*.rb'
62
+ end
63
+ rescue LoadError
64
+ task :reek do
65
+ abort 'Reek is not available. In order to run reek, you must: bundle install'
66
+ end
67
+ end
68
+
45
69
  begin
46
70
  require 'yard'
47
71
  YARD::Rake::YardocTask.new do |t|
@@ -49,6 +73,6 @@ begin
49
73
  end
50
74
  rescue LoadError
51
75
  task :yard do
52
- abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
76
+ abort "YARD is not available. In order to run yardoc, you must: bundle install"
53
77
  end
54
78
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.25
1
+ 1.0.2
@@ -1,7 +1,4 @@
1
- require 'pathname'
2
-
3
- # Require plugin-files
4
- require Pathname(__FILE__).dirname.expand_path / 'is' / 'friendly'
1
+ require "dm-is-friendly/is/friendly"
5
2
 
6
3
  # Include the plugin in Model
7
4
  DataMapper::Model.append_extensions(DataMapper::Is::Friendly)
@@ -5,29 +5,42 @@ module DataMapper
5
5
 
6
6
  def is_friendly(options = {})
7
7
  options = {:require_acceptance => true, :friendship_class => "Friendship" }.merge(options)
8
- @friendly_options = FriendlyConfig.new(self, options)
9
- def self.friendly_options; @friendly_options; end
10
-
11
- class_eval(<<-RUBY,(__FILE__),(__LINE__+1)
12
- has n, :friendships, :model => #{options[:friendship_class]}
13
- has n, :friends_by_me, :through => :friendships, :model => "#{self.name}", :via => :#{self.name.downcase}
14
- has n, :friended_by, :through => :friendships, :model => "#{self.name}",
15
- :via => :#{self.name.downcase}
16
- RUBY
8
+ @friendly_config = FriendlyConfig.new(self, options)
9
+ def self.friendly_config; @friendly_config; end
10
+
11
+ reference_model = self
12
+ reference_model_name = DataMapper::Inflector.demodulize(self.name).downcase.to_sym
13
+
14
+ Object.full_const_set(options[:friendship_class],
15
+ DataMapper::Model.new do
16
+ if options[:require_acceptance]
17
+ property :accepted_at, DateTime
18
+ end
19
+
20
+ belongs_to reference_model_name, reference_model, :key => true
21
+ belongs_to :friend, :model => reference_model, :child_key => [:friend_id], :key => true
22
+ end
17
23
  )
18
24
 
25
+ friendship_class = Object.full_const_get(options[:friendship_class])
26
+
27
+ has n, :friendships, :model => options[:friendship_class]
28
+
29
+ has n, :friends_by_me, self, :through => :friendships, :via => reference_model_name
30
+ has n, :friended_by, self, :through => :friendships, :via => reference_model_name
31
+
19
32
  include DataMapper::Is::Friendly::InstanceMethods
20
33
  end
21
34
 
22
35
  # This class holds the configuration options for the plugin.
23
36
  class FriendlyConfig
24
- attr_reader :friend_class, :friendship_foreign_key, :friend_foreign_key
37
+ attr_reader :reference_model, :friendship_foreign_key, :friend_foreign_key
25
38
 
26
39
  def initialize(klazz, opts)
27
- @friend_class = klazz
40
+ @reference_model = klazz
28
41
  @friendship_class_name = opts[:friendship_class]
29
- @friendship_foreign_key = Extlib::Inflection.foreign_key(@friend_class.name).to_sym
30
- @friend_foreign_key = Extlib::Inflection.foreign_key(@friendship_class_name).to_sym
42
+ @friendship_foreign_key = DataMapper::Inflector.foreign_key(@reference_model.name).to_sym
43
+ @friend_foreign_key = DataMapper::Inflector.foreign_key(@friendship_class_name).to_sym
31
44
  @require_acceptance = opts[:require_acceptance]
32
45
  end
33
46
 
@@ -45,7 +58,7 @@ module DataMapper
45
58
  # returns all of the friends this person has that are accepted
46
59
  # @return [DataMapper::Collection] All the person's friends
47
60
  def friends
48
- friendship_requests(nil,true).union(friendships_to_accept(nil,true))
61
+ friendship_requests(nil,true) | friendships_to_accept(nil,true)
49
62
  end
50
63
 
51
64
  # returns all the people I have requested frienship from
@@ -57,8 +70,8 @@ module DataMapper
57
70
  friend_acceptance_condition(conditions, include_accepted)
58
71
  friend_scope_condition(conditions, friend)
59
72
 
60
- conditions[friendly_options.friendship_foreign_key] = self.id
61
- friendly_options.friendship_class.all(conditions).friend
73
+ conditions[friendly_config.friendship_foreign_key] = self.id
74
+ friendly_config.friendship_class.all(conditions).friend
62
75
  end
63
76
 
64
77
  # returns all the people that have requested my friendship
@@ -71,7 +84,7 @@ module DataMapper
71
84
  friend_scope_condition(conditions, friend, true)
72
85
 
73
86
  conditions[:friend_id] = self.id
74
- friendly_options.friendship_class.all(conditions).send(friendly_options.friend_class.name.downcase)
87
+ friendly_config.friendship_class.all(conditions).send(friendly_config.reference_model.name.downcase)
75
88
  end
76
89
 
77
90
  # see if there is a pending friendship request from this person to another
@@ -85,7 +98,7 @@ module DataMapper
85
98
  # @param friend
86
99
  # @return [true, false]
87
100
  def friendship_to_accept?(friend)
88
- return false unless friendly_options.require_acceptance?
101
+ return false unless friendly_config.require_acceptance?
89
102
  !friendships_to_accept(friend).empty?
90
103
  end
91
104
 
@@ -125,19 +138,19 @@ module DataMapper
125
138
  protected
126
139
  # Accepts a user and returns the friendship instance associated with both users.
127
140
  def friendship(friend, opts = {})
128
- friendly_options.friendship_class.first({:conditions => ["(#{friendly_options.friendship_foreign_key} = ? AND friend_id = ?) OR (friend_id = ? AND #{friendly_options.friendship_foreign_key} = ?)", self.id, friend.id, self.id, friend.id]}.merge(opts) )
141
+ friendly_config.friendship_class.first({:conditions => ["(#{friendly_config.friendship_foreign_key} = ? AND friend_id = ?) OR (friend_id = ? AND #{friendly_config.friendship_foreign_key} = ?)", self.id, friend.id, self.id, friend.id]}.merge(opts) )
129
142
  end
130
143
 
131
- def friendly_options; self.class.friendly_options; end
144
+ def friendly_config; self.class.friendly_config; end
132
145
 
133
146
  private
134
147
  def friend_acceptance_condition(conditions, accepted = false)
135
- accepted ? (conditions[:accepted_at.not] = nil) : (conditions[:accepted_at] = nil) if friendly_options.require_acceptance?
148
+ accepted ? (conditions[:accepted_at.not] = nil) : (conditions[:accepted_at] = nil) if friendly_config.require_acceptance?
136
149
  end
137
150
 
138
151
  def friend_scope_condition(conditions, friend = nil, for_me = false)
139
152
  return unless friend
140
- key_name = for_me ? friendly_options.friendship_foreign_key : :friend_id
153
+ key_name = for_me ? friendly_config.friendship_foreign_key : :friend_id
141
154
  conditions[key_name] = friend.id
142
155
  conditions[:limit] = 1
143
156
  end
@@ -1,63 +1,72 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require 'spec_helper'
2
2
 
3
- class Friendship
4
- include DataMapper::Resource
5
- property :person_id, Integer, :key => true
6
- property :friend_id, Integer, :key => true
7
- property :accepted_at, DateTime
8
-
9
- belongs_to :person
10
- belongs_to :friend, :model => "Person", :child_key => [:friend_id]
11
-
12
- end
3
+ describe DataMapper::Is::Friendly do
4
+ before(:all) do
5
+ class Person
6
+ include DataMapper::Resource
7
+ property :id, Serial
8
+ property :name, String
13
9
 
14
- class Person
15
- include DataMapper::Resource
16
- property :id, Serial
17
- property :name, String
18
- property :deleted_at, ParanoidDateTime
19
-
20
- is :friendly
21
- end
22
-
23
- # new classes
24
- class Homie
25
- include DataMapper::Resource
26
- property :gangster_id, Integer, :key => true
27
- property :friend_id, Integer, :key => true
28
-
29
- belongs_to :gangster
30
- belongs_to :friend, :model => "Gangster", :child_key => [:friend_id]
31
-
32
- end
33
-
34
- class Gangster
35
- include DataMapper::Resource
36
- property :id, Serial
37
- property :name, String
38
- is :friendly, :friendship_class => "Homie", :require_acceptance => false
39
- end
10
+ is :friendly
11
+ end
40
12
 
41
- describe 'DataMapper::Is::Friendly' do
42
- with_adapters do
43
- before(:all) do
44
- Friendship.auto_migrate!; Person.auto_migrate!
13
+ class Member
14
+ include DataMapper::Resource
15
+ property :id, Serial
16
+ property :name, String
17
+
18
+ is :friendly, :friendship_class => "Membership", :require_acceptance => false
19
+ end
20
+
21
+ module SomeModule
22
+ class Member
23
+ # include DataMapper::Resource
24
+ # property :id, Serial
25
+ # property :name, String
26
+ #
27
+ # is :friendly, :friendship_class => "Membership"
28
+ end
45
29
  end
30
+ end
46
31
 
47
- it "should have proper options set" do
48
- Person.friendly_options.friendship_class.should == Friendship
49
- Person.friendly_options.friend_class.should == Person
50
- Person.friendly_options.friendship_foreign_key.should == :person_id
51
- Person.friendly_options.require_acceptance?.should == true
32
+ describe "configuration" do
33
+
34
+ context "default" do
35
+ it "should have proper options set" do
36
+ Person.friendly_config.friendship_class.to_s.should == "Friendship"
37
+ Person.friendly_config.reference_model.to_s.should == "Person"
38
+ Person.friendly_config.friendship_foreign_key.should == :person_id
39
+ Person.friendly_config.require_acceptance?.should == true
40
+ end
52
41
  end
53
-
54
- describe "with friendships" do
55
- before(:all) do
56
- Friendship.auto_migrate!; Person.auto_migrate!
57
42
 
43
+ context "friendship_class and acceptance set" do
44
+ it "should have proper options set" do
45
+ Member.friendly_config.friendship_class.to_s.should == "Membership"
46
+ Member.friendly_config.reference_model.to_s.should == "Member"
47
+ Member.friendly_config.friendship_foreign_key.should == :member_id
48
+ Member.friendly_config.require_acceptance?.should == false
49
+ end
50
+ end
51
+
52
+ context "with a namespace" do
53
+ pending "should have proper options set" do
54
+ SomeModule::Member.friendly_config.friendship_class.to_s.should == "Friendship"
55
+ SomeModule::Member.friendly_config.reference_model.to_s.should == "Person"
56
+ SomeModule::Member.friendly_config.friendship_foreign_key.should == :person_id
57
+ SomeModule::Member.friendly_config.require_acceptance?.should == true
58
+ end
59
+ end
60
+ end
61
+
62
+ with_adapters do
63
+
64
+ describe "default" do
65
+ before(:all) do
66
+ DataMapper.auto_migrate!
58
67
  @quentin = Person.create(:name => "quentin")
59
- @aaron = Person.create(:name => "aaron") # state: "pending"
60
- @joe = Person.create(:name => "joe")
68
+ @aaron = Person.create(:name => "aaron")
69
+ @joe = Person.create(:name => "joe")
61
70
  end
62
71
 
63
72
  it "should work" do
@@ -72,14 +81,9 @@ describe 'DataMapper::Is::Friendly' do
72
81
  end
73
82
 
74
83
  it "should set the proper relationships" do
75
- # see if associations are correct
76
- log("@quention.friendship_requests")
77
84
  @quentin.friendship_requests.should_not include(@joe)
78
- log("@joe.friendship_requests")
79
85
  @joe.friendship_requests.should include(@quentin)
80
- log("@quention.friendships_to_accept")
81
86
  @quentin.friendships_to_accept.should include(@joe)
82
- log("@joe.friendships_to_accept")
83
87
  @joe.friendships_to_accept.should_not include(@quentin)
84
88
  end
85
89
 
@@ -116,7 +120,6 @@ describe 'DataMapper::Is::Friendly' do
116
120
 
117
121
  it "should be able to delete friendships" do
118
122
  lambda do
119
- # joe sleeps with quentin's wife perhaps
120
123
  @quentin.end_friendship_with(@joe)
121
124
  end.should change(Friendship,:count)
122
125
 
@@ -131,17 +134,17 @@ describe 'DataMapper::Is::Friendly' do
131
134
 
132
135
  describe "without requiring acceptance" do
133
136
  before(:all) do
134
- Homie.auto_migrate!; Gangster.auto_migrate!
137
+ DataMapper.auto_migrate!
135
138
 
136
- @quentin = Gangster.create(:name => "quentin")
137
- @aaron = Gangster.create(:name => "aaron") # state: "pending"
138
- @joe = Gangster.create(:name => "joe")
139
+ @quentin = Member.create(:name => "quentin")
140
+ @aaron = Member.create(:name => "aaron")
141
+ @joe = Member.create(:name => "joe")
139
142
  end
140
143
 
141
144
  it "should work" do
142
145
  lambda do
143
146
  @joe.request_friendship(@quentin)
144
- end.should change(Homie, :count).by(1)
147
+ end.should change(Membership, :count).by(1)
145
148
  end
146
149
 
147
150
  it "should recognize every friend request" do
@@ -167,7 +170,8 @@ describe 'DataMapper::Is::Friendly' do
167
170
  @joe.request_friendship(@quentin)
168
171
  @joe.should have(1).friends
169
172
  @quentin.should have(1).friends
170
- end.should_not change(Homie,:count)
173
+
174
+ end.should_not change(Membership,:count)
171
175
  end
172
176
 
173
177
  it "should be able to have multiple friends" do
@@ -178,9 +182,8 @@ describe 'DataMapper::Is::Friendly' do
178
182
 
179
183
  it "should be able to delete friendships" do
180
184
  lambda do
181
- # joe sleeps with quentin's wife perhaps
182
185
  @quentin.end_friendship_with(@joe)
183
- end.should change(Homie,:count)
186
+ end.should change(Membership,:count)
184
187
 
185
188
  @quentin.reload; @joe.reload
186
189
 
@@ -190,4 +193,4 @@ describe 'DataMapper::Is::Friendly' do
190
193
 
191
194
  end
192
195
  end
193
- end
196
+ end
@@ -1,24 +1,33 @@
1
1
  # path to my git clones of the latest dm-core and extlib
2
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), *%w[.. ..]))
2
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), *%w[.. lib]))
3
3
 
4
- require 'pathname'
5
4
  require 'rubygems'
6
- require 'spec'
5
+ require 'bundler/setup'
6
+
7
+ Bundler.setup(:datamapper, :runtime, :development)
7
8
 
8
9
  # Add all external dependencies for the plugin here
9
- gem 'extlib', '~>0.9.14'
10
- require "extlib"
11
10
 
12
- gem 'dm-core', '~>0.10.2'
13
11
  require 'dm-core'
14
-
15
- gem 'dm-aggregates', '~>0.10.2'
12
+ require 'dm-core/spec/setup'
13
+ require "dm-core/spec/lib/adapter_helpers"
14
+ require "dm-core/spec/lib/spec_helper"
15
+ require "dm-types"
16
16
  require "dm-aggregates"
17
+ require "dm-migrations"
18
+ require 'dm-is-friendly'
19
+
20
+ ENV['ADAPTERS'] ||= 'sqlite mysql postgres'
21
+ ENV['LOG'] ||= "file"
17
22
 
18
- require Pathname(__FILE__).dirname.expand_path.parent + 'lib/dm-is-friendly'
19
23
 
20
- DataMapper::Logger.new("test.log", :debug)
21
- # DataMapper.logger.auto_flush = true
24
+ ADAPTERS = ENV["ADAPTERS"].split(' ')
25
+
26
+ DRIVERS = {
27
+ :sqlite => 'sqlite3::memory:',
28
+ :mysql => 'mysql://datamapper:datamapper@localhost/dm_is_friendly_test',
29
+ :postgres => 'postgres://postgres:postgres@localhost/dm_is_friendly_test'
30
+ }
22
31
 
23
32
  def load_driver(name, default_uri)
24
33
  return false unless DRIVERS[name]
@@ -33,16 +42,6 @@ def load_driver(name, default_uri)
33
42
  end
34
43
  end
35
44
 
36
- ENV['ADAPTERS'] ||= 'sqlite3 mysql'
37
-
38
- DRIVERS = {
39
- :sqlite3 => 'sqlite3::memory:',
40
- :mysql => 'mysql://root:pass@localhost/dm_is_friendly_test',
41
- :postgres => 'postgres://postgres@localhost/dm_is_friendly_test'
42
- }
43
-
44
- ADAPTERS = ENV["ADAPTERS"].split(' ')
45
-
46
45
  module SpecAdapterHelper
47
46
  def with_adapters(&block)
48
47
  ::ADAPTERS.each do |adapter|
@@ -55,9 +54,28 @@ module SpecAdapterHelper
55
54
  end
56
55
  end
57
56
  end
57
+
58
+ def self.extended(base)
59
+ base.class_eval do
60
+ def log(msg)
61
+ DataMapper.logger.push("****** #{msg}")
62
+ end
63
+ end
64
+ end
65
+
58
66
  end
59
67
 
60
- Spec::Runner.configure do |conf|
61
- def log(msg); DataMapper.logger.push("****** #{msg}"); end
62
- conf.extend(SpecAdapterHelper)
68
+ RSpec.configure do |config|
69
+
70
+ config.extend( DataMapper::Spec::Adapters::Helpers)
71
+ config.extend(SpecAdapterHelper)
72
+
73
+ config.after :all do
74
+ DataMapper::Spec.cleanup_models
75
+ end
76
+
77
+ config.after :all do
78
+ # global ivar cleanup
79
+ DataMapper::Spec.remove_ivars(self, instance_variables.reject { |ivar| ivar[0, 2] == '@_' })
80
+ end
63
81
  end
metadata CHANGED
@@ -1,64 +1,180 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-is-friendly
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
7
+ - 1
6
8
  - 0
7
- - 10
8
- - 25
9
- version: 0.10.25
9
+ - 2
10
+ version: 1.0.2
10
11
  platform: ruby
11
12
  authors:
12
- - Kabari Hendrick
13
+ - RipTheJacker
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-03-14 00:00:00 -06:00
18
+ date: 2010-12-07 00:00:00 -06:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: extlib
22
+ type: :runtime
22
23
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ name: activesupport
25
+ version_requirements: &id001 !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ~>
26
29
  - !ruby/object:Gem::Version
30
+ hash: 7
27
31
  segments:
32
+ - 3
28
33
  - 0
29
- - 9
30
- - 14
31
- version: 0.9.14
32
- type: :runtime
33
- version_requirements: *id001
34
+ - 0
35
+ version: 3.0.0
36
+ requirement: *id001
34
37
  - !ruby/object:Gem::Dependency
38
+ type: :runtime
39
+ prerelease: false
35
40
  name: dm-core
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ hash: 19
47
+ segments:
48
+ - 1
49
+ - 0
50
+ - 2
51
+ version: 1.0.2
52
+ requirement: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ type: :development
36
55
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
56
+ name: rake
57
+ version_requirements: &id003 !ruby/object:Gem::Requirement
58
+ none: false
38
59
  requirements:
39
60
  - - ~>
40
61
  - !ruby/object:Gem::Version
62
+ hash: 49
41
63
  segments:
42
64
  - 0
43
- - 10
65
+ - 8
66
+ - 7
67
+ version: 0.8.7
68
+ requirement: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ type: :development
71
+ prerelease: false
72
+ name: rspec
73
+ version_requirements: &id004 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ hash: 11
79
+ segments:
44
80
  - 2
45
- version: 0.10.2
46
- type: :runtime
47
- version_requirements: *id002
81
+ - 1
82
+ - 0
83
+ version: 2.1.0
84
+ requirement: *id004
85
+ - !ruby/object:Gem::Dependency
86
+ type: :development
87
+ prerelease: false
88
+ name: jeweler
89
+ version_requirements: &id005 !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ hash: 7
95
+ segments:
96
+ - 1
97
+ - 4
98
+ version: "1.4"
99
+ requirement: *id005
48
100
  - !ruby/object:Gem::Dependency
101
+ type: :development
102
+ prerelease: false
49
103
  name: dm-aggregates
104
+ version_requirements: &id006 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ hash: 19
110
+ segments:
111
+ - 1
112
+ - 0
113
+ - 2
114
+ version: 1.0.2
115
+ requirement: *id006
116
+ - !ruby/object:Gem::Dependency
117
+ type: :development
50
118
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
119
+ name: dm-types
120
+ version_requirements: &id007 !ruby/object:Gem::Requirement
121
+ none: false
52
122
  requirements:
53
123
  - - ~>
54
124
  - !ruby/object:Gem::Version
125
+ hash: 19
55
126
  segments:
127
+ - 1
56
128
  - 0
57
- - 10
58
129
  - 2
59
- version: 0.10.2
130
+ version: 1.0.2
131
+ requirement: *id007
132
+ - !ruby/object:Gem::Dependency
133
+ type: :development
134
+ prerelease: false
135
+ name: rspec
136
+ version_requirements: &id008 !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ hash: 11
142
+ segments:
143
+ - 2
144
+ - 1
145
+ - 0
146
+ version: 2.1.0
147
+ requirement: *id008
148
+ - !ruby/object:Gem::Dependency
149
+ type: :development
150
+ prerelease: false
151
+ name: jeweler
152
+ version_requirements: &id009 !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ requirement: *id009
162
+ - !ruby/object:Gem::Dependency
60
163
  type: :runtime
61
- version_requirements: *id003
164
+ prerelease: false
165
+ name: dm-core
166
+ version_requirements: &id010 !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ~>
170
+ - !ruby/object:Gem::Version
171
+ hash: 19
172
+ segments:
173
+ - 1
174
+ - 0
175
+ - 2
176
+ version: 1.0.2
177
+ requirement: *id010
62
178
  description:
63
179
  email: kabari@gmail.com
64
180
  executables: []
@@ -69,45 +185,45 @@ extra_rdoc_files:
69
185
  - LICENSE
70
186
  - README.markdown
71
187
  files:
72
- - .document
73
- - .gitignore
74
188
  - LICENSE
75
189
  - README.markdown
76
190
  - Rakefile
77
191
  - VERSION
78
- - dm-is-friendly.gemspec
79
192
  - lib/dm-is-friendly.rb
80
- - lib/is/friendly.rb
193
+ - lib/dm-is-friendly/is/friendly.rb
81
194
  - spec/dm-is-friendly_spec.rb
82
- - spec/spec.opts
83
195
  - spec/spec_helper.rb
84
- has_rdoc: true
85
- homepage: http://github.com/kabari/dm-is-friendly
196
+ has_rdoc: yard
197
+ homepage: http://github.com/RipTheJacker/dm-is-friendly
86
198
  licenses: []
87
199
 
88
200
  post_install_message:
89
- rdoc_options:
90
- - --charset=UTF-8
201
+ rdoc_options: []
202
+
91
203
  require_paths:
92
204
  - lib
93
205
  required_ruby_version: !ruby/object:Gem::Requirement
206
+ none: false
94
207
  requirements:
95
208
  - - ">="
96
209
  - !ruby/object:Gem::Version
210
+ hash: 3
97
211
  segments:
98
212
  - 0
99
213
  version: "0"
100
214
  required_rubygems_version: !ruby/object:Gem::Requirement
215
+ none: false
101
216
  requirements:
102
217
  - - ">="
103
218
  - !ruby/object:Gem::Version
219
+ hash: 3
104
220
  segments:
105
221
  - 0
106
222
  version: "0"
107
223
  requirements: []
108
224
 
109
225
  rubyforge_project:
110
- rubygems_version: 1.3.6
226
+ rubygems_version: 1.3.7
111
227
  signing_key:
112
228
  specification_version: 3
113
229
  summary: DataMapper plugin that adds self-referential friendship functionality to your models.
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
6
- *.log
@@ -1,61 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{dm-is-friendly}
8
- s.version = "0.10.25"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Kabari Hendrick"]
12
- s.date = %q{2010-03-14}
13
- s.email = %q{kabari@gmail.com}
14
- s.extra_rdoc_files = [
15
- "LICENSE",
16
- "README.markdown"
17
- ]
18
- s.files = [
19
- ".document",
20
- ".gitignore",
21
- "LICENSE",
22
- "README.markdown",
23
- "Rakefile",
24
- "VERSION",
25
- "dm-is-friendly.gemspec",
26
- "lib/dm-is-friendly.rb",
27
- "lib/is/friendly.rb",
28
- "spec/dm-is-friendly_spec.rb",
29
- "spec/spec.opts",
30
- "spec/spec_helper.rb"
31
- ]
32
- s.homepage = %q{http://github.com/kabari/dm-is-friendly}
33
- s.rdoc_options = ["--charset=UTF-8"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.6}
36
- s.summary = %q{DataMapper plugin that adds self-referential friendship functionality to your models.}
37
- s.test_files = [
38
- "spec/dm-is-friendly_spec.rb",
39
- "spec/spec_helper.rb"
40
- ]
41
-
42
- if s.respond_to? :specification_version then
43
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
- s.specification_version = 3
45
-
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
- s.add_runtime_dependency(%q<extlib>, ["~> 0.9.14"])
48
- s.add_runtime_dependency(%q<dm-core>, ["~> 0.10.2"])
49
- s.add_runtime_dependency(%q<dm-aggregates>, ["~> 0.10.2"])
50
- else
51
- s.add_dependency(%q<extlib>, ["~> 0.9.14"])
52
- s.add_dependency(%q<dm-core>, ["~> 0.10.2"])
53
- s.add_dependency(%q<dm-aggregates>, ["~> 0.10.2"])
54
- end
55
- else
56
- s.add_dependency(%q<extlib>, ["~> 0.9.14"])
57
- s.add_dependency(%q<dm-core>, ["~> 0.10.2"])
58
- s.add_dependency(%q<dm-aggregates>, ["~> 0.10.2"])
59
- end
60
- end
61
-
@@ -1,2 +0,0 @@
1
- --colour
2
- --format nested