1 ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
6 # =======================
7 # = Gem packaging tasks =
8 # =======================
12 task :install => :'package:install'
13 task :package => :'package:package'
14 task :manifest => :'package:manifest'
16 Echoe.new('nfoiled', Nfoiled::Version) do |g|
18 g.author = ['elliottcable']
19 g.email = ['Nfoiled@elliottcable.com']
20 g.summary = 'The Rubyist\'s interface to Ncurses.'
21 g.url = 'http://github.com/elliottcable/nfoiled'
22 g.runtime_dependencies = ['ncurses'] #, 'yard >=0.2.3'
23 g.development_dependencies = ['echoe >= 3.0.2', 'rspec', 'rcov', 'yard', 'stringray']
24 g.manifest_name = '.manifest'
25 g.retain_gemspec = true
26 g.rakefile_name = 'Rakefile.rb'
27 g.ignore_pattern = /^\.git\/|^meta\/|\.gemspec/
30 desc 'tests packaged files to ensure they are all present'
31 task :verify => :package do
32 # An error message will be displayed if files are missing
33 if system %(ruby -e "require 'rubygems'; require 'pkg/nfoiled-#{Nfoiled::Version}/lib/nfoiled'")
34 puts "\nThe library files are present"
40 desc 'You need the `echoe` gem to package Nfoiled'
44 # =======================
45 # = Spec/Coverage tasks =
46 # =======================
50 require 'spec/rake/spectask'
52 task :default => :'coverage:run'
53 task :coverage => :'coverage:run'
54 namespace :coverage do
55 Spec::Rake::SpecTask.new(:run) do |t|
56 t.spec_opts = ["--format", "specdoc"]
57 t.spec_opts << "--colour" unless ENV['CI']
58 t.spec_files = Dir['spec/**/*_spec.rb'].sort
61 t.rcov_opts = ['--exclude-only', '".*"', '--include-file', '"^lib"']
62 t.rcov_dir = File.join('meta', 'coverage')
66 require 'spec/rake/verify_rcov'
67 # For the moment, this is the only way I know of to fix RCov. I may
68 # release the fix as it's own gem at some point in the near future.
69 require 'stringray/core_ext/spec/rake/verify_rcov'
70 RCov::VerifyTask.new(:verify) do |t|
72 t.index_html = File.join('meta', 'coverage', 'index.html')
73 t.require_exact_threshold = false
76 desc 'You need the `stringray` gem to verify coverage'
81 system 'open ' + File.join('meta', 'coverage', 'index.html') if PLATFORM['darwin']
86 desc 'You need the `rcov` and `rspec` gems to run specs/coverage'
90 # =======================
91 # = Documentation tasks =
92 # =======================
95 require 'yard/rake/yardoc_task'
97 task :documentation => :'documentation:generate'
98 namespace :documentation do
99 YARD::Rake::YardocTask.new :generate do |t|
100 t.files = ['lib/**/*.rb']
101 t.options = ['--output-dir', File.join('meta', 'documentation'),
102 '--readme', 'README.markdown']
105 YARD::Rake::YardocTask.new :dotyardoc do |t|
106 t.files = ['lib/**/*.rb']
107 t.options = ['--no-output',
108 '--readme', 'README.markdown']
112 system 'open ' + File.join('meta', 'documentation', 'index.html') if PLATFORM['darwin']
117 desc 'You need the `yard` gem to generate documentation'
124 desc 'Removes all meta producs'
126 `rm -rf #{File.expand_path(File.join( File.dirname(__FILE__), 'meta' ))}`
129 desc 'Check everything over before commiting'
130 task :aok => [:'documentation:generate', :'documentation:open',
132 :'coverage:run', :'coverage:verify', :'coverage:open']
134 task :ci => [:'documentation:generate', :'coverage:run', :'coverage:verify']