pairtree 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bfe1638a3d904fd9b8d4f7ae4e6f3f09ff2cc421a66977e8b82a142e00c55daa
4
+ data.tar.gz: 581951758cc1e541080ddec8ec977caaffe54a2d4420a454c5bc0d4d9aff26bf
5
+ SHA512:
6
+ metadata.gz: 4f6ed2b44ac4c133072e1589932bfa0dd2465ead35ede03fe6f487f319ca1a8517b4c0bbeeda521b3a313842a18aaf12c217dd9e00d735800ce832d6a33dc00c
7
+ data.tar.gz: 4b1c7550ce53c1161963e8a7d99663df9cd93c108fa4c7bb0be16b5edb8d8ef6a10852d6c4445ddee1b2da9ac2e72a9acde525d01d677a9cfd9328e9f4c17cee
@@ -0,0 +1,22 @@
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
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
@@ -42,3 +43,5 @@ pkg
42
43
  #*.swp
43
44
  #
44
45
  Gemfile.lock
46
+
47
+ .idea/
data/Gemfile CHANGED
@@ -1,4 +1,10 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
+ # Specify your gem's dependencies in test.gemspec
3
4
  gemspec
4
- gem 'rcov', :platform => :mri_18
5
+
6
+ group :development, :test do
7
+ gem "simplecov"
8
+ gem "standardrb"
9
+ gem "simplecov-lcov"
10
+ end
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ [![Tests](https://github.com/ruby-microservices/pairtree/actions/workflows/tests.yml/badge.svg)](https://github.com/ruby-microservices/pairtree/actions/workflows/tests.yml)
2
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
3
+
4
+ # pairtree
5
+
6
+ Ruby implementation of the [Pairtree](https://www.ietf.org/archive/id/draft-kunze-pairtree-01.txt) specification from the California Digital Library.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'pairtree'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install pairtree
23
+
24
+ ## Usage
25
+
26
+ ```ruby
27
+ require 'pairtree'
28
+
29
+ # Initiate a tree
30
+ pairtree = Pairtree.at('./data', :prefix => 'pfx:', :create => true)
31
+
32
+ # Create a ppath
33
+ obj = pairtree.mk('pfx:abc123def')
34
+
35
+ # Access an existing ppath
36
+ obj = pairtree['pfx:abc123def']
37
+ obj = pairtree.get('pfx:abc123def')
38
+
39
+ # ppaths are Dir instances with some File and Dir class methods mixed in
40
+ obj.read('content.xml')
41
+ => "<content/>"
42
+ obj.open('my_file.txt','w') { |io| io.write("Write text to file") }
43
+ obj.entries
44
+ => ["content.xml","my_file.txt"]
45
+ obj['*.xml']
46
+ => ["content.xml"]
47
+ obj.each { |file| ... }
48
+ obj.unlink('my_file.txt')
49
+
50
+ # Delete a ppath and all its contents
51
+ pairtree.purge!('pfx:abc123def')
52
+ ```
53
+
54
+ ## Copyright
55
+
56
+ Copyright (c) 2010 Chris Beer. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -1,27 +1,37 @@
1
- Dir.glob('lib/tasks/*.rake').each { |r| import r }
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rake'
5
- require 'rspec/core/rake_task'
6
-
1
+ require "rubygems"
2
+ require "bundler"
7
3
  begin
8
- if RUBY_VERSION < "1.9"
9
- require 'rcov/rcovtask'
10
- desc "Generate code coverage"
11
- RSpec::Core::RakeTask.new(:rcov) do |t|
12
- t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
13
- t.rcov = true
14
- t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
15
- end
16
- end
17
- rescue
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ warn e.message
7
+ warn "Run `bundle install` to install missing gems"
8
+ exit e.status_code
18
9
  end
19
10
 
20
- RSpec::Core::RakeTask.new(:spec)
11
+ Bundler::GemHelper.install_tasks
21
12
 
22
- task :clean do
23
- puts 'Cleaning old coverage.data'
24
- FileUtils.rm('coverage.data') if(File.exists? 'coverage.data')
25
- end
13
+ require "rake"
14
+ require "rspec"
15
+ require "rspec/core/rake_task"
16
+
17
+ desc "Default: run specs."
18
+ task default: :spec
26
19
 
27
- task :default => [:rcov, :doc]
20
+ # Use yard to build docs
21
+ begin
22
+ require "yard"
23
+ require "yard/rake/yardoc_task"
24
+ project_root = __dir__
25
+ doc_destination = File.join(project_root, "doc")
26
+
27
+ YARD::Rake::YardocTask.new(:doc) do |yt|
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"]
31
+ end
32
+ rescue LoadError
33
+ desc "Generate YARD Documentation"
34
+ task :doc do
35
+ abort "Please install the YARD gem to generate rdoc."
36
+ end
37
+ end
@@ -1,34 +1,51 @@
1
1
  module Pairtree
2
2
  class Identifier
3
- ENCODE_REGEX = Regexp.compile("[\"*+,<=>?\\\\^|]|[^\x21-\x7e]", nil, 'u')
4
- DECODE_REGEX = Regexp.compile("\\^(..)", nil, 'u')
3
+ ENCODE_REGEX = Regexp.compile("[\"*+,<=>?\\\\^|]|[^\x21-\x7e]", nil)
4
+ DECODE_REGEX = Regexp.compile("\\^(..)", nil)
5
5
 
6
6
  ##
7
7
  # Encode special characters within an identifier
8
8
  # @param [String] id The identifier
9
9
  def self.encode id
10
- id.gsub(ENCODE_REGEX) { |c| char2hex(c) }.tr('/:.', '=+,')
10
+ id.gsub(ENCODE_REGEX) { |c| char2hex(c) }.tr("/:.", "=+,")
11
11
  end
12
12
 
13
13
  ##
14
14
  # Decode special characters within an identifier
15
15
  # @param [String] id The identifier
16
16
  def self.decode id
17
- id.tr('=+,', '/:.').gsub(DECODE_REGEX) { |h| hex2char(h) }
17
+ input = id.tr("=+,", "/:.").bytes.to_a
18
+ intermediate = []
19
+ while input.first
20
+ if input.first == 94
21
+ h = []
22
+ input.shift
23
+ h << input.shift
24
+ h << input.shift
25
+ intermediate << h.pack("c*").hex
26
+ else
27
+ intermediate << input.shift
28
+ end
29
+ end
30
+ result = intermediate.pack("c*")
31
+ if result.respond_to? :force_encoding
32
+ result.force_encoding("UTF-8")
33
+ end
34
+ result
18
35
  end
19
36
 
20
37
  ##
21
38
  # Convert a character to its pairtree hexidecimal representation
22
39
  # @param [Char] c The character to convert
23
40
  def self.char2hex c
24
- c.unpack('H*')[0].scan(/../).map { |x| "^#{x}"}
41
+ c.unpack1("H*").scan(/../).map { |x| "^#{x}" }.join("")
25
42
  end
26
43
 
27
44
  ##
28
45
  # Convert a pairtree hexidecimal string to its character representation
29
46
  # @param [String] h The hexidecimal string to convert
30
47
  def self.hex2char h
31
- '' << h.delete('^').hex
48
+ "" << h.delete("^").hex
32
49
  end
33
50
  end
34
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,24 +1,17 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = %q{pairtree}
3
- s.summary = %q{Ruby Pairtree implementation}
4
- s.version = "0.1.0"
5
- s.homepage = %q{http://github.com/microservices/pairtree}
6
- s.licenses = ["Apache2"]
7
- s.rubygems_version = %q{1.3.7}
2
+ s.name = "pairtree"
3
+ s.summary = "Ruby Pairtree implementation"
4
+ s.version = "0.3.0"
5
+ s.homepage = "http://github.com/ruby-microservices/pairtree"
6
+ s.licenses = ["Apache2"]
7
+ s.authors = ["Chris Beer, Bryan Hockey, Michael Slone, Aaron Elkiss"]
8
+ s.files = `git ls-files`.split("\n")
9
+ s.extra_rdoc_files = ["LICENSE.txt", "README.md"]
10
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
11
+ s.require_paths = ["lib"]
8
12
 
9
- s.authors = ["Chris Beer"]
10
- s.date = %q{2010-12-23}
11
- s.email = %q{chris@cbeer.info}
12
- s.files = `git ls-files`.split("\n")
13
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
- s.extra_rdoc_files = ["LICENSE.txt", "README.textile"]
15
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
- s.require_paths = ["lib"]
17
-
18
-
19
- s.add_development_dependency "bundler", "~> 1.0.0"
20
- s.add_development_dependency "rspec", ">= 2.0"
13
+ s.add_development_dependency "bundler"
14
+ s.add_development_dependency "rspec", ">= 3.12"
21
15
  s.add_development_dependency "yard"
22
- s.add_development_dependency "RedCloth"
16
+ s.add_development_dependency "rake"
23
17
  end
24
-