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('nfoiled', Nfoiled::VERSION) do |g|; g.name = 'Nfoiled'
17 g.author = ['elliottcable']
18 g.email = ['Nfoiled@elliottcable.com']
19 g.summary = 'The Rubyist\'s interface to Ncurses.'
20 g.url = 'http://github.com/elliottcable/nfoiled'
21 g.runtime_dependencies = ['ncurses'] #, 'yard >=0.2.3'
22 g.development_dependencies = ['echoe', 'rspec', 'rcov', 'yard', 'stringray']
23 g.manifest_name = '.manifest'
24 g.ignore_pattern = /^\.git\/|^meta\/|\.gemspec/
27 desc 'tests packaged files to ensure they are all present'
28 task :verify => :package do
29 # An error message will be displayed if files are missing
30 if system %(ruby -e "require 'rubygems'; require 'pkg/nfoiled-#{Nfoiled::VERSION}/lib/nfoiled'")
31 puts "\nThe library files are present"
35 task :copy_gemspec => [:package] do
36 pkg = Dir['pkg/*'].select {|dir| File.directory? dir}.last
37 mv File.join(pkg, pkg.gsub(/^pkg\//,'').gsub(/\-\d+$/,'.gemspec')), './'
40 desc 'builds a gemspec as GitHub wants it'
41 task :gemspec => [:package, :copy_gemspec, :clobber_package]
45 desc 'You need the `echoe` gem to package Nfoiled'
49 # =======================
50 # = Spec/Coverage tasks =
51 # =======================
55 require 'spec/rake/spectask'
57 task :default => :'coverage:run'
58 task :coverage => :'coverage:run'
59 namespace :coverage do
60 Spec::Rake::SpecTask.new(:run) do |t|
61 t.spec_opts = ["--format", "specdoc"]
62 t.spec_opts << "--colour" unless ENV['CI']
63 t.spec_files = Dir['spec/**/*_spec.rb'].sort
66 t.rcov_opts = ['--exclude-only', '".*"', '--include-file', '"^lib"']
67 t.rcov_dir = File.join('meta', 'coverage')
71 require 'spec/rake/verify_rcov'
72 # For the moment, this is the only way I know of to fix RCov. I may
73 # release the fix as it's own gem at some point in the near future.
74 require 'stringray/core_ext/spec/rake/verify_rcov'
75 RCov::VerifyTask.new(:verify) do |t|
77 t.index_html = File.join('meta', 'coverage', 'index.html')
78 t.require_exact_threshold = false
81 desc 'You need the `stringray` gem to verify coverage'
86 system 'open ' + File.join('meta', 'coverage', 'index.html') if PLATFORM['darwin']
91 desc 'You need the `rcov` and `rspec` gems to run specs/coverage'
95 # =======================
96 # = Documentation tasks =
97 # =======================
100 require 'yard/rake/yardoc_task'
102 task :documentation => :'documentation:generate'
103 namespace :documentation do
104 YARD::Rake::YardocTask.new :generate do |t|
105 t.files = ['lib/**/*.rb']
106 t.options = ['--output-dir', File.join('meta', 'documentation'),
107 '--readme', 'README.markdown']
110 YARD::Rake::YardocTask.new :dotyardoc do |t|
111 t.files = ['lib/**/*.rb']
112 t.options = ['--no-output',
113 '--readme', 'README.markdown']
117 system 'open ' + File.join('meta', 'documentation', 'index.html') if PLATFORM['darwin']
122 desc 'You need the `yard` gem to generate documentation'
129 desc 'Removes all meta producs'
131 `rm -rf #{File.expand_path(File.join( File.dirname(__FILE__), 'meta' ))}`
134 desc 'Check everything over before commiting'
135 task :aok => [:'documentation:generate', :'documentation:open',
137 :'coverage:run', :'coverage:verify', :'coverage:open']
139 task :ci => [:'documentation:generate', :'coverage:run', :'coverage:verify']