hiptest-publisher 0.6.0 → 0.6.1
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.rb +5 -2
- data/lib/hiptest-publisher/cli_options_checker.rb +82 -84
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f219529aaf89fce834dfffb2683f81de8a6c9eff
|
4
|
+
data.tar.gz: 401d0ddd19ec7883ade57f1522a44f2c846f1b12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c79aba51a8f5fdee28125451b77ef75c1376d9211e809a7dc9e079b4e6ed3d36d87cb35aec33c568bd9d1980c429d273184e4f631f7411a39599ae20f2f5a7c
|
7
|
+
data.tar.gz: fbee9b6f63416cf08e764464bdeda95bf6e1ebf5ad245755e6d528339db650215f4cb0e8ddfd28f31d8452d3d191f4abb471a5e1011fd7931a891ccc65ac922e
|
data/lib/hiptest-publisher.rb
CHANGED
@@ -36,9 +36,12 @@ module Hiptest
|
|
36
36
|
|
37
37
|
def run
|
38
38
|
normalize_cli_options!
|
39
|
-
|
39
|
+
begin
|
40
|
+
CliOptionsChecker.new(@cli_options, reporter).check!
|
41
|
+
rescue CliOptionError => e
|
42
|
+
puts e.message
|
40
43
|
exit 1 if @exit_on_bad_arguments
|
41
|
-
|
44
|
+
raise
|
42
45
|
end
|
43
46
|
|
44
47
|
if @cli_options.only == 'list'
|
@@ -1,107 +1,105 @@
|
|
1
|
+
require 'pathname'
|
1
2
|
|
2
|
-
|
3
|
-
|
4
|
-
class CliOptionsChecker
|
5
|
-
attr_reader :reporter, :cli_options
|
6
|
-
def initialize(cli_options, reporter)
|
7
|
-
@cli_options = cli_options
|
8
|
-
@reporter = reporter
|
3
|
+
module Hiptest
|
4
|
+
class CliOptionError < StandardError
|
9
5
|
end
|
10
6
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
puts "Error with --config: the file \"#{cli_options.config}\" does not exist or is not readable"
|
17
|
-
return true
|
7
|
+
class CliOptionsChecker
|
8
|
+
attr_reader :reporter, :cli_options
|
9
|
+
def initialize(cli_options, reporter)
|
10
|
+
@cli_options = cli_options
|
11
|
+
@reporter = reporter
|
18
12
|
end
|
19
13
|
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
def check!
|
15
|
+
# ensure config file was readable if specified
|
16
|
+
begin
|
17
|
+
ParseConfig.new(cli_options.config) if present?(cli_options.config)
|
18
|
+
rescue Errno::EACCES => err
|
19
|
+
raise CliOptionError, "Error with --config: the file \"#{cli_options.config}\" does not exist or is not readable"
|
20
|
+
end
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
if cli_options.only == 'list'
|
23
|
+
return
|
24
|
+
end
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
puts ""
|
32
|
-
puts "The project secret token can be found on Hiptest in the settings section, under"
|
33
|
-
puts "'Publication settings'. It is a sequence of numbers uniquely identifying your"
|
34
|
-
puts "project."
|
35
|
-
puts ""
|
36
|
-
puts "Note that settings section is available only to administrators of the project."
|
37
|
-
return true
|
38
|
-
end
|
26
|
+
unless cli_options.push.nil? || cli_options.push.empty?
|
27
|
+
return
|
28
|
+
end
|
39
29
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
30
|
+
# secret token
|
31
|
+
if missing?(cli_options.token) || empty?(cli_options.token)
|
32
|
+
raise CliOptionError, [
|
33
|
+
"Missing argument --token: you must specify project secret token with --token=<project-token>",
|
34
|
+
"",
|
35
|
+
"The project secret token can be found on Hiptest in the settings section, under",
|
36
|
+
"'Publication settings'. It is a sequence of numbers uniquely identifying your",
|
37
|
+
"project.",
|
38
|
+
"",
|
39
|
+
"Note that settings section is available only to administrators of the project.",
|
40
|
+
].join("\n")
|
41
|
+
end
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
if !parent.writable?
|
48
|
-
if parent.realpath === Pathname.new(cli_options.output_directory).cleanpath
|
49
|
-
puts "Error with --output-directory: the directory \"#{@cli_options.output_directory}\" is not writable"
|
50
|
-
else
|
51
|
-
puts "Error with --output-directory: the directory \"#{@cli_options.output_directory}\" can not be created because \"#{parent.realpath}\" is not writable"
|
43
|
+
unless numeric?(cli_options.token)
|
44
|
+
raise CliOptionError, "Invalid format --token=\"#{@cli_options.token}\": the project secret token must be numeric"
|
52
45
|
end
|
53
|
-
return true
|
54
|
-
elsif !parent.directory?
|
55
|
-
puts "Error with --output-directory: the file \"#{@cli_options.output_directory}\" is not a directory"
|
56
|
-
return true
|
57
|
-
end
|
58
46
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
return true
|
47
|
+
# output directory
|
48
|
+
parent = first_existing_parent(cli_options.output_directory)
|
49
|
+
if !parent.writable?
|
50
|
+
if parent.realpath === Pathname.new(cli_options.output_directory).cleanpath
|
51
|
+
raise CliOptionError, "Error with --output-directory: the directory \"#{@cli_options.output_directory}\" is not writable"
|
52
|
+
else
|
53
|
+
raise CliOptionError, "Error with --output-directory: the directory \"#{@cli_options.output_directory}\" can not be created because \"#{parent.realpath}\" is not writable"
|
54
|
+
end
|
55
|
+
elsif !parent.directory?
|
56
|
+
raise CliOptionError, "Error with --output-directory: the file \"#{@cli_options.output_directory}\" is not a directory"
|
70
57
|
end
|
71
|
-
end
|
72
58
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
59
|
+
# actionwords signature file
|
60
|
+
if cli_options.actionwords_diff || cli_options.aw_deleted || cli_options.aw_created || cli_options.aw_renamed || cli_options.aw_signature_changed
|
61
|
+
actionwords_signature_file = Pathname.new(cli_options.output_directory).join("actionwords_signature.yaml")
|
62
|
+
if actionwords_signature_file.directory?
|
63
|
+
raise CliOptionError, "Bad Action Words signature file: the file \"#{actionwords_signature_file.realpath}\" is a directory"
|
64
|
+
elsif !actionwords_signature_file.exist?
|
65
|
+
full_path = File.expand_path(cli_options.output_directory)
|
66
|
+
raise CliOptionError, [
|
67
|
+
"Missing Action Words signature file: the file \"actionwords_signature.yaml\" could not be found in directory \"#{full_path}\"",
|
68
|
+
"Use --actionwords-signature to generate the file \"#{full_path}/actionwords_signature.yaml\"",
|
69
|
+
].join("\n")
|
70
|
+
end
|
71
|
+
end
|
78
72
|
|
79
|
-
|
80
|
-
|
73
|
+
# test run id
|
74
|
+
if present?(cli_options.test_run_id) && !numeric?(cli_options.test_run_id)
|
75
|
+
raise CliOptionError, "Invalid format --test-run-id=\"#{@cli_options.test_run_id}\": the test run id must be numeric"
|
76
|
+
end
|
77
|
+
end
|
81
78
|
|
82
|
-
|
79
|
+
private
|
83
80
|
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
def numeric?(arg)
|
82
|
+
arg =~ /^\d*$/
|
83
|
+
end
|
87
84
|
|
88
|
-
|
89
|
-
|
90
|
-
|
85
|
+
def missing?(arg)
|
86
|
+
arg.nil?
|
87
|
+
end
|
91
88
|
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
def empty?(arg)
|
90
|
+
arg.strip.empty?
|
91
|
+
end
|
95
92
|
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
def present?(arg)
|
94
|
+
arg && !arg.strip.empty?
|
95
|
+
end
|
99
96
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
97
|
+
def first_existing_parent(path)
|
98
|
+
pathname = Pathname.new(path)
|
99
|
+
while !pathname.exist?
|
100
|
+
pathname = pathname.parent
|
101
|
+
end
|
102
|
+
pathname.realpath
|
104
103
|
end
|
105
|
-
pathname.realpath
|
106
104
|
end
|
107
105
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiptest-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiptest R&D
|
@@ -108,56 +108,56 @@ dependencies:
|
|
108
108
|
name: ruby-handlebars
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - "
|
111
|
+
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: 0.0.2
|
114
114
|
type: :runtime
|
115
115
|
prerelease: false
|
116
116
|
version_requirements: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
|
-
- - "
|
118
|
+
- - "~>"
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: 0.0.2
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
122
|
name: pry
|
123
123
|
requirement: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
|
-
- - "
|
125
|
+
- - "~>"
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
type: :development
|
129
129
|
prerelease: false
|
130
130
|
version_requirements: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
|
-
- - "
|
132
|
+
- - "~>"
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: pry-byebug
|
137
137
|
requirement: !ruby/object:Gem::Requirement
|
138
138
|
requirements:
|
139
|
-
- - "
|
139
|
+
- - "~>"
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: '
|
141
|
+
version: '3'
|
142
142
|
type: :development
|
143
143
|
prerelease: false
|
144
144
|
version_requirements: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
|
-
- - "
|
146
|
+
- - "~>"
|
147
147
|
- !ruby/object:Gem::Version
|
148
|
-
version: '
|
148
|
+
version: '3'
|
149
149
|
- !ruby/object:Gem::Dependency
|
150
150
|
name: pry-stack_explorer
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- - "
|
153
|
+
- - "~>"
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
type: :development
|
157
157
|
prerelease: false
|
158
158
|
version_requirements: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
|
-
- - "
|
160
|
+
- - "~>"
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
163
|
- !ruby/object:Gem::Dependency
|