usps_flags-burgees 0.0.18 → 0.0.19

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: e924595309fe475b16a151406466760e90a8889e
4
- data.tar.gz: b6bef0c89ced76100d45386e0588a63c6bedb22c
3
+ metadata.gz: ab960bbef5e36df832cff4dc10508b0dde78fea1
4
+ data.tar.gz: fca43207fb7792abeda63a3c4795848593fa5d15
5
5
  SHA512:
6
- metadata.gz: 9e72621e3a485670cb967173e8204771ac803a76958a56aa722be44cc8dba69e818fc8a39022604b73ad1d70fe9b28aece8916390583ea1c341d1c065d81b95c
7
- data.tar.gz: 6db3514f4fc7ace6dd0aa8cdda6738828b890f78c163d2e9428d0d60443274fdd8e6affdabb156a1462ff199cdd78de2aa6d8a495a801a6528b82a9e38e36be5
6
+ metadata.gz: 3093ee22eca9203de1703ffc28523398f22cdcbee7a132cc8d630818a887599da38101165423ec78113adafeeab9baba282143f28f4355d6f319e2b81a797d83
7
+ data.tar.gz: 5079084c0b22e075a1e718bcb41a87e4645583f198b1bb132cf3a8bc4125e5af3a21093f1894ce3e883423727a5684825fd67d39f3b9546d67c8b184dcbb89f1
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-burgees (0.0.18)
4
+ usps_flags-burgees (0.0.19)
5
5
  usps_flags (~> 0.3, >= 0.3.18)
6
6
 
7
7
  GEM
@@ -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.18)
35
+ usps_flags (0.3.19)
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)
@@ -0,0 +1,28 @@
1
+ # Helper class for generating crossed-staves.
2
+ #
3
+ # @private
4
+ class USPSFlags::Burgees::Crossed
5
+ def self.generate(svg)
6
+ ensign = USPSFlags::Core::Ensign.new.svg
7
+ <<~SVG
8
+ <g transform="translate(2850, 200)">
9
+ <g id="crossed-flags" transform="translate(0, 250)">
10
+ <g id="flags">
11
+ <g id="burgee" transform="translate(3000) rotate(30)">
12
+ #{svg}
13
+ </g>
14
+
15
+ <g id="ensign" transform="scale(-0.9765625, 0.9765625) rotate(30)">
16
+ #{ensign}
17
+ </g>
18
+ </g>
19
+
20
+ <g id="flag-poles">
21
+ <rect fill="#041E42" x="0" y="0" width="150" height="4000" transform="rotate(-30)" />
22
+ <rect fill="#041E42" x="0" y="0" width="150" height="4000" transform="translate(2850) rotate(30, 150, 0)" />
23
+ </g>
24
+ </g>
25
+ </g>
26
+ SVG
27
+ end
28
+ end
@@ -6,6 +6,7 @@ require 'usps_flags/burgees/errors'
6
6
  class USPSFlags::Burgees
7
7
  require 'usps_flags/burgees/builtins'
8
8
  require 'usps_flags/burgees/customs'
9
+ require 'usps_flags/burgees/crossed'
9
10
 
10
11
  # List of available burgees.
11
12
  def self.available
@@ -41,13 +42,22 @@ class USPSFlags::Burgees
41
42
 
42
43
  # Generates the constructed file as SVG.
43
44
  #
45
+ # @params crossed Returns the burgee crossed-staves with the Ensign.
44
46
  # @return [String] Returns the SVG file output path, or the svg data if no path was specified.
45
- def svg
47
+ def svg(crossed: false)
46
48
  raise USPSFlags::Errors::UnknownBurgee unless USPSFlags::Burgees.available.include?(@squadron)
47
49
 
50
+ if crossed
51
+ burgee = crossed(@squadron)
52
+ header_opts = { width: 1200, height: 600, scale: 7.25 }
53
+ else
54
+ burgee = core(@squadron)
55
+ header_opts = {}
56
+ end
57
+
48
58
  @svg = <<~SVG
49
- #{USPSFlags::Core.headers(title: @title)}
50
- #{core(@squadron)}
59
+ #{USPSFlags::Core.headers(header_opts.merge(title: @title))}
60
+ #{burgee}
51
61
  #{USPSFlags::Core.footer}
52
62
  SVG
53
63
 
@@ -55,6 +65,7 @@ class USPSFlags::Burgees
55
65
  end
56
66
 
57
67
  private
68
+
58
69
  def core(burgee)
59
70
  if custom?(burgee)
60
71
  USPSFlags::Burgees::Customs.get(burgee)
@@ -63,6 +74,10 @@ class USPSFlags::Burgees
63
74
  end
64
75
  end
65
76
 
77
+ def crossed(burgee)
78
+ USPSFlags::Burgees::Crossed.generate(core(burgee))
79
+ end
80
+
66
81
  def custom?(burgee)
67
82
  USPSFlags::Burgees::Customs.available.include?(burgee)
68
83
  end
@@ -133,4 +133,14 @@ describe USPSFlags::Burgees do
133
133
 
134
134
  ::FileUtils.rm_rf(USPSFlags.configuration.burgees_dir)
135
135
  end
136
+
137
+ it "should generate a crossed-staves burgee" do
138
+ @burgee = USPSFlags::Burgees.new do |b|
139
+ b.squadron = :birmingham
140
+ b.outfile = ""
141
+ end
142
+
143
+ expect(@burgee.svg(crossed: true)).to include('<g id="crossed-flags"')
144
+ expect(@burgee.svg(crossed: true)).to include('<g id="flag-poles"')
145
+ end
136
146
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'usps_flags-burgees'
3
- s.version = '0.0.18'
4
- s.date = '2018-01-10'
3
+ s.version = '0.0.19'
4
+ s.date = '2018-02-25'
5
5
  s.summary = 'Flag generator for United States Power Squadrons burgees'
6
6
  s.description = 'An extension to the flag image (PNG, SVG) generator for United States Power Squadrons to generate burgees.'
7
7
  s.homepage = 'http://rubygems.org/gems/usps_flags-burgees'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps_flags-burgees
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
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: 2018-01-10 00:00:00.000000000 Z
33
+ date: 2018-02-25 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: usps_flags
@@ -134,6 +134,7 @@ files:
134
134
  - lib/usps_flags/burgees/builtins.rb
135
135
  - lib/usps_flags/burgees/builtins/birmingham.svg
136
136
  - lib/usps_flags/burgees/config.rb
137
+ - lib/usps_flags/burgees/crossed.rb
137
138
  - lib/usps_flags/burgees/customs.rb
138
139
  - lib/usps_flags/burgees/errors.rb
139
140
  - spec/spec_helper.rb
metadata.gz.sig CHANGED
Binary file