usps_flags-grades 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +5 -20
- data/lib/usps_flags/grades.rb +26 -4
- data/spec/usps_flags/grades_spec.rb +30 -8
- data/usps_flags-grades.gemspec +3 -6
- metadata +5 -33
- checksums.yaml.gz.sig +0 -3
- data.tar.gz.sig +0 -0
- data/certs/jfiander.pem +0 -26
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a5991abb508061d741c0e065757ecc32ddbd14e878d1203dd45785916f6e5f1
|
4
|
+
data.tar.gz: 6e53b7a1d08472ad0152747f96b236100c948142a995c845464e8125a3fe2ced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 011e2f9724320cfb0fb8b07fc8d2c00b3b813226bedb5c94a7dea12b34fd8b9d3c86bd6bfcad507305c0fe6d5f2b0be54a3a23dfe6701f086b89aa88acdf88da
|
7
|
+
data.tar.gz: 2b3ac1f555c1728eaf7dfeb1bdda2b0309d3a90e439b23c83803eb329a2f058f78580e71ca8eee7d79f3e66048f874949b7060956492615c41a3cd263e574218
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
usps_flags-grades (0.0.
|
5
|
-
usps_flags (~> 0.3, >= 0.3.
|
4
|
+
usps_flags-grades (0.0.7)
|
5
|
+
usps_flags (~> 0.3, >= 0.3.21)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
json (>= 1.8, < 3)
|
33
33
|
simplecov-html (~> 0.10.0)
|
34
34
|
simplecov-html (0.10.2)
|
35
|
-
usps_flags (0.3.
|
35
|
+
usps_flags (0.3.21)
|
36
36
|
file_utils (~> 1.1, >= 1.1.2)
|
37
37
|
mini_magick (~> 4.8, >= 4.8.0)
|
38
38
|
rubyzip (~> 1.2, >= 1.2.1)
|
data/README.md
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/760b824f0edac3316a11/test_coverage)](https://codeclimate.com/github/jfiander/usps-flags_grades/test_coverage)
|
6
6
|
[![Maintainability](https://api.codeclimate.com/v1/badges/760b824f0edac3316a11/maintainability)](https://codeclimate.com/github/jfiander/usps-flags_grades/maintainability)
|
7
7
|
|
8
|
-
An extension for [USPSFlags](https://github.com/jfiander/usps-flags) to generate
|
8
|
+
An extension for [USPSFlags](https://github.com/jfiander/usps-flags) to generate
|
9
|
+
regrade insignia.
|
9
10
|
|
10
11
|
## Usage
|
11
12
|
|
@@ -20,27 +21,11 @@ end
|
|
20
21
|
insignia.svg #=> Generates SVG file at "/path/to/svg/output.svg"
|
21
22
|
```
|
22
23
|
|
23
|
-
## Security
|
24
|
-
|
25
|
-
This gem is cryptographically signed. To be sure the gem code hasn’t been
|
26
|
-
tampered with:
|
27
|
-
|
28
|
-
Add my public key as a trusted certificate:
|
29
|
-
|
30
|
-
```sh
|
31
|
-
gem cert --add <(curl -Ls https://raw.github.com/jfiander/usps-flags_grades/master/certs/jfiander.pem)
|
32
|
-
```
|
33
|
-
|
34
|
-
Then install the gem securely:
|
35
|
-
|
36
|
-
```sh
|
37
|
-
gem install usps_flags-grades -P HighSecurity
|
38
|
-
```
|
39
|
-
|
40
24
|
## License
|
41
25
|
|
42
|
-
Actual images generated
|
43
|
-
|
26
|
+
Actual images generated are
|
27
|
+
[registered trademarks](http://www.usps.org/national/itcom/trademark.html) of
|
28
|
+
United States Power Squadrons.
|
44
29
|
|
45
30
|
This project is released under the
|
46
31
|
[GPLv3](https://raw.github.com/jfiander/usps-flags-grades/master/LICENSE).
|
data/lib/usps_flags/grades.rb
CHANGED
@@ -42,7 +42,7 @@ class USPSFlags::Grades
|
|
42
42
|
def svg
|
43
43
|
validate
|
44
44
|
@svg = <<~SVG
|
45
|
-
#{USPSFlags::Core.headers(title:
|
45
|
+
#{USPSFlags::Core.headers(title: title)}
|
46
46
|
<g transform="translate(0, 50)">
|
47
47
|
#{USPSFlags::Grades::Grade.get(@grade)}
|
48
48
|
#{USPSFlags::Grades::EdPro.get(@grade) if @edpro && USPSFlags::Grades::EdPro.for_grade(@grade)}
|
@@ -57,6 +57,9 @@ class USPSFlags::Grades
|
|
57
57
|
USPSFlags::Helpers.output(@svg, outfile: @outfile)
|
58
58
|
end
|
59
59
|
|
60
|
+
# Generates the descriptive title for the SVG.
|
61
|
+
#
|
62
|
+
# @return [String] Returns the descriptive title.
|
60
63
|
def title
|
61
64
|
grade = @grade.to_s.upcase
|
62
65
|
edpro = " - EdPro" if @edpro && @grade != :sn
|
@@ -71,9 +74,28 @@ class USPSFlags::Grades
|
|
71
74
|
end
|
72
75
|
|
73
76
|
private
|
77
|
+
|
74
78
|
def validate
|
75
|
-
|
76
|
-
|
77
|
-
|
79
|
+
validate_grade
|
80
|
+
validate_edpro
|
81
|
+
validate_membership
|
82
|
+
end
|
83
|
+
|
84
|
+
def validate_grade
|
85
|
+
return if @grade.nil? || USPSFlags::Grades::Grade.valid_grades.include?(@grade)
|
86
|
+
|
87
|
+
raise USPSFlags::Errors::InvalidInsignia, "Unknown grade: #{@grade}"
|
88
|
+
end
|
89
|
+
|
90
|
+
def validate_edpro
|
91
|
+
return if [true, false].include?(@edpro)
|
92
|
+
|
93
|
+
raise USPSFlags::Errors::InvalidInsignia, "EdPro must be boolean"
|
94
|
+
end
|
95
|
+
|
96
|
+
def validate_membership
|
97
|
+
return if [nil, :senior, :life].include?(@membership)
|
98
|
+
|
99
|
+
raise USPSFlags::Errors::InvalidInsignia, "Unknown membership level: #{@membership}"
|
78
100
|
end
|
79
101
|
end
|
@@ -1,14 +1,38 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe USPSFlags::Grades do
|
4
|
-
|
5
|
-
it "should raise USPSFlags::Errors::InvalidInsignia if an invalid
|
4
|
+
describe "invalid insignia" do
|
5
|
+
it "should raise USPSFlags::Errors::InvalidInsignia if an invalid grade is specified" do
|
6
6
|
@insignia = USPSFlags::Grades.new do |b|
|
7
7
|
b.grade = :not_a_grade
|
8
8
|
b.outfile = ""
|
9
9
|
end
|
10
10
|
|
11
|
-
expect { @insignia.svg }.to raise_error(
|
11
|
+
expect { @insignia.svg }.to raise_error(
|
12
|
+
USPSFlags::Errors::InvalidInsignia, "Unknown grade: not_a_grade"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should raise USPSFlags::Errors::InvalidInsignia if an invalid edpro is specified" do
|
17
|
+
@insignia = USPSFlags::Grades.new do |b|
|
18
|
+
b.edpro = nil
|
19
|
+
b.outfile = ""
|
20
|
+
end
|
21
|
+
|
22
|
+
expect { @insignia.svg }.to raise_error(
|
23
|
+
USPSFlags::Errors::InvalidInsignia, "EdPro must be boolean"
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should raise USPSFlags::Errors::InvalidInsignia if an invalid membership is specified" do
|
28
|
+
@insignia = USPSFlags::Grades.new do |b|
|
29
|
+
b.membership = :normal
|
30
|
+
b.outfile = ""
|
31
|
+
end
|
32
|
+
|
33
|
+
expect { @insignia.svg }.to raise_error(
|
34
|
+
USPSFlags::Errors::InvalidInsignia, "Unknown membership level: normal"
|
35
|
+
)
|
12
36
|
end
|
13
37
|
end
|
14
38
|
|
@@ -257,11 +281,8 @@ describe USPSFlags::Grades do
|
|
257
281
|
end
|
258
282
|
|
259
283
|
it "should have the SN insignia box" do
|
260
|
-
expect(@insignia.svg).to include(
|
261
|
-
|
262
|
-
<polyline points="20,-10 735,-10 735,150 20,150 20,-10" fill="none" stroke-width="15" stroke="#FFBF3F" />
|
263
|
-
SVG
|
264
|
-
)
|
284
|
+
expect(@insignia.svg).to include('<rect x="20" y="-10" width="')
|
285
|
+
expect(@insignia.svg).to include('" height="150" fill="none" stroke-width="15"')
|
265
286
|
end
|
266
287
|
|
267
288
|
it "should have a senior member arrow" do
|
@@ -270,6 +291,7 @@ describe USPSFlags::Grades do
|
|
270
291
|
<polyline points="0,250 75,220 75,240 150,240 150,260 75,260 75,280 0,250" fill="#FFBF3F" />
|
271
292
|
<polyline points="145,240 350,240 350,260 145,260 145,240" fill="#FFBF3F" />
|
272
293
|
<polyline points="400,240 610,240 610,260 400,260 400,240" fill="#FFBF3F" />
|
294
|
+
|
273
295
|
<polyline points="600,240 675,240 675,220 750,250 675,280 675,260 600,260 600,240" fill="#FFBF3F" />
|
274
296
|
|
275
297
|
<polyline points="325,200 350,200 375,275 400,200 425,200 390,300 360,300 325,200" fill="#FFBF3F" />
|
data/usps_flags-grades.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'usps_flags-grades'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2019-
|
3
|
+
s.version = '0.0.7'
|
4
|
+
s.date = '2019-02-08'
|
5
5
|
s.summary = 'Insignia generator for United States Power Squadrons'
|
6
6
|
s.description = 'An extension to the flag image (PNG, SVG) generator for United States Power Squadrons to generate grade insignia.'
|
7
7
|
s.homepage = 'http://rubygems.org/gems/usps_flags-grades'
|
@@ -12,12 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
14
14
|
|
15
|
-
s.cert_chain = ['certs/jfiander.pem']
|
16
|
-
s.signing_key = File.expand_path("~/.ssh/usps-flags-cert-2019.pem") if $0 =~ /gem\z/
|
17
|
-
|
18
15
|
s.required_ruby_version = '~> 2.4'
|
19
16
|
|
20
|
-
s.add_runtime_dependency 'usps_flags', '~> 0.3', '>= 0.3.
|
17
|
+
s.add_runtime_dependency 'usps_flags', '~> 0.3', '>= 0.3.21'
|
21
18
|
|
22
19
|
s.add_development_dependency 'rake', '~> 12.2', '>= 12.2.1'
|
23
20
|
s.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
|
metadata
CHANGED
@@ -1,41 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usps_flags-grades
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIEdDCCAtygAwIBAgIBATANBgkqhkiG9w0BAQsFADBAMRIwEAYDVQQDDAlqc2Zp
|
14
|
-
YW5kZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
15
|
-
bTAeFw0xOTAxMjMxNzM4MjVaFw0yMDAxMjMxNzM4MjVaMEAxEjAQBgNVBAMMCWpz
|
16
|
-
ZmlhbmRlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
17
|
-
Y29tMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEA1wNuP8liL/6u1CPf
|
18
|
-
mDHh3pQVrmjhoXrahUnCYpFNuxLtLr5uguhHYGK2pnUXmaJ5yECuMkYyNpdw5Cr0
|
19
|
-
DQXyQU3xLbZRvxBSYqzADxVsH/QYoxUkpSJCIY24eOa/5ri5VripMyB05C9J6xdM
|
20
|
-
Useylp5mkEwpw/0yHaniE93Bh3NOpQfN3leW6ipffavcExEI6/YSv6biqO7ksz+J
|
21
|
-
wlY8N96vldmd5f/Ha+R/Gu4o/u/8XsrJ9wGZHixHOMJVSweXEhUg+wnYC/r6vAqy
|
22
|
-
C8kxqqT47phSiODnuWMdC9JAgIXse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ICATE-----
|
38
|
-
date: 2019-01-23 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-08 00:00:00.000000000 Z
|
39
12
|
dependencies:
|
40
13
|
- !ruby/object:Gem::Dependency
|
41
14
|
name: usps_flags
|
@@ -46,7 +19,7 @@ dependencies:
|
|
46
19
|
version: '0.3'
|
47
20
|
- - ">="
|
48
21
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.3.
|
22
|
+
version: 0.3.21
|
50
23
|
type: :runtime
|
51
24
|
prerelease: false
|
52
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +29,7 @@ dependencies:
|
|
56
29
|
version: '0.3'
|
57
30
|
- - ">="
|
58
31
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.3.
|
32
|
+
version: 0.3.21
|
60
33
|
- !ruby/object:Gem::Dependency
|
61
34
|
name: rake
|
62
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,7 +107,6 @@ files:
|
|
134
107
|
- LICENSE
|
135
108
|
- README.md
|
136
109
|
- Rakefile
|
137
|
-
- certs/jfiander.pem
|
138
110
|
- lib/usps_flags/grades.rb
|
139
111
|
- lib/usps_flags/grades/config.rb
|
140
112
|
- lib/usps_flags/grades/edpro.rb
|
checksums.yaml.gz.sig
DELETED
data.tar.gz.sig
DELETED
Binary file
|
data/certs/jfiander.pem
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIEdDCCAtygAwIBAgIBATANBgkqhkiG9w0BAQsFADBAMRIwEAYDVQQDDAlqc2Zp
|
3
|
-
YW5kZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
4
|
-
bTAeFw0xOTAxMjMxNzM4MjVaFw0yMDAxMjMxNzM4MjVaMEAxEjAQBgNVBAMMCWpz
|
5
|
-
ZmlhbmRlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwE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