hiptest-publisher 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hiptest-publisher/cli_options_checker.rb +10 -4
- data/lib/hiptest-publisher/utils.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd7605662ca83f41503ad95b2a506451ac5b501e
|
4
|
+
data.tar.gz: dc4237ee6f5843a22fbb989de9f12f274d90dca0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b66828000929f3d5bf98d776f84d2544fc0db8c79527a90db405e2cd668d35e019f21e0faac6cb1a8a8325efbf93a988d9c5571f487af5437ea1f3d270da030
|
7
|
+
data.tar.gz: 928a8581fb2cda37e2c5f70888b36e3d5ba41a5b8a19e7ad49b4590ee4dec59c50ebbb0d5edff387b7e8ebcd20899e858a8fdb6f77245990ce26f98931306329
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
|
3
|
+
require 'hiptest-publisher/utils'
|
4
|
+
|
3
5
|
module Hiptest
|
4
6
|
class CliOptionError < StandardError
|
5
7
|
end
|
@@ -61,7 +63,7 @@ module Hiptest
|
|
61
63
|
|
62
64
|
def check_push_file
|
63
65
|
if cli_options.push
|
64
|
-
agnostic_path = cli_options.push
|
66
|
+
agnostic_path = clean_path(cli_options.push)
|
65
67
|
globbed_files = Dir.glob(agnostic_path)
|
66
68
|
|
67
69
|
if globbed_files.length == 0
|
@@ -77,7 +79,9 @@ module Hiptest
|
|
77
79
|
end
|
78
80
|
|
79
81
|
def check_output_directory
|
80
|
-
|
82
|
+
output_directory = clean_path(cli_options.output_directory)
|
83
|
+
|
84
|
+
parent = first_existing_parent(output_directory)
|
81
85
|
if !parent.writable?
|
82
86
|
if parent.realpath === Pathname.new(cli_options.output_directory).cleanpath
|
83
87
|
raise CliOptionError, "Error with --output-directory: the directory \"#{@cli_options.output_directory}\" is not writable"
|
@@ -107,9 +111,11 @@ module Hiptest
|
|
107
111
|
|
108
112
|
def check_xml_file
|
109
113
|
if cli_options.xml_file
|
110
|
-
|
114
|
+
xml_path = clean_path(cli_options.xml_file)
|
115
|
+
|
116
|
+
if !File.readable?(xml_path)
|
111
117
|
raise CliOptionError, "Error with --xml-file: the file \"#{cli_options.xml_file}\" does not exist or is not readable"
|
112
|
-
elsif !File.file?(
|
118
|
+
elsif !File.file?(xml_path)
|
113
119
|
raise CliOptionError, "Error with --xml-file: the file \"#{cli_options.xml_file}\" is not a regular file"
|
114
120
|
end
|
115
121
|
end
|
@@ -3,6 +3,8 @@ require 'io/console'
|
|
3
3
|
require 'open-uri'
|
4
4
|
require 'openssl'
|
5
5
|
require 'net/http/post/multipart'
|
6
|
+
require 'pathname'
|
7
|
+
|
6
8
|
|
7
9
|
def hiptest_publisher_path
|
8
10
|
Gem.loaded_specs['hiptest-publisher'].full_gem_path
|
@@ -113,3 +115,7 @@ def push_results(options)
|
|
113
115
|
http.request(req)
|
114
116
|
end
|
115
117
|
end
|
118
|
+
|
119
|
+
def clean_path(path)
|
120
|
+
Pathname.new(path).cleanpath.to_s
|
121
|
+
end
|