--- a/Rakefile Mon Nov 14 14:43:41 2016 -0800
+++ b/Rakefile Mon Nov 14 15:17:46 2016 -0800
@@ -1,79 +1,128 @@
#!/usr/bin/env rake
+# vim: set nosta noet ts=4 sw=4:
+
+require 'pathname'
-begin
- require 'hoe'
-rescue LoadError
- abort "This Rakefile requires hoe (gem install hoe)"
+PROJECT = 'thingfish-metastore-pggraph'
+BASEDIR = Pathname.new( __FILE__ ).expand_path.dirname.relative_path_from( Pathname.getwd )
+LIBDIR = BASEDIR + 'lib'
+LIBFILE = LIBDIR + ( PROJECT.gsub( '-', '/' ) + '.rb' )
+
+if Rake.application.options.trace
+ $trace = true
+ $stderr.puts '$trace is enabled'
end
-GEMSPEC = 'thingfish-metastore-pggraph.gemspec'
+# parse the current library version
+$version = LIBFILE.read.split(/\n/).
+ select{|line| line =~ /VERSION =/}.first.match(/([\d|.]+)/)[1]
+
+task :default => [ :spec, :docs, :package ]
-Hoe.plugin :mercurial
-Hoe.plugin :signing
-Hoe.plugin :deveiate
-Hoe.plugin :bundler
-
-Hoe.plugins.delete :rubyforge
-
-hoespec = Hoe.spec 'thingfish-metastore-pggraph' do |spec|
- spec.readme_file = 'README.md'
- spec.history_file = 'History.md'
- spec.extra_rdoc_files = FileList[ '*.rdoc' ]
- spec.license 'BSD-3-Clause'
- spec.urls = {
- home: 'https://bitbucket.org/mahlon/thingfish-metastore-pggraph',
- code: 'https://bitbucket.org/mahlon/thingfish-metastore-pggraph'
- }
+########################################################################
+### P A C K A G I N G
+########################################################################
- if File.directory?( '.hg' )
- spec.spec_extras[:rdoc_options] = ['-f', 'fivefish', '-t', 'Thingfish-Metastore-PgGraph']
- end
-
- spec.developer 'Michael Granger', 'ged@FaerieMUD.org'
- spec.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
+require 'rubygems'
+require 'rubygems/package_task'
+spec = Gem::Specification.new do |s|
+ s.email = 'mahlon@martini.nu'
+ s.homepage = 'https://bitbucket.org/mahlon/thingfish-metastore-pggraph'
+ s.authors = [ 'Mahlon E. Smith <mahlon@martini.nu>', 'Michael Granger <ged@faeriemud.org>' ]
+ s.platform = Gem::Platform::RUBY
+ s.summary = "Graph DDL storage for Thingfish metadata."
+ s.name = PROJECT
+ s.version = $version
+ s.license = 'BSD-3-Clause'
+ s.has_rdoc = true
+ s.require_path = 'lib'
+ s.bindir = 'bin'
+ s.files = File.read( __FILE__ ).split( /^__END__/, 2 ).last.split
+ # s.executables = %w[]
+ s.description = <<-EOF
+This is a metadata storage plugin for the Thingfish digital asset
+manager. It provides persistent storage for uploaded data to PostgreSQL
+tables.
- spec.dependency 'thingfish', '~> 0.5'
- spec.dependency 'loggability', '~> 0.11'
- spec.dependency 'configurability', '~> 2.2'
- spec.dependency 'sequel', '~> 4.35'
- spec.dependency 'pg', '~> 0.19'
+It is heavily based on the regular PG metastore, however it differs by
+storing objects as nodes, and their relations as edges.
+ EOF
+ s.required_ruby_version = '>= 2.3'
- spec.dependency 'hoe-deveiate', '~> 0.8', :development
- spec.dependency 'rspec', '~> 3.0', :development
+ s.add_dependency 'thingfish', '~> 0.5'
+ s.add_dependency 'loggability', '~> 0.11'
+ s.add_dependency 'configurability', '~> 2.2'
+ s.add_dependency 'sequel', '~> 4.35'
+ s.add_dependency 'pg', '~> 0.19'
+end
- spec.require_ruby_version( '>=2.3.0' )
- spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
+Gem::PackageTask.new( spec ) do |pkg|
+ pkg.need_zip = true
+ pkg.need_tar = true
end
-ENV['VERSION'] ||= hoespec.spec.version.to_s
+########################################################################
+### D O C U M E N T A T I O N
+########################################################################
-# Run the tests before checking in
-task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
+begin
+ require 'rdoc/task'
-# Rebuild the ChangeLog immediately before release
-task :prerelease => 'ChangeLog'
-CLOBBER.include( 'ChangeLog' )
+ desc 'Generate rdoc documentation'
+ RDoc::Task.new do |rdoc|
+ rdoc.name = :docs
+ rdoc.rdoc_dir = 'docs'
+ rdoc.main = "README.md"
+ rdoc.rdoc_files = [ 'lib', *FileList['*.md'] ]
-desc "Build a coverage report"
-task :coverage do
- ENV["COVERAGE"] = 'yes'
- Rake::Task[:spec].invoke
+ if File.directory?( '.hg' )
+ rdoc.options = [ '-f', 'fivefish' ]
+ end
+ end
+
+ RDoc::Task.new do |rdoc|
+ rdoc.name = :doc_coverage
+ rdoc.options = [ '-C1' ]
+ end
+
+rescue LoadError
+ $stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed."
end
-task :gemspec => GEMSPEC
-file GEMSPEC => __FILE__ do |task|
- spec = $hoespec.spec
- spec.files.delete( '.gemtest' )
- spec.signing_key = nil
- spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
- File.open( task.name, 'w' ) do |fh|
- fh.write( spec.to_ruby )
- end
+########################################################################
+### T E S T I N G
+########################################################################
+
+begin
+ require 'rspec/core/rake_task'
+ task :test => :spec
+
+ desc "Run specs"
+ RSpec::Core::RakeTask.new do |t|
+ t.pattern = "spec/**/*_spec.rb"
+ end
+
+ desc "Build a coverage report"
+ task :coverage do
+ ENV[ 'COVERAGE' ] = "yep"
+ Rake::Task[ :spec ].invoke
+ end
+
+rescue LoadError
+ $stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed."
end
-task :default => :gemspec
-CLOBBER.include( GEMSPEC.to_s )
+
+########################################################################
+### M A N I F E S T
+########################################################################
+__END__
+data/thingfish-metastore-pggraph/migrations/20151102_initial.rb
+lib/thingfish/metastore/pggraph/edge.rb
+lib/thingfish/metastore/pggraph/node.rb
+lib/thingfish/metastore/pggraph.rb
+