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 = ['elliottcable-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 `elliottcable-echoe` gem to package Jello'
43 # =======================
44 # = Spec/Coverage tasks =
45 # =======================
49 require 'spec/rake/spectask'
51 task :default => :'coverage:run'
52 task :coverage => :'coverage:run'
53 namespace :coverage do
54 Spec::Rake::SpecTask.new(:run) do |t|
55 t.spec_opts = ["--format", "specdoc"]
56 t.spec_opts << "--colour" unless ENV['CI']
57 t.spec_files = Dir['spec/**/*_spec.rb'].sort
60 t.rcov_opts = [ '--include-file', '"^lib"', '--exclude-only', '".*"']
61 t.rcov_dir = File.join('meta', 'coverage')
65 require 'spec/rake/verify_rcov'
66 # For the moment, this is the only way I know of to fix RCov. I may
67 # release the fix as it's own gem at some point in the near future.
68 require 'stringray/core_ext/spec/rake/verify_rcov'
69 RCov::VerifyTask.new(:verify) do |t|
71 t.index_html = File.join('meta', 'coverage', 'index.html')
72 t.require_exact_threshold = false
75 desc 'You need the `stringray` gem to verify coverage'
80 system 'open ' + File.join('meta', 'coverage', 'index.html') if PLATFORM['darwin']
85 desc 'You need the `rcov` and `rspec` gems to run specs/coverage'
89 # =======================
90 # = Documentation tasks =
91 # =======================
94 require 'yard/rake/yardoc_task'
96 task :documentation => :'documentation:generate'
97 namespace :documentation do
98 YARD::Rake::YardocTask.new :generate do |t|
99 t.files = ['lib/**/*.rb']
100 t.options = ['--output-dir', File.join('meta', 'documentation'),
101 '--readme', 'README.markdown']
104 YARD::Rake::YardocTask.new :dotyardoc do |t|
105 t.files = ['lib/**/*.rb']
106 t.options = ['--no-output',
107 '--readme', 'README.markdown']
111 system 'open ' + File.join('meta', 'documentation', 'index.html') if PLATFORM['darwin']
116 desc 'You need the `yard` gem to generate documentation'
123 desc 'Removes all meta producs'
125 `rm -rf #{File.expand_path(File.join( File.dirname(__FILE__), 'meta' ))}`
128 desc 'Check everything over before commiting'
129 task :aok => [:'documentation:generate', :'documentation:open',
130 :'package:manifest', :'package:package',
131 :'coverage:run', :'coverage:verify', :'coverage:open']
133 task :ci => [:'documentation:generate', :'coverage:run', :'coverage:verify']