1 ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
6 # =======================
7 # = Gem packaging tasks =
8 # =======================
12 task :package => :'package:package'
13 task :install => :'package:install'
14 task :manifest => :'package:manifest'
16 Echoe.new('jello', Jello::Version) do |g|
18 g.author = ['elliottcable']
19 g.email = ['Jello@elliottcable.com']
20 g.summary = 'A library to watch the OS X pasteboard, and process/modify incoming pastes.'
21 g.url = 'http://github.com/elliottcable/jello'
22 g.development_dependencies = ['echoe >= 3.0.2', 'rspec', 'rcov', 'yard', 'stringray']
23 g.manifest_name = '.manifest'
24 g.retain_gemspec = true
25 g.rakefile_name = 'Rakefile.rb'
26 g.ignore_pattern = /^\.git\/|^meta\/|\.gemspec/
29 desc 'tests packaged files to ensure they are all present'
30 task :verify => :package do
31 # An error message will be displayed if files are missing
32 if system %(ruby -e "require 'rubygems'; require 'pkg/jello-#{Jello::Version}/lib/jello'")
33 puts "\nThe library files are present"
39 desc 'You need the `echoe` gem to package Jello'
44 require 'launchdr/task'
46 LaunchDr::Task.new :launchd, :bin => 'jello', :arguments => ['shortener', 'grabup']
48 desc 'You need the `elliottcable-launchdr` gem to generate a launchd property list'
52 # =======================
53 # = Spec/Coverage tasks =
54 # =======================
58 require 'spec/rake/spectask'
60 task :default => :'coverage:run'
61 task :coverage => :'coverage:run'
62 namespace :coverage do
63 Spec::Rake::SpecTask.new(:run) do |t|
64 t.spec_opts = ["--format", "specdoc"]
65 t.spec_opts << "--colour" unless ENV['CI']
66 t.spec_files = Dir['spec/**/*_spec.rb'].sort
69 t.rcov_opts = [ '--include-file', '"^lib"', '--exclude-only', '".*"']
70 t.rcov_dir = File.join('meta', 'coverage')
74 require 'spec/rake/verify_rcov'
75 # For the moment, this is the only way I know of to fix RCov. I may
76 # release the fix as it's own gem at some point in the near future.
77 require 'stringray/core_ext/spec/rake/verify_rcov'
78 RCov::VerifyTask.new(:verify) do |t|
80 t.index_html = File.join('meta', 'coverage', 'index.html')
81 t.require_exact_threshold = false
84 desc 'You need the `stringray` gem to verify coverage'
89 system 'open ' + File.join('meta', 'coverage', 'index.html') if PLATFORM['darwin']
94 desc 'You need the `rcov` and `rspec` gems to run specs/coverage'
98 # =======================
99 # = Documentation tasks =
100 # =======================
103 require 'yard/rake/yardoc_task'
105 task :documentation => :'documentation:generate'
106 namespace :documentation do
107 YARD::Rake::YardocTask.new :generate do |t|
108 t.files = ['lib/**/*.rb']
109 t.options = ['--output-dir', File.join('meta', 'documentation'),
110 '--readme', 'README.markdown']
113 YARD::Rake::YardocTask.new :dotyardoc do |t|
114 t.files = ['lib/**/*.rb']
115 t.options = ['--no-output',
116 '--readme', 'README.markdown']
120 system 'open ' + File.join('meta', 'documentation', 'index.html') if PLATFORM['darwin']
125 desc 'You need the `yard` gem to generate documentation'
132 desc 'Removes all meta producs'
134 `rm -rf #{File.expand_path(File.join( File.dirname(__FILE__), 'meta' ))}`
137 desc 'Check everything over before commiting'
138 task :aok => [:'documentation:generate', :'documentation:open',
139 :'package:manifest', :'package:package',
140 :'coverage:run', :'coverage:verify', :'coverage:open']
142 task :ci => [:'documentation:generate', :'coverage:run', :'coverage:verify']