hierarchy 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -9
- data/Gemfile.lock +32 -32
- data/README.textile +1 -1
- data/Rakefile +12 -9
- data/VERSION +1 -1
- data/hierarchy.gemspec +40 -27
- data/lib/hierarchy.rb +1 -0
- metadata +8 -23
data/Gemfile
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
source :rubygems
|
2
2
|
|
3
|
-
# DEPENDENCIES
|
4
3
|
gem 'rails', '>= 3.0.2'
|
5
4
|
|
6
|
-
|
7
|
-
gem 'jeweler'
|
8
|
-
gem 'yard'
|
9
|
-
gem 'RedCloth', require: 'redcloth'
|
10
|
-
gem 'pg'
|
11
|
-
|
12
|
-
|
13
|
-
gem 'rspec'
|
5
|
+
group :development do
|
6
|
+
gem 'jeweler'
|
7
|
+
gem 'yard'
|
8
|
+
gem 'RedCloth', require: 'redcloth'
|
9
|
+
gem 'pg'
|
10
|
+
gem 'rspec'
|
11
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -3,33 +3,33 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
RedCloth (4.2.3)
|
5
5
|
abstract (1.0.0)
|
6
|
-
actionmailer (3.0.
|
7
|
-
actionpack (= 3.0.
|
6
|
+
actionmailer (3.0.3)
|
7
|
+
actionpack (= 3.0.3)
|
8
8
|
mail (~> 2.2.9)
|
9
|
-
actionpack (3.0.
|
10
|
-
activemodel (= 3.0.
|
11
|
-
activesupport (= 3.0.
|
9
|
+
actionpack (3.0.3)
|
10
|
+
activemodel (= 3.0.3)
|
11
|
+
activesupport (= 3.0.3)
|
12
12
|
builder (~> 2.1.2)
|
13
13
|
erubis (~> 2.6.6)
|
14
|
-
i18n (~> 0.4
|
14
|
+
i18n (~> 0.4)
|
15
15
|
rack (~> 1.2.1)
|
16
16
|
rack-mount (~> 0.6.13)
|
17
17
|
rack-test (~> 0.5.6)
|
18
18
|
tzinfo (~> 0.3.23)
|
19
|
-
activemodel (3.0.
|
20
|
-
activesupport (= 3.0.
|
19
|
+
activemodel (3.0.3)
|
20
|
+
activesupport (= 3.0.3)
|
21
21
|
builder (~> 2.1.2)
|
22
|
-
i18n (~> 0.4
|
23
|
-
activerecord (3.0.
|
24
|
-
activemodel (= 3.0.
|
25
|
-
activesupport (= 3.0.
|
22
|
+
i18n (~> 0.4)
|
23
|
+
activerecord (3.0.3)
|
24
|
+
activemodel (= 3.0.3)
|
25
|
+
activesupport (= 3.0.3)
|
26
26
|
arel (~> 2.0.2)
|
27
27
|
tzinfo (~> 0.3.23)
|
28
|
-
activeresource (3.0.
|
29
|
-
activemodel (= 3.0.
|
30
|
-
activesupport (= 3.0.
|
31
|
-
activesupport (3.0.
|
32
|
-
arel (2.0.
|
28
|
+
activeresource (3.0.3)
|
29
|
+
activemodel (= 3.0.3)
|
30
|
+
activesupport (= 3.0.3)
|
31
|
+
activesupport (3.0.3)
|
32
|
+
arel (2.0.4)
|
33
33
|
builder (2.1.2)
|
34
34
|
diff-lcs (1.1.2)
|
35
35
|
erubis (2.6.6)
|
@@ -40,9 +40,9 @@ GEM
|
|
40
40
|
bundler (~> 1.0.0)
|
41
41
|
git (>= 1.2.5)
|
42
42
|
rake
|
43
|
-
mail (2.2.
|
43
|
+
mail (2.2.10)
|
44
44
|
activesupport (>= 2.3.6)
|
45
|
-
i18n (
|
45
|
+
i18n (~> 0.4.1)
|
46
46
|
mime-types (~> 1.16)
|
47
47
|
treetop (~> 1.4.8)
|
48
48
|
mime-types (1.16)
|
@@ -53,17 +53,17 @@ GEM
|
|
53
53
|
rack (>= 1.0.0)
|
54
54
|
rack-test (0.5.6)
|
55
55
|
rack (>= 1.0)
|
56
|
-
rails (3.0.
|
57
|
-
actionmailer (= 3.0.
|
58
|
-
actionpack (= 3.0.
|
59
|
-
activerecord (= 3.0.
|
60
|
-
activeresource (= 3.0.
|
61
|
-
activesupport (= 3.0.
|
62
|
-
bundler (~> 1.0
|
63
|
-
railties (= 3.0.
|
64
|
-
railties (3.0.
|
65
|
-
actionpack (= 3.0.
|
66
|
-
activesupport (= 3.0.
|
56
|
+
rails (3.0.3)
|
57
|
+
actionmailer (= 3.0.3)
|
58
|
+
actionpack (= 3.0.3)
|
59
|
+
activerecord (= 3.0.3)
|
60
|
+
activeresource (= 3.0.3)
|
61
|
+
activesupport (= 3.0.3)
|
62
|
+
bundler (~> 1.0)
|
63
|
+
railties (= 3.0.3)
|
64
|
+
railties (3.0.3)
|
65
|
+
actionpack (= 3.0.3)
|
66
|
+
activesupport (= 3.0.3)
|
67
67
|
rake (>= 0.8.7)
|
68
68
|
thor (~> 0.14.4)
|
69
69
|
rake (0.8.7)
|
@@ -75,11 +75,11 @@ GEM
|
|
75
75
|
rspec-expectations (2.1.0)
|
76
76
|
diff-lcs (~> 1.1.2)
|
77
77
|
rspec-mocks (2.1.0)
|
78
|
-
thor (0.14.
|
78
|
+
thor (0.14.6)
|
79
79
|
treetop (1.4.9)
|
80
80
|
polyglot (>= 0.3.1)
|
81
81
|
tzinfo (0.3.23)
|
82
|
-
yard (0.6.
|
82
|
+
yard (0.6.3)
|
83
83
|
|
84
84
|
PLATFORMS
|
85
85
|
ruby
|
data/README.textile
CHANGED
data/Rakefile
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
2
3
|
begin
|
3
|
-
|
4
|
-
rescue
|
5
|
-
puts
|
6
|
-
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
7
9
|
end
|
10
|
+
require 'rake'
|
8
11
|
|
9
|
-
|
10
|
-
|
12
|
+
require 'jeweler'
|
11
13
|
Jeweler::Tasks.new do |gem|
|
12
14
|
gem.name = "hierarchy"
|
13
15
|
gem.summary = %Q{Use PostgreSQL LTREE type with ActiveRecord}
|
@@ -16,16 +18,17 @@ Jeweler::Tasks.new do |gem|
|
|
16
18
|
gem.homepage = "http://github.com/riscfuture/hierarchy"
|
17
19
|
gem.authors = [ "Tim Morgan" ]
|
18
20
|
gem.required_ruby_version = '>= 1.9'
|
19
|
-
gem.add_dependency 'rails', '>= 3.0.2'
|
20
21
|
end
|
21
|
-
Jeweler::
|
22
|
+
Jeweler::RubygemsDotOrgTasks.new
|
22
23
|
|
23
24
|
require 'rspec/core/rake_task'
|
24
25
|
RSpec::Core::RakeTask.new
|
25
26
|
|
27
|
+
require 'yard'
|
26
28
|
YARD::Rake::YardocTask.new('doc') do |doc|
|
27
29
|
doc.options << "-m" << "textile"
|
28
30
|
doc.options << "--protected"
|
31
|
+
doc.options << "--no-private"
|
29
32
|
doc.options << "-r" << "README.textile"
|
30
33
|
doc.options << "-o" << "doc"
|
31
34
|
doc.options << "--title" << "Hierarchy Documentation".inspect
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/hierarchy.gemspec
CHANGED
@@ -1,51 +1,49 @@
|
|
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{hierarchy}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tim Morgan"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-27}
|
13
13
|
s.description = %q{Adds ActiveRecord support for hierarchial data structures using PostgreSQL's LTREE column type.}
|
14
14
|
s.email = %q{git@timothymorgan.info}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.textile"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
"templates/add_ltree_type.rb"
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE",
|
25
|
+
"README.textile",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"hierarchy.gemspec",
|
29
|
+
"lib/hierarchy.rb",
|
30
|
+
"lib/hierarchy/index_path.rb",
|
31
|
+
"lib/hierarchy/node.rb",
|
32
|
+
"lib/hierarchy_generator.rb",
|
33
|
+
"spec/hierarchy_spec.rb",
|
34
|
+
"spec/index_path_spec.rb",
|
35
|
+
"spec/spec_helper.rb",
|
36
|
+
"templates/add_ltree_type.rb"
|
38
37
|
]
|
39
38
|
s.homepage = %q{http://github.com/riscfuture/hierarchy}
|
40
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
41
39
|
s.require_paths = ["lib"]
|
42
40
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9")
|
43
41
|
s.rubygems_version = %q{1.3.7}
|
44
42
|
s.summary = %q{Use PostgreSQL LTREE type with ActiveRecord}
|
45
43
|
s.test_files = [
|
46
44
|
"spec/hierarchy_spec.rb",
|
47
|
-
|
48
|
-
|
45
|
+
"spec/index_path_spec.rb",
|
46
|
+
"spec/spec_helper.rb"
|
49
47
|
]
|
50
48
|
|
51
49
|
if s.respond_to? :specification_version then
|
@@ -53,12 +51,27 @@ Gem::Specification.new do |s|
|
|
53
51
|
s.specification_version = 3
|
54
52
|
|
55
53
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<rails>, [">= 3.0"])
|
54
|
+
s.add_runtime_dependency(%q<rails>, [">= 3.0.2"])
|
55
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<RedCloth>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<pg>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
57
60
|
else
|
58
|
-
s.add_dependency(%q<rails>, [">= 3.0"])
|
61
|
+
s.add_dependency(%q<rails>, [">= 3.0.2"])
|
62
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
63
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
64
|
+
s.add_dependency(%q<RedCloth>, [">= 0"])
|
65
|
+
s.add_dependency(%q<pg>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
59
67
|
end
|
60
68
|
else
|
61
|
-
s.add_dependency(%q<rails>, [">= 3.0"])
|
69
|
+
s.add_dependency(%q<rails>, [">= 3.0.2"])
|
70
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
71
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
72
|
+
s.add_dependency(%q<RedCloth>, [">= 0"])
|
73
|
+
s.add_dependency(%q<pg>, [">= 0"])
|
74
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
62
75
|
end
|
63
76
|
end
|
64
77
|
|
data/lib/hierarchy.rb
CHANGED
@@ -54,6 +54,7 @@ module Hierarchy
|
|
54
54
|
base.scope :descendants_of, ->(obj) { base.where([ "path <@ ?", obj.my_path ]) }
|
55
55
|
base.scope :siblings_of, ->(obj) { base.where(path: obj.path) }
|
56
56
|
base.scope :priority_order, base.order("NLEVEL(path) ASC")
|
57
|
+
base.scope :top_level, base.where([ "path IS NULL or path = ?", '' ])
|
57
58
|
|
58
59
|
base.before_save { |obj| obj.path ||= '' }
|
59
60
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 5
|
9
|
+
version: 1.0.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tim Morgan
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-27 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
segments:
|
43
43
|
- 0
|
44
44
|
version: "0"
|
45
|
-
type: :
|
45
|
+
type: :development
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
segments:
|
56
56
|
- 0
|
57
57
|
version: "0"
|
58
|
-
type: :
|
58
|
+
type: :development
|
59
59
|
prerelease: false
|
60
60
|
version_requirements: *id003
|
61
61
|
- !ruby/object:Gem::Dependency
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
segments:
|
69
69
|
- 0
|
70
70
|
version: "0"
|
71
|
-
type: :
|
71
|
+
type: :development
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: *id004
|
74
74
|
- !ruby/object:Gem::Dependency
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
segments:
|
82
82
|
- 0
|
83
83
|
version: "0"
|
84
|
-
type: :
|
84
|
+
type: :development
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: *id005
|
87
87
|
- !ruby/object:Gem::Dependency
|
@@ -94,24 +94,9 @@ dependencies:
|
|
94
94
|
segments:
|
95
95
|
- 0
|
96
96
|
version: "0"
|
97
|
-
type: :
|
97
|
+
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: *id006
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: rails
|
102
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
|
-
requirements:
|
105
|
-
- - ">="
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
segments:
|
108
|
-
- 3
|
109
|
-
- 0
|
110
|
-
- 2
|
111
|
-
version: 3.0.2
|
112
|
-
type: :runtime
|
113
|
-
prerelease: false
|
114
|
-
version_requirements: *id007
|
115
100
|
description: Adds ActiveRecord support for hierarchial data structures using PostgreSQL's LTREE column type.
|
116
101
|
email: git@timothymorgan.info
|
117
102
|
executables: []
|