hiptest-publisher 0.9.4 → 0.9.5

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: 28a019b7a966bc8e817af252b26d62b85e8cf580
4
- data.tar.gz: e5315516c9b1bfc5811f1aed60916a454c8ea9ff
3
+ metadata.gz: f9e228fe6ad2d7d881b36f26840b36913e85ea67
4
+ data.tar.gz: ad6e0391043d4151aca6baa465c866f1b11cd391
5
5
  SHA512:
6
- metadata.gz: 2152d5efb59c969192fedb859d2103654e7a6ae149e29fdac635c285b7f9b02ce726d3fa1498bf8e96b03926aca2d05cda910da6211c013f478da732960142b7
7
- data.tar.gz: f7a86d49243f8705be44f725143f895c55c93a772e24d95ff5afbab03a8bb579930dfe9512cf0fca3ba5866a550a6b1d1f90503f85dea9f37ec86e994001708c
6
+ metadata.gz: fdc24c2b0d4d1ea01805a449da06baa669baa3255b1ac3264a46e4473d5dccbbf77d2ffdb3b1c89f4dcb44f29fdb7f6fa8ac1ec7672f3418197a7abf7791ee87
7
+ data.tar.gz: 94126113d32073c041da4d95258af402efd57b741850cf2ef9ff7d8d7929c706cb3b2f2b6ee4d1ef233c24e589eae34ec9b7968f41fd6b1086572c98308fb18d
@@ -12,22 +12,34 @@ module Hiptest
12
12
  end
13
13
 
14
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
15
+ check_config_file
21
16
 
22
17
  if cli_options.only == 'list'
23
18
  return
24
19
  end
25
20
 
21
+ check_secret_token
22
+
26
23
  if push?(cli_options)
27
- return
24
+ check_push_file
25
+ else
26
+ check_output_directory
27
+ check_actionwords_signature_file
28
+ check_xml_file
29
+ check_test_run_id
30
+ check_language_and_only
28
31
  end
32
+ end
29
33
 
30
- # secret token
34
+ def check_config_file
35
+ begin
36
+ ParseConfig.new(cli_options.config) if present?(cli_options.config)
37
+ rescue Errno::EACCES => err
38
+ raise CliOptionError, "Error with --config: the file \"#{cli_options.config}\" does not exist or is not readable"
39
+ end
40
+ end
41
+
42
+ def check_secret_token
31
43
  if absent?(cli_options.xml_file)
32
44
  if absent?(cli_options.token)
33
45
  raise CliOptionError, [
@@ -45,8 +57,24 @@ module Hiptest
45
57
  raise CliOptionError, "Invalid format --token=\"#{@cli_options.token}\": the project secret token must be numeric"
46
58
  end
47
59
  end
60
+ end
48
61
 
49
- # output directory
62
+ def check_push_file
63
+ if cli_options.push
64
+ globbed_files = Dir.glob(cli_options.push)
65
+ if globbed_files.length == 0
66
+ raise CliOptionError, "Error with --push: the file \"#{cli_options.push}\" does not exist or is not readable"
67
+ elsif globbed_files.length == 1 && globbed_files == [cli_options.push]
68
+ if !File.readable?(cli_options.push)
69
+ raise CliOptionError, "Error with --push: the file \"#{cli_options.push}\" does not exist or is not readable"
70
+ elsif !File.file?(cli_options.push)
71
+ raise CliOptionError, "Error with --push: the file \"#{cli_options.push}\" is not a regular file"
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ def check_output_directory
50
78
  parent = first_existing_parent(cli_options.output_directory)
51
79
  if !parent.writable?
52
80
  if parent.realpath === Pathname.new(cli_options.output_directory).cleanpath
@@ -57,8 +85,10 @@ module Hiptest
57
85
  elsif !parent.directory?
58
86
  raise CliOptionError, "Error with --output-directory: the file \"#{@cli_options.output_directory}\" is not a directory"
59
87
  end
88
+ end
89
+
60
90
 
61
- # actionwords signature file
91
+ def check_actionwords_signature_file
62
92
  if cli_options.actionwords_diff?
63
93
  actionwords_signature_file = Pathname.new(cli_options.output_directory).join("actionwords_signature.yaml")
64
94
  if actionwords_signature_file.directory?
@@ -71,8 +101,9 @@ module Hiptest
71
101
  ].join("\n")
72
102
  end
73
103
  end
104
+ end
74
105
 
75
- # xml file
106
+ def check_xml_file
76
107
  if cli_options.xml_file
77
108
  if !File.readable?(cli_options.xml_file)
78
109
  raise CliOptionError, "Error with --xml-file: the file \"#{cli_options.xml_file}\" does not exist or is not readable"
@@ -80,13 +111,15 @@ module Hiptest
80
111
  raise CliOptionError, "Error with --xml-file: the file \"#{cli_options.xml_file}\" is not a regular file"
81
112
  end
82
113
  end
114
+ end
83
115
 
84
- # test run id
116
+ def check_test_run_id
85
117
  if present?(cli_options.test_run_id) && !numeric?(cli_options.test_run_id)
86
118
  raise CliOptionError, "Invalid format --test-run-id=\"#{@cli_options.test_run_id}\": the test run id must be numeric"
87
119
  end
120
+ end
88
121
 
89
- # language and --only
122
+ def check_language_and_only
90
123
  if present?(cli_options.language)
91
124
  begin
92
125
  language_config_parser = LanguageConfigParser.new(cli_options)
@@ -75,6 +75,7 @@ def show_status_message(message, status=nil)
75
75
  else
76
76
  return unless $stdout.tty?
77
77
  rows, columns = IO.console.winsize
78
+ return if columns == 0
78
79
  vertical_offset = (4 + message.length) / columns
79
80
  cursor_offset = "\r\e[#{vertical_offset + 1}A"
80
81
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiptest-publisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiptest R&D
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize