nested_set 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ sqlite3:
2
+ adapter: sqlite3
3
+ database: awesome_nested_set.sqlite3.db
4
+ sqlite3mem:
5
+ adapter: sqlite3
6
+ database: ":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
@@ -0,0 +1,30 @@
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
+
24
+ create_table :renamed_columns, :force => true do |t|
25
+ t.column :name, :string
26
+ t.column :mother_id, :integer
27
+ t.column :red, :integer
28
+ t.column :black, :integer
29
+ end
30
+ end
@@ -0,0 +1,45 @@
1
+ # top_level --
2
+ # |\
3
+ # | child_1
4
+ # \
5
+ # | child_2--
6
+ # | \
7
+ # \ child_2_1
8
+ # child_3
9
+ #
10
+ # top_level_2 --
11
+
12
+ top_level:
13
+ id: 1
14
+ name: Top Level
15
+ lft: 1
16
+ rgt: 10
17
+ child_1:
18
+ id: 2
19
+ name: Child 1
20
+ parent_id: 1
21
+ lft: 2
22
+ rgt: 3
23
+ child_2:
24
+ id: 3
25
+ name: Child 2
26
+ parent_id: 1
27
+ lft: 4
28
+ rgt: 7
29
+ child_2_1:
30
+ id: 4
31
+ name: Child 2.1
32
+ parent_id: 3
33
+ lft: 5
34
+ rgt: 6
35
+ child_3:
36
+ id: 5
37
+ name: Child 3
38
+ parent_id: 1
39
+ lft: 8
40
+ rgt: 9
41
+ top_level_2:
42
+ id: 6
43
+ name: Top Level 2
44
+ lft: 11
45
+ rgt: 12
@@ -0,0 +1,15 @@
1
+ class Category < ActiveRecord::Base
2
+ acts_as_nested_set
3
+
4
+ def to_s
5
+ name
6
+ end
7
+
8
+ def recurse &block
9
+ block.call self, lambda{
10
+ self.children.each do |child|
11
+ child.recurse &block
12
+ end
13
+ }
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ top:
2
+ id: 1
3
+ name: Top
@@ -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: 1
36
+ rgt: 2
37
+ notable_id: 1
38
+ notable_type: Departments
@@ -0,0 +1,32 @@
1
+ plugin_test_dir = File.dirname(__FILE__)
2
+
3
+ $:.unshift(plugin_test_dir + '/../lib')
4
+
5
+ require 'rubygems'
6
+ require 'test/unit'
7
+ require 'active_support'
8
+ require 'active_support/test_case'
9
+ require 'active_record'
10
+ require 'action_pack'
11
+ require 'awesome_nested_set'
12
+
13
+ CollectiveIdea::Acts::NestedSet::Railtie.extend_active_record
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
+ class ActiveSupport::TestCase #:nodoc:
25
+ include ActiveRecord::TestFixtures
26
+
27
+ self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
28
+ self.use_transactional_fixtures = true
29
+ self.use_instantiated_fixtures = false
30
+
31
+ fixtures :categories, :notes, :departments
32
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nested_set
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 5
8
+ - 0
9
+ version: 1.5.0
10
+ platform: ruby
11
+ authors:
12
+ - Brandon Keepers
13
+ - Daniel Morrison
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-07 00:00:00 +04:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activerecord
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 3
31
+ - 0
32
+ - 0
33
+ - rc
34
+ version: 3.0.0.rc
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: An awesome nested set implementation for Active Record
38
+ email: info@collectiveidea.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - README.rdoc
45
+ files:
46
+ - .autotest
47
+ - .gitignore
48
+ - MIT-LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - VERSION
52
+ - init.rb
53
+ - lib/nested_set.rb
54
+ - lib/nested_set/base.rb
55
+ - lib/nested_set/depth.rb
56
+ - lib/nested_set/descendants.rb
57
+ - lib/nested_set/helper.rb
58
+ - lib/nested_set/railtie.rb
59
+ - rails/init.rb
60
+ - test/application.rb
61
+ - test/awesome_nested_set/helper_test.rb
62
+ - test/awesome_nested_set_test.rb
63
+ - test/db/database.yml
64
+ - test/db/schema.rb
65
+ - test/fixtures/categories.yml
66
+ - test/fixtures/category.rb
67
+ - test/fixtures/departments.yml
68
+ - test/fixtures/notes.yml
69
+ - test/test_helper.rb
70
+ has_rdoc: true
71
+ homepage: http://github.com/collectiveidea/awesome_nested_set
72
+ licenses: []
73
+
74
+ post_install_message:
75
+ rdoc_options:
76
+ - --charset=UTF-8
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.3.7
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: An awesome nested set implementation for Active Record
102
+ test_files:
103
+ - test/db/schema.rb
104
+ - test/application.rb
105
+ - test/fixtures/category.rb
106
+ - test/awesome_nested_set/helper_test.rb
107
+ - test/awesome_nested_set_test.rb
108
+ - test/test_helper.rb