preservation 0.2.0 → 0.2.1

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: 37837b8796fc9b31c0c135b966de5837fd99aba9
4
- data.tar.gz: eb8bd1f506a30b8035b18d541c9fabc84c67fe29
3
+ metadata.gz: a6efcc684837cbf6bac7115145709ee5b566a235
4
+ data.tar.gz: 7fd819b11289942989c00eb6575479551565a01c
5
5
  SHA512:
6
- metadata.gz: 5d1f1e0ea0408952329524d1653da892eeb61f1ab1a3ef4847ee4520b0255c464f7a18c3969f5f3c96b5e0ae69d1b05ae22ea63eb91ced76c75288d7527cd52c
7
- data.tar.gz: b559abab2a467dacb0cb8afcd531b9cea7c8415ce3b08c7b653d4711631bf4c30ef40d992e806150b83c17664d3fbe7ec734cc80de2011e3032021643924d06f
6
+ metadata.gz: cc61f57e033bc225bf111e726011a422a29a46a3c0078e3cb6e0c66043abd4c0873e3dcd50fa4e37ffa73e272bafad5dd1d4943b5ee0bc0161d4b1a6fa731f72
7
+ data.tar.gz: c053938ddc860d3cec69eeb4d509428938c803c8c806b0b80294623158af82074fc10a170ff19fbca9c2c1cbed5c79a8f1b99de98e3f000d8a88f04fb7a83547
data/CHANGELOG.md CHANGED
@@ -4,7 +4,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## Unreleased
6
6
 
7
- ## 0.2.0 - 2016-09-17
7
+ ## 0.2.1 - 2016-09-26
8
+ ### Fixed
9
+ - Reporting - handling nulls in database.
10
+ - Reporting - namespace for hex/bin conversion.
11
+
12
+ ## 0.2.0 - 2016-09-18
8
13
  ### Changed
9
14
  - Singular uuid rather than an array of uuids as parameter for transfer preparation.
10
15
  - Modules, classes and API.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Preservation [![Gem Version](https://badge.fury.io/rb/preservation.svg)](https://badge.fury.io/rb/preservation) [![GitPitch](https://gitpitch.com/assets/badge.svg)](https://gitpitch.com/lulibrary/preservation/master?grs=github&t=sky)
1
+ # Preservation [![Gem Version](https://badge.fury.io/rb/preservation.svg)](https://badge.fury.io/rb/preservation) [![GitPitch](https://gitpitch.com/assets/badge.svg)](https://gitpitch.com/lulibrary/preservation)
2
2
 
3
3
  Extraction and Transformation for Loading by Archivematica's Automation Tools.
4
4
 
@@ -19,28 +19,10 @@ module Preservation
19
19
 
20
20
  query = "SELECT id, uuid, hex(path) as hex_path, unit_type, status, microservice, current FROM unit WHERE status #{status_presence} ?"
21
21
 
22
- # Archivematica stores path as BLOB, so need to convert path to Hex, to search for it
23
- # and use hex function in DB query
24
22
  records = []
25
23
  db.results_as_hash = true
26
24
  db.execute( query, [ status_to_find ] ) do |row|
27
- id = row['id']
28
- uuid = row['uuid']
29
- bin_path = Preservation::Conversion.hex_to_bin row['hex_path']
30
- unit_type = row['unit_type']
31
- status = row['status']
32
- microservice = row['microservice']
33
- current = row['current']
34
- o = {}
35
- o['path'] = bin_path if !bin_path.empty?
36
- o['unit_type'] = unit_type if !unit_type.empty?
37
- o['status'] = status if !status.empty?
38
- o['microservice'] = microservice if !microservice.empty?
39
- o['current'] = current if current
40
- o['id'] = id if id
41
- o['uuid'] = uuid if !uuid.empty?
42
-
43
- records << o
25
+ records << row_to_hash(row)
44
26
  end
45
27
 
46
28
  records
@@ -52,25 +34,10 @@ module Preservation
52
34
  def self.current
53
35
  query = "SELECT id, uuid, hex(path) as hex_path, unit_type, status, microservice, current FROM unit WHERE current = 1"
54
36
 
55
- # Archivematica stores path as BLOB, so need to convert path to Hex, to search for it
56
- # and use hex function in DB query
57
37
  o = {}
58
38
  db.results_as_hash = true
59
39
  db.execute( query ) do |row|
60
- id = row['id']
61
- uuid = row['uuid']
62
- bin_path = hex_to_bin row['hex_path']
63
- unit_type = row['unit_type']
64
- status = row['status']
65
- microservice = row['microservice']
66
- current = row['current']
67
- o['path'] = bin_path if !bin_path.empty?
68
- o['unit_type'] = unit_type if !unit_type.empty?
69
- o['status'] = status if !status.empty?
70
- o['microservice'] = microservice if !microservice.empty?
71
- o['current'] = current if current
72
- o['id'] = id if id
73
- o['uuid'] = uuid if !uuid.empty?
40
+ o = row_to_hash(row)
74
41
  end
75
42
  o
76
43
  end
@@ -159,6 +126,27 @@ module Preservation
159
126
  Preservation::Report::Database.db_connection Preservation.db_path
160
127
  end
161
128
 
129
+ def self.row_to_hash(row)
130
+ id = row['id']
131
+ uuid = row['uuid']
132
+ # Archivematica stores path as BLOB, so need to convert path to Hex, to search for it
133
+ # and use hex function in DB query
134
+ bin_path = Preservation::Conversion.hex_to_bin row['hex_path']
135
+ unit_type = row['unit_type']
136
+ status = row['status']
137
+ microservice = row['microservice']
138
+ current = row['current']
139
+ o = {}
140
+ o['path'] = bin_path if !bin_path.nil? && !bin_path.empty?
141
+ o['unit_type'] = unit_type if !unit_type.nil? && !unit_type.empty?
142
+ o['status'] = status if !status.nil? && !status.empty?
143
+ o['microservice'] = microservice if !microservice.nil? && !microservice.empty?
144
+ o['current'] = current if current
145
+ o['id'] = id if id
146
+ o['uuid'] = uuid if !uuid.nil? && !uuid.empty?
147
+ o
148
+ end
149
+
162
150
  end
163
151
 
164
152
  end
@@ -1,5 +1,5 @@
1
1
  module Preservation
2
2
  # Semantic version number
3
3
  #
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
data/preservation.gemspec CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_runtime_dependency 'free_disk_space', '~> 1.0'
24
24
  spec.add_runtime_dependency 'puree', '~> 0.17'
25
- spec.add_runtime_dependency'sqlite3', '~> 1.3'
25
+ spec.add_runtime_dependency 'sqlite3', '~> 1.3'
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: preservation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Albin-Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-17 00:00:00.000000000 Z
11
+ date: 2016-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: free_disk_space