cyrun 0.1.3 → 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
  SHA256:
3
- metadata.gz: 919223dc8a8848b5503472cf1ba9f83904b7c8a4fd3e80657f9246386aeeeb53
4
- data.tar.gz: 46c203fc506cea1a56b6ae6898db6d6fe377d71209097c788a9ad50d85db59bc
3
+ metadata.gz: 0e62e6731281630f345c8e1cd166158771fee4ecbd076648922da738eac4242a
4
+ data.tar.gz: 5dcd1a2da03d3370d916474abc34c25ad978790efa03ab06908528987dea34a5
5
5
  SHA512:
6
- metadata.gz: 881d7d0362318f8531ba3119694a9ce6fef346cffd787191bd5b6777b6c93e7c1d5649aa4650e26a6d74374af7b7f9b2baaa09031fe527a2c54a3980ef82010f
7
- data.tar.gz: a8f570dac6747227a38a90f5e2aaea39873af04a60f3a3f19df500c632c1b04ae0e958f09b6b3fd5dd20e00dea39d4411b4c84757ad5e7411704af2eb2e53a8e
6
+ metadata.gz: 7f12fef457aa139ee04dd87b2bf8de75376e1cbb2e2a3ef5ba166212b45879ea288212c88d586740e32c2b3c81c3cee876ee28ddcf13762dcf6bc7c944aeb9a7
7
+ data.tar.gz: b25ad55b81bba08903b632db69b6d8236243e1dfccb2a26571300bde52b6dc989b55093f762d7a036c98b9d9ffac07fb963310650e95b28ef9fb2da524a61648
data/exe/cyrun CHANGED
@@ -68,10 +68,11 @@ runner = Cyrun::Runner.new(
68
68
  base_directory,
69
69
  pattern,
70
70
  screenshots_pattern,
71
+ screenshots_directory,
71
72
  group_size,
72
73
  npm_task_name,
73
74
  max_retries: max_retries,
74
75
  iterations: iterations
75
76
  )
76
77
  runner.run
77
- runner.store_results(results_directory, screenshots_directory)
78
+ runner.store_results(results_directory)
data/lib/cyrun/runner.rb CHANGED
@@ -7,9 +7,9 @@ module Cyrun
7
7
  include Logging
8
8
 
9
9
  attr_reader :collector, :group_builder, :task_runner,
10
- :overall_results, :max_retries, :iterations
10
+ :overall_results, :max_retries, :iterations, :screenshots_directory
11
11
 
12
- def initialize(base_directory, pattern, screenshots_pattern, group_size, npm_task_name, max_retries: nil, iterations: nil)
12
+ def initialize(base_directory, pattern, screenshots_pattern, screenshots_directory, group_size, npm_task_name, max_retries: nil, iterations: nil)
13
13
  @collector = SpecCollector.new(base_directory, npm_task_name, [pattern])
14
14
  @group_builder = GroupBuilder.new(group_size)
15
15
  @task_runner = TaskRunner.new(screenshots_pattern)
@@ -17,6 +17,7 @@ module Cyrun
17
17
  @overall_results = SpecGroupExecutionResult.create_empty
18
18
  @max_retries = max_retries
19
19
  @iterations = iterations
20
+ @screenshots_directory = screenshots_directory
20
21
  end
21
22
 
22
23
  def run
@@ -26,13 +27,12 @@ module Cyrun
26
27
  overall_results
27
28
  end
28
29
 
29
- def store_results(results_directory, screenshots_directory)
30
+ def store_results(results_directory)
30
31
  latest_results = overall_results.latest_results
31
32
  invalid_results = latest_results.select { |result| result.result_filename.nil? }
32
33
  valid_results = latest_results - invalid_results
33
34
 
34
35
  copy_result_files valid_results, results_directory
35
- copy_screenshots overall_results, screenshots_directory
36
36
 
37
37
  invalid_results.empty?
38
38
  end
@@ -55,16 +55,16 @@ module Cyrun
55
55
  success
56
56
  end
57
57
 
58
- def copy_screenshots(results, directory)
58
+ def move_screenshots(results, directory)
59
59
  FileUtils.mkdir_p directory
60
60
 
61
61
  success = true
62
62
 
63
- info "Copying #{results.screenshots.size} screenshots"
63
+ info "Moving #{results.screenshots.size} screenshots to #{directory}"
64
64
  results.screenshots.each do |path|
65
- FileUtils.cp(path, "#{directory}/#{SecureRandom.uuid}-#{File.basename(path)}")
65
+ FileUtils.mv(path, "#{directory}/#{SecureRandom.uuid}-#{File.basename(path)}")
66
66
  rescue StandardError => e
67
- error "Failed to copy screenshot #{path}: #{e.message}"
67
+ error "Failed to move screenshot #{path}: #{e.message}"
68
68
  success = false
69
69
  end
70
70
 
@@ -97,6 +97,7 @@ module Cyrun
97
97
  .each(&method(:handle_single_execution_result))
98
98
 
99
99
  log_results overall_results
100
+ move_screenshots results, screenshots_directory
100
101
  end
101
102
 
102
103
  def handle_single_execution_result(result)
@@ -52,5 +52,9 @@ module Cyrun
52
52
  task_results(task).last
53
53
  end
54
54
  end
55
+
56
+ def clear_screenshot_list!
57
+ @screenshots = []
58
+ end
55
59
  end
56
60
  end
data/lib/cyrun/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cyrun
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/sig/runner.rbs CHANGED
@@ -6,12 +6,13 @@ module Cyrun
6
6
  attr_reader iterations: Integer?
7
7
  attr_reader max_retries: Integer?
8
8
  attr_reader npm_task_name: String
9
+ attr_reader screenshots_directory: String
9
10
  attr_reader overall_results: SpecGroupExecutionResult
10
11
  attr_reader task_runner: TaskRunner
11
12
 
12
- def initialize: (String, String, String, Integer, String, max_retries: Integer?, iterations: Integer?) -> void
13
+ def initialize: (String, String, String, String, Integer, String, max_retries: Integer?, iterations: Integer?) -> void
13
14
 
14
- def store_results: (String, String)-> bool
15
+ def store_results: (String)-> bool
15
16
 
16
17
  def run: -> SpecGroupExecutionResult
17
18
 
@@ -20,7 +21,7 @@ module Cyrun
20
21
  def collect_specs: (String) -> void
21
22
 
22
23
  def copy_result_files: (Array[SingleSpecExecutionResult], String) -> bool
23
- def copy_screenshots: (SpecGroupExecutionResult, String) -> bool
24
+ def move_screenshots: (SpecGroupExecutionResult, String) -> bool
24
25
 
25
26
  def handle_single_execution_result: (SingleSpecExecutionResult) -> void
26
27
  def log_results: (SpecGroupExecutionResult) -> void
@@ -7,6 +7,9 @@ module Cyrun
7
7
  attr_reader single_results: Array[SingleSpecExecutionResult]
8
8
 
9
9
  def initialize: (Array[SingleSpecExecutionResult], Array[String], Integer) -> void
10
+
11
+ def clear_screenshot_list!: -> void
12
+
10
13
  def effectiveness: -> Float
11
14
  def merge!: (SpecGroupExecutionResult)-> void
12
15
  def net_time_in_seconds: -> Integer
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyrun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oskar Kirmis