Rakefile
author Mahlon E. Smith <mahlon@laika.com>
Wed, 16 Nov 2016 13:11:39 -0800
changeset 0 266fe36d11dd
child 3 a062019c2926
permissions -rw-r--r--
Initial release.
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
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     2
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     3
begin
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     4
	require 'hoe'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     5
rescue LoadError
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     6
	abort "This Rakefile requires hoe (gem install hoe)"
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     7
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     8
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
     9
GEMSPEC = 'thingfish-processor-pdf.gemspec'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    10
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    11
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    12
Hoe.plugin :mercurial
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    13
Hoe.plugin :signing
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    14
Hoe.plugin :deveiate
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    15
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    16
Hoe.plugins.delete :rubyforge
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    17
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    18
hoespec = Hoe.spec 'thingfish-processor-pdf' do |spec|
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    19
	spec.readme_file = 'README.md'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    20
	spec.history_file = 'History.md'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    21
	spec.extra_rdoc_files = FileList[ '*.rdoc', '*.md' ]
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    22
	spec.urls = {
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    23
		home: 'https://bitbucket.org/mahlon/thingfish-processor-pdf'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    24
	}
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    25
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    26
	spec.extra_rdoc_files = FileList[ '*.rdoc', '*.md' ]
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    27
	spec.license 'BSD-3-Clause'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    28
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    29
	spec.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    30
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    31
	spec.dependency 'thingfish',   '~> 0.5'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    32
	spec.dependency 'pdf-reader',  '~> 1.4'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    33
	spec.dependency 'loggability', '~> 0.11'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    34
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    35
	spec.dependency 'hoe-deveiate',            '~> 0.8', :developer
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    36
	spec.dependency 'simplecov',               '~> 0.12', :developer
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    37
	spec.dependency 'rdoc-generator-fivefish', '~> 0.1', :developer
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    38
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    39
	spec.require_ruby_version( '>=2.3.1' )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    40
	spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    41
	spec.check_history_on_release = true if spec.respond_to?( :check_history_on_release= )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    42
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    43
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    44
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    45
ENV['VERSION'] ||= hoespec.spec.version.to_s
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    46
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    47
# Run the tests before checking in
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    48
task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    49
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    50
task :test => :spec
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    51
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    52
# Rebuild the ChangeLog immediately before release
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    53
task :prerelease => 'ChangeLog'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    54
CLOBBER.include( 'ChangeLog' )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    55
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    56
desc "Build a coverage report"
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    57
task :coverage do
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    58
	ENV["COVERAGE"] = 'yes'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    59
	Rake::Task[:spec].invoke
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    60
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    61
CLOBBER.include( 'coverage' )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    62
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    63
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    64
# Use the fivefish formatter for docs generated from development checkout
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    65
if File.directory?( '.hg' )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    66
	require 'rdoc/task'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    67
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    68
	Rake::Task[ 'docs' ].clear
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    69
	RDoc::Task.new( 'docs' ) do |rdoc|
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    70
	    rdoc.main = "README.rdoc"
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    71
		rdoc.markup = 'markdown'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    72
	    rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb" )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    73
	    rdoc.generator = :fivefish
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    74
		rdoc.title = 'Thingfish-Processor-PDF'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    75
	    rdoc.rdoc_dir = 'doc'
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    76
	end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    77
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    78
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    79
task :gemspec => GEMSPEC
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    80
file GEMSPEC => __FILE__
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    81
task GEMSPEC do |task|
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    82
	spec = $hoespec.spec
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    83
	spec.files.delete( '.gemtest' )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    84
	spec.signing_key = nil
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    85
	spec.cert_chain = Rake::FileList[ 'certs/*.pem' ].to_a
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    86
	spec.version = "#{spec.version.bump}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    87
	File.open( task.name, 'w' ) do |fh|
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    88
		fh.write( spec.to_ruby )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    89
	end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    90
end
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    91
CLOBBER.include( GEMSPEC.to_s )
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    92
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    93
task :default => :gemspec
266fe36d11dd Initial release.
Mahlon E. Smith <mahlon@laika.com>
parents:
diff changeset
    94