ancestry 1.0.0
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 +151 -0
- data/Rakefile +22 -0
- data/ancestry.gemspec +18 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/ancestry.rb +1 -0
- data/lib/ancestry/acts_as_tree.rb +302 -0
- data/rails/init.rb +1 -0
- data/test/acts_as_tree_test.rb +385 -0
- data/test/ancestry_plugin.sqlite3.db +0 -0
- data/test/database.yml +18 -0
- data/test/debug.log +67202 -0
- data/test/schema.rb +9 -0
- data/test/test_helper.rb +31 -0
- data/uninstall.rb +1 -0
- metadata +79 -0
data/test/schema.rb
ADDED
data/test/test_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
ENV['RAILS_ENV'] = 'test'
|
2
|
+
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
|
6
|
+
require 'test_help'
|
7
|
+
|
8
|
+
def load_schema
|
9
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
10
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
11
|
+
db_adapter = ENV['DB']
|
12
|
+
# no db passed, try one of these fine config-free DBs before bombing.
|
13
|
+
db_adapter ||= begin
|
14
|
+
require 'rubygems'
|
15
|
+
require 'sqlite'
|
16
|
+
'sqlite'
|
17
|
+
rescue MissingSourceFile
|
18
|
+
begin
|
19
|
+
require 'sqlite3'
|
20
|
+
'sqlite3'
|
21
|
+
rescue MissingSourceFile
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
if db_adapter.nil?
|
26
|
+
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
27
|
+
end
|
28
|
+
ActiveRecord::Base.establish_connection(config[db_adapter])
|
29
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
30
|
+
require File.dirname(__FILE__) + '/../rails/init.rb'
|
31
|
+
end
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ancestry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stefan Kroes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-16 00:00:00 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activerecord
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.1.0
|
24
|
+
version:
|
25
|
+
description: Organise ActiveRecord model into a tree structure
|
26
|
+
email: s.a.kroes@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- ancestry.gemspec
|
35
|
+
- init.rb
|
36
|
+
- install.rb
|
37
|
+
- uninstall.rb
|
38
|
+
- lib/ancestry/acts_as_tree.rb
|
39
|
+
- lib/ancestry.rb
|
40
|
+
- rails/init.rb
|
41
|
+
- test/acts_as_tree_test.rb
|
42
|
+
- test/ancestry_plugin.sqlite3.db
|
43
|
+
- test/database.yml
|
44
|
+
- test/debug.log
|
45
|
+
- test/schema.rb
|
46
|
+
- test/test_helper.rb
|
47
|
+
- Rakefile
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.rdoc
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://github.com/stefankroes/ancestry
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
requirements: []
|
72
|
+
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 1.3.5
|
75
|
+
signing_key:
|
76
|
+
specification_version: 3
|
77
|
+
summary: Ancestry allows the records of a ActiveRecord model to be organised in a tree structure, using a single, intuitively formatted database column. It exposes all the standard tree structure relations (ancestors, parent, root, children, siblings, descendants) and all of them can be fetched in a single sql query. Additional features are named_scopes, integrity checking, integrity restoration, arrangement of (sub)tree into hashes and different strategies for dealing with orphaned records.
|
78
|
+
test_files: []
|
79
|
+
|