rubysl-tsort 1.0.0 → 2.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbef2bc585a86be57ed019dab0b8bb3fefbcc9ef
4
- data.tar.gz: 53b88f63caead7e17da6a47ca37aedc51ee30adc
3
+ metadata.gz: 15567ecf63300d8393e8f0ef5fba571654f92a49
4
+ data.tar.gz: 084e6fb807ae8703dc7b8116a500e743a5406677
5
5
  SHA512:
6
- metadata.gz: 86f2e9798814f5dba80e550ea1046625fc7c226547607d7526b16155f81a5b4263fe27b207f147b54e127d8d43db25efd0f89bbc1c61c0fd1066c2c510c33140
7
- data.tar.gz: a6d219f33ada7967cbf66cc63aecd9ce7980345a3ef106ed1d42ec158310a1e0c1c297adbbfb2fee41f54aa405ac6e475438bcd5c8c479a875e861cd7b391af5
6
+ metadata.gz: 833370c8f10c03e3c7b26ca0904697cd1233d7903d9c5435c05137a9df95d7bd4463f93d4fa93c08147d55c7c5caf049133d56a96b02b6f05b4c39b64539d43a
7
+ data.tar.gz: b451e41b372266d1b8660eba5dd759919d9105e2d601aa6cdad87ecad60a2f11d5c129e12534442b048cc2083d534165f655aff586dfddef7803d081e456902c
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  env:
3
3
  - RUBYLIB=lib
4
- script: bundle exec mspec
4
+ script: bundle exec mspec spec
5
5
  rvm:
6
- - 1.8.7
7
- - rbx-nightly-18mode
6
+ - rbx-nightly-19mode
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  #--
3
2
  # tsort.rb - provides a module for topological sorting and strongly connected components.
4
3
  #++
@@ -32,7 +31,7 @@
32
31
  # array using the user-supplied block.
33
32
  #
34
33
  # require 'tsort'
35
- #
34
+ #
36
35
  # class Hash
37
36
  # include TSort
38
37
  # alias tsort_each_node each_key
@@ -40,10 +39,10 @@
40
39
  # fetch(node).each(&block)
41
40
  # end
42
41
  # end
43
- #
42
+ #
44
43
  # {1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
45
44
  # #=> [3, 2, 1, 4]
46
- #
45
+ #
47
46
  # {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_components
48
47
  # #=> [[4], [2, 3], [1]]
49
48
  #
@@ -52,19 +51,19 @@
52
51
  # A very simple `make' like tool can be implemented as follows:
53
52
  #
54
53
  # require 'tsort'
55
- #
54
+ #
56
55
  # class Make
57
56
  # def initialize
58
57
  # @dep = {}
59
58
  # @dep.default = []
60
59
  # end
61
- #
60
+ #
62
61
  # def rule(outputs, inputs=[], &block)
63
62
  # triple = [outputs, inputs, block]
64
63
  # outputs.each {|f| @dep[f] = [triple]}
65
64
  # @dep[triple] = inputs
66
65
  # end
67
- #
66
+ #
68
67
  # def build(target)
69
68
  # each_strongly_connected_component_from(target) {|ns|
70
69
  # if ns.length != 1
@@ -88,18 +87,18 @@
88
87
  # end
89
88
  # }
90
89
  # end
91
- #
90
+ #
92
91
  # def tsort_each_child(node, &block)
93
92
  # @dep[node].each(&block)
94
93
  # end
95
94
  # include TSort
96
95
  # end
97
- #
96
+ #
98
97
  # def command(arg)
99
98
  # print arg, "\n"
100
99
  # system arg
101
100
  # end
102
- #
101
+ #
103
102
  # m = Make.new
104
103
  # m.rule(%w[t1]) { command 'date > t1' }
105
104
  # m.rule(%w[t2]) { command 'date > t2' }
@@ -189,7 +188,7 @@ module TSort
189
188
  end
190
189
 
191
190
  #
192
- # Iterates over strongly connected component in the subgraph reachable from
191
+ # Iterates over strongly connected component in the subgraph reachable from
193
192
  # _node_.
194
193
  #
195
194
  # Return value is unspecified.
@@ -241,50 +240,3 @@ module TSort
241
240
  raise NotImplementedError.new
242
241
  end
243
242
  end
244
-
245
- if __FILE__ == $0
246
- require 'test/unit'
247
-
248
- class TSortHash < Hash # :nodoc:
249
- include TSort
250
- alias tsort_each_node each_key
251
- def tsort_each_child(node, &block)
252
- fetch(node).each(&block)
253
- end
254
- end
255
-
256
- class TSortArray < Array # :nodoc:
257
- include TSort
258
- alias tsort_each_node each_index
259
- def tsort_each_child(node, &block)
260
- fetch(node).each(&block)
261
- end
262
- end
263
-
264
- class TSortTest < Test::Unit::TestCase # :nodoc:
265
- def test_dag
266
- h = TSortHash[{1=>[2, 3], 2=>[3], 3=>[]}]
267
- assert_equal([3, 2, 1], h.tsort)
268
- assert_equal([[3], [2], [1]], h.strongly_connected_components)
269
- end
270
-
271
- def test_cycle
272
- h = TSortHash[{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}]
273
- assert_equal([[4], [2, 3], [1]],
274
- h.strongly_connected_components.map {|nodes| nodes.sort})
275
- assert_raise(TSort::Cyclic) { h.tsort }
276
- end
277
-
278
- def test_array
279
- a = TSortArray[[1], [0], [0], [2]]
280
- assert_equal([[0, 1], [2], [3]],
281
- a.strongly_connected_components.map {|nodes| nodes.sort})
282
-
283
- a = TSortArray[[], [0]]
284
- assert_equal([[0], [1]],
285
- a.strongly_connected_components.map {|nodes| nodes.sort})
286
- end
287
- end
288
-
289
- end
290
-
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module TSort
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
@@ -16,6 +16,9 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ["lib"]
18
18
 
19
+ spec.required_ruby_version = "~> 2.0"
20
+
19
21
  spec.add_development_dependency "bundler", "~> 1.3"
20
22
  spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "mspec", "~> 1.5"
21
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysl-tsort
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-27 00:00:00.000000000 Z
11
+ date: 2013-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
41
55
  description: Ruby standard library tsort.
42
56
  email:
43
57
  - brixen@gmail.com
@@ -66,9 +80,9 @@ require_paths:
66
80
  - lib
67
81
  required_ruby_version: !ruby/object:Gem::Requirement
68
82
  requirements:
69
- - - '>='
83
+ - - ~>
70
84
  - !ruby/object:Gem::Version
71
- version: '0'
85
+ version: '2.0'
72
86
  required_rubygems_version: !ruby/object:Gem::Requirement
73
87
  requirements:
74
88
  - - '>='
@@ -81,3 +95,4 @@ signing_key:
81
95
  specification_version: 4
82
96
  summary: Ruby standard library tsort.
83
97
  test_files: []
98
+ has_rdoc: