hybag 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/hybag.rb +12 -0
- data/lib/hybag/ingester.rb +1 -1
- data/lib/hybag/validator.rb +1 -1
- data/lib/hybag/version.rb +1 -1
- data/spec/lib/hybag/ingester_spec.rb +2 -2
- data/spec/lib/hybag/validator_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzZkYTExZGU2NGI5YjA3MzFkNWE5YjA5ZTVkOTA4ZTgxM2U4MDY4Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjM0NjU0NTc0ZGQzNWViNjc5OTQ2MjhhZGVkNjIzYmVkNDJjY2I1OQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDgwZDYwZjEyMjY4ZTQ0ZmFjZWYyYWRlNjNiZGQwYTI1NDI5NzVjMWUxY2Nk
|
10
|
+
MDgyMmY2YWFiNDkyMzMwZDdiMmRiNzU2YjYxYTM1M2VjYzk4ZDY1NGYzNzI5
|
11
|
+
Y2MwYjM2ZTI0NTgzYTM4YTMyNDQ4NjYyOWJmZWU2NjY0NzIwMmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDFkOWUxNTY0NzI3NjJlZjVjYjlmOGI0ZTUwYTdkMzdhN2ZkYzQzNjZlNTFj
|
14
|
+
MWFiYTY5NGRkMzNlNzIwMDE0MzEwYjdiNDFjMGM1OWZmMDhhNGU0MDQ3ZmJl
|
15
|
+
ZDdiNTMzOGQ5NWI3ZTI3MTZjYTliMWE2M2EzMjVhM2U1MmM2YmE=
|
data/lib/hybag.rb
CHANGED
@@ -12,4 +12,16 @@ module Hybag
|
|
12
12
|
def self.ingest(bag)
|
13
13
|
Hybag::Ingester.new(bag).ingest
|
14
14
|
end
|
15
|
+
|
16
|
+
# Error Classes
|
17
|
+
class UndiscoverableModelName < StandardError
|
18
|
+
def initialize(bag)
|
19
|
+
super("Unable to determine model from bag at #{bag.bag_dir}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
class InvalidBaggable < StandardError
|
23
|
+
def initialize(object)
|
24
|
+
super("#{object} requested to be bagged, but it is invalid")
|
25
|
+
end
|
26
|
+
end
|
15
27
|
end
|
data/lib/hybag/ingester.rb
CHANGED
@@ -8,7 +8,7 @@ module Hybag
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def ingest
|
11
|
-
raise
|
11
|
+
raise Hybag::UndiscoverableModelName.new(bag) if model_name.blank?
|
12
12
|
new_object = model_name.constantize.new
|
13
13
|
# Assign a pid
|
14
14
|
new_object.inner_object.pid = new_object.inner_object.assign_pid
|
data/lib/hybag/validator.rb
CHANGED
data/lib/hybag/version.rb
CHANGED
@@ -79,7 +79,7 @@ describe Hybag::Ingester do
|
|
79
79
|
subject.stub(:model_name).and_return(nil)
|
80
80
|
end
|
81
81
|
it "should raise an error" do
|
82
|
-
expect{subject.ingest}.to raise_error(
|
82
|
+
expect{subject.ingest}.to raise_error(Hybag::UndiscoverableModelName)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
context "when there is a model" do
|
@@ -94,7 +94,7 @@ describe Hybag::Ingester do
|
|
94
94
|
subject.stub(:model_name).and_return("Blabla")
|
95
95
|
end
|
96
96
|
it "should raise an error" do
|
97
|
-
expect{subject.ingest}.to raise_error
|
97
|
+
expect{subject.ingest}.to raise_error(NameError)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hybag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trey Terrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|