ggoodale-awesome_nested_set 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +68 -0
- data/Rakefile +46 -0
- data/init.rb +1 -0
- data/lib/awesome_nested_set.rb +534 -0
- data/lib/awesome_nested_set/compatability.rb +29 -0
- data/lib/awesome_nested_set/helper.rb +41 -0
- data/lib/awesome_nested_set/named_scope.rb +140 -0
- data/rails/init.rb +13 -0
- data/test/awesome_nested_set/helper_test.rb +41 -0
- data/test/awesome_nested_set_test.rb +594 -0
- data/test/db/database.yml +18 -0
- data/test/db/schema.rb +23 -0
- data/test/fixtures/categories.yml +34 -0
- data/test/fixtures/category.rb +15 -0
- data/test/fixtures/departments.yml +3 -0
- data/test/fixtures/notes.yml +38 -0
- data/test/test_helper.rb +31 -0
- metadata +98 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
sqlite3:
|
2
|
+
adapter: sqlite3
|
3
|
+
dbfile: awesome_nested_set.sqlite3.db
|
4
|
+
sqlite3mem:
|
5
|
+
:adapter: sqlite3
|
6
|
+
:dbfile: ":memory:"
|
7
|
+
postgresql:
|
8
|
+
:adapter: postgresql
|
9
|
+
:username: postgres
|
10
|
+
:password: postgres
|
11
|
+
:database: awesome_nested_set_plugin_test
|
12
|
+
:min_messages: ERROR
|
13
|
+
mysql:
|
14
|
+
:adapter: mysql
|
15
|
+
:host: localhost
|
16
|
+
:username: root
|
17
|
+
:password:
|
18
|
+
:database: awesome_nested_set_plugin_test
|
data/test/db/schema.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
|
3
|
+
create_table :categories, :force => true do |t|
|
4
|
+
t.column :name, :string
|
5
|
+
t.column :parent_id, :integer
|
6
|
+
t.column :lft, :integer
|
7
|
+
t.column :rgt, :integer
|
8
|
+
t.column :organization_id, :integer
|
9
|
+
end
|
10
|
+
|
11
|
+
create_table :departments, :force => true do |t|
|
12
|
+
t.column :name, :string
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table :notes, :force => true do |t|
|
16
|
+
t.column :body, :text
|
17
|
+
t.column :parent_id, :integer
|
18
|
+
t.column :lft, :integer
|
19
|
+
t.column :rgt, :integer
|
20
|
+
t.column :notable_id, :integer
|
21
|
+
t.column :notable_type, :string
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
top_level:
|
2
|
+
id: 1
|
3
|
+
name: Top Level
|
4
|
+
lft: 1
|
5
|
+
rgt: 10
|
6
|
+
child_1:
|
7
|
+
id: 2
|
8
|
+
name: Child 1
|
9
|
+
parent_id: 1
|
10
|
+
lft: 2
|
11
|
+
rgt: 3
|
12
|
+
child_2:
|
13
|
+
id: 3
|
14
|
+
name: Child 2
|
15
|
+
parent_id: 1
|
16
|
+
lft: 4
|
17
|
+
rgt: 7
|
18
|
+
child_2_1:
|
19
|
+
id: 4
|
20
|
+
name: Child 2.1
|
21
|
+
parent_id: 3
|
22
|
+
lft: 5
|
23
|
+
rgt: 6
|
24
|
+
child_3:
|
25
|
+
id: 5
|
26
|
+
name: Child 3
|
27
|
+
parent_id: 1
|
28
|
+
lft: 8
|
29
|
+
rgt: 9
|
30
|
+
top_level_2:
|
31
|
+
id: 6
|
32
|
+
name: Top Level 2
|
33
|
+
lft: 11
|
34
|
+
rgt: 12
|
@@ -0,0 +1,38 @@
|
|
1
|
+
scope1:
|
2
|
+
id: 1
|
3
|
+
body: Top Level
|
4
|
+
lft: 1
|
5
|
+
rgt: 10
|
6
|
+
notable_id: 1
|
7
|
+
notable_type: Category
|
8
|
+
child_1:
|
9
|
+
id: 2
|
10
|
+
body: Child 1
|
11
|
+
parent_id: 1
|
12
|
+
lft: 2
|
13
|
+
rgt: 3
|
14
|
+
notable_id: 1
|
15
|
+
notable_type: Category
|
16
|
+
child_2:
|
17
|
+
id: 3
|
18
|
+
body: Child 2
|
19
|
+
parent_id: 1
|
20
|
+
lft: 4
|
21
|
+
rgt: 7
|
22
|
+
notable_id: 1
|
23
|
+
notable_type: Category
|
24
|
+
child_3:
|
25
|
+
id: 4
|
26
|
+
body: Child 3
|
27
|
+
parent_id: 1
|
28
|
+
lft: 8
|
29
|
+
rgt: 9
|
30
|
+
notable_id: 1
|
31
|
+
notable_type: Category
|
32
|
+
scope2:
|
33
|
+
id: 5
|
34
|
+
body: Top Level 2
|
35
|
+
lft: 11
|
36
|
+
rgt: 12
|
37
|
+
notable_id: 1
|
38
|
+
notable_type: Departments
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
2
|
+
plugin_test_dir = File.dirname(__FILE__)
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'multi_rails_init'
|
7
|
+
# gem 'activerecord', '>= 2.0'
|
8
|
+
require 'active_record'
|
9
|
+
require 'action_controller'
|
10
|
+
require 'action_view'
|
11
|
+
require 'active_record/fixtures'
|
12
|
+
|
13
|
+
require plugin_test_dir + '/../init.rb'
|
14
|
+
|
15
|
+
ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/debug.log")
|
16
|
+
|
17
|
+
ActiveRecord::Base.configurations = YAML::load(IO.read(plugin_test_dir + "/db/database.yml"))
|
18
|
+
ActiveRecord::Base.establish_connection(ENV["DB"] || "sqlite3mem")
|
19
|
+
ActiveRecord::Migration.verbose = false
|
20
|
+
load(File.join(plugin_test_dir, "db", "schema.rb"))
|
21
|
+
|
22
|
+
Dir["#{plugin_test_dir}/fixtures/*.rb"].each {|file| require file }
|
23
|
+
|
24
|
+
|
25
|
+
class Test::Unit::TestCase #:nodoc:
|
26
|
+
self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
27
|
+
self.use_transactional_fixtures = true
|
28
|
+
self.use_instantiated_fixtures = false
|
29
|
+
|
30
|
+
fixtures :categories, :notes, :departments
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ggoodale-awesome_nested_set
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "1.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Collective Idea
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-10-09 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: multi_rails
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.0.4
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: activerecord
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.2.0
|
32
|
+
version:
|
33
|
+
description: An awesome replacement for acts_as_nested_set and better_nested_set.
|
34
|
+
email: info@collectiveidea.com
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- README.rdoc
|
41
|
+
files:
|
42
|
+
- init.rb
|
43
|
+
- MIT-LICENSE
|
44
|
+
- Rakefile
|
45
|
+
- README.rdoc
|
46
|
+
- lib/awesome_nested_set.rb
|
47
|
+
- lib/awesome_nested_set/compatability.rb
|
48
|
+
- lib/awesome_nested_set/helper.rb
|
49
|
+
- lib/awesome_nested_set/named_scope.rb
|
50
|
+
- rails/init.rb
|
51
|
+
- test/awesome_nested_set_test.rb
|
52
|
+
- test/test_helper.rb
|
53
|
+
- test/awesome_nested_set/helper_test.rb
|
54
|
+
- test/db/database.yml
|
55
|
+
- test/db/schema.rb
|
56
|
+
- test/fixtures/categories.yml
|
57
|
+
- test/fixtures/category.rb
|
58
|
+
- test/fixtures/departments.yml
|
59
|
+
- test/fixtures/notes.yml
|
60
|
+
has_rdoc: true
|
61
|
+
homepage: http://collectiveidea.com
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options:
|
64
|
+
- --main
|
65
|
+
- README.rdoc
|
66
|
+
- --inline-source
|
67
|
+
- --line-numbers
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
81
|
+
version:
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 1.2.0
|
86
|
+
signing_key:
|
87
|
+
specification_version: 2
|
88
|
+
summary: An awesome replacement for acts_as_nested_set and better_nested_set.
|
89
|
+
test_files:
|
90
|
+
- test/awesome_nested_set_test.rb
|
91
|
+
- test/test_helper.rb
|
92
|
+
- test/awesome_nested_set/helper_test.rb
|
93
|
+
- test/db/database.yml
|
94
|
+
- test/db/schema.rb
|
95
|
+
- test/fixtures/categories.yml
|
96
|
+
- test/fixtures/category.rb
|
97
|
+
- test/fixtures/departments.yml
|
98
|
+
- test/fixtures/notes.yml
|