gn_crossmap 2.0.0 → 2.1.0

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: 26928a347c511599c6e9a967195df956db3c1b87
4
- data.tar.gz: 9a5208575690e25eee143712db621da7170c2240
3
+ metadata.gz: 3436378ff8a58c2bcbf8fdb9988ccf89a0718429
4
+ data.tar.gz: efe61399742c47ae81a8131f9418ec3cb7ba51cf
5
5
  SHA512:
6
- metadata.gz: 00253061383725e4825ab528614b20df2fdfa83932ac725d7dc00a05dd4b3130627d130135a4c1ecacf3fe29c8a40e349cce8730ac6dd8a940cab2fdd27dab1f
7
- data.tar.gz: 04a4ab00328ed2bb90e31b306a7c73631cf1b3ae70bb8f23ce94b6792f79b696cd5d1e0870ef2079e58d4ddb7dab8b887801cc72ddd2522ae9458042bad8d252
6
+ metadata.gz: a95c9255fd031065e3383c10111017025f46ed00a801b1fb6d80cf5f0e01b72e8d1f7348b1f74a22b5f221d82d8c2c67debf3cedd6bc4a23887c58f176e33902
7
+ data.tar.gz: ae5cecc6f154eec1bc33033a41653527be10c5ac85d22faf83b0ceedd8b5d3f1bc2282a9ec089886de8eb631c87493f4ba13ad92ee053f75dacaf5905f7d3f63
data/.rubocop.yml CHANGED
@@ -2,6 +2,7 @@ AllCops:
2
2
  Exclude:
3
3
  - db/**/*
4
4
  - bundle_bin/**/*
5
+ - spec/**/*
5
6
  Include:
6
7
  - exe/crossmap
7
8
  Style/StringLiterals:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # ``gn_crossmap`` CHANGELOG
2
2
 
3
+ ## 2.1.0
4
+
5
+ * @dimus - #27 terminate resolution by a trigger
6
+
3
7
  ## 2.0.0
4
8
 
5
9
  * @dimus - #26 change GnCrossmap.run to take opts parameter
data/README.md CHANGED
@@ -130,6 +130,15 @@ GnCrossmap.run(opts) do |stats|
130
130
  end
131
131
  ```
132
132
 
133
+ To trigger termination of the resolution before it is completed
134
+
135
+ ```ruby
136
+ GnCrossmap.run(opts) do
137
+ # do something and then return STOP string from the block
138
+ "STOP"
139
+ end
140
+ ```
141
+
133
142
  #### Intermediate stats format
134
143
 
135
144
  |Field |Description |
@@ -14,19 +14,24 @@ module GnCrossmap
14
14
 
15
15
  def resolve(data)
16
16
  update_stats(data.size)
17
- data.each_slice(@batch) do |slice|
18
- with_log do
19
- names = collect_names(slice)
20
- remote_resolve(names)
21
- yield(@stats.stats) if block_given?
22
- end
23
- end
17
+ block_given? ? process(data, &Proc.new) : process(data)
24
18
  wrap_up
25
19
  yield(@stats.stats) if block_given?
26
20
  end
27
21
 
28
22
  private
29
23
 
24
+ def process(data)
25
+ cmd = nil
26
+ data.each_slice(@batch) do |slice|
27
+ with_log do
28
+ remote_resolve(collect_names(slice))
29
+ cmd = yield(@stats.stats) if block_given?
30
+ end
31
+ break if cmd == "STOP"
32
+ end
33
+ end
34
+
30
35
  def wrap_up
31
36
  @stats.stats[:resolution_stop] = Time.now
32
37
  @stats.stats[:status] = :finish
@@ -1,6 +1,6 @@
1
1
  # Namespace module for crossmapping checklists to GN sources
2
2
  module GnCrossmap
3
- VERSION = "2.0.0".freeze
3
+ VERSION = "2.1.0".freeze
4
4
 
5
5
  def self.version
6
6
  VERSION
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gn_crossmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Mozzherin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2017-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop