Rakefile
changeset 10 8388c2d1d7af
parent 9 47425483883e
child 11 b1f97f6063a3
equal deleted inserted replaced
9:47425483883e 10:8388c2d1d7af
     1 #!/usr/bin/env rake
     1 #!/usr/bin/env rake
       
     2 # vim: set nosta noet ts=4 sw=4:
     2 
     3 
     3 begin
     4 require 'pathname'
     4 	require 'hoe'
     5 
     5 rescue LoadError
     6 PROJECT = 'thingfish-metastore-pggraph'
     6 	abort "This Rakefile requires hoe (gem install hoe)"
     7 BASEDIR = Pathname.new( __FILE__ ).expand_path.dirname.relative_path_from( Pathname.getwd )
       
     8 LIBDIR  = BASEDIR + 'lib'
       
     9 LIBFILE = LIBDIR + ( PROJECT.gsub( '-', '/' ) + '.rb' )
       
    10 
       
    11 if Rake.application.options.trace
       
    12     $trace = true
       
    13     $stderr.puts '$trace is enabled'
     7 end
    14 end
     8 
    15 
     9 GEMSPEC = 'thingfish-metastore-pggraph.gemspec'
    16 # parse the current library version
       
    17 $version = LIBFILE.read.split(/\n/).
       
    18 	select{|line| line =~ /VERSION =/}.first.match(/([\d|.]+)/)[1]
       
    19 
       
    20 task :default => [ :spec, :docs, :package ]
    10 
    21 
    11 
    22 
    12 Hoe.plugin :mercurial
    23 ########################################################################
    13 Hoe.plugin :signing
    24 ### P A C K A G I N G
    14 Hoe.plugin :deveiate
    25 ########################################################################
    15 Hoe.plugin :bundler
       
    16 
    26 
    17 Hoe.plugins.delete :rubyforge
    27 require 'rubygems'
       
    28 require 'rubygems/package_task'
       
    29 spec = Gem::Specification.new do |s|
       
    30 	s.email        = 'mahlon@martini.nu'
       
    31 	s.homepage     = 'https://bitbucket.org/mahlon/thingfish-metastore-pggraph'
       
    32 	s.authors      = [ 'Mahlon E. Smith <mahlon@martini.nu>', 'Michael Granger <ged@faeriemud.org>' ]
       
    33 	s.platform     = Gem::Platform::RUBY
       
    34 	s.summary      = "Graph DDL storage for Thingfish metadata."
       
    35 	s.name         = PROJECT
       
    36 	s.version      = $version
       
    37 	s.license      = 'BSD-3-Clause'
       
    38 	s.has_rdoc     = true
       
    39 	s.require_path = 'lib'
       
    40 	s.bindir       = 'bin'
       
    41 	s.files        = File.read( __FILE__ ).split( /^__END__/, 2 ).last.split
       
    42 	# s.executables  = %w[]
       
    43 	s.description  = <<-EOF
       
    44 This is a metadata storage plugin for the Thingfish digital asset
       
    45 manager.  It provides persistent storage for uploaded data to PostgreSQL
       
    46 tables.
    18 
    47 
    19 hoespec = Hoe.spec 'thingfish-metastore-pggraph' do |spec|
    48 It is heavily based on the regular PG metastore, however it differs by
    20 	spec.readme_file = 'README.md'
    49 storing objects as nodes, and their relations as edges.
    21 	spec.history_file = 'History.md'
    50 	EOF
    22 	spec.extra_rdoc_files = FileList[ '*.rdoc' ]
    51 	s.required_ruby_version = '>= 2.3'
    23 	spec.license 'BSD-3-Clause'
       
    24 	spec.urls = {
       
    25 		home: 'https://bitbucket.org/mahlon/thingfish-metastore-pggraph',
       
    26 		code: 'https://bitbucket.org/mahlon/thingfish-metastore-pggraph'
       
    27 	}
       
    28 
    52 
    29 	if File.directory?( '.hg' )
    53 	s.add_dependency 'thingfish', '~> 0.5'
    30 		spec.spec_extras[:rdoc_options] = ['-f', 'fivefish', '-t', 'Thingfish-Metastore-PgGraph']
    54 	s.add_dependency 'loggability', '~> 0.11'
    31 	end
    55 	s.add_dependency 'configurability', '~> 2.2'
       
    56 	s.add_dependency 'sequel', '~> 4.35'
       
    57 	s.add_dependency 'pg', '~> 0.19'
       
    58 end
    32 
    59 
    33 	spec.developer 'Michael Granger', 'ged@FaerieMUD.org'
    60 Gem::PackageTask.new( spec ) do |pkg|
    34 	spec.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
    61 	pkg.need_zip = true
    35 
    62 	pkg.need_tar = true
    36 	spec.dependency 'thingfish', '~> 0.5'
       
    37 	spec.dependency 'loggability', '~> 0.11'
       
    38 	spec.dependency 'configurability', '~> 2.2'
       
    39 	spec.dependency 'sequel', '~> 4.35'
       
    40 	spec.dependency 'pg', '~> 0.19'
       
    41 
       
    42 	spec.dependency 'hoe-deveiate', '~> 0.8',  :development
       
    43 	spec.dependency 'rspec', '~> 3.0', :development
       
    44 
       
    45 	spec.require_ruby_version( '>=2.3.0' )
       
    46 	spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
       
    47 end
    63 end
    48 
    64 
    49 
    65 
    50 ENV['VERSION'] ||= hoespec.spec.version.to_s
    66 ########################################################################
       
    67 ### D O C U M E N T A T I O N
       
    68 ########################################################################
    51 
    69 
    52 # Run the tests before checking in
    70 begin
    53 task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
    71 	require 'rdoc/task'
    54 
    72 
    55 # Rebuild the ChangeLog immediately before release
    73 	desc 'Generate rdoc documentation'
    56 task :prerelease => 'ChangeLog'
    74 	RDoc::Task.new do |rdoc|
    57 CLOBBER.include( 'ChangeLog' )
    75 		rdoc.name       = :docs
       
    76 		rdoc.rdoc_dir   = 'docs'
       
    77 		rdoc.main       = "README.md"
       
    78 		rdoc.rdoc_files = [ 'lib', *FileList['*.md'] ]
    58 
    79 
    59 desc "Build a coverage report"
    80 		if File.directory?( '.hg' )
    60 task :coverage do
    81 			rdoc.options    = [ '-f', 'fivefish' ]
    61 	ENV["COVERAGE"] = 'yes'
    82 		end
    62 	Rake::Task[:spec].invoke
    83 	end
       
    84 
       
    85 	RDoc::Task.new do |rdoc|
       
    86 		rdoc.name       = :doc_coverage
       
    87 		rdoc.options    = [ '-C1' ]
       
    88 	end
       
    89 
       
    90 rescue LoadError
       
    91 	$stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed."
    63 end
    92 end
    64 
    93 
    65 
    94 
    66 task :gemspec => GEMSPEC
    95 ########################################################################
    67 file GEMSPEC => __FILE__ do |task|
    96 ### T E S T I N G
    68 	spec = $hoespec.spec
    97 ########################################################################
    69 	spec.files.delete( '.gemtest' )
    98 
    70 	spec.signing_key = nil
    99 begin
    71 	spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
   100     require 'rspec/core/rake_task'
    72 	File.open( task.name, 'w' ) do |fh|
   101     task :test => :spec
    73 		fh.write( spec.to_ruby )
   102 
    74 	end
   103     desc "Run specs"
       
   104     RSpec::Core::RakeTask.new do |t|
       
   105         t.pattern = "spec/**/*_spec.rb"
       
   106     end
       
   107 
       
   108     desc "Build a coverage report"
       
   109     task :coverage do
       
   110         ENV[ 'COVERAGE' ] = "yep"
       
   111         Rake::Task[ :spec ].invoke
       
   112     end
       
   113 
       
   114 rescue LoadError
       
   115     $stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed."
    75 end
   116 end
    76 
   117 
    77 task :default => :gemspec
       
    78 CLOBBER.include( GEMSPEC.to_s )
       
    79 
   118 
       
   119 
       
   120 ########################################################################
       
   121 ### M A N I F E S T
       
   122 ########################################################################
       
   123 __END__
       
   124 data/thingfish-metastore-pggraph/migrations/20151102_initial.rb
       
   125 lib/thingfish/metastore/pggraph/edge.rb
       
   126 lib/thingfish/metastore/pggraph/node.rb
       
   127 lib/thingfish/metastore/pggraph.rb
       
   128