spec_views 3.0.0 → 3.1.1

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: 42a03f1d324852c51d56e4afdadadcc00e6449954917f396599df6c4568176d0
4
- data.tar.gz: 466b8bddc2f1c78bed3bbe57370b26bc87f71ecf38e2476ccc46fa4237a5410a
3
+ metadata.gz: 00b69d40e64b416f54b3de9c6e90c5d1c2b49b0cd7efca85ec2a85f9d3fa958d
4
+ data.tar.gz: 0f3bdab8bb94b46529cd1162e9c2639615da142e6ee12d36bda980fbbcc28979
5
5
  SHA512:
6
- metadata.gz: 48a9730de38ccc7927d852015fcb7c051e783a8a603cb665df17095a45799e882a1cc276d09b31177a2bc7ee93c8c86a455e5d0f24314e80ad19b77adcb36860
7
- data.tar.gz: a837bcd14d1e95707830291dbd621c41bef508c3fc858854bc22c6142aee2170b24d29f991c055b457da173db0b6a94e0920aaeef87cca13b5d4f13724393238
6
+ metadata.gz: '0218edcb9bec767064a6d6eff1a261374884b8ce492788018cfee281f32aa0cb480863bb1960f064c2f734bff6af9a31d9dcdaeb08fc6c2dddb277d552ee1289'
7
+ data.tar.gz: cf6f9f5f1603a4bda7c8193061dd8322f4721726b0de5e3d758c0cfe02ab4e74fc1729093df1c188f80a9788a77e4b47cdcc8860a6d2dbfb94bba694c5dc6077
@@ -14,7 +14,7 @@ module SpecViews
14
14
  @directory = SpecViews::Directory.for_description(description, content_type: content_type)
15
15
  @extractor_failure = @extractor.extractor_failure?
16
16
  @match = !extractor_failure? && match_challenger
17
- directory.write_meta(description, run_time, type, content_type) if champion_html
17
+ directory.write_last_run(run_time) if champion_html
18
18
  return if match?
19
19
 
20
20
  if extractor_failure?
@@ -25,7 +25,8 @@ module SpecViews
25
25
  @failure_message = "#{subject_name} has changed."
26
26
  @failure_message = "#{subject_name} has been added." if champion_html.nil?
27
27
 
28
- directory.write_meta(description, run_time, type, content_type)
28
+ directory.write_last_run(run_time)
29
+ directory.write_meta(description, type, content_type)
29
30
  @directory.write_challenger(challenger_body)
30
31
  end
31
32
 
@@ -69,11 +69,11 @@ module SpecViews
69
69
  path.join('meta.txt')
70
70
  end
71
71
 
72
- def write_meta(description, run_time, spec_type, content_type)
72
+ def write_meta(description, spec_type, content_type)
73
73
  FileUtils.mkdir_p(path)
74
74
  lines = [
75
75
  description.to_s.gsub("\n", ' '),
76
- run_time.to_s,
76
+ '',
77
77
  spec_type.to_s,
78
78
  content_type.to_s
79
79
  ]
@@ -90,12 +90,6 @@ module SpecViews
90
90
  name
91
91
  end
92
92
 
93
- def last_run
94
- Time.zone.parse(meta[1])
95
- rescue Errno::ENOENT
96
- Time.zone.at(0)
97
- end
98
-
99
93
  def spec_type
100
94
  ActiveSupport::StringInquirer.new(meta[2])
101
95
  rescue Errno::ENOENT
@@ -104,9 +98,9 @@ module SpecViews
104
98
 
105
99
  def content_type
106
100
  @content_type ||= begin
107
- ActiveSupport::StringInquirer.new(meta[3])
108
- rescue Errno::ENOENT
109
- :response
101
+ ct = 'html'
102
+ ct = meta[3] if meta && meta[3].present?
103
+ ActiveSupport::StringInquirer.new(ct)
110
104
  end
111
105
  end
112
106
 
@@ -114,6 +108,21 @@ module SpecViews
114
108
  content_type.pdf?
115
109
  end
116
110
 
111
+ def last_run_path
112
+ path.join('last_run.txt')
113
+ end
114
+
115
+ def write_last_run(run_time)
116
+ FileUtils.mkdir_p(path)
117
+ File.write(last_run_path, run_time.to_s)
118
+ end
119
+
120
+ def last_run
121
+ Time.zone.parse(File.read(last_run_path).strip)
122
+ rescue Errno::ENOENT
123
+ Time.zone.at(0)
124
+ end
125
+
117
126
  private
118
127
 
119
128
  def splitted_description
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SpecViews
4
- VERSION = '3.0.0'
4
+ VERSION = '3.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spec_views
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Gaul
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-08 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails