1 ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
6 # =======================
7 # = Gem packaging tasks =
8 # =======================
12 task :package => :'package:install'
13 task :manifest => :'package:manifest'
15 Echoe.new('jello', Jello::Version) do |g|
17 g.author = ['elliottcable']
18 g.email = ['Jello@elliottcable.com']
19 g.summary = 'A library to watch the OS X pasteboard, and process/modify incoming pastes.'
20 g.url = 'http://github.com/elliottcable/jello'
21 g.development_dependencies = ['echoe >=3.0.1', 'rspec', 'rcov', 'yard', 'stringray']
22 g.manifest_name = '.manifest'
23 g.ignore_pattern = /^\.git\/|^meta\/|\.gemspec/
26 desc 'tests packaged files to ensure they are all present'
27 task :verify => :package do
28 # An error message will be displayed if files are missing
29 if system %(ruby -e "require 'rubygems'; require 'pkg/jello-#{Jello::Version}/lib/jello'")
30 puts "\nThe library files are present"
34 task :copy_gemspec => [:package] do
35 pkg = Dir['pkg/*'].select {|dir| File.directory? dir}.last
36 mv File.join(pkg, pkg.gsub(/^pkg\//,'').gsub(/\-\d+$/,'.gemspec')), './'
39 desc 'builds a gemspec as GitHub wants it'
40 task :gemspec => [:package, :copy_gemspec, :clobber_package]
44 desc 'You need the `echoe` gem to package Jello'
48 # =======================
49 # = Spec/Coverage tasks =
50 # =======================
54 require 'spec/rake/spectask'
56 task :default => :'coverage:run'
57 task :coverage => :'coverage:run'
58 namespace :coverage do
59 Spec::Rake::SpecTask.new(:run) do |t|
60 t.spec_opts = ["--format", "specdoc"]
61 t.spec_opts << "--colour" unless ENV['CI']
62 t.spec_files = Dir['spec/**/*_spec.rb'].sort
65 t.rcov_opts = [ '--include-file', '"^lib"', '--exclude-only', '".*"']
66 t.rcov_dir = File.join('meta', 'coverage')
70 require 'spec/rake/verify_rcov'
71 # For the moment, this is the only way I know of to fix RCov. I may
72 # release the fix as it's own gem at some point in the near future.
73 require 'stringray/core_ext/spec/rake/verify_rcov'
74 RCov::VerifyTask.new(:verify) do |t|
76 t.index_html = File.join('meta', 'coverage', 'index.html')
77 t.require_exact_threshold = false
80 desc 'You need the `stringray` gem to verify coverage'
85 system 'open ' + File.join('meta', 'coverage', 'index.html') if PLATFORM['darwin']
90 desc 'You need the `rcov` and `rspec` gems to run specs/coverage'
94 # =======================
95 # = Documentation tasks =
96 # =======================
99 require 'yard/rake/yardoc_task'
101 task :documentation => :'documentation:generate'
102 namespace :documentation do
103 YARD::Rake::YardocTask.new :generate do |t|
104 t.files = ['lib/**/*.rb']
105 t.options = ['--output-dir', File.join('meta', 'documentation'),
106 '--readme', 'README.markdown']
109 YARD::Rake::YardocTask.new :dotyardoc do |t|
110 t.files = ['lib/**/*.rb']
111 t.options = ['--no-output',
112 '--readme', 'README.markdown']
116 system 'open ' + File.join('meta', 'documentation', 'index.html') if PLATFORM['darwin']
121 desc 'You need the `yard` gem to generate documentation'
128 desc 'Removes all meta producs'
130 `rm -rf #{File.expand_path(File.join( File.dirname(__FILE__), 'meta' ))}`
133 desc 'Check everything over before commiting'
134 task :aok => [:'documentation:generate', :'documentation:open',
135 :'package:manifest', :'package:gemspec',
136 :'coverage:run', :'coverage:verify', :'coverage:open']
138 task :ci => [:'documentation:generate', :'coverage:run', :'coverage:verify']