simmer 1.0.0.pre.alpha.1 → 1.0.0.pre.alpha.2

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
  SHA256:
3
- metadata.gz: 4989371b7d24d0acab51620e5f6fde689544988ecce968d848f00c4eb00ea2ce
4
- data.tar.gz: 5011b80e753c36aaaf52fcf4468147440403f4a09eae13571ec3e000ed1f5ffe
3
+ metadata.gz: 1166684a6f6ae1ba9ca0e87aab0405fd6a83fa4c8bf5206950827b2d857577ff
4
+ data.tar.gz: 50214a9c1aa9dfb26bc5663f43a7cb2c36b62fbf31a7a1b52e66067ba84b5bdc
5
5
  SHA512:
6
- metadata.gz: e8c1193e86c8fdc027093ace238c73446f3ea3560957a278d6610019afe5f05bb80b0700c593a225e8a27482b125d6255936c58cea436dcde9617cc4a02c4c42
7
- data.tar.gz: 902c63c1f437938d215b84965d91c1f60a3b0a15ac7368f72fd6a728735b4e5758c5723ceff52138d96b3e8da181864765a6ebfb54dc1f04fee4a410fb141232
6
+ metadata.gz: 2675ec1ade5ebd6465c43040fa561125492a9abb6d58561ad69be852f8b6daa3056d90193fca079c187607f65dbf78983304e1e755ccb9fda0a3ca6a36279edd
7
+ data.tar.gz: cf2100c542aaf4157417c2e08bbeb7b362bc0505f3ceb2cbc0e47f3e184e9d36826b20347eadb3f6437ac2474672c1faccdefff8b6691e0dc6437a1ae53b5f41
data/.gitignore CHANGED
@@ -4,3 +4,4 @@
4
4
  /coverage
5
5
  Gemfile.lock
6
6
  /pkg
7
+ /bin/di
data/lib/simmer.rb CHANGED
@@ -36,14 +36,14 @@ require_relative 'simmer/suite'
36
36
  module Simmer
37
37
  DEFAULT_CONFIG_PATH = File.join('config', 'simmer.yaml')
38
38
  DEFAULT_RESULTS_DIR = 'results'
39
- DEFAULT_SPEC_DIR = 'simmer'
39
+ DEFAULT_SIMMER_DIR = 'simmer'
40
40
  class << self
41
41
  def run(path)
42
42
  Suite.new(
43
43
  out: $stdout,
44
44
  config_path: DEFAULT_CONFIG_PATH,
45
45
  results_dir: DEFAULT_RESULTS_DIR,
46
- spec_dir: DEFAULT_SPEC_DIR
46
+ simmer_dir: DEFAULT_SIMMER_DIR
47
47
  ).run(path)
48
48
  end
49
49
  end
@@ -34,13 +34,13 @@ module Simmer
34
34
  config_path:,
35
35
  resolver: Objectable.resolver,
36
36
  results_dir:,
37
- spec_dir:,
37
+ simmer_dir:,
38
38
  yaml_reader: Util::YamlReader.new
39
39
  )
40
40
  @config = yaml_reader.read(config_path)
41
41
  @resolver = resolver
42
42
  @results_dir = results_dir
43
- @spec_dir = spec_dir
43
+ @simmer_dir = simmer_dir
44
44
  @yaml_reader = yaml_reader
45
45
 
46
46
  freeze
@@ -59,15 +59,15 @@ module Simmer
59
59
  end
60
60
 
61
61
  def tests_dir
62
- File.join(spec_dir, TESTS)
62
+ File.join(simmer_dir, TESTS)
63
63
  end
64
64
 
65
65
  def fixtures_dir
66
- File.join(spec_dir, FIXTURES)
66
+ File.join(simmer_dir, FIXTURES)
67
67
  end
68
68
 
69
69
  def files_dir
70
- File.join(spec_dir, FILES)
70
+ File.join(simmer_dir, FILES)
71
71
  end
72
72
 
73
73
  def fixture_set
@@ -80,7 +80,7 @@ module Simmer
80
80
 
81
81
  attr_reader :resolver,
82
82
  :results_dir,
83
- :spec_dir,
83
+ :simmer_dir,
84
84
  :yaml_reader
85
85
 
86
86
  def get(key)
@@ -59,6 +59,8 @@ module Simmer
59
59
  attr_reader :bucket, :encryption, :files_dir
60
60
 
61
61
  def write_single(dest, src)
62
+ src = File.expand_path(src)
63
+
62
64
  File.open(src, 'rb') do |file|
63
65
  bucket.object(dest).put(
64
66
  body: file,
@@ -43,7 +43,7 @@ module Simmer
43
43
  begin
44
44
  time_in_seconds = Benchmark.measure do
45
45
  execution_result = execute!(specification, config)
46
- end.real.round(2)
46
+ end.real
47
47
  rescue Pdi::Spoon::PanError, Pdi::Spoon::KitchenError => e
48
48
  return Result.new(
49
49
  message: "PDI execution returned an error: #{e.class.name} (#{e.execution.code})",
@@ -17,7 +17,7 @@ module Simmer
17
17
  def initialize(message: '', execution_result:, time_in_seconds:)
18
18
  @message = message
19
19
  @execution_result = execution_result
20
- @time_in_seconds = time_in_seconds
20
+ @time_in_seconds = (time_in_seconds || 0).round(2)
21
21
 
22
22
  freeze
23
23
  end
@@ -29,7 +29,7 @@ module Simmer
29
29
  end
30
30
 
31
31
  def pass?
32
- spoon_client_result&.pass? && spoon_client_result&.pass?
32
+ judge_result&.pass? && spoon_client_result&.pass?
33
33
  end
34
34
 
35
35
  def fail?
@@ -23,17 +23,13 @@ module Simmer
23
23
  freeze
24
24
  end
25
25
 
26
- def write!(path)
27
- FileUtils.mkdir_p(path)
26
+ def write!(dir)
27
+ dir = setup_directory(dir)
28
28
 
29
- data_path = File.join(path, DATA_FILE)
30
- pdi_out = File.join(path, PDI_OUT_FILE)
31
- pdi_err = File.join(path, PDI_ERR_FILE)
29
+ IO.write(data_path(dir), session_result.to_h.to_yaml)
32
30
 
33
- IO.write(data_path, session_result.to_h.to_yaml)
34
-
35
- pdi_out_file = File.open(pdi_out, 'w')
36
- pdi_err_file = File.open(pdi_err, 'w')
31
+ pdi_out_file = File.open(pdi_out_path(dir), 'w')
32
+ pdi_err_file = File.open(pdi_err_path(dir), 'w')
37
33
 
38
34
  write_part(session_result.runner_results, pdi_out_file, pdi_err_file)
39
35
 
@@ -55,6 +51,24 @@ module Simmer
55
51
 
56
52
  attr_reader :session_result
57
53
 
54
+ def data_path(dir)
55
+ File.join(dir, DATA_FILE)
56
+ end
57
+
58
+ def pdi_out_path(dir)
59
+ File.join(dir, PDI_OUT_FILE)
60
+ end
61
+
62
+ def pdi_err_path(dir)
63
+ File.join(dir, PDI_ERR_FILE)
64
+ end
65
+
66
+ def setup_directory(dir)
67
+ File.expand_path(dir).tap do |expanded_dir|
68
+ FileUtils.mkdir_p(expanded_dir)
69
+ end
70
+ end
71
+
58
72
  def write_part(runner_results, pdi_out_file, pdi_err_file)
59
73
  runner_results.each do |runner_result|
60
74
  name = runner_result.name
data/lib/simmer/suite.rb CHANGED
@@ -19,11 +19,11 @@ module Simmer
19
19
  class Suite
20
20
  attr_reader :configuration, :session
21
21
 
22
- def initialize(out:, config_path:, results_dir:, spec_dir:)
22
+ def initialize(config_path:, out:, results_dir:, simmer_dir:)
23
23
  @configuration = Configuration.new(
24
24
  config_path: config_path,
25
25
  results_dir: results_dir,
26
- spec_dir: spec_dir
26
+ simmer_dir: simmer_dir
27
27
  )
28
28
 
29
29
  runner = Runner.new(
@@ -29,6 +29,7 @@ module Simmer
29
29
  end
30
30
 
31
31
  def read(path)
32
+ path = File.expand_path(path)
32
33
  contents = File.read(path)
33
34
 
34
35
  YAML.safe_load(contents) || {}
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Simmer
11
- VERSION = '1.0.0-alpha.1'
11
+ VERSION = '1.0.0-alpha.2'
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha.1
4
+ version: 1.0.0.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio