usps_flags 0.3.26 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +87 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +2 -2
- data/Rakefile +4 -2
- data/lib/rational.rb +3 -1
- data/lib/usps_flags.rb +15 -17
- data/lib/usps_flags/config.rb +32 -29
- data/lib/usps_flags/core.rb +11 -9
- data/lib/usps_flags/core/ensign.rb +20 -17
- data/lib/usps_flags/core/field.rb +33 -30
- data/lib/usps_flags/core/footer.rb +2 -0
- data/lib/usps_flags/core/headers.rb +11 -8
- data/lib/usps_flags/core/icons.rb +14 -0
- data/lib/usps_flags/core/{anchor.rb → icons/anchor.rb} +7 -5
- data/lib/usps_flags/core/{binoculars.rb → icons/binoculars.rb} +7 -5
- data/lib/usps_flags/core/{lighthouse.rb → icons/lighthouse.rb} +3 -1
- data/lib/usps_flags/core/{star.rb → icons/star.rb} +3 -1
- data/lib/usps_flags/core/{trident.rb → icons/trident.rb} +29 -25
- data/lib/usps_flags/core/{trumpet.rb → icons/trumpet.rb} +3 -1
- data/lib/usps_flags/core/pennant.rb +20 -17
- data/lib/usps_flags/core/trident_spec.rb +62 -174
- data/lib/usps_flags/core/trident_specs.rb +14 -0
- data/lib/usps_flags/core/trident_specs/base.rb +15 -0
- data/lib/usps_flags/core/trident_specs/circle.rb +51 -0
- data/lib/usps_flags/core/trident_specs/delta.rb +68 -0
- data/lib/usps_flags/core/trident_specs/header.rb +65 -0
- data/lib/usps_flags/core/trident_specs/long.rb +54 -0
- data/lib/usps_flags/core/trident_specs/short.rb +176 -0
- data/lib/usps_flags/core/tridents.rb +16 -14
- data/lib/usps_flags/core/us.rb +9 -7
- data/lib/usps_flags/core/wheel.rb +2 -0
- data/lib/usps_flags/errors.rb +16 -4
- data/lib/usps_flags/generate.rb +48 -44
- data/lib/usps_flags/generate/flag.rb +33 -30
- data/lib/usps_flags/helpers.rb +48 -63
- data/lib/usps_flags/helpers/builders.rb +39 -37
- data/lib/usps_flags/helpers/spec_arrows.rb +16 -13
- data/spec/rational_spec.rb +9 -7
- data/spec/spec_helper.rb +5 -3
- data/spec/usps_flags/config_spec.rb +15 -13
- data/spec/usps_flags/core_spec.rb +52 -51
- data/spec/usps_flags/generate_spec.rb +70 -60
- data/spec/usps_flags/helpers_spec.rb +12 -10
- data/spec/usps_flags_spec.rb +22 -20
- data/usps_flags.gemspec +4 -2
- metadata +31 -21
data/spec/usps_flags_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe USPSFlags do
|
@@ -93,68 +95,68 @@ describe USPSFlags do
|
|
93
95
|
@flag = USPSFlags.new
|
94
96
|
end
|
95
97
|
|
96
|
-
describe
|
97
|
-
it
|
98
|
-
@flag.type =
|
99
|
-
expect(@flag.type).to eql(
|
98
|
+
describe 'constructor' do
|
99
|
+
it 'should update type' do
|
100
|
+
@flag.type = 'LtC'
|
101
|
+
expect(@flag.type).to eql('LtC')
|
100
102
|
end
|
101
103
|
|
102
|
-
it
|
104
|
+
it 'should update scale' do
|
103
105
|
@flag.scale = 4
|
104
106
|
expect(@flag.scale).to eql(4)
|
105
107
|
end
|
106
108
|
|
107
|
-
it
|
109
|
+
it 'should update field' do
|
108
110
|
@flag.field = false
|
109
111
|
expect(@flag.field).to eql(false)
|
110
112
|
end
|
111
113
|
|
112
|
-
it
|
114
|
+
it 'should update trim' do
|
113
115
|
@flag.trim = true
|
114
116
|
expect(@flag.trim).to eql(true)
|
115
117
|
end
|
116
118
|
|
117
|
-
it
|
119
|
+
it 'should correctly update svg_file' do
|
118
120
|
@flag.svg_file = "#{$tmp_alt_flags_dir}/SVG/output.svg"
|
119
121
|
expect(@flag.svg_file).to eql("#{$tmp_alt_flags_dir}/SVG/output.svg")
|
120
122
|
end
|
121
123
|
|
122
|
-
it
|
124
|
+
it 'should correctly update png_file' do
|
123
125
|
@flag.png_file = "#{$tmp_alt_flags_dir}/PNG/output.png"
|
124
126
|
expect(@flag.png_file).to eql("#{$tmp_alt_flags_dir}/PNG/output.png")
|
125
127
|
end
|
126
128
|
|
127
|
-
describe
|
129
|
+
describe 'as configured' do
|
128
130
|
before(:each) do
|
129
|
-
@flag.type =
|
131
|
+
@flag.type = 'LtC'
|
130
132
|
@flag.scale = 5
|
131
|
-
@flag.svg_file =
|
133
|
+
@flag.svg_file = ''
|
132
134
|
end
|
133
135
|
|
134
|
-
it
|
136
|
+
it 'should construct and generate a flag with a valid header' do
|
135
137
|
expect(@flag.svg).to include(@valid_header)
|
136
138
|
end
|
137
139
|
|
138
|
-
it
|
140
|
+
it 'should construct and generate a flag with a valid body' do
|
139
141
|
expect(@flag.svg).to include(@valid_body)
|
140
142
|
end
|
141
143
|
|
142
|
-
describe
|
143
|
-
it
|
144
|
-
expect { @flag.png }.to raise_error(USPSFlags::Errors::PNGGenerationError,
|
144
|
+
describe 'png' do
|
145
|
+
it 'should raise PNGGenerationError without png_file set' do
|
146
|
+
expect { @flag.png }.to raise_error(USPSFlags::Errors::PNGGenerationError, 'A path must be set with png_file.')
|
145
147
|
end
|
146
148
|
|
147
|
-
context
|
149
|
+
context 'with png_file set' do
|
148
150
|
before(:each) do
|
149
151
|
@flag.png_file = "#{$tmp_alt_flags_dir}/PNG/LtC.png"
|
150
152
|
::FileUtils.mkdir_p("#{$tmp_alt_flags_dir}/PNG/")
|
151
153
|
end
|
152
154
|
|
153
|
-
it
|
155
|
+
it 'should not raise PNGGenerationError with png_file set' do
|
154
156
|
expect { @flag.png }.to_not raise_error(USPSFlags::Errors::PNGGenerationError)
|
155
157
|
end
|
156
158
|
|
157
|
-
it
|
159
|
+
it 'should return the value of png_file' do
|
158
160
|
expect(@flag.png).to eql("#{$tmp_alt_flags_dir}/PNG/LtC.png")
|
159
161
|
end
|
160
162
|
end
|
data/usps_flags.gemspec
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = 'usps_flags'
|
3
|
-
s.version = '0.
|
4
|
-
s.date = '2019-
|
5
|
+
s.version = '0.4.0'
|
6
|
+
s.date = '2019-05-30'
|
5
7
|
s.summary = 'Flag generator for United States Power Squadrons'
|
6
8
|
s.description = 'A flag image (PNG, SVG) generator for United States Power Squadrons.'
|
7
9
|
s.homepage = 'http://rubygems.org/gems/usps_flags'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usps_flags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: file_utils
|
@@ -34,22 +34,22 @@ dependencies:
|
|
34
34
|
name: mini_magick
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 4.8.0
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '4.8'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 4.8.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 4.8.0
|
50
47
|
- - "~>"
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: '4.8'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 4.8.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rubyzip
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,22 +94,22 @@ dependencies:
|
|
94
94
|
name: rspec
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: 3.7.0
|
100
97
|
- - "~>"
|
101
98
|
- !ruby/object:Gem::Version
|
102
99
|
version: '3.7'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 3.7.0
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - ">="
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 3.7.0
|
110
107
|
- - "~>"
|
111
108
|
- !ruby/object:Gem::Version
|
112
109
|
version: '3.7'
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 3.7.0
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: simplecov
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -138,6 +138,7 @@ extra_rdoc_files: []
|
|
138
138
|
files:
|
139
139
|
- ".gitignore"
|
140
140
|
- ".rspec"
|
141
|
+
- ".rubocop.yml"
|
141
142
|
- ".travis.yml"
|
142
143
|
- ".yardopts"
|
143
144
|
- CONTRIBUTING.md
|
@@ -150,19 +151,27 @@ files:
|
|
150
151
|
- lib/usps_flags.rb
|
151
152
|
- lib/usps_flags/config.rb
|
152
153
|
- lib/usps_flags/core.rb
|
153
|
-
- lib/usps_flags/core/anchor.rb
|
154
|
-
- lib/usps_flags/core/binoculars.rb
|
155
154
|
- lib/usps_flags/core/ensign.rb
|
156
155
|
- lib/usps_flags/core/field.rb
|
157
156
|
- lib/usps_flags/core/footer.rb
|
158
157
|
- lib/usps_flags/core/headers.rb
|
159
|
-
- lib/usps_flags/core/
|
158
|
+
- lib/usps_flags/core/icons.rb
|
159
|
+
- lib/usps_flags/core/icons/anchor.rb
|
160
|
+
- lib/usps_flags/core/icons/binoculars.rb
|
161
|
+
- lib/usps_flags/core/icons/lighthouse.rb
|
162
|
+
- lib/usps_flags/core/icons/star.rb
|
163
|
+
- lib/usps_flags/core/icons/trident.rb
|
164
|
+
- lib/usps_flags/core/icons/trumpet.rb
|
160
165
|
- lib/usps_flags/core/pennant.rb
|
161
|
-
- lib/usps_flags/core/star.rb
|
162
|
-
- lib/usps_flags/core/trident.rb
|
163
166
|
- lib/usps_flags/core/trident_spec.rb
|
167
|
+
- lib/usps_flags/core/trident_specs.rb
|
168
|
+
- lib/usps_flags/core/trident_specs/base.rb
|
169
|
+
- lib/usps_flags/core/trident_specs/circle.rb
|
170
|
+
- lib/usps_flags/core/trident_specs/delta.rb
|
171
|
+
- lib/usps_flags/core/trident_specs/header.rb
|
172
|
+
- lib/usps_flags/core/trident_specs/long.rb
|
173
|
+
- lib/usps_flags/core/trident_specs/short.rb
|
164
174
|
- lib/usps_flags/core/tridents.rb
|
165
|
-
- lib/usps_flags/core/trumpet.rb
|
166
175
|
- lib/usps_flags/core/us.rb
|
167
176
|
- lib/usps_flags/core/us_defs.svg.partial
|
168
177
|
- lib/usps_flags/core/wheel.rb
|
@@ -202,7 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
211
|
- !ruby/object:Gem::Version
|
203
212
|
version: '0'
|
204
213
|
requirements: []
|
205
|
-
|
214
|
+
rubyforge_project:
|
215
|
+
rubygems_version: 2.7.6
|
206
216
|
signing_key:
|
207
217
|
specification_version: 4
|
208
218
|
summary: Flag generator for United States Power Squadrons
|