simmer 2.1.0 → 3.0.0

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: bf6398ec1c55e3f63c9da6796be45202c7ce4d17e22daae45ab987b3bc5b662e
4
- data.tar.gz: 9ef3abdb1dd37a96b31bb13029bec1edf3f6a2b0ee352c016266377a015de29d
3
+ metadata.gz: 4c2be2ad790619cfd4a18f34df9c05b9a575a67b80a8d8be4a4e2a0fae4f1271
4
+ data.tar.gz: 5467d82cf7c7be7c1aab033b45302d6b97d74b56447194ddd3b8ac4760a7ff11
5
5
  SHA512:
6
- metadata.gz: bd518ae0abcc6f9831141f2a9fd21794408e05076ae3527776b621b27acabdbd1870f539db436ca80c15a218e91324fae4e836b7f3875e9c08876ef0d7f0c8f6
7
- data.tar.gz: 4805d47aaff9664e9f1dfdb1ae559b983dc7b88f7e418ebc1ac16a44bd47921d3c01f830915b68281c39475608f6124986572132f151284305b3b5095ceb7e3e
6
+ metadata.gz: 28076b241e673455e18ffc482829425f81754ffde566e58fd9b011cb5d0dd40cb1143b6a35f51f59789096406e5ace09e707e72fa7de640f786b55863a0d7242
7
+ data.tar.gz: eb7a544f07c273e659aa313877741ddb9628ec1e03f04002f63e26663000f47efa8161582a61146f5a5a059130202bafd469047d00fabfcb1371fa1b323d01f2
@@ -1 +1 @@
1
- 2.6.5
1
+ 2.6.6
@@ -6,9 +6,9 @@ services:
6
6
  - mysql
7
7
  rvm:
8
8
  # Build on the latest stable of all supported Rubies (https://www.ruby-lang.org/en/downloads/):
9
- - 2.5.5
10
- - 2.6.5
11
- - 2.7.0
9
+ - 2.5.8
10
+ - 2.6.6
11
+ - 2.7.1
12
12
  cache: bundler
13
13
  before_script:
14
14
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
@@ -1,4 +1,21 @@
1
- # 2.1.0 (May 13th, 2020)
1
+ # Simmer Change Log
2
+
3
+ ## 3.0.0 (June 8th, 2020)
4
+
5
+ Breaking Changes:
6
+
7
+ * `Simmer::Runner` now accepts a `Simmer::Suite::OutputRouter` instead of an `IO` instance as its 'out' parameter.
8
+ * The `execution_output` and `execution_result` methods have been removed from `Simmer::Runner::Result`.
9
+
10
+ Additions:
11
+
12
+ * pdi_out.txt is written to throughout test execution instead of at the end.
13
+
14
+ Fixes:
15
+
16
+ * Fixtures now handle identifiers which are MySQL reserved words.
17
+
18
+ ## 2.1.0 (May 13th, 2020)
2
19
 
3
20
  Additions:
4
21
 
@@ -6,7 +23,7 @@ Additions:
6
23
  * Do not make PDI timeouts short-circuit the rest of the test suite.
7
24
  * Report PDI's exit code and execution time to the console.
8
25
 
9
- # 2.0.0 (May 11th, 2020)
26
+ ## 2.0.0 (May 11th, 2020)
10
27
 
11
28
  Breaking Changes:
12
29
 
data/README.md CHANGED
@@ -281,6 +281,15 @@ Basic steps to take to get this repository compiling:
281
281
  3. Clone the repository (git clone git@github.com:bluemarblepayroll/simmer.git)
282
282
  4. Navigate to the root folder (cd simmer)
283
283
  5. Install dependencies (bundle)
284
+ 6. Create the 'simmer_test' MySQL database as defined in `spec/db/tables.sql`.
285
+ 7. Add the tables from `spec/db/tables.sql` to this database.
286
+ 8. Configure your test simmer.yaml:
287
+
288
+ ````bash
289
+ cp spec/config/simmer.yaml.ci spec/config/simmer.yaml
290
+ ```
291
+
292
+ 9. Edit `spec/config/simmer.yaml` so that it can connect to the database created in step seven.
284
293
 
285
294
  ### Running Tests
286
295
 
@@ -51,7 +51,8 @@ module Simmer
51
51
  )
52
52
  configuration = make_configuration(config_path: config_path, simmer_dir: simmer_dir)
53
53
  specs = make_specifications(path, configuration.tests_dir)
54
- runner = make_runner(configuration, out)
54
+ out_router = make_output_router(configuration, out)
55
+ runner = make_runner(configuration, out_router)
55
56
  suite = make_suite(configuration, out, runner)
56
57
 
57
58
  suite.run(specs)
@@ -66,7 +67,7 @@ module Simmer
66
67
  Configuration.new(raw_config, simmer_dir)
67
68
  end
68
69
 
69
- def make_runner(configuration, out)
70
+ def make_runner(configuration, out_router)
70
71
  database = make_mysql_database(configuration)
71
72
  file_system = make_file_system(configuration)
72
73
  fixture_set = make_fixture_set(configuration)
@@ -76,7 +77,7 @@ module Simmer
76
77
  database: database,
77
78
  file_system: file_system,
78
79
  fixture_set: fixture_set,
79
- out: out,
80
+ out: out_router,
80
81
  spoon_client: spoon_client
81
82
  )
82
83
  end
@@ -156,5 +157,10 @@ module Simmer
156
157
  runner: runner
157
158
  )
158
159
  end
160
+
161
+ def make_output_router(configuration, console_out)
162
+ pdi_out = Suite::PdiOutputWriter.new(configuration.results_dir)
163
+ Simmer::Suite::OutputRouter.new(console_out, pdi_out)
164
+ end
159
165
  end
160
166
  end
@@ -27,7 +27,7 @@ module Simmer
27
27
  end
28
28
 
29
29
  def records(table, columns = [])
30
- query = "SELECT #{sql_select_params(columns)} FROM #{table}"
30
+ query = "SELECT #{sql_select_params(columns)} FROM #{qualify(table)}"
31
31
 
32
32
  client.query(query).to_a
33
33
  end
@@ -53,7 +53,11 @@ module Simmer
53
53
  attr_reader :client, :fixture_set, :table_names
54
54
 
55
55
  def sql_select_params(columns)
56
- Array(columns).any? ? Array(columns).map { |c| client.escape(c) }.join(',') : '*'
56
+ if Array(columns).any?
57
+ Array(columns).map { |c| qualify(client.escape(c)).to_s }.join(',')
58
+ else
59
+ '*'
60
+ end
57
61
  end
58
62
 
59
63
  def seed_sql_statements(fixtures)
@@ -62,7 +66,7 @@ module Simmer
62
66
 
63
67
  def clean_sql_statements
64
68
  table_names.map do |table_name|
65
- "TRUNCATE #{table_name}"
69
+ "TRUNCATE #{qualify(table_name)}"
66
70
  end
67
71
  end
68
72
 
@@ -110,6 +114,10 @@ module Simmer
110
114
 
111
115
  raise ArgumentError, "database (#{name}) must end in #{DATABASE_SUFFIX}"
112
116
  end
117
+
118
+ def qualify(identifier)
119
+ "`#{identifier}`"
120
+ end
113
121
  end
114
122
  end
115
123
  end
@@ -24,13 +24,13 @@ module Simmer
24
24
  freeze
25
25
  end
26
26
 
27
- def run(specification, config)
27
+ def run(specification, config, &output_capturer)
28
28
  execution_result = nil
29
29
  time_in_seconds = nil
30
30
 
31
31
  begin
32
32
  time_in_seconds = Benchmark.measure do
33
- execution_result = execute!(specification, config)
33
+ execution_result = execute!(specification, config, &output_capturer)
34
34
  end.real
35
35
  rescue Pdi::Spoon::PanError, Pdi::Spoon::KitchenError => e
36
36
  return Result.new(
@@ -50,14 +50,15 @@ module Simmer
50
50
 
51
51
  attr_reader :files_dir
52
52
 
53
- def execute!(specification, config)
53
+ def execute!(specification, config, &output_capturer)
54
54
  act = specification.act
55
55
 
56
56
  spoon.run(
57
57
  repository: act.repository,
58
58
  name: act.name,
59
59
  params: act.compiled_params(files_dir, config),
60
- type: act.type
60
+ type: act.type,
61
+ &output_capturer
61
62
  )
62
63
  end
63
64
  end
@@ -27,9 +27,7 @@ module Simmer
27
27
  end
28
28
 
29
29
  def run(specification, config: {}, id: SecureRandom.uuid)
30
- print("Name: #{specification.name}")
31
- print("Path: #{specification.path}")
32
-
30
+ out.announce_start(id, specification)
33
31
  clean_and_seed(specification)
34
32
 
35
33
  spoon_client_result = execute_spoon(specification, config)
@@ -41,7 +39,7 @@ module Simmer
41
39
  specification: specification,
42
40
  spoon_client_result: spoon_client_result
43
41
  ).tap do |result|
44
- print_result(result)
42
+ out.final_verdict(result)
45
43
  end
46
44
  rescue Database::FixtureSet::FixtureMissingError, Timeout::Error => e
47
45
  Result.new(
@@ -49,20 +47,18 @@ module Simmer
49
47
  specification: specification,
50
48
  errors: e.message
51
49
  ).tap do |result|
52
- print_result(result)
50
+ out.final_verdict(result)
53
51
  end
54
52
  end
55
53
 
54
+ def complete
55
+ out.close
56
+ end
57
+
56
58
  private
57
59
 
58
60
  attr_reader :database, :file_system, :fixture_set, :judge, :out
59
61
 
60
- def print_result(result)
61
- msg = pass_message(result)
62
- print_waiting('Done', 'Final verdict')
63
- print(msg)
64
- end
65
-
66
62
  def clean_and_seed(specification)
67
63
  clean_db
68
64
  seed_db(specification)
@@ -71,100 +67,72 @@ module Simmer
71
67
  end
72
68
 
73
69
  def clean_db
74
- print_waiting('Stage', 'Cleaning database')
70
+ out.waiting('Stage', 'Cleaning database')
75
71
  count = database.clean!
76
- print("#{count} table(s) emptied")
72
+ out.console_puts("#{count} table(s) emptied")
77
73
 
78
74
  count
79
75
  end
80
76
 
81
77
  def seed_db(specification)
82
- print_waiting('Stage', 'Seeding database')
78
+ out.waiting('Stage', 'Seeding database')
83
79
 
84
80
  fixtures = specification.stage.fixtures.map { |f| fixture_set.get!(f) }
85
81
  count = database.seed!(fixtures)
86
82
 
87
- print("#{count} record(s) inserted")
83
+ out.console_puts("#{count} record(s) inserted")
88
84
 
89
85
  count
90
86
  rescue Database::FixtureSet::FixtureMissingError => e
91
- print('Missing Fixture(s)')
87
+ out.console_puts('Missing Fixture(s)')
92
88
  raise e
93
89
  end
94
90
 
95
91
  def clean_file_system
96
- print_waiting('Stage', 'Cleaning File System')
92
+ out.waiting('Stage', 'Cleaning File System')
97
93
  count = file_system.clean!
98
- print("#{count} file(s) deleted")
94
+ out.console_puts("#{count} file(s) deleted")
99
95
 
100
96
  count
101
97
  end
102
98
 
103
99
  def seed_file_system(specification)
104
- print_waiting('Stage', 'Seeding File System')
100
+ out.waiting('Stage', 'Seeding File System')
105
101
  count = file_system.write!(specification.stage.files)
106
- print("#{count} file(s) uploaded")
102
+ out.console_puts("#{count} file(s) uploaded")
107
103
 
108
104
  count
109
105
  end
110
106
 
111
107
  def execute_spoon(specification, config)
112
- print_waiting('Act', 'Executing Spoon')
108
+ out.waiting('Act', 'Executing Spoon')
113
109
 
114
- spoon_client_result = spoon_client.run(specification, config)
115
- time_in_seconds = spoon_client_result.time_in_seconds
116
- code = spoon_client_result.execution_result.status.code
117
-
118
- msg = [
119
- pass_message(spoon_client_result),
120
- "(Exited with code #{code} after #{time_in_seconds} seconds)"
121
- ].join(' ')
110
+ spoon_client_result = spoon_client.run(specification, config) do |output|
111
+ out.capture_spoon_output(output)
112
+ end
122
113
 
123
- print(msg)
114
+ out.finish_spec
115
+ out.spoon_execution_detail_message(spoon_client_result)
124
116
 
125
117
  spoon_client_result
126
118
  rescue Timeout::Error => e
127
- print('Timed out')
119
+ out.console_puts('Timed out')
128
120
  raise e
129
121
  end
130
122
 
131
123
  def assert(specification, spoon_client_result)
132
- print_waiting('Assert', 'Checking results')
124
+ out.waiting('Assert', 'Checking results')
133
125
 
134
126
  if spoon_client_result.fail?
135
- print('Skipped')
127
+ out.console_puts('Skipped')
136
128
  return nil
137
129
  end
138
130
 
139
131
  output = spoon_client_result.execution_result.out
140
132
  judge_result = judge.assert(specification, output)
141
- msg = pass_message(judge_result)
142
-
143
- print(msg)
133
+ out.result(judge_result)
144
134
 
145
135
  judge_result
146
136
  end
147
-
148
- def print(msg)
149
- out.puts(msg)
150
- end
151
-
152
- def print_waiting(stage, msg)
153
- max = 25
154
- char = '.'
155
- msg = " > #{pad_right(stage, 6)} - #{pad_right(msg, max, char)}"
156
-
157
- out.print(msg)
158
- end
159
-
160
- def pad_right(msg, len, char = ' ')
161
- missing = len - msg.length
162
-
163
- "#{msg}#{char * missing}"
164
- end
165
-
166
- def pass_message(obj)
167
- obj.pass? ? 'Pass' : 'Fail'
168
- end
169
137
  end
170
138
  end
@@ -61,14 +61,6 @@ module Simmer
61
61
  'errors' => errors,
62
62
  }
63
63
  end
64
-
65
- def execution_output
66
- execution_result&.out
67
- end
68
-
69
- def execution_result
70
- spoon_client_result&.execution_result
71
- end
72
64
  end
73
65
  end
74
66
  end
@@ -7,7 +7,9 @@
7
7
  # LICENSE file in the root directory of this source tree.
8
8
  #
9
9
 
10
- require_relative 'suite/reporter'
10
+ require_relative 'suite/output_router'
11
+ require_relative 'suite/pdi_output_writer'
12
+ require_relative 'suite/results_writer'
11
13
  require_relative 'suite/result'
12
14
 
13
15
  module Simmer
@@ -33,15 +35,12 @@ module Simmer
33
35
 
34
36
  def run(specifications)
35
37
  runner_results = run_all_specs(specifications)
38
+ runner.complete
36
39
 
37
40
  Result.new(runner_results).tap do |result|
38
- if result.pass?
39
- out.puts('Suite ended successfully')
40
- else
41
- out.puts('Suite ended but was not successful')
42
- end
41
+ output_summary(result.pass?)
43
42
 
44
- Reporter.new(result).write!(results_dir)
43
+ ResulstWriter.new(result, results_dir).write!
45
44
 
46
45
  out.puts("Results can be viewed at #{results_dir}")
47
46
  end
@@ -77,5 +76,13 @@ module Simmer
77
76
  def print_line
78
77
  out.puts('-' * LINE_LENGTH)
79
78
  end
79
+
80
+ def output_summary(passed)
81
+ if passed
82
+ out.puts('Suite ended successfully')
83
+ else
84
+ out.puts('Suite ended but was not successful')
85
+ end
86
+ end
80
87
  end
81
88
  end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Simmer
4
+ class Suite
5
+ # Routes output either to the console or the <tt>PdiOutputWriter</tt>. It
6
+ # also provides some methods to help format output.
7
+ class OutputRouter
8
+ extend Forwardable
9
+
10
+ attr_reader :console, :pdi_out
11
+
12
+ def_delegator :console, :puts, :console_puts
13
+ def_delegators :pdi_out, :close, :finish_spec
14
+ def_delegator :pdi_out, :write, :capture_spoon_output
15
+
16
+ def initialize(console, pdi_out)
17
+ @console = console || raise(ArgumentError, 'console is required')
18
+ @pdi_out = pdi_out || raise(ArgumentError, 'pdi_out is required')
19
+
20
+ freeze
21
+ end
22
+
23
+ def announce_start(id, specification)
24
+ console_puts("Name: #{specification.name}")
25
+ console_puts("Path: #{specification.path}")
26
+ pdi_out.demarcate_spec(id, specification.name)
27
+ end
28
+
29
+ def result(result)
30
+ console_puts(pass_message(result))
31
+ end
32
+
33
+ def final_verdict(result)
34
+ msg = pass_message(result)
35
+ waiting('Done', 'Final verdict')
36
+ console_puts(msg)
37
+ end
38
+
39
+ def waiting(stage, msg)
40
+ # This is not for debugging.
41
+ # rubocop:disable Lint/Debugger
42
+ console.print(
43
+ " > #{pad_right(stage, 6)} - #{pad_right(msg, WAITING_MAX_WIDTH, WAITING_PADDING_CHAR)}"
44
+ )
45
+ # rubocop:enable Lint/Debugger
46
+ end
47
+
48
+ def spoon_execution_detail_message(spoon_client_result)
49
+ code = spoon_client_result.execution_result.status.code
50
+ detail = "(Exited with code #{code} after #{spoon_client_result.time_in_seconds} seconds)"
51
+
52
+ console_puts("#{pass_message(spoon_client_result)} #{detail}")
53
+ end
54
+
55
+ private
56
+
57
+ WAITING_MAX_WIDTH = 25
58
+ WAITING_PADDING_CHAR = '.'
59
+
60
+ private_constant :WAITING_MAX_WIDTH, :WAITING_PADDING_CHAR
61
+
62
+ def pad_right(msg, len, char = ' ')
63
+ missing = len - msg.length
64
+
65
+ "#{msg}#{char * missing}"
66
+ end
67
+
68
+ def pass_message(obj)
69
+ obj.pass? ? 'Pass' : 'Fail'
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Simmer
11
+ class Suite
12
+ # Captures PDI output from multiple specifications to a single file.
13
+ class PdiOutputWriter # :nodoc:
14
+ PDI_OUT_FILE = 'pdi_out.txt'
15
+
16
+ attr_reader :results_dir
17
+
18
+ def initialize(results_dir)
19
+ raise ArgumentError, 'results_dir is required' unless results_dir
20
+
21
+ results_dir = Util::FileSystem.setup_directory(results_dir)
22
+ @out = File.new(File.join(results_dir, PDI_OUT_FILE), 'w')
23
+
24
+ freeze
25
+ end
26
+
27
+ def demarcate_spec(runner_id, spec_name)
28
+ out.puts(LINE_OF_HYPHENS)
29
+ out.puts("Name: #{spec_name}")
30
+ out.puts("Runner ID: #{runner_id}")
31
+ out.puts(LINE_OF_HYPHENS)
32
+ end
33
+
34
+ def write(contents)
35
+ bytes_written = out.write(contents)
36
+ out.flush
37
+ bytes_written
38
+ end
39
+
40
+ def finish_spec
41
+ out.puts
42
+ end
43
+
44
+ def close
45
+ out.close
46
+ end
47
+
48
+ private
49
+
50
+ attr_reader :out
51
+
52
+ LINE_OF_HYPHENS = ('-' * 80).freeze
53
+ private_constant :LINE_OF_HYPHENS
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ module Simmer
11
+ class Suite
12
+ # Understands how to write a SessionResult instance to disk.
13
+ class ResulstWriter
14
+ DATA_FILE = 'data.yaml'
15
+
16
+ # Pass in dir here:
17
+ def initialize(session_result, results_dir)
18
+ raise ArgumentError, 'session_result is required' unless session_result
19
+ raise ArgumentError, 'results_directory is required' unless results_dir
20
+
21
+ @session_result = session_result
22
+ @results_directory = Util::FileSystem.setup_directory(results_dir)
23
+
24
+ freeze
25
+ end
26
+
27
+ def write!
28
+ dir = Util::FileSystem.setup_directory(results_directory)
29
+
30
+ IO.write(data_path(dir), session_result.to_h.to_yaml)
31
+
32
+ self
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :results_directory, :session_result
38
+
39
+ def data_path(dir)
40
+ File.join(dir, DATA_FILE)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -8,5 +8,6 @@
8
8
  #
9
9
 
10
10
  require_relative 'util/evaluator'
11
+ require_relative 'util/file_system'
11
12
  require_relative 'util/record_set'
12
13
  require_relative 'util/yaml_reader'
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
+ #
6
+ # This source code is licensed under the MIT license found in the
7
+ # LICENSE file in the root directory of this source tree.
8
+ #
9
+
10
+ require_relative 'resolver'
11
+
12
+ module Simmer
13
+ module Util
14
+ # Provides convenience methods for working with the file system.
15
+ class FileSystem # :nodoc:
16
+ class << self
17
+ def setup_directory(dir_path)
18
+ File.expand_path(dir_path).tap do |expanded_dir|
19
+ FileUtils.mkdir_p(expanded_dir)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Simmer
11
- VERSION = '2.1.0'
11
+ VERSION = '3.0.0'
12
12
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  Provides a harness for testing Pentaho Data Integration jobs and transformations.
12
12
  DESCRIPTION
13
13
 
14
- s.authors = ['Matthew Ruggio']
14
+ s.authors = ['Matthew Ruggio', 'Ryan Gerry']
15
15
  s.email = ['mruggio@bluemarblepayroll.com']
16
16
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  s.bindir = 'exe'
@@ -32,11 +32,12 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency('aws-sdk-s3', '~>1.6')
33
33
  s.add_dependency('mysql2', '~>0.5')
34
34
  s.add_dependency('objectable', '~>1')
35
- s.add_dependency('pdi', '~>2')
35
+ s.add_dependency('pdi', '~>2.1')
36
36
  s.add_dependency('stringento', '~>2')
37
37
 
38
38
  s.add_development_dependency('guard-rspec', '~>4.7')
39
39
  s.add_development_dependency('pry', '~>0')
40
+ s.add_development_dependency 'pry-byebug'
40
41
  s.add_development_dependency('rake', '~> 13')
41
42
  s.add_development_dependency('rspec')
42
43
  s.add_development_dependency('rubocop', '~>0.79.0')
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
8
+ - Ryan Gerry
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
12
+ date: 2020-06-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: acts_as_hashable
@@ -72,14 +73,14 @@ dependencies:
72
73
  requirements:
73
74
  - - "~>"
74
75
  - !ruby/object:Gem::Version
75
- version: '2'
76
+ version: '2.1'
76
77
  type: :runtime
77
78
  prerelease: false
78
79
  version_requirements: !ruby/object:Gem::Requirement
79
80
  requirements:
80
81
  - - "~>"
81
82
  - !ruby/object:Gem::Version
82
- version: '2'
83
+ version: '2.1'
83
84
  - !ruby/object:Gem::Dependency
84
85
  name: stringento
85
86
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +123,20 @@ dependencies:
122
123
  - - "~>"
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: pry-byebug
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
125
140
  - !ruby/object:Gem::Dependency
126
141
  name: rake
127
142
  requirement: !ruby/object:Gem::Requirement
@@ -245,10 +260,13 @@ files:
245
260
  - lib/simmer/specification/stage.rb
246
261
  - lib/simmer/specification/stage/input_file.rb
247
262
  - lib/simmer/suite.rb
248
- - lib/simmer/suite/reporter.rb
263
+ - lib/simmer/suite/output_router.rb
264
+ - lib/simmer/suite/pdi_output_writer.rb
249
265
  - lib/simmer/suite/result.rb
266
+ - lib/simmer/suite/results_writer.rb
250
267
  - lib/simmer/util.rb
251
268
  - lib/simmer/util/evaluator.rb
269
+ - lib/simmer/util/file_system.rb
252
270
  - lib/simmer/util/record.rb
253
271
  - lib/simmer/util/record_set.rb
254
272
  - lib/simmer/util/resolver.rb
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Copyright (c) 2020-present, Blue Marble Payroll, LLC
5
- #
6
- # This source code is licensed under the MIT license found in the
7
- # LICENSE file in the root directory of this source tree.
8
- #
9
-
10
- module Simmer
11
- class Suite
12
- # Understands how to write a SessionResult instance to disk.
13
- class Reporter
14
- DATA_FILE = 'data.yaml'
15
- PDI_OUT_FILE = 'pdi_out.txt'
16
-
17
- def initialize(session_result)
18
- raise ArgumentError, 'session_result is required' unless session_result
19
-
20
- @session_result = session_result
21
-
22
- freeze
23
- end
24
-
25
- def write!(dir)
26
- dir = setup_directory(dir)
27
-
28
- IO.write(data_path(dir), session_result.to_h.to_yaml)
29
-
30
- pdi_out_file = File.open(pdi_out_path(dir), 'w')
31
-
32
- write_part(session_result.runner_results, pdi_out_file)
33
-
34
- pdi_out_file.close
35
-
36
- self
37
- end
38
-
39
- private
40
-
41
- attr_reader :session_result
42
-
43
- def data_path(dir)
44
- File.join(dir, DATA_FILE)
45
- end
46
-
47
- def pdi_out_path(dir)
48
- File.join(dir, PDI_OUT_FILE)
49
- end
50
-
51
- def setup_directory(dir)
52
- File.expand_path(dir).tap do |expanded_dir|
53
- FileUtils.mkdir_p(expanded_dir)
54
- end
55
- end
56
-
57
- def write_part(runner_results, pdi_out_file)
58
- runner_results.each do |runner_result|
59
- name = runner_result.name
60
- runner_id = runner_result.id
61
- out_contents = runner_result.execution_output
62
-
63
- write_block(pdi_out_file, name, runner_id, out_contents)
64
- end
65
-
66
- nil
67
- end
68
-
69
- def write_block(file, name, runner_id, contents)
70
- hyphens = '-' * 80
71
-
72
- file.write("#{hyphens}\n")
73
- file.write("Name: #{name}\n")
74
- file.write("Runner ID: #{runner_id}\n")
75
- file.write("#{hyphens}\n")
76
- file.write("#{contents}\n")
77
- file.write("\n")
78
-
79
- nil
80
- end
81
- end
82
- end
83
- end