depression 0.0.3 → 0.1.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,75 @@
1
+ Easy Resolution of Before/After Relations For Ruby
2
+ ==================================================
3
+
4
+ Depression resolves before/after relations by forming a graph of them and
5
+ flattening it. It supports simple before/after as well as "greedy" relations.
6
+
7
+ Getting Started
8
+ ---------------
9
+
10
+ $ gem install depression
11
+
12
+ After installation the first steps are really easy. You simply need a bunch of
13
+ objects that respond to `#name` as well as `#relations` and return something
14
+ more or less unique and a hash, resp.
15
+
16
+ require "depression"
17
+
18
+ Item = Struct.new(:name, :relations)
19
+ items = [
20
+ Item.new(:foo, {}),
21
+ Item.new(:bar, :before => [:foo]),
22
+ Item.new(:baz, :after => [:foo])
23
+ ]
24
+
25
+ sorted = Depression.process(items)
26
+ puts sorted.map {|i| i.name }.join(",")
27
+ # bar,foo,baz
28
+
29
+ Greedy Relations
30
+ ----------------
31
+
32
+ TODO
33
+
34
+ Resolving Conflicts
35
+ -------------------
36
+
37
+ TODO
38
+
39
+ Resolving Circular Relations
40
+ ----------------------------
41
+
42
+ TODO
43
+
44
+ Dependencies
45
+ ------------
46
+
47
+ * [mocha](https://rubygems.org/gems/mocha) and
48
+ [test-unit](https://rubygems.org/gems/test-unit) for development
49
+
50
+ Runs fine on Ruby 1.9.2 and JRuby 1.5.6.
51
+
52
+ To do & Ideas
53
+ -------------
54
+
55
+ * Gracefully drop greedy relations if they conflict with normal relations
56
+ * Implement a "friendly" mode that simply drops "older" relations until a
57
+ circular relation is resolved
58
+ * Visualize various stages of relation resolution (probably via GraphViz)
59
+ * Maybe switch to TSort
60
+
61
+ Contributing
62
+ ------------
63
+
64
+ 1. Fork at [github.com/lgierth/depression](https://github.com/lgierth/depression)
65
+ 2. Create a new branch
66
+ 3. Commit, commit, commit!
67
+ 4. Open a Pull Request
68
+
69
+ You can also open an issue for discussion first, if you want.
70
+
71
+ License
72
+ -------
73
+
74
+ Depression is subject to an MIT-style license that can be found in the LICENSE
75
+ file.
@@ -10,13 +10,10 @@ Gem::Specification.new do |s|
10
10
  s.authors = ["Lars Gierth"]
11
11
  s.email = ["lars.gierth@gmail.com"]
12
12
  s.homepage = "http://rubygems.org/gems/depression"
13
- s.summary = %q{Easy resolution of before/after relations for Ruby}
14
- s.description = %q{depression resolves before/after relations ny forming a
15
- graph of them and flattening it. Simple before/after
16
- relations are supported as well as "greedy" relations
17
- (before/after all other items) with simple relations being
18
- more important in the case of a conflict. Circular
19
- dependencies are detected and cause an exception.}
13
+ s.summary = %q{Easy Resolution of Before/After Relations For Ruby}
14
+ s.description = %q{Depression resolves before/after relations by forming a
15
+ graph of them and flattening it. It supports simple
16
+ before/after as well as "greedy" relations.}
20
17
 
21
18
  s.add_development_dependency "test-unit"
22
19
  s.add_development_dependency "mocha"
@@ -1,3 +1,3 @@
1
1
  class Depression
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/helper"
1
+ require File.expand_path("../helper", __FILE__)
2
2
 
3
3
  class DepressionTest < Test::Unit::TestCase
4
4
  def setup
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depression
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
7
+ - 1
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ version: 0.1.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Lars Gierth
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-11-23 00:00:00 +01:00
17
+ date: 2011-01-13 00:00:00 +01:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
@@ -40,19 +38,15 @@ dependencies:
40
38
  requirements:
41
39
  - - ">="
42
40
  - !ruby/object:Gem::Version
43
- hash: 3
44
41
  segments:
45
42
  - 0
46
43
  version: "0"
47
44
  type: :development
48
45
  version_requirements: *id002
49
46
  description: |-
50
- depression resolves before/after relations ny forming a
51
- graph of them and flattening it. Simple before/after
52
- relations are supported as well as "greedy" relations
53
- (before/after all other items) with simple relations being
54
- more important in the case of a conflict. Circular
55
- dependencies are detected and cause an exception.
47
+ Depression resolves before/after relations by forming a
48
+ graph of them and flattening it. It supports simple
49
+ before/after as well as "greedy" relations.
56
50
  email:
57
51
  - lars.gierth@gmail.com
58
52
  executables: []
@@ -64,7 +58,7 @@ extra_rdoc_files: []
64
58
  files:
65
59
  - Gemfile
66
60
  - LICENSE
67
- - README.rdoc
61
+ - README.md
68
62
  - Rakefile
69
63
  - depression.gemspec
70
64
  - lib/depression.rb
@@ -85,7 +79,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
79
  requirements:
86
80
  - - ">="
87
81
  - !ruby/object:Gem::Version
88
- hash: 3
89
82
  segments:
90
83
  - 0
91
84
  version: "0"
@@ -94,7 +87,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
87
  requirements:
95
88
  - - ">="
96
89
  - !ruby/object:Gem::Version
97
- hash: 3
98
90
  segments:
99
91
  - 0
100
92
  version: "0"
@@ -104,6 +96,6 @@ rubyforge_project:
104
96
  rubygems_version: 1.3.7
105
97
  signing_key:
106
98
  specification_version: 3
107
- summary: Easy resolution of before/after relations for Ruby
99
+ summary: Easy Resolution of Before/After Relations For Ruby
108
100
  test_files: []
109
101
 
@@ -1,7 +0,0 @@
1
- = Easy resolution of before/after relations for Ruby
2
-
3
- == Todo
4
-
5
- * Drop greedy relations if they conflict with simple relations.
6
- * Implement a "friendly" mode that doesn't raise errors but simply drops
7
- "older" relations until a circular relation is resolved.