usps_flags 0.3.2 → 0.3.3

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: 942e55ca17285fbdb9c4fe12e43228591bd8a8ab
4
- data.tar.gz: 3bdfc5258b528ae4b69d759e18cadf42539cc18f
3
+ metadata.gz: ffd7af5feab5e3c542c9593a56fba66daeee999b
4
+ data.tar.gz: 07aeee695c11a2ec1c9d586531192a842d7a49f1
5
5
  SHA512:
6
- metadata.gz: d55585eb11f710f9486a784f2867b31d1a78669baccf9f2c58cfbfbdbe5994c767c830b7ea03d7115e479c4fdd923193a6550df60a51bf0e3d2e09cd6ecb5c5c
7
- data.tar.gz: ef662fc64315e1bb319cdbc8ef8a4745a222849f04f01d23a854fff098c042fefdf950c2f8bf17259b796b8265e9963c732427aa81d92e04ceeb2f1f7ae26a94
6
+ metadata.gz: 0210cd18bc48da7d8ec1760e6334b5fd27c1599435db6d27403a515e0553e493eba653ce7b29dc43b9348467d7cba7efd35199ad24a0a9d488a84a0b9283ae41
7
+ data.tar.gz: 25ffd187580ea85831a9cb188bc3e7eaaae6efd1528c7c8986392bce905b35c4313241708e2ee700e230ddf1b442fe6d18a590e18ce069be0d2e895f434292a0
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1 @@
1
- \����/�?���e��_^uU9�v��ʭ��UI��$5�V�p2>�;�w�*?��8��w/�21S�^�7��#�ni[�֎���R�$H+�qb��vGa�}R$?`�.��
2
- �s��A��"F���xg��%Mw�?L�E.+m�p�"��R����d���
3
- ��a]o�?� ,��'<�� ��?�B�px�űv=@#&�3�T�fs�{@{�A������n���鳰#2 ��S��x�~�c1����̎O�
1
+ g��Ů�۴dg�>>��w��QU%��:��n>kQ��^J��j��w���f ]L��yZd��YL�}!���
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps_flags (0.3.1)
4
+ usps_flags (0.3.2)
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)
@@ -40,12 +40,7 @@ class USPSFlags::Config
40
40
  bar_width = USPSFlags::Config::BASE_FLY/48
41
41
  bar_width = bar_width*5/4 if self.use_larger_tridents
42
42
  {
43
- height: {
44
- s: USPSFlags::Config::BASE_HOIST/2,
45
- d: USPSFlags::Config::BASE_HOIST*5/8,
46
- stf: USPSFlags::Config::BASE_HOIST*3/4,
47
- n: USPSFlags::Config::BASE_HOIST*3/4
48
- },
43
+ height: trident_heights,
49
44
 
50
45
  center_point: BASE_FLY/2,
51
46
 
@@ -136,4 +131,13 @@ class USPSFlags::Config
136
131
  @@use_larger_tridents = @use_larger_tridents
137
132
  @@log_fail_quietly = @log_fail_quietly
138
133
  end
134
+
135
+ def trident_heights
136
+ {
137
+ s: USPSFlags::Config::BASE_HOIST/2,
138
+ d: USPSFlags::Config::BASE_HOIST*5/8,
139
+ stf: USPSFlags::Config::BASE_HOIST*3/4,
140
+ n: USPSFlags::Config::BASE_HOIST*3/4
141
+ }
142
+ end
139
143
  end
@@ -4,7 +4,22 @@
4
4
  # @private
5
5
  class USPSFlags::Core::Ensign
6
6
  def svg
7
- field = <<~SVG
7
+ <<~SVG
8
+ #{stripes}
9
+ <g transform="scale(0.3675)">
10
+ <g transform="translate(1200, 600)">
11
+ <g transform="rotate(-45, 693, 1500)">
12
+ #{USPSFlags::Core::Anchor.new(color: :white).svg}
13
+ </g>
14
+ </g>
15
+ </g>
16
+ #{star_circle}
17
+ SVG
18
+ end
19
+
20
+ private
21
+ def stripes
22
+ <<~SVG
8
23
  <rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY/13}" height="#{USPSFlags::Config::BASE_HOIST}" fill="#{USPSFlags::Config::BLUE}" />
9
24
  <rect x="#{USPSFlags::Config::BASE_FLY*1/13}" y="0" width="#{USPSFlags::Config::BASE_FLY/13}" height="#{USPSFlags::Config::BASE_HOIST}" fill="#FFFFFF" />
10
25
  <rect x="#{USPSFlags::Config::BASE_FLY*2/13}" y="0" width="#{USPSFlags::Config::BASE_FLY/13}" height="#{USPSFlags::Config::BASE_HOIST}" fill="#{USPSFlags::Config::BLUE}" />
@@ -21,13 +36,13 @@ class USPSFlags::Core::Ensign
21
36
  <rect x="0" y="0" width="#{USPSFlags::Config::BASE_FLY*6/13}" height="1000" fill="#{USPSFlags::Config::RED}" />
22
37
  SVG
23
38
  # <circle cx="#{USPSFlags::Config::BASE_FLY*3/13}" cy="#{USPSFlags::Config::BASE_HOIST/4}" r="#{USPSFlags::Config::BASE_FLY*6/13*5/16}" fill="#FFFFFF" fill-opacity="0.6" />
39
+ end
24
40
 
25
- anchor = USPSFlags::Core::Anchor.new(color: :white).svg
26
-
27
- star_circle = ""
41
+ def star_circle
42
+ svg = ""
28
43
  (0..13).each do |i|
29
44
  rotation = i * (360.0 / 13)
30
- star_circle << <<~SVG
45
+ svg << <<~SVG
31
46
  <g transform="scale(0.375)">
32
47
  <g transform="translate(1885, 465)">
33
48
  <g transform="rotate(#{rotation}, 0, 900)">
@@ -37,17 +52,6 @@ class USPSFlags::Core::Ensign
37
52
  </g>
38
53
  SVG
39
54
  end
40
-
41
- <<~SVG
42
- #{field}
43
- <g transform="scale(0.3675)">
44
- <g transform="translate(1200, 600)">
45
- <g transform="rotate(-45, 693, 1500)">
46
- #{anchor}
47
- </g>
48
- </g>
49
- </g>
50
- #{star_circle}
51
- SVG
55
+ svg
52
56
  end
53
57
  end
@@ -11,36 +11,43 @@ class USPSFlags::Core::Pennant
11
11
 
12
12
  def svg
13
13
  if @type == "OIC"
14
- svg = <<~SVG
15
- <polyline fill="#{USPSFlags::Config::BLUE}" points="0 0 #{USPSFlags::Config::BASE_FLY} #{USPSFlags::Config::BASE_HOIST/8} 0 #{USPSFlags::Config::BASE_HOIST/4}" />
16
- SVG
14
+ svg = oic
17
15
  elsif @type == "CRUISE"
18
- svg = <<~SVG
19
- <path d="M 0 0
20
- l #{@fly*10/36} #{@hoist*5/36}
21
- l 0 #{@hoist*26/36}
22
- l -#{@fly*10/36} #{@hoist*5/36}
23
- " fill="#{USPSFlags::Config::RED}" />
24
- <path d="M #{@fly*10/36} #{@hoist*5/36}
25
- l #{@fly*11/36} #{@hoist*5.5/36}
26
- l 0 #{@hoist*15/36}
27
- l -#{@fly*11/36} #{@hoist*5.5/36}
28
- " fill="#FFFFFF" />
29
- <path d="M #{@fly*21/36} #{@hoist*10.5/36}
30
- l #{@fly*15/36} #{@hoist*7.5/36}
31
- l -#{@fly*15/36} #{@hoist*7.5/36}
32
- " fill="#{USPSFlags::Config::BLUE}" />
33
- <path d="M 0 0
34
- l #{@fly} #{@hoist/2}
35
- l -#{@fly} #{@hoist/2}
36
- " fill="none" stroke="#000000" stroke-width="2" />
16
+ svg << <<~SVG
17
+ #{cruise}
18
+ <g transform=\"translate(385, 340)\">
19
+ #{USPSFlags::Core::Star.new.svg}
20
+ </g>"
37
21
  SVG
22
+ end
23
+ end
38
24
 
39
- svg << "<g transform=\"translate(385, 340)\">"
40
- svg << USPSFlags::Core::Star.new.svg
41
- svg << "</g>"
25
+ def oic
26
+ <<~SVG
27
+ <polyline fill="#{USPSFlags::Config::BLUE}" points="0 0 #{USPSFlags::Config::BASE_FLY} #{USPSFlags::Config::BASE_HOIST/8} 0 #{USPSFlags::Config::BASE_HOIST/4}" />
28
+ SVG
29
+ end
42
30
 
43
- svg
44
- end
31
+ def cruise
32
+ <<~SVG
33
+ <path d="M 0 0
34
+ l #{@fly*10/36} #{@hoist*5/36}
35
+ l 0 #{@hoist*26/36}
36
+ l -#{@fly*10/36} #{@hoist*5/36}
37
+ " fill="#{USPSFlags::Config::RED}" />
38
+ <path d="M #{@fly*10/36} #{@hoist*5/36}
39
+ l #{@fly*11/36} #{@hoist*5.5/36}
40
+ l 0 #{@hoist*15/36}
41
+ l -#{@fly*11/36} #{@hoist*5.5/36}
42
+ " fill="#FFFFFF" />
43
+ <path d="M #{@fly*21/36} #{@hoist*10.5/36}
44
+ l #{@fly*15/36} #{@hoist*7.5/36}
45
+ l -#{@fly*15/36} #{@hoist*7.5/36}
46
+ " fill="#{USPSFlags::Config::BLUE}" />
47
+ <path d="M 0 0
48
+ l #{@fly} #{@hoist/2}
49
+ l -#{@fly} #{@hoist/2}
50
+ " fill="none" stroke="#000000" stroke-width="2" />
51
+ SVG
45
52
  end
46
53
  end
@@ -12,23 +12,7 @@ class USPSFlags::Core::US
12
12
 
13
13
  star_offset = 20 # Half of scaled star height
14
14
 
15
- svg = ""
16
- svg << <<~SVG
17
- <rect x="0" y="0" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
18
- <rect x="0" y="#{base_hoist*1/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
19
- <rect x="0" y="#{base_hoist*2/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
20
- <rect x="0" y="#{base_hoist*3/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
21
- <rect x="0" y="#{base_hoist*4/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
22
- <rect x="0" y="#{base_hoist*5/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
23
- <rect x="0" y="#{base_hoist*6/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
24
- <rect x="0" y="#{base_hoist*7/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
25
- <rect x="0" y="#{base_hoist*8/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
26
- <rect x="0" y="#{base_hoist*9/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
27
- <rect x="0" y="#{base_hoist*10/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
28
- <rect x="0" y="#{base_hoist*11/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
29
- <rect x="0" y="#{base_hoist*12/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
30
- <rect x="0" y="0" width="#{canton_fly}" height="#{canton_hoist}" fill="#{USPSFlags::Config::BLUE}" />
31
- SVG
15
+ svg = stripes
32
16
 
33
17
  [1,3,5,7,9].each do |r|
34
18
  [1,3,5,7,9,11].each do |c|
@@ -53,4 +37,24 @@ class USPSFlags::Core::US
53
37
 
54
38
  svg
55
39
  end
40
+
41
+ private
42
+ def stripes
43
+ <<~SVG
44
+ <rect x="0" y="0" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
45
+ <rect x="0" y="#{base_hoist*1/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
46
+ <rect x="0" y="#{base_hoist*2/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
47
+ <rect x="0" y="#{base_hoist*3/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
48
+ <rect x="0" y="#{base_hoist*4/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
49
+ <rect x="0" y="#{base_hoist*5/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
50
+ <rect x="0" y="#{base_hoist*6/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
51
+ <rect x="0" y="#{base_hoist*7/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
52
+ <rect x="0" y="#{base_hoist*8/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
53
+ <rect x="0" y="#{base_hoist*9/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
54
+ <rect x="0" y="#{base_hoist*10/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
55
+ <rect x="0" y="#{base_hoist*11/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#FFFFFF" />
56
+ <rect x="0" y="#{base_hoist*12/13}" width="#{base_fly}" height="#{base_hoist/13}" fill="#{USPSFlags::Config::RED}" />
57
+ <rect x="0" y="0" width="#{canton_fly}" height="#{canton_hoist}" fill="#{USPSFlags::Config::BLUE}" />
58
+ SVG
59
+ end
56
60
  end
data/usps_flags.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'usps_flags'
3
- s.version = '0.3.2'
3
+ s.version = '0.3.3'
4
4
  s.date = '2017-11-06'
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.'
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.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
metadata.gz.sig CHANGED
Binary file