edge 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 500f3f8da28efe6bff2bf598de8a5d57e0bf5566
4
- data.tar.gz: 668120882414ee2aba95c072325e51132308e02e
3
+ metadata.gz: aae17b676f3e8c7f0c5228f66a548816cd41bb17
4
+ data.tar.gz: a45d3fb5955a229e42e319fbfa99e2da9342e533
5
5
  SHA512:
6
- metadata.gz: 8f4a7412655a6583140b6982ed8d8f32b9596ee9e8ffcac31219cb39be69b1e9d4de193d5415cb66e3a744128c93e03afa57781724f2770fc5f334761786e6de
7
- data.tar.gz: 830fc852b809b98c80713d54404631ca313fbb0d1b579c6c65a5aacd1c3d1384c7eba0d987e616bd12c0d42aa6404c86e933d7420436dd723ea7d3f5bdff3c11
6
+ metadata.gz: 51317099a665b022b83d0d5bda61d8483a636fb9fe0ff01cd5e5560e87999d283878a71cba51dc3f62cca1c19cf26570932bdf884c3617fa1877e96b0e9c2aa2
7
+ data.tar.gz: f526a15443b51f5cb52d7619f3cbdfd54cdf511cec4a33bf245b7e79c7a4a0bc0bfde6fbe5b00fae89f8d929e5a6ed4282db958b5f1d21291d29787b7872674c
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.1.5
5
+ - 2.0.0
6
+ gemfile:
7
+ - gemfiles/4.0.gemfile
8
+ - gemfiles/4.1.gemfile
9
+ - gemfiles/4.2.gemfile
10
+
11
+ addons:
12
+ postgresql: "9.2"
13
+
14
+ before_script:
15
+ - cp spec/database.yml.travis spec/database.yml
16
+ - bundle exec rake db:setup
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- # Unreleased
1
+ # 0.4.2 (May 21, 2015)
2
+
3
+ * Fixed premature SQL-ization that could result in PG protocol violation errors (Neil E. Pearson)
4
+ * Require Rails 4.0+
5
+ * Document ancestors method (science)
6
+
7
+ # 0.4.1 (January 15, 2015)
2
8
 
3
9
  * Include rake as development dependency
4
10
  * Fix for not passing string to belongs_to class_name (davekaro)
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Edge
2
2
 
3
+ [![Build Status](https://travis-ci.org/jackc/edge.svg?branch=master)](https://travis-ci.org/jackc/edge)
4
+
3
5
  Edge provides graph functionality to ActiveRecord using recursive common table
4
6
  expressions. It has only been tested with PostgreSQL, but it uses Arel for
5
7
  SQL generation so it should work with any database and adapter that support
@@ -50,6 +52,11 @@ must not be used after any other type of scope.
50
52
 
51
53
  Location.where(name: "Illinois").with_descendants.all # [illinois, chicago]
52
54
 
55
+ Also supported is `ancestors` instance method which returns an array of all ancestors ordered by nearest ancestors first.
56
+
57
+ city = Location.where(name: 'Chicago')
58
+ ancestors = city.ancestors # [illinois, usa]
59
+
53
60
  ## Benchmarks
54
61
 
55
62
  Edge includes a performance benchmarks. You can create test forests with a
data/edge.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Edge::VERSION
17
17
 
18
- gem.add_dependency 'activerecord', ">= 3.2.0"
18
+ gem.add_dependency 'activerecord', ">= 4.0.0"
19
19
 
20
20
  gem.add_development_dependency 'pg'
21
21
  gem.add_development_dependency 'pry'
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activerecord", "4.0.0"
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activerecord", "~> 4.1.8"
4
+
5
+ gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activerecord", "~> 4.2.0"
4
+
5
+ gemspec :path=>"../"
data/lib/edge/forest.rb CHANGED
@@ -96,7 +96,7 @@ module Edge
96
96
  # Only where scopes can precede this in a scope chain
97
97
  def with_descendants
98
98
  manager = recursive_manager.project(arel_table[:id])
99
- scope = unscoped.where("#{table_name}.id in (#{manager.to_sql})")
99
+ scope = unscoped.where(arel_table[:id].in manager)
100
100
  scope.bind_values = current_scope.bind_values if current_scope
101
101
  scope
102
102
  end
data/lib/edge/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Edge
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -0,0 +1,5 @@
1
+ test:
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ username: postgres
5
+ database: edge_test
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Christensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-16 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.0
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.0
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pg
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -117,6 +117,7 @@ extra_rdoc_files: []
117
117
  files:
118
118
  - ".gitignore"
119
119
  - ".rspec"
120
+ - ".travis.yml"
120
121
  - CHANGELOG.md
121
122
  - Gemfile
122
123
  - Guardfile
@@ -128,10 +129,14 @@ files:
128
129
  - bench/database_structure.sql
129
130
  - bench/forest_find.rb
130
131
  - edge.gemspec
132
+ - gemfiles/4.0.gemfile
133
+ - gemfiles/4.1.gemfile
134
+ - gemfiles/4.2.gemfile
131
135
  - lib/edge.rb
132
136
  - lib/edge/forest.rb
133
137
  - lib/edge/version.rb
134
138
  - spec/database.yml
139
+ - spec/database.yml.travis
135
140
  - spec/database_structure.sql
136
141
  - spec/forest_spec.rb
137
142
  - spec/spec_helper.rb