dm-is-tree 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 CHANGED
@@ -1,110 +1,42 @@
1
- # If you're working on more than one datamapper gem at a time, then it's
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
- DATAMAPPER = 'git://github.com/datamapper'
74
- DM_VERSION = '~> 1.0.2'
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 # Runtime dependencies (as in the gemspec)
10
+ group :runtime do
77
11
 
78
12
  if ENV['EXTLIB']
79
- gem 'extlib', '~> 0.9.15', :git => "#{DATAMAPPER}/extlib.git"
13
+ gem 'extlib', '~> 0.9.15', SOURCE => "#{DATAMAPPER}/extlib#{REPO_POSTFIX}", :require => nil
80
14
  else
81
- gem 'activesupport', '~> 3.0.0', :git => 'git://github.com/rails/rails.git', :branch => '3-0-stable', :require => nil
15
+ gem 'activesupport', '~> 3.0.4', :require => nil
16
+ gem 'i18n', '~> 0.5.0'
82
17
  end
83
18
 
84
- gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
19
+ gem 'dm-core', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-core#{REPO_POSTFIX}"
85
20
 
86
21
  end
87
22
 
88
- group(:development) do # Development dependencies (as in the gemspec)
23
+ group :development do
89
24
 
90
- gem 'rake', '~> 0.8.7'
91
- gem 'rspec', '~> 1.3', :git => 'git://github.com/snusnu/rspec', :branch => 'heckle_fix_plus_gemfile'
92
- gem 'jeweler', '~> 1.4'
25
+ gem 'jeweler', '~> 1.5.2'
26
+ gem 'rake', '~> 0.8.7'
27
+ gem 'rspec', '~> 1.3.1'
93
28
 
94
29
  end
95
30
 
96
- group :quality do # These gems contain rake tasks that check the quality of the source code
31
+ group :quality do
97
32
 
98
- gem 'metric_fu', '~> 1.3'
99
- gem 'rcov', '~> 0.9.8'
100
- gem 'reek', '~> 1.2.8'
101
- gem 'roodi', '~> 2.1'
102
- gem 'yard', '~> 0.5'
103
- gem 'yardstick', '~> 0.1'
33
+ gem 'rcov', '~> 0.9.9', :platforms => :mri_18
34
+ gem 'yard', '~> 0.6'
35
+ gem 'yardstick', '~> 0.2'
104
36
 
105
37
  end
106
38
 
107
- group :datamapper do # We need this because we want to pin these dependencies to their git master sources
39
+ group :datamapper do
108
40
 
109
41
  adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
110
42
  adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
@@ -114,27 +46,27 @@ group :datamapper do # We need this because we want to pin these dependencies to
114
46
 
115
47
  if (do_adapters = DM_DO_ADAPTERS & adapters).any?
116
48
  options = {}
117
- options[:git] = "#{DATAMAPPER}/do.git" if ENV['DO_GIT'] == 'true'
49
+ options[:git] = "#{DATAMAPPER}/do#{REPO_POSTFIX}" if ENV['DO_GIT'] == 'true'
118
50
 
119
- gem 'data_objects', DO_VERSION, options.dup
51
+ gem 'data_objects', DO_VERSION, options.dup
120
52
 
121
53
  do_adapters.each do |adapter|
122
54
  adapter = 'sqlite3' if adapter == 'sqlite'
123
55
  gem "do_#{adapter}", DO_VERSION, options.dup
124
56
  end
125
57
 
126
- gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter.git"
58
+ gem 'dm-do-adapter', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}"
127
59
  end
128
60
 
129
61
  adapters.each do |adapter|
130
- gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DATAMAPPER}/dm-#{adapter}-adapter.git"
62
+ gem "dm-#{adapter}-adapter", DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}"
131
63
  end
132
64
 
133
65
  plugins = ENV['PLUGINS'] || ENV['PLUGIN']
134
66
  plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
135
67
 
136
68
  plugins.each do |plugin|
137
- gem plugin, DM_VERSION, :git => "#{DATAMAPPER}/#{plugin}.git"
69
+ gem plugin, DM_VERSION, SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}"
138
70
  end
139
71
 
140
72
  end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Timothy Bennett
1
+ Copyright (c) 2011 Timothy Bennett
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -1,35 +1,387 @@
1
1
  = dm-is-tree
2
2
 
3
- DataMapper plugin allowing the creation of tree structures from data models.
3
+ DataMapper plugin enabling easy creation of tree structures from your DM models.
4
4
 
5
- Example:
5
+ This requires <b>a foreign key property</b> for your model, which by default would be called <tt>:parent_id</tt>.
6
6
 
7
- class Category
8
- include DataMapper::Resource
9
7
 
10
- property :id, Serial
11
- property :parent_id, Integer
12
- property :name, String
8
+ == Installation
13
9
 
14
- is :tree, :order => :name
15
- end
10
+ === Stable
16
11
 
17
- root
18
- +- child
19
- +- grandchild1
20
- +- grandchild2
12
+ Install the <tt>dm-is-tree</tt> gem.
21
13
 
22
- root = Category.create(:name => "root")
23
- child = root.children.create(:name => "child")
24
- grandchild1 = child1.children.create(:name => "grandchild1")
25
- grandchild2 = child2.children.create(:name => "grandchild2")
14
+ $ (sudo)? gem install dm-is-tree
26
15
 
27
- root.parent # => nil
28
- child.parent # => root
29
- root.children # => [child]
30
- root.children.first.children.first # => grandchild1
31
- Category.first_root # => root
32
- Category.roots # => [root]
16
+ === Edge
33
17
 
34
- Original Author:: Timothy Bennett (http://lanaer.com)
35
- Current Maintainer:: Garrett Heaver (http://www.linkedin.com/pub/dir/garrett/heaver)
18
+ Download or clone <tt>dm-is-versioned</tt> from Github[http://github.com/datamapper/dm-is-tree/].
19
+
20
+ $ cd /path/to/dm-is-tree
21
+
22
+ $ rake install # will install dm-is-tree
23
+
24
+
25
+
26
+ == Getting started
27
+
28
+ To start using this gem, just...
29
+
30
+ require 'dm-is-tree'
31
+
32
+
33
+ Lets say we have a Category model...
34
+
35
+ class Category
36
+ include DataMapper::Resource
37
+ property :id, Serial
38
+ property :name, String
39
+ end
40
+
41
+
42
+ ...and we want to have a tree structure within it, something like this:
43
+
44
+ the_parent
45
+ +- child
46
+ +- grandchild1
47
+ +- grandchild2
48
+
49
+
50
+ To achieve this we just add the following to the model:
51
+
52
+ class Category
53
+ <snip...>
54
+
55
+ is :tree, :order => :name
56
+
57
+ end
58
+
59
+ # No need to define the :parent_id property, it will be added automatically
60
+ property :parent_id, Integer
61
+
62
+
63
+ This will automatically add the following to your model:
64
+
65
+ === Instance Methods
66
+
67
+ * <tt>#parent</tt> / <tt>#parent=</tt>
68
+ * <tt>#children</tt> / <tt>#children=</tt>
69
+ * <tt>#siblings</tt>
70
+ * <tt>#generation</tt>
71
+ * <tt>#ancestors</tt>
72
+ - also aliased as <tt>#self_and_siblings</tt> for those used to AR's :acts_as_tree
73
+ * <tt>#root</tt>
74
+ - also aliased as <tt>#first_root</tt> for those used to AR's :acts_as_tree
75
+
76
+ === Class Methods
77
+
78
+ * <tt>#first_root</tt>
79
+ * <tt>#roots</tt>
80
+
81
+
82
+ == Configuration Options
83
+
84
+ Before we go onto the usage examples, a few quick words about configuration options available:
85
+
86
+ === <tt>:child_key</tt>
87
+
88
+ Specifies the column name to use for tracking of the tree (default: <tt>#parent_id</tt>).
89
+
90
+ class Category
91
+ <snip...>
92
+
93
+ is :tree, :child_key => :some_other_foreign_key_id
94
+
95
+ end
96
+
97
+
98
+ === <tt>:model</tt>
99
+
100
+ Specifies the name of the Model to use for the tree (default: Model class name defined in)
101
+
102
+ class Category
103
+ <snip...>
104
+
105
+ is :tree, :model => 'SomeStrangeModelName'
106
+
107
+ end
108
+
109
+
110
+ === <tt>:order</tt> [Optional]
111
+
112
+ Specifies the sort order of the children when retrieving them (default: not present)
113
+
114
+ class Category
115
+ <snip...>
116
+
117
+ is :tree, :order => [:updated_at, :name]
118
+
119
+ end
120
+
121
+
122
+
123
+ == Usage
124
+
125
+ To create the above structure, we would start with:
126
+
127
+ the_parent = Category.create(:name => "the_parent")
128
+
129
+
130
+ === <tt>#parent</tt> & <tt>#parent=</tt>
131
+
132
+ The <tt>#parent</tt> instance method returns the node referenced by the foreign key - <tt>:parent_id</tt>
133
+ or the defined <tt>:child_key</tt>.
134
+
135
+ # by default #parent and #parent_id return nil when there is no parent
136
+ the_parent.parent # => nil
137
+
138
+
139
+ The <tt>#parent=</tt> instance method sets the <tt>:parent_id</tt> foreign key to the parent's id attribute value.
140
+
141
+ To define a parent you can use either of these syntaxes:
142
+
143
+ a_child = Category.create(:name => "a_child", :parent => the_parent)
144
+
145
+ a_child = Category.create(:name => "a_child", :parent_id => the_parent.id)
146
+
147
+ a_child = Category.create(:name => "a_child")
148
+ a_child.parent = the_parent
149
+
150
+
151
+ When retrieving the parent, you will receive the full parent object ( or <tt>nil</tt> if none was declared )
152
+
153
+ a_child.parent # => the_parent
154
+
155
+
156
+ === <tt>#children</tt> & <tt>#children=</tt>
157
+
158
+ The <tt>#children</tt> instance method <b>returns all nodes with the current node as their parent</b>,
159
+ in the order specified by the <tt>:order</tt> configuration option.
160
+
161
+ # by default #children return an empty Array when there are no children
162
+ a_child.children # => []
163
+
164
+ # or an Array with child objects when there are children
165
+ the_parent.children # => [a_child]
166
+
167
+
168
+ The <tt>#children=</tt> instance method adds children by setting the <tt>:parent_id</tt> foreign key
169
+ to the parent's id attribute value.
170
+
171
+ To add a child you can use either of these syntaxes:
172
+
173
+ child = the_parent.children.create(:name => "child")
174
+
175
+ grandchild1 = Category.create(:name => "grandchild1")
176
+ child.children < grandchild1
177
+
178
+ grandchild2 = child.children.create(:name => "grandchild2")
179
+
180
+
181
+ When retrieving children, or a child, you will receive an Array of child objects.
182
+
183
+ child.children # => [grandchild1, grandchild2,...]
184
+
185
+ # just retrieve the first child
186
+ child.children.first # => grandchild1
187
+
188
+
189
+
190
+ === <tt>#siblings</tt>
191
+
192
+ The <tt>#siblings</tt> instance method <b>returns all the children of the parent, excluding the current node</b>.
193
+
194
+ # by default #siblings return an empty Array when there are no siblings
195
+ the_parent.siblings # => []
196
+
197
+ grandchild1.siblings # => [grandchild2]
198
+
199
+
200
+
201
+ === <tt>#generation</tt>
202
+
203
+ The <tt>#generation</tt> instance method returns all the children of the parent, <b>including the current node</b>.
204
+
205
+ # by default #generation return an Array with itself only when it's a 'lonely child'
206
+ the_parent.generation # => [the_parent]
207
+
208
+ #
209
+ grandchild1.generation # => [grandchild1, grandchild2]
210
+
211
+
212
+
213
+ === <tt>#ancestors</tt>
214
+
215
+ The <tt>#ancestors</tt> instance method returns all the ancestors of the current node.
216
+
217
+ # by default it returns an empty Array when born through immaculate conception (is root)
218
+ the_parent.ancestors # => []
219
+
220
+ grandchild2.ancestors # => [the_parent, a_child]
221
+
222
+
223
+
224
+ === <tt>#root</tt>
225
+
226
+ The <tt>#root</tt> instance method returns the root (parent) of the current node.
227
+
228
+ # by default returns itself only when it's the root node
229
+ the_parent.root # => the_parent
230
+
231
+ a_child.root # => the_parent
232
+
233
+ grandchild2.root # => the_parent
234
+
235
+
236
+
237
+ === <tt>self.#first_root</tt>
238
+
239
+ The <tt>#first_root</tt> class method returns the first root declared in the model.
240
+
241
+ Category.first_root # => the_parent
242
+
243
+
244
+ === <tt>self.#roots</tt>
245
+
246
+ The <tt>#roots</tt> class method returns an Array of the roots declared in the model.
247
+
248
+ Category.roots # => [the_parent]
249
+
250
+ parent2 = Category.create(:name => 'parent2')
251
+
252
+
253
+ Category.roots # => [the_parent, parent2]
254
+
255
+
256
+ === Summary
257
+
258
+ parent = Category.create(:name => "parent")
259
+
260
+ child = parent.children.create(:name => "child")
261
+
262
+ grandchild1 = child.children.create(:name => "grandchild1")
263
+ grandchild2 = child.children.create(:name => "grandchild2")
264
+
265
+ parent.parent # => nil
266
+ child.parent # => parent
267
+
268
+ parent.children # => [child]
269
+ parent.children.first.children.first # => grandchild1
270
+
271
+ parent.siblings # => []
272
+ grandchild1.siblings # => [grandchild2]
273
+
274
+ parent.generation # => [parent]
275
+ grandchild1.generation # => [grandchild1, grandchild2]
276
+
277
+ parent.ancestors # => []
278
+ grandchild2.ancestors # => [parent, child]
279
+
280
+ parent.root # => parent
281
+ parent.root # => parent
282
+ grandchild2.root # => parent
283
+
284
+
285
+ Category.first_root # => parent
286
+ Category.roots # => [parent]
287
+
288
+
289
+
290
+ == Gotchas
291
+
292
+ Now there are some gotcha's that might not be entirely obvious to everyone, so let's clarify
293
+ them here.
294
+
295
+ === Prevent a node being made a child of it self
296
+
297
+ By default dm-is-tree allows you to save a record as a child of it self, which is quite unnatural.
298
+ To prevent this, I would humbly suggest adding this custom validation code to your model(s).
299
+
300
+ class Category
301
+ <snip...>
302
+
303
+ # prevent saving Category as child of self, except when new?
304
+ validates_with_method :parent_id,
305
+ :method => :category_cannot_be_made_a_child_of_self,
306
+ :unless => :new?
307
+
308
+ protected
309
+
310
+ def category_cannot_be_made_a_child_of_self
311
+ if self.id === self.parent_id
312
+ return [
313
+ false,
314
+ "A Category [ #{self.name} ] cannot be made a child of it self [ #{self.name} ]"
315
+ ]
316
+ else
317
+ return true
318
+ end
319
+ end
320
+
321
+ end
322
+
323
+ An example:
324
+
325
+ parent = Category.create(:name => "parent")
326
+ child = parent.children.create(:name => 'child')
327
+
328
+ child.parent = child
329
+
330
+ child.save # => return false
331
+
332
+ child.errors.on(:parent_id)
333
+ # => ["A Category [ child ] cannot be made a child of it self [ child ]"]
334
+
335
+
336
+ === Sorting order within nodes
337
+
338
+ By default the sorting order is alphabetic, but this spans the entire table (with all nodes),
339
+ which might not be what you want.
340
+
341
+ To prevent this, order the results by <tt>:parent_id</tt> first, and secondly by <tt>:name</tt>
342
+ or whatever you wish to sort by.
343
+
344
+ class Category
345
+ <snip...>
346
+
347
+ is :tree, :order => [:parent_id, :name]
348
+
349
+ end
350
+
351
+
352
+ That's about it.
353
+
354
+
355
+ == Errors / Bugs
356
+
357
+ If something is not behaving intuitively, it is a bug, and should be reported.
358
+ Report it here: http://datamapper.lighthouseapp.com/
359
+
360
+
361
+ == TODOs
362
+
363
+ * Make it automatically prevent saving self as child of self.
364
+ * Anything else missing?
365
+
366
+
367
+ == Note on Patches/Pull Requests
368
+
369
+ * Fork the project.
370
+ * Make your feature addition or bug fix.
371
+ * Add tests for it. This is important so we don't break it in a future version unintentionally.
372
+ * Commit, do not mess with rakefile, version, or history.
373
+ * (if you want to have your own version, that is fine but bump version in a commit by itself we can ignore when we pull)
374
+ * Send us a pull request. Bonus points for topic branches.
375
+
376
+
377
+ == Copyright
378
+
379
+ Copyright (c) 2011 Timothy Bennett. Released under the MIT License.
380
+
381
+ See LICENSE for details.
382
+
383
+ === Credits
384
+
385
+ Credit also goes to these contributors[http://github.com/datamapper/dm-is-tree/contributors].
386
+
387
+ Current Maintainer: Garrett Heaver (http://www.linkedin.com/pub/dir/garrett/heaver)
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
 
4
4
  begin
5
- gem 'jeweler', '~> 1.4'
5
+ gem 'jeweler', '~> 1.5.2'
6
6
  require 'jeweler'
7
7
 
8
8
  Jeweler::Tasks.new do |gem|
@@ -15,10 +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 'rspec', '~> 1.3'
22
18
  end
23
19
 
24
20
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.1.0.rc1
@@ -1,70 +1,75 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
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-tree}
8
- s.version = "1.0.2"
8
+ s.version = "1.1.0.rc1"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Timothy Bennett"]
12
- s.date = %q{2010-09-07}
12
+ s.date = %q{2011-02-28}
13
13
  s.description = %q{DataMapper plugin allowing the creation of tree structures from data models}
14
14
  s.email = %q{leapord729 [a] comcast.net}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
- ".gitignore",
21
- "Gemfile",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "dm-is-tree.gemspec",
27
- "lib/dm-is-tree.rb",
28
- "lib/dm-is-tree/is/tree.rb",
29
- "spec/integration/tree_spec.rb",
30
- "spec/rcov.opts",
31
- "spec/spec.opts",
32
- "spec/spec_helper.rb",
33
- "spec/unit/tree_spec.rb",
34
- "tasks/ci.rake",
35
- "tasks/local_gemfile.rake",
36
- "tasks/metrics.rake",
37
- "tasks/spec.rake",
38
- "tasks/yard.rake",
39
- "tasks/yardstick.rake"
20
+ "Gemfile",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "dm-is-tree.gemspec",
26
+ "lib/dm-is-tree.rb",
27
+ "lib/dm-is-tree/is/tree.rb",
28
+ "spec/integration/tree_spec.rb",
29
+ "spec/rcov.opts",
30
+ "spec/spec.opts",
31
+ "spec/spec_helper.rb",
32
+ "spec/unit/tree_spec.rb",
33
+ "tasks/spec.rake",
34
+ "tasks/yard.rake",
35
+ "tasks/yardstick.rake"
40
36
  ]
41
- s.has_rdoc = %q{yard}
42
37
  s.homepage = %q{http://github.com/datamapper/dm-is-tree}
43
- s.rdoc_options = ["--charset=UTF-8"]
44
38
  s.require_paths = ["lib"]
45
39
  s.rubyforge_project = %q{datamapper}
46
- s.rubygems_version = %q{1.3.7}
40
+ s.rubygems_version = %q{1.5.2}
47
41
  s.summary = %q{DataMapper plugin allowing the creation of tree structures from data models}
48
42
  s.test_files = [
49
43
  "spec/integration/tree_spec.rb",
50
- "spec/spec_helper.rb",
51
- "spec/unit/tree_spec.rb"
44
+ "spec/spec_helper.rb",
45
+ "spec/unit/tree_spec.rb"
52
46
  ]
53
47
 
54
48
  if s.respond_to? :specification_version then
55
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
49
  s.specification_version = 3
57
50
 
58
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
59
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.2"])
60
- s.add_development_dependency(%q<rspec>, ["~> 1.3"])
52
+ s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.4"])
53
+ s.add_runtime_dependency(%q<i18n>, ["~> 0.5.0"])
54
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
55
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
56
+ s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
57
+ s.add_development_dependency(%q<rspec>, ["~> 1.3.1"])
61
58
  else
62
- s.add_dependency(%q<dm-core>, ["~> 1.0.2"])
63
- s.add_dependency(%q<rspec>, ["~> 1.3"])
59
+ s.add_dependency(%q<activesupport>, ["~> 3.0.4"])
60
+ s.add_dependency(%q<i18n>, ["~> 0.5.0"])
61
+ s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
62
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
63
+ s.add_dependency(%q<rake>, ["~> 0.8.7"])
64
+ s.add_dependency(%q<rspec>, ["~> 1.3.1"])
64
65
  end
65
66
  else
66
- s.add_dependency(%q<dm-core>, ["~> 1.0.2"])
67
- s.add_dependency(%q<rspec>, ["~> 1.3"])
67
+ s.add_dependency(%q<activesupport>, ["~> 3.0.4"])
68
+ s.add_dependency(%q<i18n>, ["~> 0.5.0"])
69
+ s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
70
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
71
+ s.add_dependency(%q<rake>, ["~> 0.8.7"])
72
+ s.add_dependency(%q<rspec>, ["~> 1.3.1"])
68
73
  end
69
74
  end
70
75
 
@@ -17,7 +17,7 @@ module DataMapper
17
17
  # class Category
18
18
  # include DataMapper::Resource
19
19
  #
20
- # property :id, Integer
20
+ # property :id, Serial
21
21
  # property :parent_id, Integer
22
22
  # property :name, String
23
23
  #
@@ -35,7 +35,4 @@ rescue LoadError
35
35
  end
36
36
  end
37
37
 
38
- task :spec => :check_dependencies
39
- task :rcov => :check_dependencies
40
-
41
38
  task :default => :spec
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-is-tree
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
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
  - Timothy Bennett
@@ -14,38 +10,75 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-09-07 00:00:00 -07:00
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: dm-core
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
- segments:
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: rspec
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
- segments:
44
- - 1
45
- - 3
46
- version: "1.3"
47
- type: :development
34
+ version: 0.5.0
35
+ type: :runtime
36
+ prerelease: false
48
37
  version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: dm-core
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 1.1.0.rc1
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: jeweler
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: 1.5.2
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: rake
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 0.8.7
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: rspec
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 1.3.1
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: *id006
49
82
  description: DataMapper plugin allowing the creation of tree structures from data models
50
83
  email: leapord729 [a] comcast.net
51
84
  executables: []
@@ -56,7 +89,6 @@ extra_rdoc_files:
56
89
  - LICENSE
57
90
  - README.rdoc
58
91
  files:
59
- - .gitignore
60
92
  - Gemfile
61
93
  - LICENSE
62
94
  - README.rdoc
@@ -70,19 +102,16 @@ files:
70
102
  - spec/spec.opts
71
103
  - spec/spec_helper.rb
72
104
  - spec/unit/tree_spec.rb
73
- - tasks/ci.rake
74
- - tasks/local_gemfile.rake
75
- - tasks/metrics.rake
76
105
  - tasks/spec.rake
77
106
  - tasks/yard.rake
78
107
  - tasks/yardstick.rake
79
- has_rdoc: yard
108
+ has_rdoc: true
80
109
  homepage: http://github.com/datamapper/dm-is-tree
81
110
  licenses: []
82
111
 
83
112
  post_install_message:
84
- rdoc_options:
85
- - --charset=UTF-8
113
+ rdoc_options: []
114
+
86
115
  require_paths:
87
116
  - lib
88
117
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -90,21 +119,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
119
  requirements:
91
120
  - - ">="
92
121
  - !ruby/object:Gem::Version
93
- segments:
94
- - 0
95
122
  version: "0"
96
123
  required_rubygems_version: !ruby/object:Gem::Requirement
97
124
  none: false
98
125
  requirements:
99
- - - ">="
126
+ - - ">"
100
127
  - !ruby/object:Gem::Version
101
- segments:
102
- - 0
103
- version: "0"
128
+ version: 1.3.1
104
129
  requirements: []
105
130
 
106
131
  rubyforge_project: datamapper
107
- rubygems_version: 1.3.7
132
+ rubygems_version: 1.5.2
108
133
  signing_key:
109
134
  specification_version: 3
110
135
  summary: DataMapper plugin allowing the creation of tree structures from data models
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/
@@ -1 +0,0 @@
1
- task :ci => [ :verify_measurements, 'metrics:all' ]
@@ -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
@@ -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