Rakefile
changeset 3 a062019c2926
parent 0 266fe36d11dd
child 4 cd8abe741d22
equal deleted inserted replaced
2:bef152286d42 3:a062019c2926
     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 'rake/clean'
     4 	require 'hoe'
     5 require 'pathname'
     5 rescue LoadError
     6 
     6 	abort "This Rakefile requires hoe (gem install hoe)"
     7 BASEDIR = Pathname( __FILE__ ).dirname.relative_path_from( Pathname.pwd )
       
     8 LIBDIR  = BASEDIR + 'lib' + 'thingfish'
       
     9 CLOBBER.include( 'coverage' )
       
    10 
       
    11 $LOAD_PATH.unshift( LIBDIR.to_s )
       
    12 
       
    13 if Rake.application.options.trace
       
    14     $trace = true
       
    15     $stderr.puts '$trace is enabled'
     7 end
    16 end
     8 
    17 
     9 GEMSPEC = 'thingfish-processor-pdf.gemspec'
    18 task :default => [ :spec, :docs, :package ]
    10 
    19 
    11 
    20 
    12 Hoe.plugin :mercurial
    21 ########################################################################
    13 Hoe.plugin :signing
    22 ### P A C K A G I N G
    14 Hoe.plugin :deveiate
    23 ########################################################################
    15 
    24 
    16 Hoe.plugins.delete :rubyforge
    25 require 'rubygems'
       
    26 require 'rubygems/package_task'
       
    27 spec = Gem::Specification.new do |s|
       
    28 	s.homepage     = 'http://projects.martini.nu/ruby-modules'
       
    29 	s.authors      = [ 'Mahlon E. Smith', 'Michael Granger' ]
       
    30 	s.email        = [ 'mahlon@martini.nu', 'ged@faeriemud.org' ]
       
    31 	s.platform     = Gem::Platform::RUBY
       
    32 	s.summary      = "Extract PDF metadata for the Thingfish digital asset manager."
       
    33 	s.name         = 'thingfish-processor-pdf'
       
    34 	s.version      = '0.1.0'
       
    35 	s.license      = 'BSD-3-Clause'
       
    36 	s.has_rdoc     = true
       
    37 	s.require_path = 'lib'
       
    38 	s.bindir       = 'bin'
       
    39 	s.files        = File.read( __FILE__ ).split( /^__END__/, 2 ).last.split
       
    40 	#s.executables  = %w[]
       
    41 	s.description  = <<-EOF
       
    42 		A basic pdf processor plugin for the Thingfish digital asset manager.
       
    43 		It extracts PDF metadata from uploaded files.
       
    44 	EOF
       
    45 	s.required_rubygems_version = '>= 2.0.3'
       
    46 	s.required_ruby_version = '>= 2.0.0'
    17 
    47 
    18 hoespec = Hoe.spec 'thingfish-processor-pdf' do |spec|
    48 	s.add_dependency 'thingfish', '~> 0.5'
    19 	spec.readme_file = 'README.md'
    49 	s.add_dependency 'pdf-reader', '~> 1.4'
    20 	spec.history_file = 'History.md'
       
    21 	spec.extra_rdoc_files = FileList[ '*.rdoc', '*.md' ]
       
    22 	spec.urls = {
       
    23 		home: 'https://bitbucket.org/mahlon/thingfish-processor-pdf'
       
    24 	}
       
    25 
    50 
    26 	spec.extra_rdoc_files = FileList[ '*.rdoc', '*.md' ]
    51 	s.add_development_dependency 'rspec',     '~> 3.7'
    27 	spec.license 'BSD-3-Clause'
    52 	s.add_development_dependency 'simplecov', '~> 0.16'
       
    53 end
    28 
    54 
    29 	spec.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
    55 Gem::PackageTask.new( spec ) do |pkg|
    30 
    56 	pkg.need_zip = true
    31 	spec.dependency 'thingfish',   '~> 0.5'
    57 	pkg.need_tar = true
    32 	spec.dependency 'pdf-reader',  '~> 1.4'
       
    33 	spec.dependency 'loggability', '~> 0.11'
       
    34 
       
    35 	spec.dependency 'hoe-deveiate',            '~> 0.8', :developer
       
    36 	spec.dependency 'simplecov',               '~> 0.12', :developer
       
    37 	spec.dependency 'rdoc-generator-fivefish', '~> 0.1', :developer
       
    38 
       
    39 	spec.require_ruby_version( '>=2.3.1' )
       
    40 	spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
       
    41 	spec.check_history_on_release = true if spec.respond_to?( :check_history_on_release= )
       
    42 end
    58 end
    43 
    59 
    44 
    60 
    45 ENV['VERSION'] ||= hoespec.spec.version.to_s
    61 ########################################################################
       
    62 ### D O C U M E N T A T I O N
       
    63 ########################################################################
    46 
    64 
    47 # Run the tests before checking in
    65 begin
    48 task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
    66 	require 'rdoc/task'
    49 
    67 
    50 task :test => :spec
    68 	desc 'Generate rdoc documentation'
       
    69 	RDoc::Task.new do |rdoc|
       
    70 		rdoc.name       = :docs
       
    71 		rdoc.rdoc_dir   = 'docs'
       
    72 		rdoc.main       = "README.rdoc"
       
    73 		rdoc.options    = [ '-f', 'fivefish' ]
       
    74 		rdoc.rdoc_files = [ 'lib', *FileList['*.rdoc'] ]
       
    75 	end
    51 
    76 
    52 # Rebuild the ChangeLog immediately before release
    77 	RDoc::Task.new do |rdoc|
    53 task :prerelease => 'ChangeLog'
    78 		rdoc.name       = :doc_coverage
    54 CLOBBER.include( 'ChangeLog' )
    79 		rdoc.options    = [ '-C1' ]
       
    80 	end
    55 
    81 
    56 desc "Build a coverage report"
    82 rescue LoadError
    57 task :coverage do
    83 	$stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed."
    58 	ENV["COVERAGE"] = 'yes'
       
    59 	Rake::Task[:spec].invoke
       
    60 end
    84 end
    61 CLOBBER.include( 'coverage' )
       
    62 
    85 
    63 
    86 
    64 # Use the fivefish formatter for docs generated from development checkout
    87 ########################################################################
    65 if File.directory?( '.hg' )
    88 ### T E S T I N G
    66 	require 'rdoc/task'
    89 ########################################################################
    67 
    90 
    68 	Rake::Task[ 'docs' ].clear
    91 begin
    69 	RDoc::Task.new( 'docs' ) do |rdoc|
    92 	require 'rspec/core/rake_task'
    70 	    rdoc.main = "README.rdoc"
    93 	task :test => :spec
    71 		rdoc.markup = 'markdown'
    94 
    72 	    rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb" )
    95 	desc "Run specs"
    73 	    rdoc.generator = :fivefish
    96 	RSpec::Core::RakeTask.new do |t|
    74 		rdoc.title = 'Thingfish-Processor-PDF'
    97 		t.pattern = "spec/**/*_spec.rb"
    75 	    rdoc.rdoc_dir = 'doc'
       
    76 	end
    98 	end
       
    99 
       
   100 	desc "Build a coverage report"
       
   101 	task :coverage do
       
   102 		ENV[ 'COVERAGE' ] = "yep"
       
   103 		Rake::Task[ :spec ].invoke
       
   104 	end
       
   105 
       
   106 rescue LoadError
       
   107 	$stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed."
    77 end
   108 end
    78 
   109 
    79 task :gemspec => GEMSPEC
       
    80 file GEMSPEC => __FILE__
       
    81 task GEMSPEC do |task|
       
    82 	spec = $hoespec.spec
       
    83 	spec.files.delete( '.gemtest' )
       
    84 	spec.signing_key = nil
       
    85 	spec.cert_chain = Rake::FileList[ 'certs/*.pem' ].to_a
       
    86 	spec.version = "#{spec.version.bump}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
       
    87 	File.open( task.name, 'w' ) do |fh|
       
    88 		fh.write( spec.to_ruby )
       
    89 	end
       
    90 end
       
    91 CLOBBER.include( GEMSPEC.to_s )
       
    92 
   110 
    93 task :default => :gemspec
   111 ########################################################################
    94 
   112 ### M A N I F E S T
       
   113 ########################################################################
       
   114 __END__
       
   115 lib/thingfish/processor/pdf.rb