rpairtree 0.2.0 → 0.3.0

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
- SHA1:
3
- metadata.gz: a4d0513966c46f689157aed52b75c1b10731fc2a
4
- data.tar.gz: 18ecfb0525a2102152303d4c957e54fa62550a15
2
+ SHA256:
3
+ metadata.gz: 0b6eb22f15bd5816f7966625e049603bc5916d7f2b1097454aec48fb033df2fa
4
+ data.tar.gz: 9abb21a6befc45e4ce494aa981e1b4b82bf4c8244300169c4840c8d976acfffd
5
5
  SHA512:
6
- metadata.gz: 20de254a99e42de2341801c3be0a39dd23130311dfcfb094c337ccee1c2713c68e17e805fde7d98b7e59d236c38bf5ff1820298c503f56a48c5553c1233244f5
7
- data.tar.gz: 90de343158f62be17ae7b617d389fc865e86aa0142ac46316e1dfd7dee8b2d7d6826f47c08bf0fdcc43beb02f64e63696e44232dd7344e28679f890ea485168b
6
+ metadata.gz: 74e73cfb3d511934be42ff0c7f9a695105d29c355448281d2ed637028ab92b18f3c5d3fdbd6807bb75fcc9038ebcc3d40971b1d9be9ae46dafb7c23f899adfe3
7
+ data.tar.gz: 8a2fce1a92979e25cbd84690d2ebf0a665f0903b5bd7c6926b3f9978520f021cbbb3c06d48796750849a973cea0393c3d618783cdee5d95e6d5f38dec3b0f3fd
@@ -0,0 +1,26 @@
1
+ name: Run Tests
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+ name: Ruby ${{ matrix.ruby }}
9
+ strategy:
10
+ matrix:
11
+ ruby: [2.7, 3.0, 3.1, 3.2]
12
+ steps:
13
+ - uses: actions/checkout@v3
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ bundler-cache: true
19
+ - name: Run linter for Ruby
20
+ run: bundle exec standardrb
21
+ - name: Run tests
22
+ run: bundle exec rspec
23
+ - name: Report to Coveralls
24
+ uses: coverallsapp/github-action@1.1.3
25
+ with:
26
+ github-token: ${{ secrets.github_token }}
data/.gitignore CHANGED
@@ -10,6 +10,7 @@ doc
10
10
 
11
11
  # bundler
12
12
  .bundle
13
+ vendor/
13
14
 
14
15
  # jeweler generated
15
16
  pkg
data/Gemfile CHANGED
@@ -3,7 +3,8 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in test.gemspec
4
4
  gemspec
5
5
 
6
-
7
- gem 'rcov', :platform => :mri_18
8
- gem 'simplecov', :platforms => [:mri_19, :mri_20]
9
- gem 'simplecov-rcov', :platforms => [:mri_19, :mri_20]
6
+ group :development, :test do
7
+ gem "simplecov"
8
+ gem "standardrb"
9
+ gem "simplecov-lcov"
10
+ end
data/README.md CHANGED
@@ -1,11 +1,15 @@
1
- # (r)pairtree
1
+ [![Tests](https://github.com/mlibrary/pairtree/actions/workflows/tests.yml/badge.svg)](https://github.com/mlibrary/pairtree/actions/workflows/tests.yml)
2
+ [![Coverage Status](https://coveralls.io/repos/github/mlibrary/pairtree/badge.svg?branch=main)](https://coveralls.io/github/mlibrary/pairtree?branch=main)
3
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
2
4
 
3
- Ruby implementation of the [Pairtree](https://wiki.ucop.edu/display/Curation/PairTree) specification from the California Digital Library.
5
+ > :warning: Please use https://github.com/ruby-microservices/pairtree
6
+ > It is now being maintained again, so there is no need for this separate fork.
7
+ > `pairtree` 0.3.0 and `rpairtree` 0.3.0 are identical. This repository will be
8
+ > archived, and there will be no further releases of `rpairtree`.
4
9
 
5
- ## Description
6
-
7
- A fork of the seemingly-abandoned [pairtree](https://github.com/microservices/pairtree).
10
+ # rpairtree
8
11
 
12
+ Ruby implementation of the [Pairtree](https://www.ietf.org/archive/id/draft-kunze-pairtree-01.txt) specification from the California Digital Library.
9
13
 
10
14
  ## Installation
11
15
 
@@ -26,6 +30,8 @@ Or install it yourself as:
26
30
  ## Usage
27
31
 
28
32
  ```ruby
33
+ require 'pairtree'
34
+
29
35
  # Initiate a tree
30
36
  pairtree = Pairtree.at('./data', :prefix => 'pfx:', :create => true)
31
37
 
@@ -51,4 +57,6 @@ Or install it yourself as:
51
57
  pairtree.purge!('pfx:abc123def')
52
58
  ```
53
59
 
60
+ ## Copyright
54
61
 
62
+ Copyright (c) 2010 Chris Beer. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -1,40 +1,33 @@
1
- require 'rubygems'
2
- require 'bundler'
1
+ require "rubygems"
2
+ require "bundler"
3
3
  begin
4
4
  Bundler.setup(:default, :development)
5
5
  rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
6
+ warn e.message
7
+ warn "Run `bundle install` to install missing gems"
8
8
  exit e.status_code
9
9
  end
10
10
 
11
11
  Bundler::GemHelper.install_tasks
12
12
 
13
- require 'rake'
14
- require 'rspec'
15
- require 'rspec/core/rake_task'
13
+ require "rake"
14
+ require "rspec"
15
+ require "rspec/core/rake_task"
16
16
 
17
- desc 'Default: run specs.'
18
- task :default => :spec
19
-
20
- RSpec::Core::RakeTask.new do |t|
21
- if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
22
- t.rcov = true
23
- t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
24
- end
25
- end
17
+ desc "Default: run specs."
18
+ task default: :spec
26
19
 
27
20
  # Use yard to build docs
28
21
  begin
29
- require 'yard'
30
- require 'yard/rake/yardoc_task'
31
- project_root = File.expand_path(File.dirname(__FILE__))
32
- doc_destination = File.join(project_root, 'doc')
22
+ require "yard"
23
+ require "yard/rake/yardoc_task"
24
+ project_root = __dir__
25
+ doc_destination = File.join(project_root, "doc")
33
26
 
34
27
  YARD::Rake::YardocTask.new(:doc) do |yt|
35
- yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
36
- [ File.join(project_root, 'README.md') ]
37
- yt.options = ['--output-dir', doc_destination, '--readme', 'README.md']
28
+ yt.files = Dir.glob(File.join(project_root, "lib", "**", "*.rb")) +
29
+ [File.join(project_root, "README.md")]
30
+ yt.options = ["--output-dir", doc_destination, "--readme", "README.md"]
38
31
  end
39
32
  rescue LoadError
40
33
  desc "Generate YARD Documentation"
@@ -42,4 +35,3 @@ rescue LoadError
42
35
  abort "Please install the YARD gem to generate rdoc."
43
36
  end
44
37
  end
45
-
@@ -1,4 +1,3 @@
1
- # encoding: utf-8
2
1
  module Pairtree
3
2
  class Identifier
4
3
  ENCODE_REGEX = Regexp.compile("[\"*+,<=>?\\\\^|]|[^\x21-\x7e]", nil)
@@ -8,14 +7,14 @@ module Pairtree
8
7
  # Encode special characters within an identifier
9
8
  # @param [String] id The identifier
10
9
  def self.encode id
11
- id.gsub(ENCODE_REGEX) { |c| char2hex(c) }.tr('/:.', '=+,')
10
+ id.gsub(ENCODE_REGEX) { |c| char2hex(c) }.tr("/:.", "=+,")
12
11
  end
13
12
 
14
13
  ##
15
14
  # Decode special characters within an identifier
16
15
  # @param [String] id The identifier
17
16
  def self.decode id
18
- input = id.tr('=+,', '/:.').bytes.to_a
17
+ input = id.tr("=+,", "/:.").bytes.to_a
19
18
  intermediate = []
20
19
  while input.first
21
20
  if input.first == 94
@@ -23,14 +22,14 @@ module Pairtree
23
22
  input.shift
24
23
  h << input.shift
25
24
  h << input.shift
26
- intermediate << h.pack('c*').hex
25
+ intermediate << h.pack("c*").hex
27
26
  else
28
27
  intermediate << input.shift
29
28
  end
30
29
  end
31
- result = intermediate.pack('c*')
30
+ result = intermediate.pack("c*")
32
31
  if result.respond_to? :force_encoding
33
- result.force_encoding('UTF-8')
32
+ result.force_encoding("UTF-8")
34
33
  end
35
34
  result
36
35
  end
@@ -39,14 +38,14 @@ module Pairtree
39
38
  # Convert a character to its pairtree hexidecimal representation
40
39
  # @param [Char] c The character to convert
41
40
  def self.char2hex c
42
- c.unpack('H*')[0].scan(/../).map { |x| "^#{x}"}.join('')
41
+ c.unpack1("H*").scan(/../).map { |x| "^#{x}" }.join("")
43
42
  end
44
43
 
45
44
  ##
46
45
  # Convert a pairtree hexidecimal string to its character representation
47
46
  # @param [String] h The hexidecimal string to convert
48
47
  def self.hex2char h
49
- '' << h.delete('^').hex
48
+ "" << h.delete("^").hex
50
49
  end
51
50
  end
52
51
  end
data/lib/pairtree/obj.rb CHANGED
@@ -1,52 +1,51 @@
1
- module Pairtree
1
+ module Pairtree
2
2
  class Obj < ::Dir
3
-
4
- FILE_METHODS = [:atime, :open, :read, :file?, :directory?, :exist?, :exists?, :file?, :ftype, :lstat,
3
+ FILE_METHODS = [:atime, :open, :read, :file?, :directory?, :exist?, :exists?, :file?, :ftype, :lstat,
5
4
  :mtime, :readable?, :size, :stat, :truncate, :writable?, :zero?]
6
5
  FILE_METHODS.each do |file_method|
7
- define_method file_method do |fname,*args,&block|
8
- File.send(file_method, File.join(self.path, fname), *args, &block)
6
+ define_method file_method do |fname, *args, &block|
7
+ File.send(file_method, File.join(path, fname), *args, &block)
9
8
  end
10
9
  end
11
10
 
12
11
  def delete *args
13
- File.delete(*(prepend_filenames(args)))
12
+ File.delete(*prepend_filenames(args))
14
13
  end
15
14
  alias_method :unlink, :delete
16
15
 
17
16
  def link *args
18
- File.link(*(prepend_filenames(args)))
17
+ File.link(*prepend_filenames(args))
19
18
  end
20
19
 
21
20
  def rename *args
22
- File.rename(*(prepend_filenames(args)))
21
+ File.rename(*prepend_filenames(args))
23
22
  end
24
-
23
+
25
24
  def utime atime, mtime, *args
26
- File.utime(atime, mtime, *(prepend_filenames(args)))
25
+ File.utime(atime, mtime, *prepend_filenames(args))
27
26
  end
28
-
27
+
29
28
  def entries
30
- super - ['.','..']
29
+ super - [".", ".."]
31
30
  end
32
-
31
+
33
32
  def each &block
34
- super { |entry| yield(entry) unless entry =~ /^\.{1,2}$/ }
33
+ super { |entry| yield(entry) unless /^\.{1,2}$/.match?(entry) }
35
34
  end
36
-
35
+
37
36
  def glob(string, flags = 0)
38
- result = Dir.glob(File.join(self.path, string), flags) - ['.','..']
39
- result.collect { |f| f.sub(%r{^#{self.path}/},'') }
37
+ result = Dir.glob(File.join(path, string), flags) - [".", ".."]
38
+ result.collect { |f| f.sub(%r{^#{path}/}, "") }
40
39
  end
41
-
40
+
42
41
  def [](string)
43
42
  glob(string, 0)
44
43
  end
45
-
44
+
46
45
  private
46
+
47
47
  def prepend_filenames(files)
48
- files.collect { |fname| File.join(self.path, fname) }
48
+ files.collect { |fname| File.join(path, fname) }
49
49
  end
50
-
51
50
  end
52
51
  end
data/lib/pairtree/path.rb CHANGED
@@ -1,43 +1,41 @@
1
1
  module Pairtree
2
2
  class Path
3
3
  @@leaf_proc = lambda { |id| id }
4
-
4
+
5
5
  def self.set_leaf value = nil, &block
6
- if value.nil?
7
- @@leaf_proc = block
6
+ @@leaf_proc = if value.nil?
7
+ block
8
+ elsif value.is_a?(Proc)
9
+ value
8
10
  else
9
- if value.is_a?(Proc)
10
- @@leaf_proc = value
11
- else
12
- @@leaf_proc = lambda { |id| value }
13
- end
11
+ lambda { |id| value }
14
12
  end
15
13
  end
16
-
14
+
17
15
  def self.leaf id
18
16
  if @@leaf_proc
19
17
  Pairtree::Identifier.encode(@@leaf_proc.call(id))
20
18
  else
21
- ''
19
+ ""
22
20
  end
23
21
  end
24
-
22
+
25
23
  def self.id_to_path id
26
- path = File.join(Pairtree::Identifier.encode(id).scan(/..?/),self.leaf(id))
27
- path.sub(%r{#{File::SEPARATOR}+$},'')
24
+ path = File.join(Pairtree::Identifier.encode(id).scan(/..?/), leaf(id))
25
+ path.sub(%r{#{File::SEPARATOR}+$}o, "")
28
26
  end
29
27
 
30
28
  def self.path_to_id ppath
31
29
  parts = ppath.split(File::SEPARATOR)
32
- parts.pop if @@leaf_proc and parts.last.length > Root::SHORTY_LENGTH
30
+ parts.pop if @@leaf_proc && (parts.last.length > Root::SHORTY_LENGTH)
33
31
  Pairtree::Identifier.decode(parts.join)
34
32
  end
35
-
33
+
36
34
  def self.remove! path
37
35
  FileUtils.remove_dir(path, true)
38
36
  parts = path.split(File::SEPARATOR)
39
37
  parts.pop
40
- while parts.length > 0 and parts.last != 'pairtree_root'
38
+ while (parts.length > 0) && (parts.last != "pairtree_root")
41
39
  begin
42
40
  FileUtils.rmdir(parts.join(File::SEPARATOR))
43
41
  parts.pop
data/lib/pairtree/root.rb CHANGED
@@ -1,10 +1,10 @@
1
- require 'fileutils'
1
+ require "fileutils"
2
2
  module Pairtree
3
3
  class Root
4
4
  SHORTY_LENGTH = 2
5
5
 
6
6
  attr_reader :root, :prefix
7
-
7
+
8
8
  ##
9
9
  # @param [String] root The pairtree_root directory within the pairtree home
10
10
  # @param [Hash] args Pairtree options
@@ -12,9 +12,9 @@ module Pairtree
12
12
  # @option args [String] :version (Pairtree::SPEC_VERSION) the version of the pairtree spec that this tree conforms to
13
13
  def initialize root, args = {}
14
14
  @root = root
15
-
15
+
16
16
  @shorty_length = args.delete(:shorty_length) || SHORTY_LENGTH
17
- @prefix = args.delete(:prefix) || ''
17
+ @prefix = args.delete(:prefix) || ""
18
18
 
19
19
  @options = args
20
20
  end
@@ -22,15 +22,15 @@ module Pairtree
22
22
  ##
23
23
  # Get a list of valid existing identifiers within the pairtree
24
24
  # @return [Array]
25
- def list
25
+ def list
26
26
  objects = []
27
27
  return [] unless File.directory? @root
28
28
 
29
29
  Dir.chdir(@root) do
30
- possibles = Dir['**/?'] + Dir['**/??']
30
+ possibles = Dir["**/?"] + Dir["**/??"]
31
31
  possibles.each { |path|
32
32
  contents = Dir.entries(path).reject { |x| x =~ /^\./ }
33
- objects << path unless contents.all? { |f| f.length <= @shorty_length and File.directory?(File.join(path, f)) }
33
+ objects << path unless contents.all? { |f| (f.length <= @shorty_length) && File.directory?(File.join(path, f)) }
34
34
  }
35
35
  end
36
36
  objects.map { |x| @prefix + Pairtree::Path.path_to_id(x) }
@@ -42,7 +42,7 @@ module Pairtree
42
42
  def path
43
43
  File.dirname(root)
44
44
  end
45
-
45
+
46
46
  ##
47
47
  # Get the full path for a given identifier (whether it exists or not)
48
48
  # @param [String] id The full, prefixed identifier
@@ -51,7 +51,7 @@ module Pairtree
51
51
  unless id.start_with? @prefix
52
52
  raise IdentifierError, "Identifier must start with #{@prefix}"
53
53
  end
54
- path_id = id[@prefix.length..-1]
54
+ path_id = id[@prefix.length..]
55
55
  File.join(@root, Pairtree::Path.id_to_path(path_id))
56
56
  end
57
57
 
@@ -62,7 +62,7 @@ module Pairtree
62
62
  def exists? id
63
63
  File.directory?(path_for(id))
64
64
  end
65
-
65
+
66
66
  ##
67
67
  # Get an existing ppath
68
68
  # @param [String] id The full, prefixed identifier
@@ -71,7 +71,7 @@ module Pairtree
71
71
  Pairtree::Obj.new path_for(id)
72
72
  end
73
73
  alias_method :[], :get
74
-
74
+
75
75
  ##
76
76
  # Create a new ppath
77
77
  # @param [String] id The full, prefixed identifier
@@ -80,7 +80,7 @@ module Pairtree
80
80
  FileUtils.mkdir_p path_for(id)
81
81
  get(id)
82
82
  end
83
-
83
+
84
84
  ##
85
85
  # Delete a ppath
86
86
  # @param [String] id The full, prefixed identifier
@@ -89,7 +89,7 @@ module Pairtree
89
89
  if exists?(id)
90
90
  Pairtree::Path.remove!(path_for(id))
91
91
  end
92
- not exists?(id)
92
+ !exists?(id)
93
93
  end
94
94
 
95
95
  ##
@@ -98,6 +98,5 @@ module Pairtree
98
98
  def pairtree_version
99
99
  @options[:version]
100
100
  end
101
-
102
101
  end
103
102
  end
data/lib/pairtree.rb CHANGED
@@ -1,17 +1,19 @@
1
- require 'pairtree/identifier'
2
- require 'pairtree/path'
3
- require 'pairtree/obj'
4
- require 'pairtree/root'
1
+ require "pairtree/identifier"
2
+ require "pairtree/path"
3
+ require "pairtree/obj"
4
+ require "pairtree/root"
5
5
 
6
- require 'fileutils'
6
+ require "fileutils"
7
7
 
8
8
  module Pairtree
9
- class IdentifierError < Exception; end
10
- class PathError < Exception; end
11
- class VersionMismatch < Exception; end
9
+ class IdentifierError < RuntimeError; end
10
+
11
+ class PathError < RuntimeError; end
12
+
13
+ class VersionMismatch < RuntimeError; end
12
14
 
13
15
  SPEC_VERSION = 0.1
14
-
16
+
15
17
  ##
16
18
  # Instantiate a pairtree at a given path location
17
19
  # @param [String] path The path in which the pairtree resides
@@ -20,34 +22,34 @@ module Pairtree
20
22
  # @option args [String] :version (Pairtree::SPEC_VERSION) the version of the pairtree spec that this tree conforms to
21
23
  # @option args [Boolean] :create (false) if true, create the pairtree and its directory structure if it doesn't already exist
22
24
  def self.at path, args = {}
23
- args = { :prefix => nil, :version => nil, :create => false }.merge(args)
25
+ args = {prefix: nil, version: nil, create: false}.merge(args)
24
26
  args[:version] ||= SPEC_VERSION
25
27
  args[:version] = args[:version].to_f
26
-
27
- root_path = File.join(path, 'pairtree_root')
28
- prefix_file = File.join(path, 'pairtree_prefix')
28
+
29
+ root_path = File.join(path, "pairtree_root")
30
+ prefix_file = File.join(path, "pairtree_prefix")
29
31
  version_file = File.join(path, pairtree_version_filename(args[:version]))
30
- existing_version_file = Dir[File.join(path, "pairtree_version*")].sort.last
31
-
32
+ existing_version_file = Dir[File.join(path, "pairtree_version*")].max
33
+
32
34
  if args.delete(:create)
33
- if File.exists?(path) and not File.directory?(path)
35
+ if File.exist?(path) && !File.directory?(path)
34
36
  raise PathError, "#{path} exists, but is not a valid pairtree root"
35
37
  end
36
38
  FileUtils.mkdir_p(root_path)
37
39
 
38
- unless File.exists? prefix_file
39
- File.open(prefix_file, 'w') { |f| f.write(args[:prefix].to_s) }
40
+ unless File.exist? prefix_file
41
+ File.write(prefix_file, args[:prefix].to_s)
40
42
  end
41
-
43
+
42
44
  if existing_version_file
43
45
  if existing_version_file != version_file
44
- stored_version = existing_version_file.scan(/([0-9]+)_([0-9]+)/).flatten.join('.').to_f
46
+ stored_version = existing_version_file.scan(/([0-9]+)_([0-9]+)/).flatten.join(".").to_f
45
47
  raise VersionMismatch, "Version #{args[:version]} specified, but #{stored_version} found."
46
48
  end
47
49
  else
48
50
  args[:version] ||= SPEC_VERSION
49
51
  version_file = File.join(path, pairtree_version_filename(args[:version]))
50
- File.open(version_file, 'w') { |f| f.write %{This directory conforms to Pairtree Version #{args[:version]}. Updated spec: http://www.cdlib.org/inside/diglib/pairtree/pairtreespec.html} }
52
+ File.write(version_file, %(This directory conforms to Pairtree Version #{args[:version]}. Updated spec: http://www.cdlib.org/inside/diglib/pairtree/pairtreespec.html))
51
53
  existing_version_file = version_file
52
54
  end
53
55
  else
@@ -57,22 +59,25 @@ module Pairtree
57
59
  end
58
60
 
59
61
  stored_prefix = File.read(prefix_file)
60
- unless args[:prefix].nil? or args[:prefix].to_s == stored_prefix
62
+ unless args[:prefix].nil? || (args[:prefix].to_s == stored_prefix)
61
63
  raise IdentifierError, "Specified prefix #{args[:prefix].inspect} does not match stored prefix #{stored_prefix.inspect}"
62
64
  end
63
65
  args[:prefix] = stored_prefix
64
66
 
65
- stored_version = existing_version_file.scan(/([0-9]+)_([0-9]+)/).flatten.join('.').to_f
67
+ stored_version = existing_version_file.scan(/([0-9]+)_([0-9]+)/).flatten.join(".").to_f
66
68
  args[:version] ||= stored_version
67
69
  unless args[:version] == stored_version
68
70
  raise VersionMismatch, "Version #{args[:version]} specified, but #{stored_version} found."
69
71
  end
70
-
71
- Pairtree::Root.new(File.join(path, 'pairtree_root'), args)
72
+
73
+ Pairtree::Root.new(File.join(path, "pairtree_root"), args)
72
74
  end
73
75
 
74
- private
75
- def self.pairtree_version_filename(version)
76
- "pairtree_version#{version.to_s.gsub(/\./,'_')}"
76
+ class << self
77
+ private
78
+
79
+ def pairtree_version_filename(version)
80
+ "pairtree_version#{version.to_s.tr(".", "_")}"
81
+ end
77
82
  end
78
83
  end
data/lib/tasks/rdoc.rake CHANGED
@@ -1,21 +1,21 @@
1
1
  desc "Generate RDoc"
2
- task :doc => ['doc:generate']
2
+ task doc: ["doc:generate"]
3
3
 
4
4
  namespace :doc do
5
- project_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
6
- doc_destination = File.join(project_root, 'rdoc')
5
+ project_root = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
6
+ doc_destination = File.join(project_root, "rdoc")
7
7
 
8
8
  begin
9
- require 'yard'
10
- require 'yard/rake/yardoc_task'
9
+ require "yard"
10
+ require "yard/rake/yardoc_task"
11
11
 
12
12
  YARD::Rake::YardocTask.new(:generate) do |yt|
13
- yt.files = Dir.glob(File.join(project_root, 'lib', '*.rb')) +
14
- Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
15
- [ File.join(project_root, 'README.rdoc') ] +
16
- [ File.join(project_root, 'LICENSE') ]
17
-
18
- yt.options = ['--output-dir', doc_destination, '--readme', 'README.rdoc']
13
+ yt.files = Dir.glob(File.join(project_root, "lib", "*.rb")) +
14
+ Dir.glob(File.join(project_root, "lib", "**", "*.rb")) +
15
+ [File.join(project_root, "README.rdoc")] +
16
+ [File.join(project_root, "LICENSE")]
17
+
18
+ yt.options = ["--output-dir", doc_destination, "--readme", "README.rdoc"]
19
19
  end
20
20
  rescue LoadError
21
21
  desc "Generate YARD Documentation"
@@ -26,7 +26,6 @@ namespace :doc do
26
26
 
27
27
  desc "Remove generated documenation"
28
28
  task :clean do
29
- rm_r doc_destination if File.exists?(doc_destination)
29
+ rm_r doc_destination if File.exist?(doc_destination)
30
30
  end
31
-
32
- end
31
+ end
data/pairtree.gemspec CHANGED
@@ -1,21 +1,25 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = %q{rpairtree}
3
- s.summary = %q{Ruby Pairtree implementation, forked from pairtree which is abandoned.}
4
- s.version = "0.2.0"
5
- s.homepage = %q{http://github.com/mlibrary/pairtree}
6
- s.licenses = ["Apache2"]
7
- s.authors = ["Chris Beer, Bryan Hockey, Michael Slone"]
8
- s.date = %q{2015-05-05}
9
- s.files = `git ls-files`.split("\n")
10
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
11
- s.extra_rdoc_files = ["LICENSE.txt", "README.md"]
12
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
- s.require_paths = ["lib"]
2
+ deprecation_warning = <<~EOT
3
+ rpairtree is deprecated; please use pairtree instead, which is now being
4
+ maintained. rpairtree 0.3.0 and pairtree 0.3.0 are identical. There will be no
5
+ further releases of rpairtree.
6
+ EOT
14
7
 
8
+ s.name = "rpairtree"
9
+ s.summary = "Ruby Pairtree implementation"
10
+ s.description = deprecation_warning
11
+ s.post_install_message = deprecation_warning
12
+ s.version = "0.3.0"
13
+ s.homepage = "http://github.com/mlibrary/pairtree"
14
+ s.licenses = ["Apache2"]
15
+ s.authors = ["Chris Beer, Bryan Hockey, Michael Slone, Aaron Elkiss"]
16
+ s.files = `git ls-files`.split("\n")
17
+ s.extra_rdoc_files = ["LICENSE.txt", "README.md"]
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
15
20
 
16
21
  s.add_development_dependency "bundler"
17
- s.add_development_dependency "rspec", ">= 2.0"
22
+ s.add_development_dependency "rspec", ">= 3.12"
18
23
  s.add_development_dependency "yard"
19
24
  s.add_development_dependency "rake"
20
25
  end
21
-
@@ -1,10 +1,8 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
- require 'pairtree'
1
+ require "spec_helper"
2
+ require "pairtree"
4
3
 
5
4
  describe "Pairtree encoding" do
6
-
7
- def roundtrip(id, expected_encoded=nil, expected_path=nil)
5
+ def roundtrip(id, expected_encoded = nil, expected_path = nil)
8
6
  encoded = Pairtree::Identifier.encode(id)
9
7
  unless expected_encoded.nil?
10
8
  expect(encoded).to eql(expected_encoded)
@@ -14,50 +12,50 @@ describe "Pairtree encoding" do
14
12
  expect(path).to eql(expected_path)
15
13
  end
16
14
  str = Pairtree::Identifier.decode(encoded)
17
-
15
+
18
16
  if str.respond_to? :force_encoding
19
17
  str.force_encoding("UTF-8")
20
18
  end
21
19
 
22
20
  expect(str).to eql(id)
23
21
  end
24
-
22
+
25
23
  it "should handle a" do
26
- roundtrip('a', 'a', 'a/a')
24
+ roundtrip("a", "a", "a/a")
27
25
  end
28
26
 
29
27
  it "should handle ab" do
30
- roundtrip('ab', 'ab', 'ab/ab')
28
+ roundtrip("ab", "ab", "ab/ab")
31
29
  end
32
30
 
33
31
  it "should handle abc" do
34
- roundtrip('abc', 'abc', 'ab/c/abc')
32
+ roundtrip("abc", "abc", "ab/c/abc")
35
33
  end
36
34
 
37
35
  it "should handle abcd" do
38
- roundtrip('abcd', 'abcd', 'ab/cd/abcd')
36
+ roundtrip("abcd", "abcd", "ab/cd/abcd")
39
37
  end
40
38
 
41
39
  it "should handle space" do
42
- roundtrip('hello world', 'hello^20world', 'he/ll/o^/20/wo/rl/d/hello^20world')
40
+ roundtrip("hello world", "hello^20world", "he/ll/o^/20/wo/rl/d/hello^20world")
43
41
  end
44
42
 
45
43
  it "should handle slash" do
46
- roundtrip("/","=",'=/=')
44
+ roundtrip("/", "=", "=/=")
47
45
  end
48
46
 
49
47
  it "should handle urn" do
50
- roundtrip('http://n2t.info/urn:nbn:se:kb:repos-1','http+==n2t,info=urn+nbn+se+kb+repos-1','ht/tp/+=/=n/2t/,i/nf/o=/ur/n+/nb/n+/se/+k/b+/re/po/s-/1/http+==n2t,info=urn+nbn+se+kb+repos-1')
48
+ roundtrip("http://n2t.info/urn:nbn:se:kb:repos-1", "http+==n2t,info=urn+nbn+se+kb+repos-1", "ht/tp/+=/=n/2t/,i/nf/o=/ur/n+/nb/n+/se/+k/b+/re/po/s-/1/http+==n2t,info=urn+nbn+se+kb+repos-1")
51
49
  end
52
-
50
+
53
51
  it "should handle wtf" do
54
- roundtrip('what-the-*@?#!^!?', "what-the-^2a@^3f#!^5e!^3f", "wh/at/-t/he/-^/2a/@^/3f/#!/^5/e!/^3/f/what-the-^2a@^3f#!^5e!^3f")
52
+ roundtrip("what-the-*@?#!^!?", "what-the-^2a@^3f#!^5e!^3f", "wh/at/-t/he/-^/2a/@^/3f/#!/^5/e!/^3/f/what-the-^2a@^3f#!^5e!^3f")
55
53
  end
56
54
 
57
55
  it "should handle special characters" do
58
56
  roundtrip('\\"*+,<=>?^|', "^5c^22^2a^2b^2c^3c^3d^3e^3f^5e^7c")
59
57
  end
60
-
58
+
61
59
  it "should roundtrip hardcore Unicode" do
62
60
  roundtrip(%{
63
61
  1. Euro Symbol: €.
@@ -76,9 +74,9 @@ describe "Pairtree encoding" do
76
74
  14. Thai: ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ "
77
75
  })
78
76
  end
79
-
77
+
80
78
  it "should roundtrip French" do
81
- roundtrip('Années de Pèlerinage', 'Ann^c3^a9es^20de^20P^c3^a8lerinage', 'An/n^/c3/^a/9e/s^/20/de/^2/0P/^c/3^/a8/le/ri/na/ge/Ann^c3^a9es^20de^20P^c3^a8lerinage')
79
+ roundtrip("Années de Pèlerinage", "Ann^c3^a9es^20de^20P^c3^a8lerinage", "An/n^/c3/^a/9e/s^/20/de/^2/0P/^c/3^/a8/le/ri/na/ge/Ann^c3^a9es^20de^20P^c3^a8lerinage")
82
80
  roundtrip(%{
83
81
  Années de Pèlerinage (Years of Pilgrimage) (S.160, S.161,
84
82
  S.163) is a set of three suites by Franz Liszt for solo piano. Liszt's
@@ -89,6 +87,5 @@ describe "Pairtree encoding" do
89
87
  was composed well after the first two volumes and often displays less
90
88
  showy virtuosity and more harmonic experimentation.
91
89
  })
92
- end
93
-
90
+ end
94
91
  end
@@ -1,69 +1,67 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require 'pairtree'
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require "pairtree"
3
3
 
4
4
  describe "Pairtree::Obj" do
5
-
6
5
  before(:all) do
7
6
  @base_path = File.join(File.dirname(__FILE__), "../test_data/working")
8
7
  Dir.chdir(File.join(File.dirname(__FILE__), "../test_data")) do
9
- FileUtils.cp_r('fixtures/pairtree_root_spec', './working')
8
+ FileUtils.cp_r("fixtures/pairtree_root_spec", "./working")
10
9
  end
11
10
  @root = Pairtree.at(@base_path)
12
- @obj = @root.get('pfx:abc123def')
11
+ @obj = @root.get("pfx:abc123def")
13
12
  end
14
-
13
+
15
14
  after(:all) do
16
15
  FileUtils.rm_rf(@base_path)
17
16
  end
18
-
17
+
19
18
  it "should read a file" do
20
- expect(@obj.read('content.xml')).to eql('<content/>')
19
+ expect(@obj.read("content.xml")).to eql("<content/>")
21
20
  end
22
21
 
23
22
  it "should have entries" do
24
- expect(@obj.entries).to eql(['content.xml'])
23
+ expect(@obj.entries).to eql(["content.xml"])
25
24
  end
26
-
25
+
27
26
  it "should glob" do
28
- expect(@obj['*.xml']).to eql(['content.xml'])
29
- expect(@obj['*.txt']).to eql([])
27
+ expect(@obj["*.xml"]).to eql(["content.xml"])
28
+ expect(@obj["*.txt"]).to eql([])
30
29
  end
31
-
30
+
32
31
  it "should be enumerable" do
33
- block_body = double('block_body')
34
- expect(block_body).to receive(:yielded).with('content.xml')
32
+ block_body = double("block_body")
33
+ expect(block_body).to receive(:yielded).with("content.xml")
35
34
  @obj.each { |file| block_body.yielded(file) }
36
35
  end
37
-
36
+
38
37
  describe "Call a bunch of File methods" do
39
38
  before(:each) do
40
- @target = File.join(@base_path, 'pairtree_root/ab/c1/23/de/f/abc123def/content.xml')
39
+ @target = File.join(@base_path, "pairtree_root/ab/c1/23/de/f/abc123def/content.xml")
41
40
  end
42
-
41
+
43
42
  it "should open a file" do
44
- expect(File).to receive(:open).with(@target,'r')
45
- @obj.open('content.xml','r')
43
+ expect(File).to receive(:open).with(@target, "r")
44
+ @obj.open("content.xml", "r")
46
45
  end
47
46
 
48
47
  it "should call delete" do
49
48
  expect(File).to receive(:delete).with(@target)
50
- @obj.delete('content.xml')
49
+ @obj.delete("content.xml")
51
50
  end
52
51
 
53
52
  it "should call link" do
54
- expect(File).to receive(:link).with(@target,@target + '.2')
55
- @obj.link('content.xml','content.xml.2')
53
+ expect(File).to receive(:link).with(@target, @target + ".2")
54
+ @obj.link("content.xml", "content.xml.2")
56
55
  end
57
56
 
58
57
  it "should call rename" do
59
- expect(File).to receive(:rename).with(@target,@target + '.new')
60
- @obj.rename('content.xml','content.xml.new')
58
+ expect(File).to receive(:rename).with(@target, @target + ".new")
59
+ @obj.rename("content.xml", "content.xml.new")
61
60
  end
62
61
 
63
62
  it "should call utime" do
64
- expect(File).to receive(:utime).with(0,1,@target)
65
- @obj.utime(0,1,'content.xml')
63
+ expect(File).to receive(:utime).with(0, 1, @target)
64
+ @obj.utime(0, 1, "content.xml")
66
65
  end
67
66
  end
68
-
69
- end
67
+ end
@@ -1,35 +1,33 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require 'pairtree'
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require "pairtree"
3
3
 
4
4
  describe "Pairtree::Path" do
5
-
6
5
  after(:each) do
7
6
  Pairtree::Path.set_leaf { |id| id }
8
7
  end
9
-
8
+
10
9
  it "should generate an encoded id as the leaf path by default" do
11
- expect(Pairtree::Path.leaf('abc/def')).to eql("abc=def")
10
+ expect(Pairtree::Path.leaf("abc/def")).to eql("abc=def")
12
11
  end
13
12
 
14
13
  it "should accept a nil override" do
15
14
  Pairtree::Path.set_leaf nil
16
- expect(Pairtree::Path.leaf('abc/def')).to eql("")
15
+ expect(Pairtree::Path.leaf("abc/def")).to eql("")
17
16
  end
18
-
17
+
19
18
  it "should accept a scalar override" do
20
- Pairtree::Path.set_leaf 'obj'
21
- expect(Pairtree::Path.leaf('abc/def')).to eql("obj")
19
+ Pairtree::Path.set_leaf "obj"
20
+ expect(Pairtree::Path.leaf("abc/def")).to eql("obj")
22
21
  end
23
-
22
+
24
23
  it "should accept a Proc override" do
25
- lp = Proc.new { |id| id.reverse }
24
+ lp = proc { |id| id.reverse }
26
25
  Pairtree::Path.set_leaf(lp)
27
- expect(Pairtree::Path.leaf('abc/def')).to eql("fed=cba")
26
+ expect(Pairtree::Path.leaf("abc/def")).to eql("fed=cba")
28
27
  end
29
-
28
+
30
29
  it "should accept a block override" do
31
30
  Pairtree::Path.set_leaf { |id| id.reverse }
32
- expect(Pairtree::Path.leaf('abc/def')).to eql("fed=cba")
31
+ expect(Pairtree::Path.leaf("abc/def")).to eql("fed=cba")
33
32
  end
34
-
35
33
  end
@@ -1,63 +1,61 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require 'pairtree'
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require "pairtree"
3
3
 
4
4
  describe "Pairtree::Root" do
5
-
6
5
  before(:all) do
7
6
  @base_path = File.join(File.dirname(__FILE__), "../test_data/working")
8
7
  Dir.chdir(File.join(File.dirname(__FILE__), "../test_data")) do
9
- FileUtils.cp_r('fixtures/pairtree_root_spec', './working')
8
+ FileUtils.cp_r("fixtures/pairtree_root_spec", "./working")
10
9
  end
11
10
  @root = Pairtree.at(@base_path)
12
11
  end
13
-
12
+
14
13
  after(:all) do
15
14
  FileUtils.rm_rf(@base_path)
16
15
  end
17
-
16
+
18
17
  it "should have the correct prefix" do
19
- expect(@root.prefix).to eql('pfx:')
18
+ expect(@root.prefix).to eql("pfx:")
20
19
  end
21
-
20
+
22
21
  it "should be in the correct location" do
23
22
  expect(File.expand_path(@root.path)).to eql(File.expand_path(@base_path))
24
23
  expect(File.expand_path(@root.root)).to eql(File.expand_path(File.join(@base_path, "pairtree_root")))
25
24
  end
26
-
25
+
27
26
  it "should list identifiers" do
28
- expect(@root.list).to eql(['pfx:abc123def'])
27
+ expect(@root.list).to eql(["pfx:abc123def"])
29
28
  end
30
-
29
+
31
30
  it "should verify whether an identifier exists" do
32
- expect(@root.exists?('pfx:abc123def')).to be true
33
- expect(@root.exists?('pfx:abc123jkl')).to be false
31
+ expect(@root.exists?("pfx:abc123def")).to be true
32
+ expect(@root.exists?("pfx:abc123jkl")).to be false
34
33
  end
35
-
34
+
36
35
  it "should raise an exception if an invalid prefix is used" do
37
- expect { @root.exists?('xfp:abc123def') }.to raise_error(Pairtree::IdentifierError)
36
+ expect { @root.exists?("xfp:abc123def") }.to raise_error(Pairtree::IdentifierError)
38
37
  end
39
-
38
+
40
39
  it "should get a ppath for a valid ID" do
41
- obj = @root.get 'pfx:abc123def'
40
+ obj = @root.get "pfx:abc123def"
42
41
  expect(obj.class).to eql(Pairtree::Obj)
43
42
  expect(File.expand_path(obj.path)).to eql(File.expand_path(File.join(@base_path, "pairtree_root/ab/c1/23/de/f/abc123def/")))
44
43
  end
45
-
44
+
46
45
  it "should raise an exception when attempting to get a ppath for an invalid ID" do
47
- expect { @root.get 'pfx:abc123jkl' }.to raise_error(Errno::ENOENT)
46
+ expect { @root.get "pfx:abc123jkl" }.to raise_error(Errno::ENOENT)
48
47
  end
49
-
48
+
50
49
  it "should create a new ppath" do
51
- obj = @root.mk 'pfx:abc123jkl'
50
+ obj = @root.mk "pfx:abc123jkl"
52
51
  expect(obj.class).to eql(Pairtree::Obj)
53
52
  expect(File.expand_path(obj.path)).to eql(File.expand_path(File.join(@base_path, "pairtree_root/ab/c1/23/jk/l/abc123jkl/")))
54
- expect(@root.exists?('pfx:abc123jkl')).to be true
53
+ expect(@root.exists?("pfx:abc123jkl")).to be true
55
54
  end
56
-
55
+
57
56
  it "should delete a ppath" do
58
- expect(@root.exists?('pfx:abc123jkl')).to be true
59
- @root.purge!('pfx:abc123jkl')
60
- expect(@root.exists?('pfx:abc123jkl')).to be false
57
+ expect(@root.exists?("pfx:abc123jkl")).to be true
58
+ @root.purge!("pfx:abc123jkl")
59
+ expect(@root.exists?("pfx:abc123jkl")).to be false
61
60
  end
62
-
63
- end
61
+ end
@@ -1,12 +1,11 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
- require 'pairtree'
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require "pairtree"
3
3
 
4
4
  describe "Pairtree" do
5
-
6
5
  before(:all) do
7
6
  @base_path = File.join(File.dirname(__FILE__), "../test_data/working")
8
7
  end
9
-
8
+
10
9
  it "should raise an error if a non-existent is specified without :create" do
11
10
  expect { Pairtree.at(@base_path) }.to raise_error(Pairtree::PathError)
12
11
  end
@@ -17,53 +16,50 @@ describe "Pairtree" do
17
16
  end
18
17
 
19
18
  it "should create a new pairtree" do
20
- prefix = 'my_prefix:'
21
- pt = Pairtree.at(@base_path, :prefix => prefix, :create => true)
19
+ prefix = "my_prefix:"
20
+ pt = Pairtree.at(@base_path, prefix: prefix, create: true)
22
21
  expect(pt.prefix).to eql(prefix)
23
- expect(File.read(File.join(@base_path,'pairtree_prefix'))).to eql(prefix)
24
- expect(pt.root).to eql(File.join(@base_path, 'pairtree_root'))
22
+ expect(File.read(File.join(@base_path, "pairtree_prefix"))).to eql(prefix)
23
+ expect(pt.root).to eql(File.join(@base_path, "pairtree_root"))
25
24
  expect(pt.pairtree_version).to eql(Pairtree::SPEC_VERSION)
26
25
  end
27
-
28
26
  end
29
-
27
+
30
28
  describe "existing pairtree" do
31
29
  before(:all) do
32
30
  Dir.chdir(File.join(File.dirname(__FILE__), "../test_data")) do
33
- FileUtils.cp_r('fixtures/pairtree_root_spec', './working')
31
+ FileUtils.cp_r("fixtures/pairtree_root_spec", "./working")
34
32
  end
35
33
  end
36
-
34
+
37
35
  after(:all) do
38
36
  FileUtils.rm_rf(@base_path)
39
37
  end
40
38
 
41
39
  it "should raise an error if a regular file is specified as a root" do
42
- expect { Pairtree.at(File.join(@base_path, "pairtree_prefix"), :create => true) }.to raise_error(Pairtree::PathError)
40
+ expect { Pairtree.at(File.join(@base_path, "pairtree_prefix"), create: true) }.to raise_error(Pairtree::PathError)
43
41
  end
44
-
42
+
45
43
  it "should read the prefix if none is specified" do
46
- expect(Pairtree.at(@base_path).prefix).to eql(File.read(File.join(@base_path, 'pairtree_prefix')))
44
+ expect(Pairtree.at(@base_path).prefix).to eql(File.read(File.join(@base_path, "pairtree_prefix")))
47
45
  end
48
46
 
49
47
  it "should not complain if the given prefix matches the saved prefix" do
50
- expect(Pairtree.at(@base_path, :prefix => 'pfx:').prefix).to eql(File.read(File.join(@base_path, 'pairtree_prefix')))
48
+ expect(Pairtree.at(@base_path, prefix: "pfx:").prefix).to eql(File.read(File.join(@base_path, "pairtree_prefix")))
51
49
  end
52
-
50
+
53
51
  it "should raise an error if the given prefix does not match the saved prefix" do
54
- expect { Pairtree.at(@base_path, :prefix => 'wrong-prefix:') }.to raise_error(Pairtree::IdentifierError)
52
+ expect { Pairtree.at(@base_path, prefix: "wrong-prefix:") }.to raise_error(Pairtree::IdentifierError)
55
53
  end
56
-
54
+
57
55
  it "should not complain if the given version matches the saved version" do
58
- expect(Pairtree.at(@base_path, :version => Pairtree::SPEC_VERSION).pairtree_version).to eql(Pairtree::SPEC_VERSION)
59
- expect(Pairtree.at(@base_path, :version => Pairtree::SPEC_VERSION, :create => true).pairtree_version).to eql(Pairtree::SPEC_VERSION)
56
+ expect(Pairtree.at(@base_path, version: Pairtree::SPEC_VERSION).pairtree_version).to eql(Pairtree::SPEC_VERSION)
57
+ expect(Pairtree.at(@base_path, version: Pairtree::SPEC_VERSION, create: true).pairtree_version).to eql(Pairtree::SPEC_VERSION)
60
58
  end
61
59
 
62
60
  it "should raise an error if the given version does not match the saved version" do
63
- expect { Pairtree.at(@base_path, :version => 0.2) }.to raise_error(Pairtree::VersionMismatch)
64
- expect { Pairtree.at(@base_path, :version => 0.2, :create => true) }.to raise_error(Pairtree::VersionMismatch)
61
+ expect { Pairtree.at(@base_path, version: 0.2) }.to raise_error(Pairtree::VersionMismatch)
62
+ expect { Pairtree.at(@base_path, version: 0.2, create: true) }.to raise_error(Pairtree::VersionMismatch)
65
63
  end
66
-
67
64
  end
68
-
69
65
  end
data/spec/spec_helper.rb CHANGED
@@ -1,16 +1,22 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
3
 
4
- require 'bundler/setup'
5
- require 'rspec'
4
+ require "bundler/setup"
5
+ require "rspec"
6
6
 
7
- if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/
8
- require 'simplecov'
9
- SimpleCov.start
7
+ require "simplecov"
8
+ require "simplecov-lcov"
9
+ SimpleCov::Formatter::LcovFormatter.config do |c|
10
+ c.report_with_single_file = true
11
+ c.single_report_path = "coverage/lcov.info"
10
12
  end
13
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
14
+ SimpleCov::Formatter::HTMLFormatter,
15
+ SimpleCov::Formatter::LcovFormatter
16
+ ])
17
+ SimpleCov.start
11
18
 
12
- require 'pairtree'
19
+ require "pairtree"
13
20
 
14
21
  RSpec.configure do |config|
15
-
16
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpairtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Chris Beer, Bryan Hockey, Michael Slone
7
+ - Chris Beer, Bryan Hockey, Michael Slone, Aaron Elkiss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-05 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: '3.12'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: '3.12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: yard
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,10 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description:
69
+ description: |
70
+ rpairtree is deprecated; please use pairtree instead, which is now being
71
+ maintained. rpairtree 0.3.0 and pairtree 0.3.0 are identical. There will be no
72
+ further releases of rpairtree.
70
73
  email:
71
74
  executables: []
72
75
  extensions: []
@@ -75,8 +78,8 @@ extra_rdoc_files:
75
78
  - README.md
76
79
  files:
77
80
  - ".document"
81
+ - ".github/workflows/tests.yml"
78
82
  - ".gitignore"
79
- - ".travis.yml"
80
83
  - Gemfile
81
84
  - LICENSE.txt
82
85
  - README.md
@@ -101,7 +104,10 @@ homepage: http://github.com/mlibrary/pairtree
101
104
  licenses:
102
105
  - Apache2
103
106
  metadata: {}
104
- post_install_message:
107
+ post_install_message: |
108
+ rpairtree is deprecated; please use pairtree instead, which is now being
109
+ maintained. rpairtree 0.3.0 and pairtree 0.3.0 are identical. There will be no
110
+ further releases of rpairtree.
105
111
  rdoc_options: []
106
112
  require_paths:
107
113
  - lib
@@ -116,10 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
122
  - !ruby/object:Gem::Version
117
123
  version: '0'
118
124
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 2.4.5
125
+ rubygems_version: 3.3.5
121
126
  signing_key:
122
127
  specification_version: 4
123
- summary: Ruby Pairtree implementation, forked from pairtree which is abandoned.
128
+ summary: Ruby Pairtree implementation
124
129
  test_files: []
125
- has_rdoc:
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.8.7
4
- - 1.9.3
5
- - 2.0.0
6
- - jruby-18mode
7
- - jruby-19mode
8
- script: bundle exec rake