usps_flags-burgees 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 8348e7ae4aec5a1ca44f6099e807337141268abed42e206b6526609491942271
4
- data.tar.gz: b4e2c5334fa9da38d8b1766dca00db8b20616dc64052f10475cdd07794ccefd1
3
+ metadata.gz: c6513c7d9bdaa937224b6e6986f9911ee29b91d26538f60d23978cd178b47f1c
4
+ data.tar.gz: c0e2f7aa09c313804aa7e281fc96dce72cbe832fcf109489a1edc133b625a732
5
5
  SHA512:
6
- metadata.gz: 7665bd2eef059d87b1d946b57ba611b269be113045c95c74a20de12faca60582e8c69af033a8688e31ea226dbc99f97310cb66b70fe2e17225c09da40dc6a0a6
7
- data.tar.gz: 3a4a6fc7f18ed80b9697c20c17b7ddb85c05c6959475ee6327ecd8b39405be25a07b07b80b1c2e565c96082d38bc0d52e5b90f664bb9b1786421c4cb1dc488d7
6
+ metadata.gz: 3676b5be6aad784c0752f51084e96f7c9f209469b693e0f2f14ae566798df5d793362c2259eeefd04014fa8c2e74e6bcdde9862dbd03fad6723428b12bdb967a
7
+ data.tar.gz: 979267d9112678abd1697c1eae155babe19a1a18af9e896eb2bbe0227dee21b90bdd39ff618c726e9cc6074482caea79ac9e75e50a19f8b8b0de568eb72e23e3
data/.rubocop.yml ADDED
@@ -0,0 +1,95 @@
1
+ require: rubocop-rspec
2
+ AllCops:
3
+ TargetRubyVersion: 2.5
4
+ Exclude:
5
+ - lib/output/*
6
+ - tmp/**/*
7
+ - vendor/**/*
8
+
9
+ Layout/IndentFirstHashElement:
10
+ EnforcedStyle: consistent
11
+ Layout/AccessModifierIndentation:
12
+ EnforcedStyle: outdent
13
+ Layout/EmptyLinesAroundAccessModifier:
14
+ Enabled: true
15
+ Layout/AlignArray:
16
+ Enabled: true
17
+ Layout/AlignHash:
18
+ Enabled: true
19
+ Layout/EmptyLineAfterGuardClause:
20
+ Enabled: true
21
+ Layout/SpaceInsideBlockBraces:
22
+ EnforcedStyle: space
23
+ EnforcedStyleForEmptyBraces: no_space
24
+ Layout/SpaceInsideHashLiteralBraces:
25
+ EnforcedStyle: space
26
+ EnforcedStyleForEmptyBraces: no_space
27
+ Layout/SpaceInsideArrayLiteralBrackets:
28
+ EnforcedStyle: no_space
29
+ Layout/EndAlignment:
30
+ EnforcedStyleAlignWith: start_of_line
31
+
32
+ Lint/UnusedMethodArgument:
33
+ Enabled: true
34
+ Lint/UselessAssignment:
35
+ Enabled: true
36
+
37
+ Metrics/BlockLength:
38
+ Exclude:
39
+ - 'spec/**/*.rb'
40
+ Metrics/LineLength:
41
+ Max: 120
42
+ Metrics/MethodLength:
43
+ Enabled: true
44
+ Metrics/ClassLength:
45
+ Enabled: true
46
+ Max: 125
47
+ Metrics/ParameterLists:
48
+ Enabled: true
49
+ Metrics/CyclomaticComplexity:
50
+ Enabled: true
51
+ Metrics/AbcSize:
52
+ Enabled: true
53
+
54
+ Naming/UncommunicativeMethodParamName:
55
+ Enabled: false
56
+ Naming/AccessorMethodName:
57
+ Enabled: false
58
+
59
+ RSpec/MessageSpies:
60
+ EnforcedStyle: receive
61
+ RSpec/InstanceVariable:
62
+ Enabled: false
63
+ RSpec/NestedGroups:
64
+ Enabled: false
65
+ RSpec/ExampleLength:
66
+ Enabled: false
67
+
68
+ Style/Documentation:
69
+ Enabled: false
70
+ Style/FrozenStringLiteralComment:
71
+ Enabled: true
72
+ Style/NumericLiterals:
73
+ Enabled: true
74
+ Style/StringLiterals:
75
+ EnforcedStyle: single_quotes
76
+ Style/AndOr:
77
+ Enabled: true
78
+ Style/ClassCheck:
79
+ Enabled: true
80
+ Style/GuardClause:
81
+ Enabled: true
82
+ Style/ClassAndModuleChildren:
83
+ EnforcedStyle: nested
84
+ Style/GlobalVars:
85
+ Exclude:
86
+ - 'spec/**/*.rb'
87
+ Style/ParallelAssignment:
88
+ Enabled: false
89
+
90
+ Security/Eval:
91
+ Enabled: true
92
+ Security/JSONLoad:
93
+ Enabled: true
94
+ Security/YAMLLoad:
95
+ Enabled: true
data/.travis.yml CHANGED
@@ -8,3 +8,6 @@ notifications:
8
8
  email:
9
9
  on_success: change
10
10
  on_failure: always
11
+ script:
12
+ - bundle exec rubocop
13
+ - bundle exec rspec
data/Gemfile.lock CHANGED
@@ -1,17 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps_flags-burgees (0.1.1)
4
+ usps_flags-burgees (0.1.2)
5
5
  usps_flags (~> 0.5, >= 0.5.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ ast (2.4.0)
10
11
  diff-lcs (1.3)
11
12
  docile (1.3.1)
12
13
  file_utils (1.1.2)
14
+ jaro_winkler (1.5.2)
13
15
  json (2.2.0)
14
16
  mini_magick (4.9.3)
17
+ parallel (1.17.0)
18
+ parser (2.6.3.0)
19
+ ast (~> 2.4.0)
20
+ rainbow (3.0.0)
15
21
  rake (12.3.2)
16
22
  rspec (3.8.0)
17
23
  rspec-core (~> 3.8.0)
@@ -26,12 +32,23 @@ GEM
26
32
  diff-lcs (>= 1.2.0, < 2.0)
27
33
  rspec-support (~> 3.8.0)
28
34
  rspec-support (3.8.0)
35
+ rubocop (0.71.0)
36
+ jaro_winkler (~> 1.5.1)
37
+ parallel (~> 1.10)
38
+ parser (>= 2.6)
39
+ rainbow (>= 2.2.2, < 4.0)
40
+ ruby-progressbar (~> 1.7)
41
+ unicode-display_width (>= 1.4.0, < 1.7)
42
+ rubocop-rspec (1.33.0)
43
+ rubocop (>= 0.60.0)
44
+ ruby-progressbar (1.10.1)
29
45
  rubyzip (1.2.3)
30
46
  simplecov (0.16.1)
31
47
  docile (~> 1.1)
32
48
  json (>= 1.8, < 3)
33
49
  simplecov-html (~> 0.10.0)
34
50
  simplecov-html (0.10.2)
51
+ unicode-display_width (1.6.0)
35
52
  usps_flags (0.5.1)
36
53
  file_utils (~> 1.1, >= 1.1.2)
37
54
  mini_magick (~> 4.8, >= 4.8.0)
@@ -43,6 +60,8 @@ PLATFORMS
43
60
  DEPENDENCIES
44
61
  rake (~> 12.2, >= 12.2.1)
45
62
  rspec (~> 3.7, >= 3.7.0)
63
+ rubocop (~> 0.71, >= 0.71.0)
64
+ rubocop-rspec (~> 1.30, >= 1.30.0)
46
65
  simplecov (~> 0.15, >= 0.15.1)
47
66
  usps_flags-burgees!
48
67
 
@@ -3,18 +3,22 @@
3
3
  # Helper class for handling built-in burgees.
4
4
  #
5
5
  # @private
6
- class USPSFlags::Burgees::Builtins
7
- @@builtins_dir = "#{File.expand_path(File.dirname(__FILE__))}/builtins"
6
+ class USPSFlags
7
+ class Burgees
8
+ class Builtins
9
+ @builtins_dir = "#{__dir__}/builtins"
8
10
 
9
- def self.available
10
- Dir.glob("#{@@builtins_dir}/**/*.svg").map { |b|
11
- b.split('/').last.split('.svg').first
12
- }.map(&:to_sym)
13
- end
11
+ def self.available
12
+ Dir.glob("#{@builtins_dir}/**/*.svg").map do |b|
13
+ b.split('/').last.split('.svg').first
14
+ end.map(&:to_sym)
15
+ end
14
16
 
15
- def self.get(burgee)
16
- raise USPSFlags::Errors::UnknownBurgee "Looked in #{@@builtins_dir}" unless self.available.include?(burgee)
17
+ def self.get(burgee)
18
+ raise USPSFlags::Errors::UnknownBurgee "Looked in #{@builtins_dir}" unless available.include?(burgee)
17
19
 
18
- ::File.read("#{@@builtins_dir}/#{burgee}.svg")
20
+ ::File.read("#{@builtins_dir}/#{burgee}.svg")
21
+ end
22
+ end
19
23
  end
20
24
  end
@@ -3,18 +3,22 @@
3
3
  # Extension of USPSFlags::Config to allow including custom burgee files.
4
4
  #
5
5
  # @private
6
- class USPSFlags::Config
7
- attr_accessor :burgees_dir
6
+ class USPSFlags
7
+ class Config
8
+ attr_writer :burgees_dir
8
9
 
9
- def initialize
10
- get_defaults
11
- get_extension_defaults
12
- yield self if block_given?
13
- end
14
-
15
- private
10
+ def initialize
11
+ get_defaults
12
+ burgees_dir
13
+ yield self if block_given?
14
+ end
16
15
 
17
- def get_extension_defaults
18
- @burgees_dir ||= defined?(::Rails) ? "#{::Rails.root}/app/lib/usps-burgees" : "#{File.dirname(__dir__)}/output"
16
+ def burgees_dir
17
+ @burgees_dir ||= if defined?(::Rails)
18
+ "#{::Rails.root}/app/lib/usps-burgees"
19
+ else
20
+ "#{File.dirname(__dir__)}/output"
21
+ end
22
+ end
19
23
  end
20
24
  end
@@ -3,28 +3,32 @@
3
3
  # Helper class for generating crossed-staves.
4
4
  #
5
5
  # @private
6
- class USPSFlags::Burgees::Crossed
7
- def self.generate(svg)
8
- ensign = USPSFlags::Core::Ensign.new.svg
9
- <<~SVG
10
- <g transform="translate(2850, 200)">
11
- <g id="crossed-flags" transform="translate(0, 250)">
12
- <g id="flags">
13
- <g id="burgee" transform="translate(3000) rotate(30)">
14
- #{svg}
15
- </g>
6
+ class USPSFlags
7
+ class Burgees
8
+ class Crossed
9
+ def self.generate(svg)
10
+ ensign = USPSFlags::Core::Ensign.new.svg
11
+ <<~SVG
12
+ <g transform="translate(2850, 200)">
13
+ <g id="crossed-flags" transform="translate(0, 250)">
14
+ <g id="flags">
15
+ <g id="burgee" transform="translate(3000) rotate(30)">
16
+ #{svg}
17
+ </g>
16
18
 
17
- <g id="ensign" transform="scale(-0.9765625, 0.9765625) rotate(30)">
18
- #{ensign}
19
- </g>
20
- </g>
19
+ <g id="ensign" transform="scale(-0.9765625, 0.9765625) rotate(30)">
20
+ #{ensign}
21
+ </g>
22
+ </g>
21
23
 
22
- <g id="flag-poles">
23
- <rect fill="#041E42" x="0" y="0" width="150" height="4000" transform="rotate(-30)" />
24
- <rect fill="#041E42" x="0" y="0" width="150" height="4000" transform="translate(2850) rotate(30, 150, 0)" />
24
+ <g id="flag-poles">
25
+ <rect fill="#041E42" x="0" y="0" width="150" height="4000" transform="rotate(-30)" />
26
+ <rect fill="#041E42" x="0" y="0" width="150" height="4000" transform="translate(2850) rotate(30, 150, 0)" />
27
+ </g>
28
+ </g>
25
29
  </g>
26
- </g>
27
- </g>
28
- SVG
30
+ SVG
31
+ end
32
+ end
29
33
  end
30
34
  end
@@ -3,16 +3,20 @@
3
3
  # Helper class for handling user-provided burgees.
4
4
  #
5
5
  # @private
6
- class USPSFlags::Burgees::Customs
7
- def self.available
8
- Dir.glob("#{USPSFlags.configuration.burgees_dir}/**/*.svg").map do |b|
9
- b.split('/').last.split('.svg').first.to_sym
10
- end
11
- end
6
+ class USPSFlags
7
+ class Burgees
8
+ class Customs
9
+ def self.available
10
+ Dir.glob("#{USPSFlags.configuration.burgees_dir}/**/*.svg").map do |b|
11
+ b.split('/').last.split('.svg').first.to_sym
12
+ end
13
+ end
12
14
 
13
- def self.get(burgee)
14
- raise USPSFlags::Errors::UnknownBurgee unless self.available.include?(burgee)
15
+ def self.get(burgee)
16
+ raise USPSFlags::Errors::UnknownBurgee unless available.include?(burgee)
15
17
 
16
- ::File.read("#{USPSFlags.configuration.burgees_dir}/#{burgee}.svg")
18
+ ::File.read("#{USPSFlags.configuration.burgees_dir}/#{burgee}.svg")
19
+ end
20
+ end
17
21
  end
18
22
  end
@@ -5,90 +5,91 @@ require 'usps_flags/burgees/config'
5
5
  require 'usps_flags/burgees/errors'
6
6
 
7
7
  # Main class for generating burgees.
8
- class USPSFlags::Burgees
9
- require 'usps_flags/burgees/builtins'
10
- require 'usps_flags/burgees/customs'
11
- require 'usps_flags/burgees/crossed'
8
+ class USPSFlags
9
+ class Burgees
10
+ require 'usps_flags/burgees/builtins'
11
+ require 'usps_flags/burgees/customs'
12
+ require 'usps_flags/burgees/crossed'
12
13
 
13
- # List of available burgees.
14
- def self.available
15
- (USPSFlags::Burgees::Builtins.available + USPSFlags::Burgees::Customs.available).uniq
16
- end
14
+ # List of available burgees.
15
+ def self.available
16
+ (USPSFlags::Burgees::Builtins.available + USPSFlags::Burgees::Customs.available).uniq
17
+ end
17
18
 
18
- # Constructor for generating burgees.
19
- #
20
- # @example Generate Birmingham's burgee
21
- # burgee = USPSFlags::Burgee.new do |b|
22
- # b.type = :birmingham
23
- # b.outfile = "/path/to/svg/output.svg"
24
- # end
25
- #
26
- # burgee.svg #=> Generates SVG file at "/path/to/svg/output.svg"
27
- def initialize
28
- @squadron = nil
29
- @outfile = nil
30
- # @width = 3000
31
- # @height = 2000
32
- @title = nil
33
- @generated_at = Time.now.strftime('%Y%m%d.%H%S%z')
34
- yield self if block_given?
35
- @title ||= title(@squadron)
36
- end
19
+ # Constructor for generating burgees.
20
+ #
21
+ # @example Generate Birmingham's burgee
22
+ # burgee = USPSFlags::Burgee.new do |b|
23
+ # b.type = :birmingham
24
+ # b.outfile = "/path/to/svg/output.svg"
25
+ # end
26
+ #
27
+ # burgee.svg #=> Generates SVG file at "/path/to/svg/output.svg"
28
+ def initialize(options = {})
29
+ @squadron = options[:squadron]
30
+ @outfile = options[:outfile]
31
+ # @width = 3000
32
+ # @height = 2000
33
+ @title = options[:title]
34
+ @generated_at = Time.now.strftime('%Y%m%d.%H%S%z')
35
+ yield self if block_given?
36
+ @title ||= format_title(@squadron)
37
+ end
37
38
 
38
- attr_accessor :squadron
39
- attr_accessor :outfile
40
- # attr_accessor :width
41
- # attr_accessor :height
42
- attr_accessor :title
43
- attr_accessor :outfile
39
+ attr_accessor :squadron
40
+ attr_accessor :outfile
41
+ # attr_accessor :width
42
+ # attr_accessor :height
43
+ attr_accessor :title
44
44
 
45
- # Generates the constructed file as SVG.
46
- #
47
- # @params crossed Returns the burgee crossed-staves with the Ensign.
48
- # @return [String] Returns the SVG file output path, or the svg data if no path was specified.
49
- def svg(crossed: false)
50
- raise USPSFlags::Errors::UnknownBurgee unless USPSFlags::Burgees.available.include?(@squadron)
45
+ # Generates the constructed file as SVG.
46
+ #
47
+ # @params crossed Returns the burgee crossed-staves with the Ensign.
48
+ # @return [String] Returns the SVG file output path, or the svg data if no path was specified.
49
+ def svg(crossed: false)
50
+ raise USPSFlags::Errors::UnknownBurgee unless USPSFlags::Burgees.available.include?(@squadron)
51
51
 
52
- burgee = crossed ? crossed(@squadron) : core(@squadron)
53
- header_opts = crossed ? { width: 1200, height: 600, scale: 7.25 } : {}
52
+ burgee = crossed ? crossed(@squadron) : core(@squadron)
53
+ header_opts = crossed ? { width: 1200, height: 600, scale: 7.25 } : {}
54
54
 
55
- @svg = <<~SVG
56
- #{USPSFlags::Core.headers(header_opts.merge(title: @title))}
57
- #{burgee}
58
- #{USPSFlags::Core.footer}
59
- SVG
55
+ @svg = <<~SVG
56
+ #{USPSFlags::Core.headers(header_opts.merge(title: @title))}
57
+ #{burgee}
58
+ #{USPSFlags::Core.footer}
59
+ SVG
60
60
 
61
- USPSFlags::Helpers.output(@svg, outfile: @outfile)
62
- end
61
+ USPSFlags::Helpers.output(@svg, outfile: @outfile)
62
+ end
63
63
 
64
- private
64
+ private
65
65
 
66
- def core(burgee)
67
- if custom?(burgee)
68
- USPSFlags::Burgees::Customs.get(burgee)
69
- elsif builtin?(burgee)
70
- USPSFlags::Burgees::Builtins.get(burgee)
66
+ def core(burgee)
67
+ if custom?(burgee)
68
+ USPSFlags::Burgees::Customs.get(burgee)
69
+ elsif builtin?(burgee)
70
+ USPSFlags::Burgees::Builtins.get(burgee)
71
+ end
71
72
  end
72
- end
73
73
 
74
- def crossed(burgee)
75
- USPSFlags::Burgees::Crossed.generate(core(burgee))
76
- end
74
+ def crossed(burgee)
75
+ USPSFlags::Burgees::Crossed.generate(core(burgee))
76
+ end
77
77
 
78
- def custom?(burgee)
79
- USPSFlags::Burgees::Customs.available.include?(burgee)
80
- end
78
+ def custom?(burgee)
79
+ USPSFlags::Burgees::Customs.available.include?(burgee)
80
+ end
81
81
 
82
- def builtin?(burgee)
83
- USPSFlags::Burgees::Builtins.available.include?(burgee)
84
- end
82
+ def builtin?(burgee)
83
+ USPSFlags::Burgees::Builtins.available.include?(burgee)
84
+ end
85
85
 
86
- def title(burgee)
87
- burgee_string = burgee.to_s
88
- if burgee_string.match?(/_/)
89
- burgee_string.gsub('_', ' ').split(' ').map { |word| word.capitalize }.join(' ') + ' Burgee'
90
- else
91
- "#{burgee_string.capitalize} Burgee"
86
+ def format_title(burgee)
87
+ burgee_string = burgee.to_s
88
+ if burgee_string.match?(/_/)
89
+ burgee_string.gsub('_', ' ').split(' ').map(&:capitalize).join(' ') + ' Burgee'
90
+ else
91
+ "#{burgee_string.capitalize} Burgee"
92
+ end
92
93
  end
93
94
  end
94
95
  end
@@ -3,12 +3,12 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe USPSFlags::Burgees do
6
- it 'should return the list of available burgees from available' do
7
- expect(USPSFlags::Burgees.available).to eql([:birmingham])
6
+ it 'returns the list of available burgees from available' do
7
+ expect(described_class.available).to eql([:birmingham])
8
8
  end
9
9
 
10
- it 'should raise USPSFlags::Errors::UnknownBurgee if an invalid burgee is entered' do
11
- @burgee = USPSFlags::Burgees.new do |b|
10
+ it 'raises USPSFlags::Errors::UnknownBurgee if an invalid burgee is entered' do
11
+ @burgee = described_class.new do |b|
12
12
  b.squadron = :not_a_squadron
13
13
  b.outfile = ''
14
14
  end
@@ -16,23 +16,12 @@ describe USPSFlags::Burgees do
16
16
  expect { @burgee.svg }.to raise_error(USPSFlags::Errors::UnknownBurgee)
17
17
  end
18
18
 
19
- it 'should generate a burgee from the builtins' do
20
- @burgee = USPSFlags::Burgees.new do |b|
19
+ it 'generates a burgee from the builtins' do
20
+ @burgee = described_class.new do |b|
21
21
  b.squadron = :birmingham
22
22
  b.outfile = ''
23
23
  end
24
24
 
25
- expect(@burgee.svg).to include(
26
- <<~SVG
27
- <?xml version="1.0" standalone="no"?>
28
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
29
- <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="1024" height="682" viewBox="0 0 3072 2048" preserveAspectRatio="xMidYMid meet">
30
- <title>Birmingham Burgee</title>
31
- <metadata>
32
- <desc id="created-by">Julian Fiander</desc>
33
- SVG
34
- )
35
-
36
25
  expect(@burgee.svg).to include(
37
26
  <<~SVG
38
27
  <desc id="trademark-desc">This image is a registered trademark of United States Power Squadrons.</desc>
@@ -116,32 +105,43 @@ describe USPSFlags::Burgees do
116
105
  )
117
106
  end
118
107
 
119
- it 'should generate a burgee from the custom directory' do
120
- @custom_file = "#{USPSFlags.configuration.burgees_dir}/birmingham.svg"
108
+ it 'generates a burgee from the custom directory' do
109
+ @custom_file = "#{USPSFlags.configuration.burgees_dir}/custom_birmingham.svg"
121
110
  ::FileUtils.mkdir_p(USPSFlags.configuration.burgees_dir)
122
111
  ::FileUtils.cp('lib/usps_flags/burgees/builtins/birmingham.svg', @custom_file)
112
+
113
+ burgee = ::File.read(@custom_file).gsub('Birmingham Burgee', 'Custom Birmingham Burgee')
123
114
  f = ::File.open(@custom_file, 'w+')
124
- f.write('<!-- Custom -->')
115
+ f.write(burgee)
125
116
  f.close
126
117
 
127
- @burgee = USPSFlags::Burgees.new do |b|
128
- b.squadron = :birmingham
118
+ @burgee = described_class.new do |b|
119
+ b.squadron = :custom_birmingham
129
120
  b.outfile = ''
130
121
  end
131
122
 
132
- expect(@burgee.svg).to include('<title>Birmingham Burgee</title>')
133
- expect(@burgee.svg).to include('<!-- Custom -->')
123
+ expect(@burgee.svg).to include('<title>Custom Birmingham Burgee</title>')
134
124
 
135
125
  ::FileUtils.rm_rf(USPSFlags.configuration.burgees_dir)
136
126
  end
137
127
 
138
- it 'should generate a crossed-staves burgee' do
139
- @burgee = USPSFlags::Burgees.new do |b|
140
- b.squadron = :birmingham
141
- b.outfile = ''
128
+ describe 'crossed-staves burgee' do
129
+ it 'has the crossed flags' do
130
+ @burgee = described_class.new do |b|
131
+ b.squadron = :birmingham
132
+ b.outfile = ''
133
+ end
134
+
135
+ expect(@burgee.svg(crossed: true)).to include('<g id="crossed-flags"')
142
136
  end
143
137
 
144
- expect(@burgee.svg(crossed: true)).to include('<g id="crossed-flags"')
145
- expect(@burgee.svg(crossed: true)).to include('<g id="flag-poles"')
138
+ it 'has the crossed flag poles' do
139
+ @burgee = described_class.new do |b|
140
+ b.squadron = :birmingham
141
+ b.outfile = ''
142
+ end
143
+
144
+ expect(@burgee.svg(crossed: true)).to include('<g id="flag-poles"')
145
+ end
146
146
  end
147
147
  end
@@ -4,23 +4,23 @@ require 'spec_helper'
4
4
 
5
5
  describe USPSFlags::Config do
6
6
  describe 'general configuration' do
7
- it 'should correctly set the burgees_dir in USPSFlags::Config' do
7
+ it 'correctlies set the burgees_dir in USPSFlags::Config' do
8
8
  expect(USPSFlags.configuration.burgees_dir).to eql($tmp_burgees_dir)
9
9
  end
10
10
  end
11
11
 
12
12
  describe 'Rails configuration' do
13
- before(:each) do
13
+ before do
14
14
  class Rails
15
15
  def self.root
16
16
  'tmp/rails_app'
17
17
  end
18
18
  end
19
19
 
20
- @config = USPSFlags::Config.new
20
+ @config = described_class.new
21
21
  end
22
22
 
23
- it 'should use the default Rails log directory' do
23
+ it 'uses the default Rails log directory' do
24
24
  expect(@config.burgees_dir).to eql('tmp/rails_app/app/lib/usps-burgees')
25
25
  end
26
26
  end
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'usps_flags-burgees'
5
- s.version = '0.1.1'
5
+ s.version = '0.1.2'
6
6
  s.date = '2019-06-08'
7
7
  s.summary = 'Flag generator for United States Power Squadrons burgees'
8
- s.description = 'An extension to the flag image (PNG, SVG) generator for United States Power Squadrons to generate burgees.'
8
+ s.description = 'An extension to the flag image generator for United States Power Squadrons to generate burgees.'
9
9
  s.homepage = 'http://rubygems.org/gems/usps_flags-burgees'
10
10
  s.license = 'GPL-3.0'
11
11
  s.authors = ['Julian Fiander']
12
12
  s.email = 'julian@fiander.one'
13
- s.require_paths = ['lib', 'spec']
13
+ s.require_paths = %w[lib spec]
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- spec/*`.split("\n")
16
16
 
@@ -18,7 +18,9 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_runtime_dependency 'usps_flags', '~> 0.5', '>= 0.5.1'
20
20
 
21
- s.add_development_dependency 'rake', '~> 12.2', '>= 12.2.1'
22
- s.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
23
- s.add_development_dependency 'simplecov', '~> 0.15', '>= 0.15.1'
21
+ s.add_development_dependency 'rake', '~> 12.2', '>= 12.2.1'
22
+ s.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
23
+ s.add_development_dependency 'rubocop', '~> 0.71', '>= 0.71.0'
24
+ s.add_development_dependency 'rubocop-rspec', '~> 1.30', '>= 1.30.0'
25
+ s.add_development_dependency 'simplecov', '~> 0.15', '>= 0.15.1'
24
26
  end
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -70,6 +70,46 @@ dependencies:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: 3.7.0
73
+ - !ruby/object:Gem::Dependency
74
+ name: rubocop
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '0.71'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.71.0
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.71'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 0.71.0
93
+ - !ruby/object:Gem::Dependency
94
+ name: rubocop-rspec
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '1.30'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 1.30.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.30'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 1.30.0
73
113
  - !ruby/object:Gem::Dependency
74
114
  name: simplecov
75
115
  requirement: !ruby/object:Gem::Requirement
@@ -90,8 +130,8 @@ dependencies:
90
130
  - - ">="
91
131
  - !ruby/object:Gem::Version
92
132
  version: 0.15.1
93
- description: An extension to the flag image (PNG, SVG) generator for United States
94
- Power Squadrons to generate burgees.
133
+ description: An extension to the flag image generator for United States Power Squadrons
134
+ to generate burgees.
95
135
  email: julian@fiander.one
96
136
  executables: []
97
137
  extensions: []
@@ -99,6 +139,7 @@ extra_rdoc_files: []
99
139
  files:
100
140
  - ".gitignore"
101
141
  - ".rspec"
142
+ - ".rubocop.yml"
102
143
  - ".ruby-version"
103
144
  - ".travis.yml"
104
145
  - ".yardopts"
@@ -116,8 +157,8 @@ files:
116
157
  - lib/usps_flags/burgees/customs.rb
117
158
  - lib/usps_flags/burgees/errors.rb
118
159
  - spec/spec_helper.rb
119
- - spec/usps_flags/burgees/config_spec.rb
120
160
  - spec/usps_flags/burgees_spec.rb
161
+ - spec/usps_flags/config_spec.rb
121
162
  - usps_flags-burgees.gemspec
122
163
  homepage: http://rubygems.org/gems/usps_flags-burgees
123
164
  licenses:
@@ -146,5 +187,5 @@ specification_version: 4
146
187
  summary: Flag generator for United States Power Squadrons burgees
147
188
  test_files:
148
189
  - spec/spec_helper.rb
149
- - spec/usps_flags/burgees/config_spec.rb
150
190
  - spec/usps_flags/burgees_spec.rb
191
+ - spec/usps_flags/config_spec.rb