Rakefile
author Mahlon E. Smith <mahlon@martini.nu>
Mon, 02 Sep 2019 09:22:50 -0700
changeset 4 cd8abe741d22
parent 3 a062019c2926
permissions -rw-r--r--
Bye, Bitbucket.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     1
#!/usr/bin/env rake
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     2
# vim: set nosta noet ts=4 sw=4:
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     4
require 'rake/clean'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     5
require 'pathname'
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     6
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     7
BASEDIR = Pathname( __FILE__ ).dirname.relative_path_from( Pathname.pwd )
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     8
LIBDIR  = BASEDIR + 'lib' + 'thingfish'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     9
CLOBBER.include( 'coverage' )
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    10
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    11
$LOAD_PATH.unshift( LIBDIR.to_s )
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    12
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    13
if Rake.application.options.trace
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    14
    $trace = true
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    15
    $stderr.puts '$trace is enabled'
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    16
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    17
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    18
task :default => [ :spec, :docs, :package ]
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    19
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    20
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    21
########################################################################
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    22
### P A C K A G I N G
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    23
########################################################################
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    24
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    25
require 'rubygems'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    26
require 'rubygems/package_task'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    27
spec = Gem::Specification.new do |s|
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    28
	s.homepage     = 'http://projects.martini.nu/ruby-modules'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    29
	s.authors      = [ 'Mahlon E. Smith', 'Michael Granger' ]
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    30
	s.email        = [ 'mahlon@martini.nu', 'ged@faeriemud.org' ]
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    31
	s.platform     = Gem::Platform::RUBY
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    32
	s.summary      = "Extract PDF metadata for the Thingfish digital asset manager."
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    33
	s.name         = 'thingfish-processor-pdf'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    34
	s.version      = '0.1.0'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    35
	s.license      = 'BSD-3-Clause'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    36
	s.require_path = 'lib'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    37
	s.bindir       = 'bin'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    38
	s.files        = File.read( __FILE__ ).split( /^__END__/, 2 ).last.split
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    39
	#s.executables  = %w[]
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    40
	s.description  = <<-EOF
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    41
		A basic pdf processor plugin for the Thingfish digital asset manager.
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    42
		It extracts PDF metadata from uploaded files.
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    43
	EOF
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    44
	s.required_rubygems_version = '>= 2.0.3'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    45
	s.required_ruby_version = '>= 2.0.0'
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    46
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    47
	s.add_dependency 'thingfish', '~> 0.5'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    48
	s.add_dependency 'pdf-reader', '~> 1.4'
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    49
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    50
	s.add_development_dependency 'rspec',     '~> 3.7'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    51
	s.add_development_dependency 'simplecov', '~> 0.16'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    52
end
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    53
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    54
Gem::PackageTask.new( spec ) do |pkg|
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    55
	pkg.need_zip = true
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    56
	pkg.need_tar = true
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    57
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    58
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    59
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    60
########################################################################
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    61
### D O C U M E N T A T I O N
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    62
########################################################################
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    63
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    64
begin
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    65
	require 'rdoc/task'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    66
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    67
	desc 'Generate rdoc documentation'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    68
	RDoc::Task.new do |rdoc|
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    69
		rdoc.name       = :docs
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    70
		rdoc.rdoc_dir   = 'docs'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    71
		rdoc.main       = "README.rdoc"
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    72
		rdoc.options    = [ '-f', 'fivefish' ]
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    73
		rdoc.rdoc_files = [ 'lib', *FileList['*.rdoc'] ]
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    74
	end
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    75
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    76
	RDoc::Task.new do |rdoc|
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    77
		rdoc.name       = :doc_coverage
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    78
		rdoc.options    = [ '-C1' ]
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    79
	end
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    80
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    81
rescue LoadError
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    82
	$stderr.puts "Omitting 'docs' tasks, rdoc doesn't seem to be installed."
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    83
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    84
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    85
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    86
########################################################################
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    87
### T E S T I N G
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    88
########################################################################
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    89
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    90
begin
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    91
	require 'rspec/core/rake_task'
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    92
	task :test => :spec
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    93
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    94
	desc "Run specs"
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    95
	RSpec::Core::RakeTask.new do |t|
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    96
		t.pattern = "spec/**/*_spec.rb"
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    97
	end
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    98
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    99
	desc "Build a coverage report"
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   100
	task :coverage do
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   101
		ENV[ 'COVERAGE' ] = "yep"
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   102
		Rake::Task[ :spec ].invoke
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   103
	end
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
   104
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   105
rescue LoadError
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   106
	$stderr.puts "Omitting testing tasks, rspec doesn't seem to be installed."
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   107
end
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   108
0
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
   109
3
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   110
########################################################################
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   111
### M A N I F E S T
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   112
########################################################################
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   113
__END__
a062019c2926 Retire hoe Rakefile.
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   114
lib/thingfish/processor/pdf.rb