acts-as-dag 2.5.0 → 2.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Matthew Leventi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -39,6 +39,10 @@ Version 2.x of Acts As Dag uses validate and scope/where and ActiveModel::Valida
39
39
  == Installation
40
40
 
41
41
  gem install acts-as-dag
42
+
43
+ Add to your Gemfile:
44
+
45
+ gem 'acts-as-dag'
42
46
 
43
47
  == Terminology
44
48
 
data/Rakefile ADDED
@@ -0,0 +1,39 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the acts_as_dag plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the acts_as_dag plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'ActsAsDag'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README.rdoc')
21
+ rdoc.rdoc_files.include('lib/active_record/acts/dag.rb')
22
+ end
23
+
24
+ # setup to build plugin as a gem
25
+ begin
26
+ require 'jeweler'
27
+ Jeweler::Tasks.new do |gemspec|
28
+ gemspec.name = "acts-as-dag"
29
+ gemspec.summary = "Acts As DAG Gem"
30
+ gemspec.description = "Acts As Dag, short for Acts As Directed Acyclic Graph, is a gem which allows you to represent DAG hierarchy using your ActiveRecord models. Versions 1.x were built using Rails 2.x. Versions 2.x were built using Rails 3.x."
31
+ gemspec.authors = ["Matthew Leventi", "Robert Schmitt"]
32
+ gemspec.email = "mleventi@gmail.com"
33
+ gemspec.rubyforge_project = "acts-as-dag"
34
+ gemspec.homepage = "http://github.com/resgraph/acts-as-dag"
35
+ gemspec.files = FileList["[A-Z]*", "{lib,test}/**/*"]
36
+ end
37
+ rescue
38
+ puts "Jeweler or one of its dependencies is not installed."
39
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.5.3
File without changes
data/lib/dag/dag.rb CHANGED
@@ -65,45 +65,45 @@ module Dag
65
65
  belongs_to :ancestor, :polymorphic => true
66
66
  belongs_to :descendant, :polymorphic => true
67
67
 
68
- validates ancestor_type_column_name.to_sym, :presence => true
68
+ validates ancestor_type_column_name.to_sym, :presence => true
69
69
  validates descendant_type_column_name.to_sym, :presence => true
70
- validates ancestor_id_column_name.to_sym, :uniqueness => {:scope => [ancestor_type_column_name, descendant_type_column_name, descendant_id_column_name]}
70
+ validates ancestor_id_column_name.to_sym, :uniqueness => {:scope => [ancestor_type_column_name, descendant_type_column_name, descendant_id_column_name]}
71
71
 
72
- scope :with_ancestor, lambda { |ancestor| where(ancestor_id_column_name => ancestor.id, ancestor_type_column_name => ancestor.class.to_s) }
73
- scope :with_descendant, lambda { |descendant| where(descendant_id_column_name => descendant.id, descendant_type_column_name => descendant.class.to_s) }
72
+ scope :with_ancestor, lambda { |ancestor| where(ancestor_id_column_name => ancestor.id, ancestor_type_column_name => ancestor.class.to_s) }
73
+ scope :with_descendant, lambda { |descendant| where(descendant_id_column_name => descendant.id, descendant_type_column_name => descendant.class.to_s) }
74
74
 
75
- scope :with_ancestor_point, lambda { |point| where(ancestor_id_column_name => point.id, ancestor_type_column_name => point.type) }
76
- scope :with_descendant_point, lambda { |point| where(descendant_id_column_name => point.id, descendant_type_column_name => point.type) }
75
+ scope :with_ancestor_point, lambda { |point| where(ancestor_id_column_name => point.id, ancestor_type_column_name => point.type) }
76
+ scope :with_descendant_point, lambda { |point| where(descendant_id_column_name => point.id, descendant_type_column_name => point.type) }
77
77
 
78
78
  extend Polymorphic
79
79
  include Polymorphic
80
80
  else
81
- belongs_to :ancestor, :foreign_key => ancestor_id_column_name, :class_name => acts_as_dag_options[:node_class_name]
81
+ belongs_to :ancestor, :foreign_key => ancestor_id_column_name, :class_name => acts_as_dag_options[:node_class_name]
82
82
  belongs_to :descendant, :foreign_key => descendant_id_column_name, :class_name => acts_as_dag_options[:node_class_name]
83
83
 
84
84
  validates ancestor_id_column_name.to_sym, :uniqueness => {:scope => [descendant_id_column_name]}
85
85
 
86
- scope :with_ancestor, lambda { |ancestor| where(ancestor_id_column_name => ancestor.id) }
87
- scope :with_descendant, lambda { |descendant| where(descendant_id_column_name => descendant.id) }
86
+ scope :with_ancestor, lambda { |ancestor| where(ancestor_id_column_name => ancestor.id) }
87
+ scope :with_descendant, lambda { |descendant| where(descendant_id_column_name => descendant.id) }
88
88
 
89
- scope :with_ancestor_point, lambda { |point| where(ancestor_id_column_name => point.id) }
90
- scope :with_descendant_point, lambda { |point| where(descendant_id_column_name => point.id) }
89
+ scope :with_ancestor_point, lambda { |point| where(ancestor_id_column_name => point.id) }
90
+ scope :with_descendant_point, lambda { |point| where(descendant_id_column_name => point.id) }
91
91
 
92
92
  extend Standard
93
93
  include Standard
94
94
  end
95
95
 
96
96
  # TODO: rename? breaks when using 'where' query because :direct scope name and :direct => true parameter conflict?
97
- scope :direct, :conditions => {:direct => true}
98
- scope :indirect, :conditions => {:direct => false}
97
+ scope :direct, :conditions => {:direct => true}
98
+ scope :indirect, :conditions => {:direct => false}
99
99
 
100
- scope :ancestor_nodes, :joins => :ancestor
101
- scope :descendant_nodes, :joins => :descendant
100
+ scope :ancestor_nodes, :joins => :ancestor
101
+ scope :descendant_nodes, :joins => :descendant
102
102
 
103
- validates ancestor_id_column_name.to_sym, :presence => true,
104
- :numericality => true
103
+ validates ancestor_id_column_name.to_sym, :presence => true,
104
+ :numericality => true
105
105
  validates descendant_id_column_name.to_sym, :presence => true,
106
- :numericality => true
106
+ :numericality => true
107
107
 
108
108
  extend Edges
109
109
  include Edges
data/test/database.test CHANGED
Binary file
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 5
8
- - 0
9
- version: 2.5.0
8
+ - 3
9
+ version: 2.5.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matthew Leventi
@@ -28,7 +28,11 @@ extensions: []
28
28
  extra_rdoc_files:
29
29
  - README.rdoc
30
30
  files:
31
- - lib/dag.rb
31
+ - MIT-LICENSE
32
+ - README.rdoc
33
+ - Rakefile
34
+ - VERSION
35
+ - lib/acts-as-dag.rb
32
36
  - lib/dag/columns.rb
33
37
  - lib/dag/dag.rb
34
38
  - lib/dag/edges.rb
@@ -38,7 +42,6 @@ files:
38
42
  - lib/dag/validators.rb
39
43
  - test/dag_test.rb
40
44
  - test/database.test
41
- - README.rdoc
42
45
  has_rdoc: true
43
46
  homepage: http://github.com/resgraph/acts-as-dag
44
47
  licenses: []