dm-is-remixable 1.0.2 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +25 -94
- data/LICENSE +1 -1
- data/README.rdoc +121 -124
- data/Rakefile +1 -7
- data/VERSION +1 -1
- data/dm-is-remixable.gemspec +72 -65
- data/lib/dm-is-remixable/is/remixable.rb +26 -27
- data/spec/data/project.rb +13 -0
- data/spec/integration/remixable_spec.rb +70 -0
- data/spec/spec_helper.rb +1 -0
- data/tasks/spec.rake +0 -3
- metadata +69 -50
- data/.gitignore +0 -37
- data/tasks/ci.rake +0 -1
- data/tasks/local_gemfile.rake +0 -16
- data/tasks/metrics.rake +0 -36
data/Gemfile
CHANGED
@@ -1,113 +1,44 @@
|
|
1
|
-
|
2
|
-
# recommended to create a local Gemfile and use this instead of the git
|
3
|
-
# sources. This will make sure that you are developing against your
|
4
|
-
# other local datamapper sources that you currently work on. Gemfile.local
|
5
|
-
# will behave identically to the standard Gemfile apart from the fact that
|
6
|
-
# it fetches the datamapper gems from local paths. This means that you can use
|
7
|
-
# the same environment variables, like ADAPTER(S) or PLUGIN(S) when running
|
8
|
-
# bundle commands. Gemfile.local is added to .gitignore, so you don't need to
|
9
|
-
# worry about accidentally checking local development paths into git.
|
10
|
-
# In order to create a local Gemfile, all you need to do is run:
|
11
|
-
#
|
12
|
-
# bundle exec rake local_gemfile
|
13
|
-
#
|
14
|
-
# This will give you a Gemfile.local file that points to your local clones of
|
15
|
-
# the various datamapper gems. It's assumed that all datamapper repo clones
|
16
|
-
# reside in the same directory. You can use the Gemfile.local like so for
|
17
|
-
# running any bundle command:
|
18
|
-
#
|
19
|
-
# BUNDLE_GEMFILE=Gemfile.local bundle foo
|
20
|
-
#
|
21
|
-
# You can also specify which adapter(s) should be part of the bundle by setting
|
22
|
-
# an environment variable. This of course also works when using the Gemfile.local
|
23
|
-
#
|
24
|
-
# bundle foo # dm-sqlite-adapter
|
25
|
-
# ADAPTER=mysql bundle foo # dm-mysql-adapter
|
26
|
-
# ADAPTERS=sqlite,mysql bundle foo # dm-sqlite-adapter and dm-mysql-adapter
|
27
|
-
#
|
28
|
-
# Of course you can also use the ADAPTER(S) variable when using the Gemfile.local
|
29
|
-
# and running specs against selected adapters.
|
30
|
-
#
|
31
|
-
# For easily working with adapters supported on your machine, it's recommended
|
32
|
-
# that you first install all adapters that you are planning to use or work on
|
33
|
-
# by doing something like
|
34
|
-
#
|
35
|
-
# ADAPTERS=sqlite,mysql,postgres bundle install
|
36
|
-
#
|
37
|
-
# This will clone the various repositories and make them available to bundler.
|
38
|
-
# Once you have them installed you can easily switch between adapters for the
|
39
|
-
# various development tasks. Running something like
|
40
|
-
#
|
41
|
-
# ADAPTER=mysql bundle exec rake spec
|
42
|
-
#
|
43
|
-
# will make sure that the dm-mysql-adapter is part of the bundle, and will be used
|
44
|
-
# when running the specs.
|
45
|
-
#
|
46
|
-
# You can also specify which plugin(s) should be part of the bundle by setting
|
47
|
-
# an environment variable. This also works when using the Gemfile.local
|
48
|
-
#
|
49
|
-
# bundle foo # dm-migrations
|
50
|
-
# PLUGINS=dm-validations bundle foo # dm-migrations and dm-validations
|
51
|
-
# PLUGINS=dm-validations,dm-types bundle foo # dm-migrations, dm-validations and dm-types
|
52
|
-
#
|
53
|
-
# Of course you can combine the PLUGIN(S) and ADAPTER(S) env vars to run specs
|
54
|
-
# for certain adapter/plugin combinations.
|
55
|
-
#
|
56
|
-
# Finally, to speed up running specs and other tasks, it's recommended to run
|
57
|
-
#
|
58
|
-
# bundle lock
|
59
|
-
#
|
60
|
-
# after running 'bundle install' for the first time. This will make 'bundle exec' run
|
61
|
-
# a lot faster compared to the unlocked version. With an unlocked bundle you would
|
62
|
-
# typically just run 'bundle install' from time to time to fetch the latest sources from
|
63
|
-
# upstream. When you locked your bundle, you need to run
|
64
|
-
#
|
65
|
-
# bundle install --relock
|
66
|
-
#
|
67
|
-
# to make sure to fetch the latest updates and then lock the bundle again. Gemfile.lock
|
68
|
-
# is added to the .gitignore file, so you don't need to worry about accidentally checking
|
69
|
-
# it into version control.
|
1
|
+
require 'pathname'
|
70
2
|
|
71
3
|
source 'http://rubygems.org'
|
72
4
|
|
73
|
-
|
74
|
-
|
5
|
+
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
6
|
+
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
|
7
|
+
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
|
8
|
+
DM_VERSION = '~> 1.1.0.rc1'
|
75
9
|
|
76
|
-
group :runtime do
|
10
|
+
group :runtime do
|
77
11
|
|
78
12
|
if ENV['EXTLIB']
|
79
|
-
gem 'extlib',
|
13
|
+
gem 'extlib', '~> 0.9.15', SOURCE => "#{DATAMAPPER}/extlib#{REPO_POSTFIX}", :require => nil
|
80
14
|
else
|
81
|
-
gem 'activesupport', '~> 3.0.
|
15
|
+
gem 'activesupport', '~> 3.0.4', :require => nil
|
16
|
+
gem 'i18n', '~> 0.5.0'
|
82
17
|
end
|
83
18
|
|
84
|
-
gem 'dm-core',
|
19
|
+
gem 'dm-core', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-core#{REPO_POSTFIX}"
|
85
20
|
|
86
21
|
end
|
87
22
|
|
88
|
-
group
|
89
|
-
|
90
|
-
gem 'dm-validations', DM_VERSION, :git => "#{DATAMAPPER}/dm-validations.git"
|
91
|
-
gem 'dm-types', DM_VERSION, :git => "#{DATAMAPPER}/dm-types.git"
|
23
|
+
group :development do
|
92
24
|
|
25
|
+
gem 'dm-validations', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-validations#{REPO_POSTFIX}"
|
26
|
+
gem 'dm-types', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-types#{REPO_POSTFIX}"
|
27
|
+
gem 'jeweler', '~> 1.5.2'
|
93
28
|
gem 'rake', '~> 0.8.7'
|
94
|
-
gem 'rspec', '~> 1.3
|
95
|
-
gem 'jeweler', '~> 1.4'
|
29
|
+
gem 'rspec', '~> 1.3.1'
|
96
30
|
|
97
31
|
end
|
98
32
|
|
99
|
-
group :quality do
|
33
|
+
group :quality do
|
100
34
|
|
101
|
-
gem '
|
102
|
-
gem '
|
103
|
-
gem '
|
104
|
-
gem 'roodi', '~> 2.1'
|
105
|
-
gem 'yard', '~> 0.5'
|
106
|
-
gem 'yardstick', '~> 0.1'
|
35
|
+
gem 'rcov', '~> 0.9.9', :platforms => :mri_18
|
36
|
+
gem 'yard', '~> 0.6'
|
37
|
+
gem 'yardstick', '~> 0.2'
|
107
38
|
|
108
39
|
end
|
109
40
|
|
110
|
-
group :datamapper do
|
41
|
+
group :datamapper do
|
111
42
|
|
112
43
|
adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
|
113
44
|
adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
|
@@ -117,27 +48,27 @@ group :datamapper do # We need this because we want to pin these dependencies to
|
|
117
48
|
|
118
49
|
if (do_adapters = DM_DO_ADAPTERS & adapters).any?
|
119
50
|
options = {}
|
120
|
-
options[:git] = "#{DATAMAPPER}/do
|
51
|
+
options[:git] = "#{DATAMAPPER}/do#{REPO_POSTFIX}" if ENV['DO_GIT'] == 'true'
|
121
52
|
|
122
|
-
gem 'data_objects',
|
53
|
+
gem 'data_objects', DO_VERSION, options.dup
|
123
54
|
|
124
55
|
do_adapters.each do |adapter|
|
125
56
|
adapter = 'sqlite3' if adapter == 'sqlite'
|
126
57
|
gem "do_#{adapter}", DO_VERSION, options.dup
|
127
58
|
end
|
128
59
|
|
129
|
-
gem 'dm-do-adapter', DM_VERSION,
|
60
|
+
gem 'dm-do-adapter', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}"
|
130
61
|
end
|
131
62
|
|
132
63
|
adapters.each do |adapter|
|
133
|
-
gem "dm-#{adapter}-adapter", DM_VERSION,
|
64
|
+
gem "dm-#{adapter}-adapter", DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}"
|
134
65
|
end
|
135
66
|
|
136
67
|
plugins = ENV['PLUGINS'] || ENV['PLUGIN']
|
137
68
|
plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
|
138
69
|
|
139
70
|
plugins.each do |plugin|
|
140
|
-
gem plugin, DM_VERSION,
|
71
|
+
gem plugin, DM_VERSION, SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}"
|
141
72
|
end
|
142
73
|
|
143
74
|
end
|
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -3,168 +3,165 @@
|
|
3
3
|
DataMapper::Is::Remixable allows you to create re-usable chunks of relational data, its kind of like multiple
|
4
4
|
inheritance for models.
|
5
5
|
|
6
|
-
|
7
6
|
For example:
|
8
|
-
#Comments are everywhere, why define them over and over?
|
9
|
-
module Comment
|
10
|
-
include DataMapper::Resource
|
11
|
-
is :remixable
|
12
7
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
# Comments are everywhere, why define them over and over?:
|
9
|
+
module Comment
|
10
|
+
include DataMapper::Resource
|
11
|
+
is :remixable
|
17
12
|
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
property :id, Serial
|
14
|
+
property :body, String
|
15
|
+
property :created_at, DateTime
|
16
|
+
end
|
21
17
|
|
22
|
-
|
23
|
-
|
18
|
+
# Lots of things can be addressable; people, buildings
|
19
|
+
module Addressable
|
20
|
+
include DataMapper::Resource
|
24
21
|
|
25
|
-
|
22
|
+
is :remixable,
|
23
|
+
:suffix => "address" #Default suffix is module name pluralized
|
26
24
|
|
27
|
-
|
25
|
+
property :id, Serial
|
28
26
|
|
29
|
-
|
30
|
-
property :address2, String, :length => 255
|
27
|
+
property :label, String #home, work, etc...
|
31
28
|
|
32
|
-
|
33
|
-
|
34
|
-
property :zip, String, :length => 5..10
|
35
|
-
end
|
29
|
+
property :address1, String, :length => 255
|
30
|
+
property :address2, String, :length => 255
|
36
31
|
|
37
|
-
|
38
|
-
|
32
|
+
property :city, String, :length => 128
|
33
|
+
property :state, String, :length => 2
|
34
|
+
property :zip, String, :length => 5..10
|
35
|
+
end
|
39
36
|
|
40
|
-
|
37
|
+
module Vote
|
38
|
+
include DataMapper::Resource
|
41
39
|
|
42
|
-
|
43
|
-
property :opinion, Enum.new("good","bad")
|
40
|
+
is :remixable
|
44
41
|
|
45
|
-
|
42
|
+
property :id, Serial
|
43
|
+
property :opinion, Enum["good","bad"]
|
44
|
+
end
|
46
45
|
|
47
|
-
class Location
|
48
|
-
|
46
|
+
class Location
|
47
|
+
include DataMapper::Resource
|
49
48
|
|
50
|
-
|
51
|
-
|
49
|
+
#Location can have 1 address
|
50
|
+
remix 1, :addressables
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
52
|
+
# This does the following:
|
53
|
+
# - creates a class called LocationAddress
|
54
|
+
(default name would be LocationAddressable, but Addressable#suffix was specified)
|
55
|
+
# - duplicates the properties of Addressable within LocationAddress
|
56
|
+
# - a table called location_addresses
|
57
|
+
# - creates Location#location_addresses accessor
|
59
58
|
|
60
|
-
|
61
|
-
end
|
59
|
+
#... methods, properties, etc ...#
|
60
|
+
end
|
62
61
|
|
62
|
+
class User
|
63
|
+
include DataMapper::Resource
|
63
64
|
|
64
|
-
|
65
|
-
|
65
|
+
#User can have many addresses
|
66
|
+
remix n, :addressables, :as => "addresses"
|
67
|
+
# - creates a class called UserAddress
|
68
|
+
(default name would be UserAddressable, but Addressable#suffix was specified)
|
69
|
+
# - duplicates the properties of Addressable within UserAddress
|
70
|
+
# - a table called user_addresses
|
71
|
+
# - creates User#user_addresses accessor
|
72
|
+
# - creates an accessor alias User#addresses
|
66
73
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
(default name would be UserAddressable, but Addressable#suffix was specified)
|
71
|
-
# - duplicates the properties of Addressable within UserAddress
|
72
|
-
# - a table called user_addresses
|
73
|
-
# - creates User#user_addresses accessor
|
74
|
-
# - creates an accessor alias User#addresses
|
74
|
+
enhance :addressables do
|
75
|
+
storage_names[:default] = "a_different_table_name"
|
76
|
+
property :label, Enum["work","home"]
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
-
property :label, Enum.new("work","home")
|
78
|
+
#This adds a column to user_addresses to store an address label
|
79
|
+
end
|
79
80
|
|
80
|
-
|
81
|
+
#... methods, properties, etc ...#
|
81
82
|
end
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
class Article
|
87
|
-
include DataMapper::Resource
|
88
|
-
|
89
|
-
remix n, :comments, :for => "User"
|
90
|
-
# - creates a class called ArticleComment
|
91
|
-
# - duplicates the properties of Comment within ArticleComment
|
92
|
-
# - a table called article_comments
|
93
|
-
# - creates Article#article_comments
|
94
|
-
# - creates User#article_comments
|
84
|
+
class Article
|
85
|
+
include DataMapper::Resource
|
95
86
|
|
96
|
-
|
87
|
+
remix n, :comments, :for => "User"
|
88
|
+
# - creates a class called ArticleComment
|
89
|
+
# - duplicates the properties of Comment within ArticleComment
|
90
|
+
# - a table called article_comments
|
91
|
+
# - creates Article#article_comments
|
92
|
+
# - creates User#article_comments
|
97
93
|
|
98
|
-
|
94
|
+
#... methods, properties, etc ...#
|
99
95
|
|
100
|
-
|
101
|
-
include DataMapper::Resource
|
96
|
+
end
|
102
97
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
98
|
+
class Video
|
99
|
+
include DataMapper::Resource
|
100
|
+
|
101
|
+
remix n, :comments, :for => "User", :as => "comments"
|
102
|
+
# - creates a class called VideoComment
|
103
|
+
# - duplicates the properties of Comment within VideoComment
|
104
|
+
# - a table called video_comments
|
105
|
+
# - creates Video#video_comments
|
106
|
+
# - creates User#video_comments
|
107
|
+
# - create Video#comments
|
108
|
+
|
109
|
+
enhance :comments do
|
110
|
+
# VideoComment now has the method #reverse
|
111
|
+
def reverse
|
112
|
+
return self.body.reverse
|
113
|
+
end
|
114
|
+
|
115
|
+
#I like YouTubes ability for users to vote comments up and down
|
116
|
+
remix 1, :votes, :for => "User"
|
117
|
+
# - creates a class called VideoCommentVote
|
118
|
+
# - duplicates the properties of Vote within VideoCommentVote
|
119
|
+
# - a table called video_comment_votes
|
120
|
+
# - creates Video#video_comments#votes
|
110
121
|
|
111
|
-
enhance :comments do
|
112
|
-
# VideoComment now has the method #reverse
|
113
|
-
def reverse
|
114
|
-
return self.body.reverse
|
115
122
|
end
|
116
123
|
|
117
|
-
|
118
|
-
remix 1, :votes, :for => "User"
|
119
|
-
# - creates a class called VideoCommentVote
|
120
|
-
# - duplicates the properties of Vote within VideoCommentVote
|
121
|
-
# - a table called video_comment_votes
|
122
|
-
# - creates Video#video_comments#votes
|
123
|
-
|
124
|
+
#... methods, properties, etc ...#
|
124
125
|
end
|
125
126
|
|
126
|
-
#... methods, properties, etc ...#
|
127
|
-
end
|
128
|
-
|
129
|
-
|
130
127
|
Further, remixables can namespace methods that should exist in the generated and remixing classes, if these
|
131
128
|
modules are present the are attached appropriately to the other classes.
|
132
129
|
|
133
|
-
module ExampleRemixable
|
134
|
-
|
135
|
-
|
130
|
+
module ExampleRemixable
|
131
|
+
include DataMapper::Resource
|
132
|
+
is :remixable
|
136
133
|
|
137
|
-
|
134
|
+
#... your properies ...
|
138
135
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
136
|
+
# Class methods that will be attached to class doing the remixing...
|
137
|
+
#
|
138
|
+
# These methods would be attached to the User class given:
|
139
|
+
# User.remixes n, :images
|
140
|
+
#
|
141
|
+
module RemixerClassMethods
|
142
|
+
end
|
146
143
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
144
|
+
# Instances methods that will be attached to objects of the class doing the remixing...
|
145
|
+
#
|
146
|
+
# These methods would be attached to User objects given:
|
147
|
+
# User.remixes n, :images
|
148
|
+
#
|
149
|
+
module RemixerInstanceMethods
|
150
|
+
end
|
154
151
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
152
|
+
# Class methods that will be attached to genereated remixed class
|
153
|
+
#
|
154
|
+
# These methods would be attached to the UserImage class given:
|
155
|
+
# User.remixes n, :images
|
156
|
+
#
|
157
|
+
module RemixeeClassMethods
|
158
|
+
end
|
162
159
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
160
|
+
# Instances methods that will be attached to objects of the genereated remixed class
|
161
|
+
#
|
162
|
+
# These methods would be attached to UserImage objects given:
|
163
|
+
# User.remixes n, :images
|
164
|
+
#
|
165
|
+
module RemixeeInstanceMethods
|
166
|
+
end
|
169
167
|
end
|
170
|
-
end
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
begin
|
5
|
-
gem 'jeweler', '~> 1.
|
5
|
+
gem 'jeweler', '~> 1.5.2'
|
6
6
|
require 'jeweler'
|
7
7
|
|
8
8
|
Jeweler::Tasks.new do |gem|
|
@@ -15,12 +15,6 @@ begin
|
|
15
15
|
gem.has_rdoc = 'yard'
|
16
16
|
|
17
17
|
gem.rubyforge_project = 'datamapper'
|
18
|
-
|
19
|
-
gem.add_dependency 'dm-core', '~> 1.0.2'
|
20
|
-
|
21
|
-
gem.add_development_dependency 'dm-validations', '~> 1.0.2'
|
22
|
-
gem.add_development_dependency 'dm-types', '~> 1.0.2'
|
23
|
-
gem.add_development_dependency 'rspec', '~> 1.3'
|
24
18
|
end
|
25
19
|
|
26
20
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.1.0.rc1
|
data/dm-is-remixable.gemspec
CHANGED
@@ -1,98 +1,105 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dm-is-remixable}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.1.0.rc1"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cory O'Daniel"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-28}
|
13
13
|
s.description = %q{dm-is-remixable allow you to create reusable data functionality}
|
14
14
|
s.email = %q{dm-is-remixable [a] coryodaniel [d] com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
"tasks/spec.rake",
|
49
|
-
"tasks/yard.rake",
|
50
|
-
"tasks/yardstick.rake"
|
20
|
+
"Gemfile",
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"dm-is-remixable.gemspec",
|
26
|
+
"lib/dm-is-remixable.rb",
|
27
|
+
"lib/dm-is-remixable/is/remixable.rb",
|
28
|
+
"spec/data/addressable.rb",
|
29
|
+
"spec/data/article.rb",
|
30
|
+
"spec/data/billable.rb",
|
31
|
+
"spec/data/bot.rb",
|
32
|
+
"spec/data/commentable.rb",
|
33
|
+
"spec/data/image.rb",
|
34
|
+
"spec/data/project.rb",
|
35
|
+
"spec/data/rating.rb",
|
36
|
+
"spec/data/tag.rb",
|
37
|
+
"spec/data/taggable.rb",
|
38
|
+
"spec/data/topic.rb",
|
39
|
+
"spec/data/user.rb",
|
40
|
+
"spec/data/viewable.rb",
|
41
|
+
"spec/integration/remixable_spec.rb",
|
42
|
+
"spec/rcov.opts",
|
43
|
+
"spec/spec.opts",
|
44
|
+
"spec/spec_helper.rb",
|
45
|
+
"tasks/spec.rake",
|
46
|
+
"tasks/yard.rake",
|
47
|
+
"tasks/yardstick.rake"
|
51
48
|
]
|
52
|
-
s.has_rdoc = %q{yard}
|
53
49
|
s.homepage = %q{http://github.com/datamapper/dm-is-remixable}
|
54
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
55
50
|
s.require_paths = ["lib"]
|
56
51
|
s.rubyforge_project = %q{datamapper}
|
57
|
-
s.rubygems_version = %q{1.
|
52
|
+
s.rubygems_version = %q{1.5.2}
|
58
53
|
s.summary = %q{dm-is-remixable allow you to create reusable data functionality}
|
59
54
|
s.test_files = [
|
60
55
|
"spec/data/addressable.rb",
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
56
|
+
"spec/data/article.rb",
|
57
|
+
"spec/data/billable.rb",
|
58
|
+
"spec/data/bot.rb",
|
59
|
+
"spec/data/commentable.rb",
|
60
|
+
"spec/data/image.rb",
|
61
|
+
"spec/data/project.rb",
|
62
|
+
"spec/data/rating.rb",
|
63
|
+
"spec/data/tag.rb",
|
64
|
+
"spec/data/taggable.rb",
|
65
|
+
"spec/data/topic.rb",
|
66
|
+
"spec/data/user.rb",
|
67
|
+
"spec/data/viewable.rb",
|
68
|
+
"spec/integration/remixable_spec.rb",
|
69
|
+
"spec/spec_helper.rb"
|
74
70
|
]
|
75
71
|
|
76
72
|
if s.respond_to? :specification_version then
|
77
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
78
73
|
s.specification_version = 3
|
79
74
|
|
80
75
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
81
|
-
s.add_runtime_dependency(%q<
|
82
|
-
s.
|
83
|
-
s.
|
84
|
-
s.add_development_dependency(%q<
|
76
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.4"])
|
77
|
+
s.add_runtime_dependency(%q<i18n>, ["~> 0.5.0"])
|
78
|
+
s.add_runtime_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
|
79
|
+
s.add_development_dependency(%q<dm-validations>, ["~> 1.1.0.rc1"])
|
80
|
+
s.add_development_dependency(%q<dm-types>, ["~> 1.1.0.rc1"])
|
81
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
82
|
+
s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
|
83
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3.1"])
|
85
84
|
else
|
86
|
-
s.add_dependency(%q<
|
87
|
-
s.add_dependency(%q<
|
88
|
-
s.add_dependency(%q<dm-
|
89
|
-
s.add_dependency(%q<
|
85
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.4"])
|
86
|
+
s.add_dependency(%q<i18n>, ["~> 0.5.0"])
|
87
|
+
s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
|
88
|
+
s.add_dependency(%q<dm-validations>, ["~> 1.1.0.rc1"])
|
89
|
+
s.add_dependency(%q<dm-types>, ["~> 1.1.0.rc1"])
|
90
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
91
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
92
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
90
93
|
end
|
91
94
|
else
|
92
|
-
s.add_dependency(%q<
|
93
|
-
s.add_dependency(%q<
|
94
|
-
s.add_dependency(%q<dm-
|
95
|
-
s.add_dependency(%q<
|
95
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.4"])
|
96
|
+
s.add_dependency(%q<i18n>, ["~> 0.5.0"])
|
97
|
+
s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
|
98
|
+
s.add_dependency(%q<dm-validations>, ["~> 1.1.0.rc1"])
|
99
|
+
s.add_dependency(%q<dm-types>, ["~> 1.1.0.rc1"])
|
100
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
101
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
102
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
96
103
|
end
|
97
104
|
end
|
98
105
|
|
@@ -11,7 +11,7 @@ rescue LoadError
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
# reopen
|
14
|
+
# reopen datamapper/extlib/lib/extlib/object.rb
|
15
15
|
class Object
|
16
16
|
|
17
17
|
def full_const_defined?(name)
|
@@ -68,7 +68,7 @@ module DataMapper
|
|
68
68
|
@is_remixable = true
|
69
69
|
|
70
70
|
# support clean suffixes for nested modules
|
71
|
-
default_suffix =
|
71
|
+
default_suffix = DataMapper::Inflector.demodulize(self.name).singularize.underscore
|
72
72
|
suffix(options.delete(:suffix) || default_suffix)
|
73
73
|
end
|
74
74
|
|
@@ -157,7 +157,7 @@ module DataMapper
|
|
157
157
|
# Example (from my upcoming dm-is-rateable gem)
|
158
158
|
# remix n, "DataMapper::Is::Rateable::Rating", :as => :ratings
|
159
159
|
remixable_module = case remixable
|
160
|
-
when Symbol then Object.full_const_get(
|
160
|
+
when Symbol then Object.full_const_get(DataMapper::Inflector.classify(remixable))
|
161
161
|
when String then Object.full_const_get(remixable)
|
162
162
|
when Module then remixable
|
163
163
|
end
|
@@ -174,7 +174,7 @@ module DataMapper
|
|
174
174
|
#Merge defaults/options
|
175
175
|
options = {
|
176
176
|
:as => nil,
|
177
|
-
:model =>
|
177
|
+
:model => DataMapper::Inflector.camelize(self.name.underscore + '_' + remixable_module.suffix),
|
178
178
|
:for => nil,
|
179
179
|
:on => nil,
|
180
180
|
:unique => false,
|
@@ -183,10 +183,10 @@ module DataMapper
|
|
183
183
|
}.update(options)
|
184
184
|
|
185
185
|
#Make sure the class hasn't been remixed already
|
186
|
-
unless Object.full_const_defined?(
|
186
|
+
unless Object.full_const_defined?(DataMapper::Inflector.classify(options[:model]))
|
187
187
|
|
188
188
|
#Storage name of our remixed model
|
189
|
-
options[:table_name] =
|
189
|
+
options[:table_name] = DataMapper::Inflector.tableize(DataMapper::Inflector.demodulize(options[:model]))
|
190
190
|
|
191
191
|
#Other model to mix with in case of M:M through Remixable
|
192
192
|
options[:other_model] = options[:for] || options[:on]
|
@@ -197,7 +197,7 @@ module DataMapper
|
|
197
197
|
# map the remixable to the remixed model
|
198
198
|
# since this will be used from 'enhance api' i think it makes perfect sense to
|
199
199
|
# always refer to a remixable by its demodulized underscored constant name
|
200
|
-
remixable_key =
|
200
|
+
remixable_key = DataMapper::Inflector.demodulize(remixable_module.name).underscore.to_sym
|
201
201
|
populate_remixables_mapping(model, options.merge(:remixable_key => remixable_key))
|
202
202
|
|
203
203
|
# attach RemixerClassMethods and RemixerInstanceMethods to remixer if defined by remixee
|
@@ -269,7 +269,7 @@ module DataMapper
|
|
269
269
|
class_name = if remixable_model.nil?
|
270
270
|
@remixables[remixable_name].keys.first
|
271
271
|
else
|
272
|
-
|
272
|
+
DataMapper::Inflector.demodulize(remixable_model.to_s).underscore.to_sym
|
273
273
|
end
|
274
274
|
|
275
275
|
model = @remixables[remixable_name][class_name][:model] unless @remixables[remixable_name][class_name].nil?
|
@@ -293,7 +293,7 @@ module DataMapper
|
|
293
293
|
key = options[:remixable_key]
|
294
294
|
accessor_name = options[:as] ? options[:as] : options[:table_name]
|
295
295
|
@remixables[key] ||= {}
|
296
|
-
model_key =
|
296
|
+
model_key = DataMapper::Inflector.demodulize(remixable_model.to_s).underscore.to_sym
|
297
297
|
@remixables[key][model_key] ||= {}
|
298
298
|
@remixables[key][model_key][:reader] ||= accessor_name.to_sym
|
299
299
|
@remixables[key][model_key][:writer] ||= "#{accessor_name}=".to_sym
|
@@ -309,8 +309,8 @@ module DataMapper
|
|
309
309
|
# options <Hash> options hash
|
310
310
|
def remix_one_to_many(cardinality, model, options)
|
311
311
|
self.has cardinality, (options[:as] || options[:table_name]).to_sym, :model => model.name
|
312
|
-
model.property
|
313
|
-
model.belongs_to belongs_to_name(self.name)
|
312
|
+
model.property DataMapper::Inflector.foreign_key(self.name).intern, Integer, :min => 0, :required => true
|
313
|
+
model.belongs_to belongs_to_name(self.name), self.name
|
314
314
|
end
|
315
315
|
|
316
316
|
# - remix_many_to_many
|
@@ -321,7 +321,7 @@ module DataMapper
|
|
321
321
|
# model <Class> remixed model that 'self' is relating through
|
322
322
|
# options <Hash> options hash
|
323
323
|
def remix_many_to_many(cardinality, model, options)
|
324
|
-
options[:other_model] = Object.full_const_get(
|
324
|
+
options[:other_model] = Object.full_const_get(DataMapper::Inflector.classify(options[:other_model]))
|
325
325
|
|
326
326
|
#TODO if options[:unique] the two *_id's need to be a unique composite key, maybe even
|
327
327
|
# attach a validates_is_unique if the validator is included.
|
@@ -330,10 +330,10 @@ module DataMapper
|
|
330
330
|
# Is M:M between two different classes or the same class
|
331
331
|
unless self.name == options[:other_model].name
|
332
332
|
self.has cardinality, (options[:as] || options[:table_name]).to_sym, :model => model.name
|
333
|
-
options[:other_model].has cardinality, options[:table_name].intern
|
333
|
+
options[:other_model].has cardinality, options[:table_name].intern, :model => model.name
|
334
334
|
|
335
|
-
model.belongs_to belongs_to_name(self.name)
|
336
|
-
model.belongs_to belongs_to_name(options[:other_model].name)
|
335
|
+
model.belongs_to belongs_to_name(self.name), self.name
|
336
|
+
model.belongs_to belongs_to_name(options[:other_model].name), options[:other_model].name
|
337
337
|
if options[:connect]
|
338
338
|
remixed = options[:as]
|
339
339
|
remixed ||= options[:other_model].to_s.underscore
|
@@ -343,7 +343,7 @@ module DataMapper
|
|
343
343
|
raise Exception, "options[:via] must be specified when Remixing a module between two of the same class" unless options[:via]
|
344
344
|
|
345
345
|
self.has cardinality, (options[:as] || options[:table_name]).to_sym, :model => model.name
|
346
|
-
model.belongs_to belongs_to_name(self.name)
|
346
|
+
model.belongs_to belongs_to_name(self.name), self.name
|
347
347
|
model.belongs_to options[:via].intern, :model => options[:other_model].name, :child_key => ["#{options[:via]}_id".intern]
|
348
348
|
end
|
349
349
|
end
|
@@ -357,16 +357,16 @@ module DataMapper
|
|
357
357
|
# ==== Returns
|
358
358
|
# <Class> remixed model
|
359
359
|
def generate_remixed_model(remixable,options)
|
360
|
-
#Create Remixed Model
|
361
|
-
klass = Class.new Object do
|
362
|
-
include DataMapper::Resource
|
363
|
-
end
|
364
360
|
|
365
|
-
#
|
366
|
-
|
361
|
+
# Create Remixed Model
|
362
|
+
# TODO clean this up!
|
363
|
+
parts = options[:model].split('::')
|
364
|
+
name = parts.last
|
365
|
+
namespace = Object.full_const_get((parts - [name]).join('::'))
|
367
366
|
|
368
|
-
|
369
|
-
|
367
|
+
model = Model.new(name, namespace) do
|
368
|
+
include remixable
|
369
|
+
end
|
370
370
|
|
371
371
|
if DataMapper.const_defined?('Validations')
|
372
372
|
|
@@ -381,8 +381,7 @@ module DataMapper
|
|
381
381
|
|
382
382
|
# Port the properties over
|
383
383
|
remixable.properties.each do |prop|
|
384
|
-
|
385
|
-
model.property(prop.name, type, prop.options)
|
384
|
+
model.property(prop.name, prop.class, prop.options)
|
386
385
|
end
|
387
386
|
|
388
387
|
# Attach remixed model access to RemixeeClassMethods and RemixeeInstanceMethods if defined
|
@@ -400,7 +399,7 @@ module DataMapper
|
|
400
399
|
end
|
401
400
|
|
402
401
|
def belongs_to_name(class_name)
|
403
|
-
class_name.underscore.gsub(/\//, '_').to_sym
|
402
|
+
DataMapper::Inflector.demodulize(class_name).underscore.gsub(/\//, '_').to_sym
|
404
403
|
end
|
405
404
|
|
406
405
|
private
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Portfolio
|
2
|
+
class Project
|
3
|
+
include DataMapper::Resource
|
4
|
+
|
5
|
+
property :id, Serial
|
6
|
+
property :title, String, :required => true, :length=> 2..50
|
7
|
+
property :url, String
|
8
|
+
|
9
|
+
remix 1, :images
|
10
|
+
remix n, :viewables
|
11
|
+
remix n, :commentables, :as => 'comments', :for => 'User', :via => 'commentor'
|
12
|
+
end
|
13
|
+
end
|
@@ -10,6 +10,7 @@ describe 'DataMapper::Is::Remixable' do
|
|
10
10
|
Image.is_remixable?.should be(true)
|
11
11
|
Article.is_remixable?.should be(false)
|
12
12
|
Commentable.is_remixable?.should be(true)
|
13
|
+
Portfolio::Project.is_remixable?.should be(false)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -169,6 +170,30 @@ describe 'DataMapper::Is::Remixable' do
|
|
169
170
|
user.user_addresses.length.should be(2)
|
170
171
|
end
|
171
172
|
|
173
|
+
let(:project) { Portfolio::Project.new }
|
174
|
+
|
175
|
+
it 'should create the correctly named relationship when using namespaced Models' do
|
176
|
+
project.should_not respond_to(:portfolio_project_images)
|
177
|
+
project.should_not respond_to(:portfolio_project_views)
|
178
|
+
project.should respond_to(:project_images)
|
179
|
+
project.should respond_to(:project_views)
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'should allow 1:M relationships with the Remixable Module and a namespaced Model' do
|
183
|
+
{
|
184
|
+
'123.202.201.209' => DateTime.parse('2009/01/02'),
|
185
|
+
'32.21.21.21' => DateTime.parse('2010/05/12'),
|
186
|
+
'88.999.910.101' => DateTime.parse('1999/12/15')
|
187
|
+
}.each do |ip, date|
|
188
|
+
view = Portfolio::ProjectView.new
|
189
|
+
view.ip = ip
|
190
|
+
view.created_at = date
|
191
|
+
project.project_views << view
|
192
|
+
end
|
193
|
+
|
194
|
+
project.project_views.length.should be(3)
|
195
|
+
end
|
196
|
+
|
172
197
|
it "should allow 1:1 relationships with the Remixable Module" do
|
173
198
|
article = Article.new
|
174
199
|
image1 = ArticleImage.new
|
@@ -194,6 +219,30 @@ describe 'DataMapper::Is::Remixable' do
|
|
194
219
|
article.pics.path.should == image2.path
|
195
220
|
end
|
196
221
|
|
222
|
+
it "should allow 1:1 relationships with the Remixable Module and a namespaced Model" do
|
223
|
+
image1 = Portfolio::ProjectImage.new
|
224
|
+
image2 = Portfolio::ProjectImage.new
|
225
|
+
|
226
|
+
project.title = "My best work"
|
227
|
+
project.url = "http://example.com/work/success-in-five-steps.html"
|
228
|
+
|
229
|
+
image1.description = 'Business Failure'
|
230
|
+
image1.path = '~/pictures/biz.jpg'
|
231
|
+
|
232
|
+
image2.description = '73 Signals Sucess'
|
233
|
+
image2.path = '~/pictures/hhd.png'
|
234
|
+
|
235
|
+
begin
|
236
|
+
project.project_images << image1
|
237
|
+
false
|
238
|
+
rescue Exception => e
|
239
|
+
e.class.should be(NoMethodError)
|
240
|
+
end
|
241
|
+
|
242
|
+
project.project_images = image2
|
243
|
+
project.project_images.path.should == image2.path
|
244
|
+
end
|
245
|
+
|
197
246
|
# Example:
|
198
247
|
# Users are Commentable by many Users
|
199
248
|
#
|
@@ -226,6 +275,27 @@ describe 'DataMapper::Is::Remixable' do
|
|
226
275
|
user.article_comments.first.should == ac
|
227
276
|
end
|
228
277
|
|
278
|
+
it 'should allow M:M relationships through the Remixable Module and a namespaced Model' do
|
279
|
+
user = User.new
|
280
|
+
pc = Portfolio::ProjectComment.new
|
281
|
+
|
282
|
+
user.first_name = 'John'
|
283
|
+
user.last_name = 'Jameson'
|
284
|
+
user.save
|
285
|
+
|
286
|
+
project.url = 'http://example.com/'
|
287
|
+
project.title = 'A showcase of my best work'
|
288
|
+
project.save
|
289
|
+
|
290
|
+
pc.comment = 'You overprice your work!'
|
291
|
+
pc.user = user
|
292
|
+
pc.project = project
|
293
|
+
pc.save
|
294
|
+
|
295
|
+
project.comments.first.should == pc
|
296
|
+
user.project_comments.first.should == pc
|
297
|
+
end
|
298
|
+
|
229
299
|
# Example:
|
230
300
|
# Remixable Image add functionality to any class that remixes it
|
231
301
|
# Image::RemixerClassMethods defines a method called 'total_images' that counts the total number of images for the class
|
data/spec/spec_helper.rb
CHANGED
data/tasks/spec.rake
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-is-remixable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
version: 1.0.2
|
4
|
+
prerelease: 6
|
5
|
+
version: 1.1.0.rc1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Cory O'Daniel
|
@@ -14,68 +10,97 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-02-28 00:00:00 -08:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
-
prerelease: false
|
17
|
+
name: activesupport
|
23
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
19
|
none: false
|
25
20
|
requirements:
|
26
21
|
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 1
|
30
|
-
- 0
|
31
|
-
- 2
|
32
|
-
version: 1.0.2
|
23
|
+
version: 3.0.4
|
33
24
|
type: :runtime
|
25
|
+
prerelease: false
|
34
26
|
version_requirements: *id001
|
35
27
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
37
|
-
prerelease: false
|
28
|
+
name: i18n
|
38
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
30
|
none: false
|
40
31
|
requirements:
|
41
32
|
- - ~>
|
42
33
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
- 2
|
47
|
-
version: 1.0.2
|
48
|
-
type: :development
|
34
|
+
version: 0.5.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
49
37
|
version_requirements: *id002
|
50
38
|
- !ruby/object:Gem::Dependency
|
51
|
-
name: dm-
|
52
|
-
prerelease: false
|
39
|
+
name: dm-core
|
53
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
41
|
none: false
|
55
42
|
requirements:
|
56
43
|
- - ~>
|
57
44
|
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
- 2
|
62
|
-
version: 1.0.2
|
63
|
-
type: :development
|
45
|
+
version: 1.1.0.rc1
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
64
48
|
version_requirements: *id003
|
65
49
|
- !ruby/object:Gem::Dependency
|
66
|
-
name:
|
67
|
-
prerelease: false
|
50
|
+
name: dm-validations
|
68
51
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
52
|
none: false
|
70
53
|
requirements:
|
71
54
|
- - ~>
|
72
55
|
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
- 1
|
75
|
-
- 3
|
76
|
-
version: "1.3"
|
56
|
+
version: 1.1.0.rc1
|
77
57
|
type: :development
|
58
|
+
prerelease: false
|
78
59
|
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: dm-types
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.1.0.rc1
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: jeweler
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.5.2
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rake
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.8.7
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: rspec
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ~>
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 1.3.1
|
101
|
+
type: :development
|
102
|
+
prerelease: false
|
103
|
+
version_requirements: *id008
|
79
104
|
description: dm-is-remixable allow you to create reusable data functionality
|
80
105
|
email: dm-is-remixable [a] coryodaniel [d] com
|
81
106
|
executables: []
|
@@ -86,7 +111,6 @@ extra_rdoc_files:
|
|
86
111
|
- LICENSE
|
87
112
|
- README.rdoc
|
88
113
|
files:
|
89
|
-
- .gitignore
|
90
114
|
- Gemfile
|
91
115
|
- LICENSE
|
92
116
|
- README.rdoc
|
@@ -101,6 +125,7 @@ files:
|
|
101
125
|
- spec/data/bot.rb
|
102
126
|
- spec/data/commentable.rb
|
103
127
|
- spec/data/image.rb
|
128
|
+
- spec/data/project.rb
|
104
129
|
- spec/data/rating.rb
|
105
130
|
- spec/data/tag.rb
|
106
131
|
- spec/data/taggable.rb
|
@@ -111,19 +136,16 @@ files:
|
|
111
136
|
- spec/rcov.opts
|
112
137
|
- spec/spec.opts
|
113
138
|
- spec/spec_helper.rb
|
114
|
-
- tasks/ci.rake
|
115
|
-
- tasks/local_gemfile.rake
|
116
|
-
- tasks/metrics.rake
|
117
139
|
- tasks/spec.rake
|
118
140
|
- tasks/yard.rake
|
119
141
|
- tasks/yardstick.rake
|
120
|
-
has_rdoc:
|
142
|
+
has_rdoc: true
|
121
143
|
homepage: http://github.com/datamapper/dm-is-remixable
|
122
144
|
licenses: []
|
123
145
|
|
124
146
|
post_install_message:
|
125
|
-
rdoc_options:
|
126
|
-
|
147
|
+
rdoc_options: []
|
148
|
+
|
127
149
|
require_paths:
|
128
150
|
- lib
|
129
151
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -131,21 +153,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
153
|
requirements:
|
132
154
|
- - ">="
|
133
155
|
- !ruby/object:Gem::Version
|
134
|
-
segments:
|
135
|
-
- 0
|
136
156
|
version: "0"
|
137
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
158
|
none: false
|
139
159
|
requirements:
|
140
|
-
- - "
|
160
|
+
- - ">"
|
141
161
|
- !ruby/object:Gem::Version
|
142
|
-
|
143
|
-
- 0
|
144
|
-
version: "0"
|
162
|
+
version: 1.3.1
|
145
163
|
requirements: []
|
146
164
|
|
147
165
|
rubyforge_project: datamapper
|
148
|
-
rubygems_version: 1.
|
166
|
+
rubygems_version: 1.5.2
|
149
167
|
signing_key:
|
150
168
|
specification_version: 3
|
151
169
|
summary: dm-is-remixable allow you to create reusable data functionality
|
@@ -156,6 +174,7 @@ test_files:
|
|
156
174
|
- spec/data/bot.rb
|
157
175
|
- spec/data/commentable.rb
|
158
176
|
- spec/data/image.rb
|
177
|
+
- spec/data/project.rb
|
159
178
|
- spec/data/rating.rb
|
160
179
|
- spec/data/tag.rb
|
161
180
|
- spec/data/taggable.rb
|
data/.gitignore
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## Rubinius
|
17
|
-
*.rbc
|
18
|
-
|
19
|
-
## PROJECT::GENERAL
|
20
|
-
*.gem
|
21
|
-
coverage
|
22
|
-
rdoc
|
23
|
-
pkg
|
24
|
-
tmp
|
25
|
-
doc
|
26
|
-
log
|
27
|
-
.yardoc
|
28
|
-
measurements
|
29
|
-
|
30
|
-
## BUNDLER
|
31
|
-
.bundle
|
32
|
-
Gemfile.local
|
33
|
-
Gemfile.lock
|
34
|
-
Gemfile.local.lock
|
35
|
-
|
36
|
-
## PROJECT::SPECIFIC
|
37
|
-
spec/db/
|
data/tasks/ci.rake
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
task :ci => [ :verify_measurements, 'metrics:all' ]
|
data/tasks/local_gemfile.rake
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
|
2
|
-
task :local_gemfile do |t|
|
3
|
-
|
4
|
-
root = Pathname(__FILE__).dirname.parent
|
5
|
-
datamapper = root.parent
|
6
|
-
|
7
|
-
root.join('Gemfile.local').open('w') do |f|
|
8
|
-
root.join('Gemfile').open.each do |line|
|
9
|
-
line.sub!(/DATAMAPPER = 'git:\/\/github.com\/datamapper'/, "DATAMAPPER = '#{datamapper}'")
|
10
|
-
line.sub!(/:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, ':path => "#{DATAMAPPER}/\1"')
|
11
|
-
line.sub!(/do_options\[:git\] = \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, 'do_options[:path] = "#{DATAMAPPER}/\1"')
|
12
|
-
f.puts line
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
data/tasks/metrics.rake
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'metric_fu'
|
3
|
-
rescue LoadError
|
4
|
-
namespace :metrics do
|
5
|
-
task :all do
|
6
|
-
abort 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
begin
|
12
|
-
require 'reek/adapters/rake_task'
|
13
|
-
|
14
|
-
Reek::RakeTask.new do |t|
|
15
|
-
t.fail_on_error = true
|
16
|
-
t.verbose = false
|
17
|
-
t.source_files = 'lib/**/*.rb'
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
task :reek do
|
21
|
-
abort 'Reek is not available. In order to run reek, you must: gem install reek'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
begin
|
26
|
-
require 'roodi'
|
27
|
-
require 'roodi_task'
|
28
|
-
|
29
|
-
RoodiTask.new do |t|
|
30
|
-
t.verbose = false
|
31
|
-
end
|
32
|
-
rescue LoadError
|
33
|
-
task :roodi do
|
34
|
-
abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
|
35
|
-
end
|
36
|
-
end
|