tangle 0.10.0 → 0.10.1

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
  SHA256:
3
- metadata.gz: dc791cdb0b95ae60507e9052e96b8c0c44550a1cde4ac88a5ab9be6661102044
4
- data.tar.gz: bf20ee14175b42f5ae9e4675ca50d2c76937e1cc09493e7420a78eaf8885aa79
3
+ metadata.gz: d5878dbe50fd2315ccbdb40dcd43d2e3989c00a1d0305c523d1e6e77eacaf2d1
4
+ data.tar.gz: 5ebbdbaa654e75390364be31c496fa0d2577df1c62a35dff4c8107f39078a61f
5
5
  SHA512:
6
- metadata.gz: 3fba37c004a711c3ed33f6966853724023b5c1dbbe61d596342fa91259a46b490153147f16b12e01f8f9b5cc66156f34197fd91ff357c50e765afb8c8571f564
7
- data.tar.gz: 0c18db46c410650ba81c4e90c891b1bedb19d0eb3e92079d68c709055883ac12b231162cd8235cbdb81fa4b7ab1bc7f4ad3d2281c0944a5c35387b2a8dc609c4
6
+ metadata.gz: d71c5d10cccb476903f7a380fdf06032253ed39f5b6870553f3ed7aaf9c6fb09b1319974262aa52d6eb5ff3a15841c65ebbced0bab38dece58bc6b564830c884
7
+ data.tar.gz: ffae0d09c0a98e225c91c786ea800674d1904e3e4f76056bb0fd515366faf785e9825b7406ddc64f3891d21c7feead28bf6f9caf71d49b2180f567203a79c76c
@@ -8,8 +8,3 @@ Metrics/BlockLength:
8
8
  Style/BlockDelimiters:
9
9
  Exclude:
10
10
  - 'spec/*_spec.rb'
11
-
12
- # Rubocop 0.56 causes false positives
13
- # https://github.com/bbatsov/rubocop/issues/5887
14
- Lint/SplatKeywordArguments:
15
- Enabled: false
@@ -8,8 +8,8 @@ require 'tangle'
8
8
  # with your gem easier. You can also use a different console, if you like.
9
9
 
10
10
  # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require 'pry'
12
- # Pry.start
11
+ require 'pry'
12
+ Pry.start
13
13
 
14
- require 'irb'
15
- IRB.start(__FILE__)
14
+ # require 'irb'
15
+ # IRB.start(__FILE__)
@@ -123,6 +123,7 @@ module Tangle
123
123
  #
124
124
  def edges(vertex = nil)
125
125
  return @edges if vertex.nil?
126
+
126
127
  @vertices.fetch(vertex)
127
128
  end
128
129
  currify :vertex, :edges
@@ -11,6 +11,7 @@ module Tangle
11
11
  vertices.each do |vertex|
12
12
  delete_vertex(vertex) if block_given? && !yield(vertex)
13
13
  next if selected.nil?
14
+
14
15
  delete_vertex(vertex) unless selected.any? { |vtx| vtx.eql?(vertex) }
15
16
  end
16
17
  end
@@ -16,6 +16,7 @@ module Tangle
16
16
  def currified_methods(tag)
17
17
  mine = @currified_methods&.[](tag) || []
18
18
  return mine unless superclass.respond_to?(:currified_methods)
19
+
19
20
  superclass.currified_methods(tag) + mine
20
21
  end
21
22
 
@@ -19,6 +19,7 @@ module Tangle
19
19
  def insert_edge(edge)
20
20
  raise CyclicError if successor?(edge.head, edge.tail) ||
21
21
  predecessor?(edge.tail, edge.head)
22
+
22
23
  super
23
24
  end
24
25
  end
@@ -31,6 +31,7 @@ module Tangle
31
31
  raise GraphError unless graph == other.graph
32
32
  return 0 if vertex == other.vertex
33
33
  return -1 if graph.successor?(vertex, other.vertex)
34
+
34
35
  1
35
36
  end
36
37
  end
@@ -11,7 +11,9 @@ module Tangle
11
11
  # loaders: list of object loader lambdas (mandatory)
12
12
  # ->(graph, **) { ... } => finished?
13
13
  # follow_links: bool for following symlinks to directories
14
- # (default false)
14
+ # exclude_root: bool for excluding the root directory
15
+ #
16
+ # All bool options default to false.
15
17
  #
16
18
  # A loader lambda is called with the graph as only positional
17
19
  # argument, and a number of keyword arguments:
@@ -42,6 +44,7 @@ module Tangle
42
44
  @root_directory = options.fetch(:root)
43
45
  @directory_loaders = options.fetch(:loaders)
44
46
  @follow_directory_links = options[:follow_links]
47
+ @exclude_root = options[:exclude_root]
45
48
  load_directory_graph(@root_directory)
46
49
  end
47
50
 
@@ -57,6 +60,18 @@ module Tangle
57
60
  # +true+ if the object was a directory (or link to one,
58
61
  # and we're following links).
59
62
  def load_directory_object(path, parent = nil)
63
+ if @exclude_root
64
+ return true if path == @root_directory
65
+
66
+ parent = nil if parent == @root_directory
67
+ end
68
+
69
+ try_directory_loaders(path, parent)
70
+ end
71
+
72
+ # Try each directory loader, returning true if the object has
73
+ # children to follow
74
+ def try_directory_loaders(path, parent)
60
75
  stat = lstat = File.lstat(path)
61
76
  stat = File.stat(path) if lstat.symlink?
62
77
 
@@ -66,6 +81,7 @@ module Tangle
66
81
  end
67
82
 
68
83
  return if lstat.symlink? && !@follow_directory_links
84
+
69
85
  stat.directory?
70
86
  end
71
87
  end
@@ -13,6 +13,7 @@ module Tangle
13
13
  def insert_edge(edge)
14
14
  raise LoopError if edge.loop?
15
15
  raise MultiEdgeError if adjacent?(*edge.each_vertex)
16
+
16
17
  super
17
18
  end
18
19
  end
@@ -29,8 +29,9 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency 'bundler', '~> 1.16'
31
31
  spec.add_development_dependency 'fasterer', '~> 0.4'
32
+ spec.add_development_dependency 'pry', '~> 0.11'
32
33
  spec.add_development_dependency 'rake', '~> 10.0'
33
34
  spec.add_development_dependency 'rspec', '~> 3.0'
34
- spec.add_development_dependency 'rubocop', '~> 0.52'
35
+ spec.add_development_dependency 'rubocop', '~> 0.57'
35
36
  spec.add_development_dependency 'simplecov', '~> 0.16'
36
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tangle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Calle Englund
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-03 00:00:00.000000000 Z
11
+ date: 2018-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git-version-bump
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.11'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.11'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '0.52'
103
+ version: '0.57'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '0.52'
110
+ version: '0.57'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: simplecov
99
113
  requirement: !ruby/object:Gem::Requirement