allure-ruby-adaptor-api 0.6.6 → 0.6.8

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: bbcf9513f1152e74b514668813a1bf1ad406ede7
4
- data.tar.gz: a11b9d5ac900a4ef87f30d5a592786a43faca9e6
3
+ metadata.gz: 856122b233a11526f316f0b75e0a3b2431bbe97e
4
+ data.tar.gz: b0ef05705836497f4a6ebf1454e215291d247bef
5
5
  SHA512:
6
- metadata.gz: aa4fb1425d70fd1b76926c34d561cc499eee150573089bf813771a5406a701d62291bc582d6af4759159fbe1f6dc94a2547ea00068c23708f85e0b2a1b28422f
7
- data.tar.gz: 72636847785b1a7d9dba135d479b01aa93576e0f075af798756963fc887214c5c17fd87d9aea2f87937f6659f3d9dc1ebb4329cec7245d5c5064519502a5a468
6
+ metadata.gz: 781774521eb43d119be95a0dbcd7c4782f7f0ffccac53d94f3961bff45b8e41476f2d9595a71ce08ab58e008e472613121f70db5f1078ba3f06d5b47e093d05b
7
+ data.tar.gz: 6a9b6c790c44ea8a6a5d2aea8fd7951c779b3e4ca9bcc4529b7835f236f166a1241152b743b36bb924ce26cfff69719893d2d55ce9d0642811022b545b98dcf3
@@ -1,16 +1,22 @@
1
1
  require 'allure-ruby-adaptor-api/version'
2
2
  require 'allure-ruby-adaptor-api/builder'
3
+ require 'logger'
3
4
 
4
5
  module AllureRubyAdaptorApi
5
6
  module Config
6
7
  class << self
7
- attr_accessor :output_dir
8
+ attr_accessor :output_dir, :logging_level
8
9
 
9
10
  DEFAULT_OUTPUT_DIR = 'gen/allure-results'
11
+ DEFAULT_LOGGING_LEVEL = Logger::DEBUG
10
12
 
11
13
  def output_dir
12
14
  @output_dir || DEFAULT_OUTPUT_DIR
13
15
  end
16
+
17
+ def logging_level
18
+ @logging_level || DEFAULT_LOGGING_LEVEL
19
+ end
14
20
  end
15
21
  end
16
22
 
@@ -1,4 +1,5 @@
1
1
  require 'digest'
2
+ require 'logger'
2
3
  require 'mimemagic'
3
4
  require 'nokogiri'
4
5
  require 'uuid'
@@ -11,11 +12,12 @@ module AllureRubyAdaptorApi
11
12
  attr_accessor :suites
12
13
  MUTEX = Mutex.new
13
14
  HOSTNAME = Socket.gethostname
15
+ LOGGER = Logger.new(STDOUT)
14
16
 
15
17
  def start_suite(suite, labels = {:severity => :normal})
16
18
  init_suites
17
19
  MUTEX.synchronize do
18
- puts "Starting case_or_suite #{suite} with labels #{labels}"
20
+ LOGGER.debug "Starting case_or_suite #{suite} with labels #{labels}"
19
21
  self.suites[suite] = {
20
22
  :title => suite,
21
23
  :start => timestamp,
@@ -27,7 +29,7 @@ module AllureRubyAdaptorApi
27
29
 
28
30
  def start_test(suite, test, labels = {:severity => :normal})
29
31
  MUTEX.synchronize do
30
- puts "Starting test #{suite}.#{test} with labels #{labels}"
32
+ LOGGER.debug "Starting test #{suite}.#{test} with labels #{labels}"
31
33
  self.suites[suite][:tests][test] = {
32
34
  :title => test,
33
35
  :start => timestamp,
@@ -46,7 +48,7 @@ module AllureRubyAdaptorApi
46
48
  end
47
49
  end
48
50
  MUTEX.synchronize do
49
- puts "Stopping test #{suite}.#{test}"
51
+ LOGGER.debug "Stopping test #{suite}.#{test}"
50
52
  self.suites[suite][:tests][test][:stop] = timestamp(result[:finished_at])
51
53
  self.suites[suite][:tests][test][:start] = timestamp(result[:started_at]) if result[:started_at]
52
54
  self.suites[suite][:tests][test][:status] = result[:status]
@@ -62,7 +64,7 @@ module AllureRubyAdaptorApi
62
64
 
63
65
  def start_step(suite, test, step)
64
66
  MUTEX.synchronize do
65
- puts "Starting step #{suite}.#{test}.#{step}"
67
+ LOGGER.debug "Starting step #{suite}.#{test}.#{step}"
66
68
  self.suites[suite][:tests][test][:steps][step] = {
67
69
  :title => step,
68
70
  :start => timestamp,
@@ -75,14 +77,14 @@ module AllureRubyAdaptorApi
75
77
  raise "File cannot be nil!" if opts[:file].nil?
76
78
  step = opts[:step]
77
79
  file = opts[:file]
78
- title = opts[:title] || file.basename
79
- puts "Adding attachment #{opts[:title]} to #{suite}.#{test}#{step.nil? ? "" : ".#{step}"}"
80
+ title = opts[:title] || File.basename(file)
81
+ LOGGER.debug "Adding attachment #{opts[:title]} to #{suite}.#{test}#{step.nil? ? "" : ".#{step}"}"
80
82
  dir = Pathname.new(Dir.pwd).join(config.output_dir)
81
83
  FileUtils.mkdir_p(dir)
82
84
  file_extname = File.extname(file.path.downcase)
83
85
  mime_type = opts[:mime_type] || MimeMagic.by_path(file.path) || "text/plain"
84
86
  attachment = dir.join("#{Digest::SHA256.file(file.path).hexdigest}-attachment#{(file_extname.empty?) ? '' : file_extname}")
85
- puts "Copying attachment to '#{attachment}'..."
87
+ @LOGGER.debug "Copying attachment to '#{attachment}'..."
86
88
  FileUtils.cp(file.path, attachment)
87
89
  attach = {
88
90
  :type => mime_type,
@@ -101,7 +103,7 @@ module AllureRubyAdaptorApi
101
103
 
102
104
  def stop_step(suite, test, step, status = :passed)
103
105
  MUTEX.synchronize do
104
- puts "Stopping step #{suite}.#{test}.#{step}"
106
+ LOGGER.debug "Stopping step #{suite}.#{test}.#{step}"
105
107
  self.suites[suite][:tests][test][:steps][step][:stop] = timestamp
106
108
  self.suites[suite][:tests][test][:steps][step][:status] = status
107
109
  end
@@ -110,7 +112,7 @@ module AllureRubyAdaptorApi
110
112
  def stop_suite(title)
111
113
  init_suites
112
114
  MUTEX.synchronize do
113
- puts "Stopping case_or_suite #{title}"
115
+ LOGGER.debug "Stopping case_or_suite #{title}"
114
116
  self.suites[title][:stop] = timestamp
115
117
  end
116
118
  end
@@ -157,7 +159,7 @@ module AllureRubyAdaptorApi
157
159
  dir = Pathname.new(config.output_dir)
158
160
  FileUtils.mkdir_p(dir)
159
161
  out_file = dir.join("#{UUID.new.generate}-testsuite.xml")
160
- puts "Writing file '#{out_file}'..."
162
+ LOGGER.debug "Writing file '#{out_file}'..."
161
163
  File.open(out_file, 'w+') do |file|
162
164
  file.write(validate_xml(xml))
163
165
  end
@@ -183,6 +185,7 @@ module AllureRubyAdaptorApi
183
185
  MUTEX.synchronize {
184
186
  self.suites ||= {}
185
187
  }
188
+ LOGGER.level = config.logging_level
186
189
  end
187
190
 
188
191
  def timestamp(time = nil)
@@ -223,4 +226,4 @@ module AllureRubyAdaptorApi
223
226
  end
224
227
  end
225
228
  end
226
- end
229
+ end
@@ -1,6 +1,6 @@
1
1
  module AllureRubyAdaptorApi # :nodoc:
2
2
  module Version # :nodoc:
3
- STRING = '0.6.6'
3
+ STRING = '0.6.8'
4
4
  ALLURE = '1.4.6'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allure-ruby-adaptor-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Sadykov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: uuid
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mimemagic
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: This is a helper library containing the basics for any ruby-based Allure
@@ -88,7 +88,7 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .gitignore
91
+ - ".gitignore"
92
92
  - Gemfile
93
93
  - Gemfile.lock
94
94
  - LICENSE
@@ -110,19 +110,18 @@ require_paths:
110
110
  - lib
111
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - '>='
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - '>='
118
+ - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.0.3
123
+ rubygems_version: 2.4.6
124
124
  signing_key:
125
125
  specification_version: 4
126
- summary: allure-ruby-adaptor-api-0.6.6
126
+ summary: allure-ruby-adaptor-api-0.6.8
127
127
  test_files: []
128
- has_rdoc: