kleos_test 0.1.2 → 0.1.4

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: 488ad2f44fc04d95bc0bafa9297a158b9d90b643
4
- data.tar.gz: 466b1f9c3d4bb873140831254c8303d4a56a5419
3
+ metadata.gz: 36b6e9d61845e4a2c7da6b0240566d47f3f3bf6f
4
+ data.tar.gz: 67d4868e21441e1a2ccc05eb78dd53c7e85ab6ee
5
5
  SHA512:
6
- metadata.gz: f24d0dadd1e07ab2c1521b5a7f74d48dd96f675fbb8166218f7a504c2e52fc1b0450716afc8abb83b24ff4de65a7f696f1840fe1e774a34f2a1107dbf68ccdf5
7
- data.tar.gz: ae4e32cb801fd2c387f4a8a8a1b7c29929a29842b59016dbaf7eab506f0f03b9b85f0d5d2c2068041c4c8efd43e41edae2c2b46b3e5082bdc70f33db7af07260
6
+ metadata.gz: 4f9258dcccc851167174323ac37635543cd84b51e2c85f455be465fa2a2c02d5a6e3b9bbde206ca2bac7a820b606010e9113a154ae03a28176c7f3dc1da8dede
7
+ data.tar.gz: 303c7e7e92f3a6f7367c8dfab1ab90e9aad9beb8578350e242f91cba46062fcae85f189a43c5c8150814fdf8181da53ea4b694a5b17b0eca9ad5afad580b3aaa
data/bin/kleos_test CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- require 'pry'
4
2
  $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + '/../lib')
5
3
  require 'kleos_test'
4
+ require 'pry'
5
+
6
+ KleosTest.base_address = ARGV[0] if ARGV[0]
6
7
 
7
8
  puts "*** Check for inside links ***\n\n"
8
9
  begin
@@ -30,25 +31,25 @@ Broken links:
30
31
  EOF
31
32
 
32
33
  if broken_inside.empty? and broken_outside.empty?
33
- result << "none.\n"
34
+ result << "- none.\n"
34
35
  elsif broken_inside.empty?
35
36
  result << "- inside: none\n"
36
- result << "- outside: \n" + broken_outside.join("\n")
37
+ result << "- outside: \n#{URI::decode(broken_outside.join("\n"))}\n"
37
38
  elsif broken_outside.empty?
38
- result << "- inside: \n" + broken_inside.join("\n")
39
+ result << "- inside: \n#{URI::decode(broken_inside.join("\n"))}\n"
39
40
  result << "- outside: none\n"
40
41
  else
41
- result << "\n- inside: \n" + broken_inside.join("\n")
42
- result << "\n- outside: \n" + broken_outside.join("\n")
42
+ result << "- inside: \n#{broken_inside.join("\n")}\n"
43
+ result << "- outside: \n#{broken_outside.join("\n")}\n"
43
44
  end
44
45
 
46
+ filename = "#{ENV['HOME']}/#{KleosTest.base_address}.report"
45
47
  begin
46
- filename = "#{ENV['HOME']}/kleos_test.report"
47
48
  File.open(filename, 'w') { |f| f.write(result) }
48
49
  puts "*** Result ***"
49
50
  puts "Result is saved at #{filename}"
50
51
  rescue
51
52
  puts "*** WARNING ***"
52
- puts "Impossible create a file."
53
+ puts "Impossible dump the report to #{filename}."
53
54
  puts result
54
55
  end
@@ -1,6 +1,4 @@
1
1
  class KleosTest::LinksCollector
2
- BASE_ADDRESS = 'https://www.kleos.ru'
3
-
4
2
  @@unverified_inside_links = ['/']
5
3
  @@unverified_outside_links = []
6
4
  @@verified_links = []
@@ -41,10 +39,10 @@ class KleosTest::LinksCollector
41
39
  end
42
40
 
43
41
  def download_inside_webpage
44
- address = @target.include?('http') ? @target : BASE_ADDRESS + @target
42
+ address = @target.include?('http') ? @target : KleosTest.base_address + @target
45
43
  @@inside_downloads += 1
46
44
  print "Downloading (#{@@inside_downloads}|#{@@unverified_inside_links.size})\
47
- #{address}..."
45
+ #{URI::decode(address)}..."
48
46
  response = RestClient.get(address)
49
47
  puts "OK"
50
48
  [response.body, response.code]
@@ -62,7 +60,7 @@ class KleosTest::LinksCollector
62
60
 
63
61
  def download_outside_webpage(address, counter)
64
62
  print "Downloading (#{counter}|#{@@unverified_outside_links.size - counter})\
65
- #{address}..."
63
+ #{URI::decode(address)}..."
66
64
  response = RestClient.get(address)
67
65
  puts "OK"
68
66
  response.code
@@ -1,3 +1,3 @@
1
1
  module KleosTest
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/kleos_test.rb CHANGED
@@ -4,4 +4,15 @@ require 'kleos_test/version'
4
4
  require 'kleos_test/links_collector'
5
5
 
6
6
  module KleosTest
7
+ module_function
8
+
9
+ @base_address = 'https://www.kleos.ru'
10
+
11
+ def base_address
12
+ @base_address
13
+ end
14
+
15
+ def base_address=(address)
16
+ @base_address = address
17
+ end
7
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kleos_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akkuzin Maxim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-13 00:00:00.000000000 Z
11
+ date: 2017-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler