active_fedora-noid 1.1.0 → 1.1.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: 72ec337cb7676e4ac6f83aec089c47768ad3595f
4
- data.tar.gz: b35b953f068dba511f39a1fd9d545534b1ce067d
3
+ metadata.gz: 4dfe7eb78a1ea93066a65a212cee6470d330c313
4
+ data.tar.gz: 45975a62c716cabe2e686e03cb4d444fb226d1eb
5
5
  SHA512:
6
- metadata.gz: cd99524c470d220f64d1d5d1363efe29018d8be8c2bedaf5731a40ed0f2079433aecd60559371e2a864ee58921d077826b36fe2d5659f2b112a358883eb97439
7
- data.tar.gz: cbd2756eb431e9de2697b49691c7586f24178da871a27802ac3f6eac145c6dce84c0dcb0630c1a6a5edb295064576c0e8bdd248bf282a2a2bcdc72d213cb4ef9
6
+ metadata.gz: 18546143cd33f6e2cc59af5080afb96510bed1e32ffbda3115317081b21a927ca1a9a7a699aebb0bc0077d2ca3e820fd4859e072c046d82c4576ea24f059d271
7
+ data.tar.gz: 5d6acecefb830f970673e5a451cba0e94989f8e636bb9eb6f8f834f8eab9c489552be7eb8f6d5f56909692b307ed8cc1126566f9137756213f0de36516b1263b
data/Gemfile CHANGED
@@ -4,5 +4,6 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development, :test do
7
+ gem 'byebug' unless ENV['CI']
7
8
  gem 'coveralls', require: false
8
9
  end
@@ -12,7 +12,9 @@ module ActiveFedora
12
12
  end
13
13
 
14
14
  def translate_uri_to_id
15
- lambda { |uri| URI(uri).path.split('/', baseparts).last }
15
+ lambda do |uri|
16
+ uri.to_s.sub(baseurl, '').split('/', baseparts).last
17
+ end
16
18
  end
17
19
 
18
20
  def translate_id_to_uri
@@ -28,8 +30,7 @@ module ActiveFedora
28
30
  end
29
31
 
30
32
  def baseparts
31
- treeparts = [(template.gsub(/\.[rsz]/,'').length.to_f/2).ceil, 4].min
32
- baseurl.count('/') + treeparts
33
+ 2 + [(template.gsub(/\.[rsz]/,'').length.to_f/2).ceil, 4].min
33
34
  end
34
35
  end
35
36
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveFedora
2
2
  module Noid
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.1.1'.freeze
4
4
  end
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'coveralls'
2
2
  Coveralls.wear!
3
3
 
4
+ require 'active_fedora'
5
+ require 'byebug' unless ENV['CI']
4
6
  require 'active_fedora/noid'
5
7
 
6
8
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
@@ -37,6 +37,11 @@ describe ActiveFedora::Noid::Config do
37
37
 
38
38
  it { is_expected.to eq 'hh63vz22q/members' }
39
39
 
40
+ context "with a hash code uri" do
41
+ let(:uri) { "http://localhost:8983/fedora/rest/test/hh/63/vz/22/hh63vz22q#g123" }
42
+ it { is_expected.to eq 'hh63vz22q#g123' }
43
+ end
44
+
40
45
  describe 'with a short custom template' do
41
46
  let(:uri) { "http://localhost:8983/fedora/rest/test/ab/cd/abcd/members" }
42
47
  let(:custom_template) { '.reeee' }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_fedora-noid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael J. Giarlo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active-fedora