usps_flags-burgees 0.0.8 → 0.0.9

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: a9d96230c4ec2e7cd7dda750c2b19bdc27eb79f4
4
- data.tar.gz: 84efebaba3b2ae4671bc7c77ccab7a05acd859f7
3
+ metadata.gz: 17cdb6d1a1b7884bacbc3d43b20dabc43705d7da
4
+ data.tar.gz: 45b65770285a0f819a272f14e23715f216684e3b
5
5
  SHA512:
6
- metadata.gz: f73ed8e9f2284807ad85620a98fec987f9547404296621628122d8af15bbbca1c92666f0eff8a3ccfb9235efb62013c09301dd6d3a356f4f88112c3b635d3a91
7
- data.tar.gz: 59cf106b71371dd4a0f31712bd00495691ab422cb82173eb363a29a90a9210d46a34d89729e69c534c9fe2fbaaaf0156665f393882596256c60eb7b2569a96e9
6
+ metadata.gz: 75caed7857b7c30d4dbef2158a91b1f9ddfa4200e7b53c2f48b0092d4c6bb3dac37f25c4fc3d47f85ba89aee43438b9615f1c4a495cedc8ab7d97a94c03e50bf
7
+ data.tar.gz: 23676c88f54dab8765b5351be84f913b4c97c0f6056eb73369619467465de58d003a41489dcf937b94bd5d4ce7def66b5db716fb8d48747cbac879fb12886403
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- 'hV�������Z3fo;Dh�~��Ϟa������(�Gd�hx�I�.Ng%&ʹ�?��}r^���y)Gm�����7��u�� ��5������<�VWj���U_W � 7V!���Qaw���� c��VE�|R��й
2
- �jsx���F�g�V�ū4Z�f�[�� S��8‹6\B�l
1
+ ӂ�3i;�]A�� ʿ"����/Th( P��9��E�J|Z��!�(B��v���i-�"4�#φlFOKV 6�]�f��T��(H� u����Gf�
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- usps_flags-burgees (0.0.8)
5
- usps_flags (~> 0.3, >= 0.3.10)
4
+ usps_flags-burgees (0.0.9)
5
+ usps_flags (~> 0.3, >= 0.3.11)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -34,7 +34,7 @@ GEM
34
34
  json (>= 1.8, < 3)
35
35
  simplecov-html (~> 0.10.0)
36
36
  simplecov-html (0.10.2)
37
- usps_flags (0.3.10)
37
+ usps_flags (0.3.11)
38
38
  file_utils (~> 1.1, >= 1.1.2)
39
39
  mini_magick (~> 4.8, >= 4.8.0)
40
40
  rubyzip (~> 1.2, >= 1.2.1)
data/README.md CHANGED
@@ -10,7 +10,7 @@ An extension for [USPSFlags](https://github.com/jfiander/usps-flags) to provide
10
10
  ## Configuration
11
11
 
12
12
  ```ruby
13
- USPSFlags::Config.new do |config|
13
+ USPSFlags.configure do |config|
14
14
  config.burgees_dir = "/path/to/burgees"
15
15
  end
16
16
  ```
@@ -2,33 +2,16 @@
2
2
  #
3
3
  # @private
4
4
  class USPSFlags::Config
5
- @@burgees_dir ||= defined?(::Rails) ? "#{::Rails.root}/app/lib/usps-burgees" : "#{File.dirname(__dir__)}/output"
6
-
7
- @@flags_dir ||= USPSFlags::Config.flags_dir
8
- @@reset ||= USPSFlags::Config.reset
9
- @@use_larger_tridents ||= USPSFlags::Config.use_larger_tridents
10
-
11
5
  attr_accessor :burgees_dir
12
6
 
13
- alias :parent_initialize :initialize
14
7
  def initialize
15
- @burgees_dir = @@burgees_dir
16
- parent_initialize do |c|
17
- c.flags_dir = @@flags_dir
18
- c.reset = @@reset
19
- c.use_larger_tridents = @@use_larger_tridents
20
- end
8
+ get_defaults
9
+ get_extension_defaults
21
10
  yield self if block_given?
22
- @@burgees_dir = @burgees_dir
23
11
  end
24
12
 
25
- def self.burgees_dir
26
- burgees_path = if defined?(::Rails)
27
- "#{::Rails.root}/app/lib/usps-burgees"
28
- else
29
- @@burgees_dir
30
- end
31
- ::FileUtils.mkdir_p(burgees_path)
32
- burgees_path
13
+ private
14
+ def get_extension_defaults
15
+ @burgees_dir ||= defined?(::Rails) ? "#{::Rails.root}/app/lib/usps-burgees" : "#{File.dirname(__dir__)}/output"
33
16
  end
34
17
  end
@@ -3,13 +3,13 @@
3
3
  # @private
4
4
  class USPSFlags::Burgees::Customs
5
5
  def self.available
6
- Dir.glob("#{USPSFlags::Config.burgees_dir}/**/*.svg").map do |b|
6
+ Dir.glob("#{USPSFlags.configuration.burgees_dir}/**/*.svg").map do |b|
7
7
  b.split("/").last.split(".svg").first.to_sym
8
8
  end
9
9
  end
10
10
 
11
11
  def self.get(burgee)
12
12
  raise USPSFlags::Errors::UnknownBurgee unless self.available.include?(burgee)
13
- ::File.read("#{USPSFlags::Config.burgees_dir}/#{burgee}.svg")
13
+ ::File.read("#{USPSFlags.configuration.burgees_dir}/#{burgee}.svg")
14
14
  end
15
15
  end
data/spec/spec_helper.rb CHANGED
@@ -13,14 +13,16 @@ RSpec::Expectations.configuration.on_potential_false_positives = :nothing
13
13
  RSpec.configure do |config|
14
14
  config.before(:suite) do
15
15
  $tmp_flags_dir = "tmp/flags"
16
+ $tmp_burgees_dir = "tmp/path/to/burgees"
16
17
 
17
- USPSFlags::Config.new do |c|
18
+ USPSFlags.configure do |c|
18
19
  c.flags_dir = $tmp_flags_dir
20
+ c.burgees_dir = $tmp_burgees_dir
19
21
  end
20
22
  end
21
23
 
22
24
  config.after(:suite) do
23
25
  ::FileUtils.rm_rf("tmp") if ::Dir.exist?("tmp")
24
- ::FileUtils.rm_rf(USPSFlags::Config.burgees_dir) if ::Dir.exist?(USPSFlags::Config.burgees_dir)
26
+ ::FileUtils.rm_rf(USPSFlags.configuration.burgees_dir) if ::Dir.exist?(USPSFlags.configuration.burgees_dir)
25
27
  end
26
28
  end
@@ -2,14 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe USPSFlags::Config do
4
4
  describe "general configuration" do
5
- before(:each) do
6
- @config = USPSFlags::Config.new do |c|
7
- c.burgees_dir = "tmp/path/to/burgees"
8
- end
9
- end
10
-
11
5
  it "should correctly set the burgees_dir in USPSFlags::Config" do
12
- expect(USPSFlags::Config.burgees_dir).to eql("tmp/path/to/burgees")
6
+ expect(USPSFlags.configuration.burgees_dir).to eql($tmp_burgees_dir)
13
7
  end
14
8
  end
15
9
 
@@ -20,10 +14,12 @@ describe USPSFlags::Config do
20
14
  "tmp/rails_app"
21
15
  end
22
16
  end
17
+
18
+ @config = USPSFlags::Config.new
23
19
  end
24
20
 
25
21
  it "should use the default Rails log directory" do
26
- expect(USPSFlags::Config.burgees_dir).to eql("tmp/rails_app/app/lib/usps-burgees")
22
+ expect(@config.burgees_dir).to eql("tmp/rails_app/app/lib/usps-burgees")
27
23
  end
28
24
  end
29
25
  end
@@ -116,8 +116,8 @@ describe USPSFlags::Burgees do
116
116
  end
117
117
 
118
118
  it "should generate a burgee from the custom directory" do
119
- @custom_file = "#{USPSFlags::Config.burgees_dir}/birmingham.svg"
120
- ::FileUtils.mkdir_p(USPSFlags::Config.burgees_dir)
119
+ @custom_file = "#{USPSFlags.configuration.burgees_dir}/birmingham.svg"
120
+ ::FileUtils.mkdir_p(USPSFlags.configuration.burgees_dir)
121
121
  ::FileUtils.cp("lib/usps_flags/burgees/builtins/birmingham.svg", @custom_file)
122
122
  f = ::File.open(@custom_file, "w+")
123
123
  f.write("<!-- Custom -->")
@@ -131,6 +131,6 @@ describe USPSFlags::Burgees do
131
131
  expect(@burgee.svg).to include("<title>Birmingham Burgee</title>")
132
132
  expect(@burgee.svg).to include("<!-- Custom -->")
133
133
 
134
- ::FileUtils.rm_rf(USPSFlags::Config.burgees_dir)
134
+ ::FileUtils.rm_rf(USPSFlags.configuration.burgees_dir)
135
135
  end
136
136
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'usps_flags-burgees'
3
- s.version = '0.0.8'
3
+ s.version = '0.0.9'
4
4
  s.date = '2017-11-08'
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.'
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.required_ruby_version = '~> 2.4'
19
19
 
20
- s.add_runtime_dependency 'usps_flags', '~> 0.3', '>= 0.3.10'
20
+ s.add_runtime_dependency 'usps_flags', '~> 0.3', '>= 0.3.11'
21
21
 
22
22
  s.add_development_dependency 'rake', '~> 12.1', '>= 12.1.0'
23
23
  s.add_development_dependency 'rspec', '~> 3.7', '>= 3.7.0'
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.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -41,7 +41,7 @@ dependencies:
41
41
  version: '0.3'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.3.10
44
+ version: 0.3.11
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
@@ -51,7 +51,7 @@ dependencies:
51
51
  version: '0.3'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.3.10
54
+ version: 0.3.11
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file