geo_works 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53a8932ef1ba631342a8328ec7eaf7cca993de94
4
- data.tar.gz: 580c364352f569f95dcc63beacd48e5399460161
3
+ metadata.gz: f0533a41de0604673a4376d3597656459ecbbaf9
4
+ data.tar.gz: 4c0f1211b8313e5c5531d37152ce9332b9b2e50d
5
5
  SHA512:
6
- metadata.gz: 2dc0210e5f06b05a69192c1115b694a934175653cecc9f593b0944a3e818f1fc578be329269be74541eb406c603e722f9880e3967f208b40f699e42666d19d25
7
- data.tar.gz: ab82e6645185eaa54cf56258aa1877fd31314434d8c8c29af05b480dea7b249e5ed41f5738d3e605fc24632c7f35401531826723a40ee23776c07087994015c8
6
+ metadata.gz: 32233c2443c74edd7eece43f1558a399fb4444527cf7df4bac7658b0ea877257a1beb22807d10328ac54b8b672628d77472b5a7ee28174837aa6e3628fa85e5b
7
+ data.tar.gz: 37fe03c153f448b27fb28522eb98d92ffb5eea0b44e4d90b13120efcbb34510478408ca8976a9ce33582454a8f27c4f3a7ff79f825629caa1a670686f9c43d0d
data/.rubocop.yml CHANGED
@@ -46,6 +46,7 @@ Metrics/AbcSize:
46
46
  - 'lib/geo_works/fgdc_metadata_extractor.rb'
47
47
 
48
48
  Metrics/MethodLength:
49
+ Max: 14
49
50
  Exclude:
50
51
  - 'Rakefile'
51
52
  - 'app/models/concerns/geo_works/extractors/iso19139_helper.rb'
@@ -15,17 +15,25 @@ module GeoWorks
15
15
  # @param out_path [String] processor output file path
16
16
  # @param method_queue [Array] set of commands to run
17
17
  # @param options [Hash] creation options to pass
18
+ # rubocop:disable Metrics/MethodLength
18
19
  def self.run_commands(in_path, out_path, method_queue, options)
19
20
  next_step = method_queue.shift
20
- if method_queue.empty?
21
- method(next_step).call(in_path, out_path, options)
22
- else
23
- temp = temp_path(out_path)
24
- method(next_step).call(in_path, temp, options)
25
- run_commands(temp, out_path, method_queue, options)
26
- FileUtils.rm_rf(temp)
21
+ temp = temp_path(out_path)
22
+ begin
23
+ if method_queue.empty?
24
+ method(next_step).call(in_path, out_path, options)
25
+ else
26
+ method(next_step).call(in_path, temp, options)
27
+ run_commands(temp, out_path, method_queue, options)
28
+ FileUtils.rm_rf(temp)
29
+ end
30
+ rescue => e
31
+ FileUtils.rm_rf(in_path) if Dir.exist?(in_path)
32
+ FileUtils.rm_rf(temp) if Dir.exist?(temp)
33
+ raise e
27
34
  end
28
35
  end
36
+ # rubocop:enable Metrics/MethodLength
29
37
 
30
38
  # Returns a path to an intermediate temp file or directory.
31
39
  # @param path [String] input file path to base temp path on
@@ -12,7 +12,6 @@ module GeoWorks
12
12
  # @param out_path [String] processor output file path.
13
13
  # @param options [Hash] creation options
14
14
  # @option options [String] `:output_size` as "w h" or "wxh"
15
- # rubocop:disable Metrics/MethodLength
16
15
  def self.convert(in_path, out_path, options)
17
16
  size = options[:output_size].tr(' ', 'x')
18
17
  convert = MiniMagick::Tool::Convert.new(whiny: false)
@@ -30,7 +29,6 @@ module GeoWorks
30
29
  # suppress stderr b/c geotiffs return 'unknown field' warnings
31
30
  convert.call { |_stdout, _stderr| }
32
31
  end
33
- # rubocop:enable Metrics/MethodLength
34
32
 
35
33
  # Trims extra whitespace.
36
34
  # @param in_path [String] file input path
@@ -1,3 +1,3 @@
1
1
  module GeoWorks
2
- VERSION = "0.1.3".freeze
2
+ VERSION = "0.1.4".freeze
3
3
  end
@@ -36,6 +36,18 @@ describe GeoWorks::Processors::BaseGeoProcessor do
36
36
  expect(FileUtils).to receive(:rm_rf).twice
37
37
  subject.class.run_commands(file_name, output_file, method_queue, options)
38
38
  end
39
+
40
+ context 'when the processor raises an error' do
41
+ before do
42
+ allow(method_queue).to receive(:empty?).and_raise('error')
43
+ allow(Dir).to receive(:exist?).and_return(true)
44
+ end
45
+
46
+ it 'cleans the derivative intermediates' do
47
+ expect(FileUtils).to receive(:rm_rf).twice
48
+ expect { subject.class.run_commands(file_name, output_file, method_queue, options) }.to raise_error
49
+ end
50
+ end
39
51
  end
40
52
 
41
53
  describe '#temp_path' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geo_works
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Griffin
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-06-22 00:00:00.000000000 Z
15
+ date: 2017-09-06 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: hyrax
@@ -689,7 +689,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
689
689
  version: '0'
690
690
  requirements: []
691
691
  rubyforge_project:
692
- rubygems_version: 2.4.5
692
+ rubygems_version: 2.6.13
693
693
  signing_key:
694
694
  specification_version: 4
695
695
  summary: Rails engine for Hydra Geo models. Built around the Hyrax engine.