usps_flags 0.3.13 → 0.3.14

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: 5d669b5f3468f48b4a83d62cb6b6aa0dada7ae0c
4
- data.tar.gz: ce206fa8f3484d9680b014e0bf4c8af711582e8a
3
+ metadata.gz: b20eb0b3cdcbf6baf553c0fb3878a6e7d33e4b81
4
+ data.tar.gz: 86ea2969a9a056c0ec68322775ac490eaab7e5d1
5
5
  SHA512:
6
- metadata.gz: f7d8bb5f5eed9ffffa15f718e16e3332ba01a629f06f41ad04f43d02dbd82458788c98fb119149afd91d6dfcf6487f4a1f06a880db39ab71dbb6d326cb2bd7c1
7
- data.tar.gz: 0a2189b2be96440579fbc9d33f538b922606edb8f429a9fc9dab039f9fa6379bafd7f6737e1071aeb0b20d351c63bd6714a7ee3806762187fde9452069955e99
6
+ metadata.gz: ea648f45a315e805e1f4fbc99fab7ef36f8008a882c853e14f813952ebf378b7f672058aa127117107ea13d0ff584c28602c705983ed302de61676205dac78c3
7
+ data.tar.gz: 6247ef9d5d329d9d3c12d88dac2e4b840567abe67deca09ad2c8ded8aca02bbf4639bcc2a39246686c3c520cdf91f1396d9e0bf5fa003c5b4ed43e3e1d68de6d
checksums.yaml.gz.sig CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps_flags (0.3.13)
4
+ usps_flags (0.3.14)
5
5
  file_utils (~> 1.1, >= 1.1.2)
6
6
  mini_magick (~> 4.8, >= 4.8.0)
7
7
  rubyzip (~> 1.2, >= 1.2.1)
data/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![Build Status](https://travis-ci.org/jfiander/usps-flags.svg)](https://travis-ci.org/jfiander/usps-flags)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/760b824f0edac3316a11/test_coverage)](https://codeclimate.com/github/jfiander/usps-flags/test_coverage)
6
6
  [![Maintainability](https://api.codeclimate.com/v1/badges/760b824f0edac3316a11/maintainability)](https://codeclimate.com/github/jfiander/usps-flags/maintainability)
7
+ [![Dependencies](https://img.shields.io/gemnasium/jfiander/usps-flags.svg)](https://gemnasium.com/github.com/jfiander/usps-flags)
7
8
 
8
9
  This gem allows you to generate precise SVG and PNG flag images based on
9
10
  official specifications.
@@ -37,7 +38,12 @@ end
37
38
 
38
39
  ## Testing
39
40
 
40
- Tests are written in Rspec. To run all specs in a cloned repo, run 'rake'.
41
+ Tests are written in Rspec.
42
+
43
+ To run all specs, run `rake` or `rspec`.
44
+
45
+ To run most specs, but skip the static file generators (which can be slow), run
46
+ `rspec --tag '~slow'`.
41
47
 
42
48
  ## Generation
43
49
 
@@ -10,6 +10,9 @@ class USPSFlags::Generate
10
10
  # @return [String] Returns the SVG data.
11
11
  def svg(flag, outfile: nil, scale: nil, field: true)
12
12
  flag = flag.upcase.delete("/", "_", "PENNANT")
13
+
14
+ USPSFlags::Helpers.ensure_dir_for_file(outfile)
15
+
13
16
  if ["CRUISE", "OIC"].include?(flag)
14
17
  USPSFlags::Generate::Flag.pennant(type: flag, outfile: outfile, scale: scale)
15
18
  elsif flag == "ENSIGN"
@@ -29,22 +32,21 @@ class USPSFlags::Generate
29
32
  # @param [String] outfile The path to save the PNG file to. (Required because the file is not accessible if this is left blank.)
30
33
  # @param [Boolean] trim Whether to trim the generated PNG file of excess transparency.
31
34
  def png(svg, outfile: nil, trim: false)
32
- temp_svg_file = "temp.svg"
33
- temp_svg = ::File.new(temp_svg_file, "w+")
34
- temp_svg.write(svg)
35
- temp_svg.flush
36
-
37
35
  raise USPSFlags::Errors::PNGGenerationError, svg: svg if outfile.nil? || outfile.empty?
38
36
 
37
+ set_temp_svg(svg)
38
+
39
+ USPSFlags::Helpers.ensure_dir_for_file(outfile)
40
+
39
41
  MiniMagick::Tool::Convert.new do |convert|
40
42
  convert << "-background" << "none"
41
43
  convert << "-format" << "png"
42
44
  convert << "-trim" if trim
43
- convert << temp_svg.path
45
+ convert << @temp_svg_path
44
46
  convert << outfile
45
47
  end
46
48
  ensure
47
- ::File.delete(temp_svg_file) if ::File.exist?(temp_svg_file)
49
+ ::File.delete(@temp_svg_path) if delete_temp_svg?
48
50
  end
49
51
 
50
52
  # Generate all static SVG and PNG files, and automaticall generates zip archives for download.
@@ -150,7 +152,6 @@ class USPSFlags::Generate
150
152
 
151
153
  def generate_static_images_for(flag, svg: true, png: true)
152
154
  start_time = Time.now
153
- # USPSFlags::Helpers.log " | | _ _ _ _ _ | \r".rjust(USPSFlags::Helpers.max_flag_name_length+31, " ")
154
155
  @flag = flag.upcase
155
156
  USPSFlags::Helpers.log "#{@flag.rjust(USPSFlags::Helpers.max_flag_name_length)} |"
156
157
 
@@ -165,14 +166,36 @@ class USPSFlags::Generate
165
166
 
166
167
  def generate_static_svg
167
168
  USPSFlags::Helpers.log " "
169
+
170
+ generate_regular_svg
171
+ generate_insignia_svg
172
+ end
173
+
174
+ def generate_regular_svg
175
+ return if file_found?(@svg_file)
176
+
168
177
  svg @flag, outfile: @svg_file, scale: 1
169
178
  USPSFlags::Helpers.log "S"
170
- if USPSFlags::Helpers.valid_flags(:past).include?(@flag) || !USPSFlags::Helpers.valid_flags(:insignia).include?(@flag)
171
- USPSFlags::Helpers.log "-"
172
- else
173
- svg @flag, field: false, outfile: @svg_ins_file, scale: 1
174
- USPSFlags::Helpers.log "I"
175
- end
179
+ end
180
+
181
+ def generate_insignia_svg
182
+ return if no_insignia?
183
+
184
+ svg @flag, field: false, outfile: @svg_ins_file, scale: 1
185
+ USPSFlags::Helpers.log "I"
186
+ end
187
+
188
+ def set_temp_svg(svg)
189
+ @temp_svg_path = "#{USPSFlags.configuration.flags_dir}/temp.svg"
190
+ temp_svg = ::File.new(@temp_svg_path, "w+")
191
+ temp_svg.write(svg)
192
+ temp_svg.flush
193
+ @temp_svg_path
194
+ end
195
+
196
+ def delete_temp_svg?
197
+ !@temp_svg_path.to_s.empty? &&
198
+ ::File.exist?(@temp_svg_path)
176
199
  end
177
200
 
178
201
  def generate_static_png
@@ -227,18 +250,21 @@ class USPSFlags::Generate
227
250
 
228
251
  def no_insignia?
229
252
  return false if USPSFlags::Helpers.valid_flags(:insignia).include?(@flag)
253
+
230
254
  USPSFlags::Helpers.log "-"
231
255
  true
232
256
  end
233
257
 
234
258
  def file_found?(file)
235
259
  return false unless ::File.exist?(file)
260
+
236
261
  USPSFlags::Helpers.log "."
237
262
  true
238
263
  end
239
264
 
240
265
  def too_big?(file, size)
241
266
  return false unless size > MiniMagick::Image.open(file)[:width]
267
+
242
268
  USPSFlags::Helpers.log "+"
243
269
  true
244
270
  end
@@ -108,6 +108,18 @@ class USPSFlags::Helpers
108
108
  log_file.close if log_file.is_a?(File)
109
109
  end
110
110
 
111
+ # Ensures the directory for the specified path exists.
112
+ #
113
+ # This should never need to be called directly.
114
+ # @private
115
+ def ensure_dir_for_file(path)
116
+ return false if path.nil? || path.empty? || !path.scan("/")
117
+
118
+ dirs = path.split("/")
119
+ dirs.pop
120
+ ::FileUtils.mkdir_p(dirs.join("/")).first
121
+ end
122
+
111
123
  # Prints output to the console or saves to a file, then returns the generated data.
112
124
  #
113
125
  # This should never need to be called directly.
@@ -116,6 +128,7 @@ class USPSFlags::Helpers
116
128
  if outfile.nil?
117
129
  puts svg, "\n"
118
130
  elsif outfile != ""
131
+ ensure_dir_for_file(outfile)
119
132
  f = ::File.new(outfile, "w+")
120
133
  f.write(svg)
121
134
  f.close
data/spec/spec_helper.rb CHANGED
@@ -15,6 +15,7 @@ RSpec.configure do |config|
15
15
 
16
16
  USPSFlags.configure do |c|
17
17
  c.flags_dir = $tmp_flags_dir
18
+ c.clear = true
18
19
  end
19
20
  end
20
21
 
@@ -33,7 +33,7 @@ describe USPSFlags::Config do
33
33
  end
34
34
 
35
35
  expect(USPSFlags.configuration.flags_dir).to eql($tmp_flags_dir)
36
- expect(USPSFlags.configuration.clear).to eql(false)
36
+ expect(USPSFlags.configuration.clear).to eql(true)
37
37
  expect(USPSFlags.configuration.use_larger_tridents).to eql(true)
38
38
  end
39
39
  end
@@ -31,83 +31,15 @@ describe USPSFlags::Generate do
31
31
  end
32
32
  end
33
33
 
34
- describe "line flags" do
35
- it "should generate CC" do
36
- expect(USPSFlags::Generate.svg("CC", outfile: "")).to include("<title>CC</title>")
37
- end
38
-
39
- it "should generate VC" do
40
- expect(USPSFlags::Generate.svg("VC", outfile: "")).to include("<title>VC</title>")
41
- end
42
-
43
- it "should generate RC" do
44
- expect(USPSFlags::Generate.svg("RC", outfile: "")).to include("<title>RC</title>")
45
- end
46
-
47
- it "should generate StfC" do
48
- expect(USPSFlags::Generate.svg("StfC", outfile: "")).to include("<title>STFC</title>")
49
- end
50
-
51
- it "should generate DC" do
52
- expect(USPSFlags::Generate.svg("DC", outfile: "")).to include("<title>DC</title>")
53
- end
54
-
55
- it "should generate DLtC" do
56
- expect(USPSFlags::Generate.svg("DLtC", outfile: "")).to include("<title>DLTC</title>")
57
- end
58
-
59
- it "should generate D1Lt" do
60
- expect(USPSFlags::Generate.svg("D1Lt", outfile: "")).to include("<title>D1LT</title>")
61
- end
62
-
63
- it "should generate DLt" do
64
- expect(USPSFlags::Generate.svg("DLt", outfile: "")).to include("<title>DLT</title>")
65
- end
66
-
67
- it "should generate Cdr" do
68
- expect(USPSFlags::Generate.svg("Cdr", outfile: "")).to include("<title>CDR</title>")
69
- end
70
-
71
- it "should generate LtC" do
72
- expect(USPSFlags::Generate.svg("LtC", outfile: "")).to include("<title>LTC</title>")
73
- end
74
-
75
- it "should generate 1Lt" do
76
- expect(USPSFlags::Generate.svg("1Lt", outfile: "")).to include("<title>1LT</title>")
77
- end
78
-
79
- it "should generate Lt" do
80
- expect(USPSFlags::Generate.svg("Lt", outfile: "")).to include("<title>LT</title>")
81
- end
82
- end
83
-
84
- describe "special flags" do
85
- it "should generate PortCap" do
86
- expect(USPSFlags::Generate.svg("PortCap", outfile: "")).to include("<title>PORTCAP</title>")
87
- end
88
-
89
- it "should generate FleetCap" do
90
- expect(USPSFlags::Generate.svg("FleetCap", outfile: "")).to include("<title>FLEETCAP</title>")
91
- end
92
-
93
- it "should generate DAide" do
94
- expect(USPSFlags::Generate.svg("DAide", outfile: "")).to include("<title>DAIDE</title>")
95
- end
96
-
97
- it "should generate NAide" do
98
- expect(USPSFlags::Generate.svg("NAide", outfile: "")).to include("<title>NAIDE</title>")
99
- end
100
-
101
- it "should generate FLt" do
102
- expect(USPSFlags::Generate.svg("FLt", outfile: "")).to include("<title>FLT</title>")
103
- end
104
-
105
- it "should generate DFLt" do
106
- expect(USPSFlags::Generate.svg("DFLt", outfile: "")).to include("<title>DFLT</title>")
107
- end
108
-
109
- it "should generate NFLt" do
110
- expect(USPSFlags::Generate.svg("NFLt", outfile: "")).to include("<title>NFLT</title>")
34
+ describe "officer flags" do
35
+ [
36
+ "PLTC", "PC", "PDLTC", "PDC", "PSTFC", "PRC", "PVC", "PCC",
37
+ "PORTCAP", "FLEETCAP", "FLT", "DAIDE", "DFLT", "NAIDE", "NFLT",
38
+ "LT", "1LT", "LTC", "CDR", "DLT", "D1LT", "DLTC", "DC", "STFC", "RC", "VC", "CC"
39
+ ].each do |flag|
40
+ it "should generate #{flag}" do
41
+ expect(USPSFlags::Generate.svg(flag, outfile: "")).to include("<title>#{flag}</title>")
42
+ end
111
43
  end
112
44
  end
113
45
 
@@ -146,12 +78,16 @@ describe USPSFlags::Generate do
146
78
  end
147
79
 
148
80
  describe "png" do
81
+ before(:each) do
82
+ @svg = USPSFlags::Generate.svg("LtC", outfile: "")
83
+ end
84
+
149
85
  it "should raise PNGGenerationError without an outfile" do
150
- expect { USPSFlags::Generate.png(USPSFlags::Generate.svg("LtC", outfile: ""), outfile: "") }.to raise_error(USPSFlags::Errors::PNGGenerationError)
86
+ expect { USPSFlags::Generate.png(@svg, outfile: "") }.to raise_error(USPSFlags::Errors::PNGGenerationError)
151
87
  end
152
88
 
153
89
  it "should not raise PNGGenerationError when correctly configured" do
154
- expect { USPSFlags::Generate.png(USPSFlags::Generate.svg("LtC", outfile: ""), outfile: "lib/output/PNG/LTC.png") }.to_not raise_error(USPSFlags::Errors::PNGGenerationError)
90
+ expect { USPSFlags::Generate.png(@svg, outfile: "lib/output/PNG/LTC.png") }.to_not raise_error(USPSFlags::Errors::PNGGenerationError)
155
91
  end
156
92
  end
157
93
 
@@ -162,7 +98,7 @@ describe USPSFlags::Generate do
162
98
  end
163
99
  end
164
100
 
165
- describe "static files" do
101
+ describe "static files errors" do
166
102
  it "should raise USPSFlags::Errors::StaticFilesGenerationError when not given any true arguments" do
167
103
  expect { USPSFlags::Generate.all(svg: false, png: false, zips: false, reset: false) }.to raise_error(
168
104
  USPSFlags::Errors::StaticFilesGenerationError, "At least one argument switch must be true out of [svg, png, zips, reset]."
@@ -174,58 +110,96 @@ describe USPSFlags::Generate do
174
110
  USPSFlags::Errors::ZipGenerationError, "At least one argument switch must be true out of [svg, png]."
175
111
  )
176
112
  end
113
+ end
177
114
 
178
- it "should not raise an error while generating all static files" do
115
+ describe "static files generation", slow: true do
116
+ before(:all) do
117
+ svg_dir = "#{USPSFlags.configuration.flags_dir}/SVG"
179
118
  png_dir = "#{USPSFlags.configuration.flags_dir}/PNG"
180
- ::FileUtils.cp("spec/assets/1LT.thumb.png", "#{png_dir}/insignia/1LT.thumb.png")
181
- ::FileUtils.cp("spec/assets/LT.png", "#{png_dir}/insignia/LT.png")
182
- ::FileUtils.cp("spec/assets/FLT.png", "#{png_dir}/FLT.png")
119
+
120
+ @svg_flag, @png_flag = USPSFlags::Helpers.valid_flags(:officer).sample(2)
121
+ @svg_ins_flag, @png_ins_flag, @thb_flag = USPSFlags::Helpers.valid_flags(:insignia).sample(3)
122
+ puts "\nSelected test flags: ", " Sf: #{@svg_flag}", " Si: #{@svg_ins_flag}", " Pf: #{@png_flag}", " Pi: #{@png_ins_flag}", " Pt: #{@thb_flag}"
123
+
124
+ ::FileUtils.rm_rf(USPSFlags.configuration.flags_dir)
125
+ USPSFlags.prepare_flags_dir
126
+
127
+ USPSFlags::Generate.svg(@svg_flag, outfile: "#{svg_dir}/#{@svg_flag}.svg")
128
+ USPSFlags::Generate.svg(@svg_ins_flag, field: false, outfile: "#{svg_dir}/insignia/#{@svg_ins_flag}.svg")
129
+ USPSFlags::Generate.png(USPSFlags::Generate.svg(@png_flag, outfile: ""), outfile: "#{png_dir}/#{@png_flag}.png")
130
+ USPSFlags::Generate.png(USPSFlags::Generate.svg(@png_ins_flag, field: false, outfile: ""), trim: true, outfile: "#{png_dir}/insignia/#{@png_ins_flag}.png")
131
+ USPSFlags::Generate.png(USPSFlags::Generate.svg(@thb_flag, field: false, outfile: ""), trim: true, outfile: "#{png_dir}/insignia/#{@thb_flag}.png")
132
+ USPSFlags::Helpers.resize_png("#{png_dir}/insignia/#{@thb_flag}.png", file: "insignia/#{@thb_flag}", size: 150, size_key: "thumb")
133
+ end
134
+
135
+ it "should not raise an error while generating all static files" do
183
136
  expect { USPSFlags::Generate.all(reset: false) }.to_not raise_error # (USPSFlags::Errors::StaticFilesGenerationError)
184
137
  end
185
138
 
186
- it "should have generated the correct log output" do
187
- correct_log_pattern = <<~LOG
188
- Flag | SVG | PNG | Run time
189
- ---------------------------------------
190
- PLTC | S- | F-H-K-D-T- | .*? s
191
- PC | S- | F-H-K-D-T- | .*? s
192
- 1LT | SI | FIH\\+K\\+DiT\\. | .*? s
193
- LTC | SI | FIHiKiDiTi | .*? s
194
- CDR | SI | FIHiKiDiTi | .*? s
195
- PORTCAP | SI | FIH\\+K\\+DiTi | .*? s
196
- FLEETCAP | SI | FIH\\+KiDiTi | .*? s
197
- LT | SI | F\\.H\\+K\\+DiTi | .*? s
198
- FLT | SI | \\.IH\\+K\\+DiTi | .*? s
199
- PDLTC | S- | F-H-K-D-T- | .*? s
200
- PDC | S- | F-H-K-D-T- | .*? s
201
- D1LT | SI | FIH\\+K\\+DiTi | .*? s
202
- DLTC | SI | FIHiKiDiTi | .*? s
203
- DC | SI | FIHiKiDiTi | .*? s
204
- DLT | SI | FIH\\+K\\+DiTi | .*? s
205
- DAIDE | SI | FIH\\+KiDiTi | .*? s
206
- DFLT | SI | FIHiKiDiTi | .*? s
207
- PSTFC | S- | F-H-K-D-T- | .*? s
208
- PRC | S- | F-H-K-D-T- | .*? s
209
- PVC | S- | F-H-K-D-T- | .*? s
210
- PCC | S- | F-H-K-D-T- | .*? s
211
- NAIDE | SI | FIH\\+KiDiTi | .*? s
212
- NFLT | SI | FIHiKiDiTi | .*? s
213
- STFC | SI | FIH\\+K\\+DiTi | .*? s
214
- RC | SI | FIH\\+K\\+DiTi | .*? s
215
- VC | SI | FIHiKiDiTi | .*? s
216
- CC | SI | FIHiKiDiTi | .*? s
217
- CRUISE | S- | F-H-K-D-T- | .*? s
218
- OIC | S- | F-H-K-D-T- | .*? s
219
- ENSIGN | S- | F-H-K-D-T- | .*? s
220
- WHEEL | S- | F-H-K-D-T- | .*? s
221
- US | S- | F-H-K-D-T- | .*? s
222
- Generated SVG Zip
223
- Generated PNG Zip
224
- LOG
225
-
226
- log_contents = ::File.read("#{USPSFlags.configuration.log_path}/flag.log")
227
-
228
- expect(log_contents).to match(Regexp.new(correct_log_pattern))
139
+ describe "generation logs" do
140
+ before(:each) do
141
+ @log_contents = ::File.read("#{USPSFlags.configuration.log_path}/flag.log")
142
+ end
143
+
144
+ it "should have generated the correct log output" do
145
+ correct_log_pattern = <<~LOG
146
+ Flag | SVG | PNG | Run time
147
+ ---------------------------------------
148
+ PLTC | S- | F-H-K-D-T- | .*{3,6} s
149
+ PC | S- | F-H-K-D-T- | .*{3,6} s
150
+ 1LT | SI | FIH+K+DiTi | .*{3,6} s
151
+ LTC | SI | FIHiKiDiTi | .*{3,6} s
152
+ CDR | SI | FIHiKiDiTi | .*{3,6} s
153
+ PORTCAP | SI | FIH+K+DiTi | .*{3,6} s
154
+ FLEETCAP | SI | FIH+KiDiTi | .*{3,6} s
155
+ LT | SI | FIH+K+DiTi | .*{3,6} s
156
+ FLT | SI | FIH+K+DiTi | .*{3,6} s
157
+ PDLTC | S- | F-H-K-D-T- | .*{3,6} s
158
+ PDC | S- | F-H-K-D-T- | .*{3,6} s
159
+ D1LT | SI | FIH+K+DiTi | .*{3,6} s
160
+ DLTC | SI | FIHiKiDiTi | .*{3,6} s
161
+ DC | SI | FIHiKiDiTi | .*{3,6} s
162
+ DLT | SI | FIH+K+DiTi | .*{3,6} s
163
+ DAIDE | SI | FIH+KiDiTi | .*{3,6} s
164
+ DFLT | SI | FIHiKiDiTi | .*{3,6} s
165
+ PSTFC | S- | F-H-K-D-T- | .*{3,6} s
166
+ PRC | S- | F-H-K-D-T- | .*{3,6} s
167
+ PVC | S- | F-H-K-D-T- | .*{3,6} s
168
+ PCC | S- | F-H-K-D-T- | .*{3,6} s
169
+ NAIDE | SI | FIH+KiDiTi | .*{3,6} s
170
+ NFLT | SI | FIHiKiDiTi | .*{3,6} s
171
+ STFC | SI | FIH+K+DiTi | .*{3,6} s
172
+ RC | SI | FIH+K+DiTi | .*{3,6} s
173
+ VC | SI | FIHiKiDiTi | .*{3,6} s
174
+ CC | SI | FIHiKiDiTi | .*{3,6} s
175
+ CRUISE | S- | F-H-K-D-T- | .*{3,6} s
176
+ OIC | S- | F-H-K-D-T- | .*{3,6} s
177
+ ENSIGN | S- | F-H-K-D-T- | .*{3,6} s
178
+ WHEEL | S- | F-H-K-D-T- | .*{3,6} s
179
+ US | S- | F-H-K-D-T- | .*{3,6} s
180
+ Generated SVG Zip
181
+ Generated PNG Zip
182
+ LOG
183
+
184
+ correct_log_pattern = correct_log_pattern.
185
+ gsub('+', '\+').gsub('|', '\|').
186
+ gsub(/#{@svg_flag} | S/, "#{@svg_flag} | \\.").
187
+ gsub(/#{@svg_ins_flag} | SI/, "#{@svg_ins_flag} | S\\.").
188
+ gsub(/#{@png_flag} | S(.) | F/, "#{@png_flag} | S\1 | \\.").
189
+ gsub(/#{@png_ins_flag} | SI | FI/, "#{@png_ins_flag} | SI | F\\.").
190
+ gsub(/#{@thm_flag} | SI | FIH(.)K(.)D(.)Ti/, "#{@thm_flag} | SI | FIH\1K\2D\3T\\.")
191
+ correct_log_regexp = Regexp.new(correct_log_pattern)
192
+
193
+ expect(@log_contents).to match(correct_log_regexp)
194
+ end
195
+
196
+ it "should not match an incorrect log output" do
197
+ incorrect_log_pattern = 'PLTC \| -- \| ---------- \| .*{3,6} s'
198
+
199
+ incorrect_log_regexp = Regexp.new(incorrect_log_pattern)
200
+
201
+ expect(@log_contents.match(incorrect_log_regexp)).to be_nil
202
+ end
229
203
  end
230
204
 
231
205
  it "should not raise an error while clearing all static files" do
data/usps_flags.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'usps_flags'
3
- s.version = '0.3.13'
4
- s.date = '2017-11-09'
3
+ s.version = '0.3.14'
4
+ s.date = '2017-11-10'
5
5
  s.summary = 'Flag generator for United States Power Squadrons'
6
6
  s.description = 'A flag image (PNG, SVG) generator for United States Power Squadrons.'
7
7
  s.homepage = 'http://rubygems.org/gems/usps_flags'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps_flags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -30,7 +30,7 @@ cert_chain:
30
30
  3YzYAc+kXfD7kkzA2NMvLT6Q1v03qQyIZ8BS8SNk5wLGAdLM+IravFDLEs448fjz
31
31
  lEAU0RHLFVbE+CXW6makIlWGHR0=
32
32
  -----END CERTIFICATE-----
33
- date: 2017-11-09 00:00:00.000000000 Z
33
+ date: 2017-11-10 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: file_utils
@@ -194,9 +194,6 @@ files:
194
194
  - lib/usps_flags/helpers.rb
195
195
  - lib/usps_flags/helpers/builders.rb
196
196
  - lib/usps_flags/helpers/spec_arrows.rb
197
- - spec/assets/1LT.thumb.png
198
- - spec/assets/FLT.png
199
- - spec/assets/LT.png
200
197
  - spec/rational_spec.rb
201
198
  - spec/spec_helper.rb
202
199
  - spec/usps_flags/config_spec.rb
@@ -232,9 +229,6 @@ signing_key:
232
229
  specification_version: 4
233
230
  summary: Flag generator for United States Power Squadrons
234
231
  test_files:
235
- - spec/assets/1LT.thumb.png
236
- - spec/assets/FLT.png
237
- - spec/assets/LT.png
238
232
  - spec/rational_spec.rb
239
233
  - spec/spec_helper.rb
240
234
  - spec/usps_flags/config_spec.rb
metadata.gz.sig CHANGED
@@ -1 +1 @@
1
- �&xd�2��0<KK<yQm��j}���[�,n/�!������x����gm@��S��t�pnĂGl(�e��=M��X6K�˫վ� %�|��I�v�ҷ>����g�޾���n�D�� ��WDz��aKI����3��+�=.��6u{4�^��dw~;�B��'����c��}!�9�k��W�O���H�{a��B�8�2�V(�N�N��Ph��d]��{ ;%��̨��8Su6�r�j�[hV�|g_
1
+ �C��L�[�"\R
Binary file
data/spec/assets/FLT.png DELETED
Binary file
data/spec/assets/LT.png DELETED
Binary file