checklinks 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77b94b65c8046e3e8c4aadb5a21d1ea0e511011462497aaa304cb44519af05c8
4
- data.tar.gz: 6b46cf2b5108b9ddc2028b58bf6253b95b3696bef60a75748aa997e30ad27b3b
3
+ metadata.gz: 737c0145972fe61cb1b570fbb8fe7cc6ecef0965f199ed56049e49399a9c9a0d
4
+ data.tar.gz: 4fc58d20f3aa261a82bd2d8f4eab7d503efa552aa8e87abd6a6d7c6510a264c4
5
5
  SHA512:
6
- metadata.gz: be687604bef24ea7ece0d9322d68589de3e8b3ec84055138b2369c4eea9c3b6128b619bfd47fb6d75b04b584ca3a9109eb1b242733207d0bd2f5fd0fefae7aae
7
- data.tar.gz: 9a383deb39970cd0eea213e12fe1de467ec9d6c9c9ce8e47db27bc85d5a0a07c0ec41f68d927b5123c09edeabc94689f4b671618aaff111bfa019015a5b802ee
6
+ metadata.gz: 42d03d2a8fde7431a92ce2466622cd0f9b545e138c05f3f066a474612c8444824f764b63af5c2f3d8177058ed1a922f8b5f645a13c24b6e66dd7d4365bd3f9ee
7
+ data.tar.gz: 20c0796f5603e531e898655d0e2c6d6f9192e13dd8b7976f55e710337e4cb10b68df8ffe2870803c2ef2026d687a15a2a10d18ad9c6509df099c5986604037f1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- checklinks (0.1.0)
4
+ checklinks (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -29,7 +29,7 @@ end
29
29
 
30
30
  # Create worklists - ahead of processing anything as they refer to each other cylically
31
31
 
32
- file_worklist = Checklinks::Worklist.new(*files)
32
+ file_worklist = Checklinks::Worklist.new(*files.shuffle)
33
33
  url_worklist = Checklinks::Worklist.new
34
34
  link_collector = Checklinks::Worklist.collector
35
35
  status_worklist = Checklinks::Worklist.new
@@ -48,6 +48,7 @@ file_worklist.process(Set.new) do |filename, found_urls|
48
48
  url_worklist.push url
49
49
  link_collector.push [url, filename, line_number]
50
50
  end
51
+ urls.shuffle!
51
52
  line_number += 1
52
53
  end
53
54
  end
@@ -97,7 +98,7 @@ end
97
98
  # Process status updates to print progress on the screen
98
99
 
99
100
  status_worklist.process({ok: 0, error: 0, ignored: 0, clear: 0}) do |message, state|
100
- print "\r#{' '*state[:clear]}\r"
101
+ print "\r#{' '*state[:clear]}\r" if $stdout.tty?
101
102
  case message.first
102
103
  when :try
103
104
  puts message.last
@@ -110,7 +111,7 @@ status_worklist.process({ok: 0, error: 0, ignored: 0, clear: 0}) do |message, st
110
111
  error_collector.push
111
112
  end
112
113
  line = "[#{state[:ok].to_s.rjust(5)} ok, #{state[:ignored].to_s.rjust(5)} ignored, #{state[:error].to_s.rjust(5)} errors, #{file_worklist.size.to_s.rjust(5)} files left, #{url_worklist.size.to_s.rjust(5)} URLs left]"
113
- print line
114
+ print line if $stdout.tty?
114
115
  state[:clear] = line.length
115
116
  end
116
117
 
@@ -123,7 +124,11 @@ errors = error_collector.close
123
124
 
124
125
  # Print a report
125
126
 
126
- puts "\r#{' '*status_state[:clear]}\r"
127
+ if $stdout.tty?
128
+ puts "\r#{' '*status_state[:clear]}\r"
129
+ else
130
+ puts
131
+ end
127
132
 
128
133
  if errors.empty?
129
134
  puts 'Ok!'
@@ -1,6 +1,6 @@
1
1
  module Checklinks
2
2
  MAJOR_VERSION = 0
3
- MINOR_VERSION = 1
3
+ MINOR_VERSION = 2
4
4
  PATCH_VERSION = 0
5
5
  VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}.#{PATCH_VERSION}"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checklinks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Seaton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-13 00:00:00.000000000 Z
11
+ date: 2020-09-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: