1 ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
5 require 'yard/rake/yardoc_task'
6 require 'spec/rake/spectask'
7 require 'spec/rake/verify_rcov'
8 require 'stringray/core_ext/spec/rake/verify_rcov'
14 Echoe.new('rat', Rat::VERSION) do |g|
15 g.author = ['elliottcable']
16 g.email = ['rat@elliottcable.com']
17 g.summary = 'Flexible terminal messaging (IM/IRC) client'
18 g.url = 'http://github.com/elliottcable/rat'
19 g.dependencies = ['stringray >=2', 'ncurses'] #, 'yard >=0.2.3'
20 g.manifest_name = '.manifest'
21 g.ignore_pattern = /^\.git\/|^meta\/|^logs\/|\.gemspec/
24 desc 'tests packaged files to ensure they are all present'
25 task :verify => :package do
26 # An error message will be displayed if files are missing
27 if system %(ruby -e "require 'rubygems'; require 'merb-core'; require 'pkg/merb_strokedb-#{Rat::VERSION}/lib/merb_strokedb'")
28 puts "\nThe library files are present"
32 task :copy_gemspec => [:package] do
33 pkg = Dir['pkg/*'].select {|dir| File.directory? dir}.last
34 mv File.join(pkg, pkg.gsub(/^pkg\//,'').gsub(/\-\d+$/,'.gemspec')), './'
37 desc 'builds a gemspec as GitHub wants it'
38 task :gemspec => [:package, :copy_gemspec, :clobber_package]
40 # desc 'Run specs, clean tree, update manifest, run coverage, and install gem!'
41 desc 'Clean tree, update manifest, and install gem!'
42 task :magic => [:clean, :manifest, :install]
45 task :manifest => [:'echoe:manifest']
47 rescue LoadError => boom
48 puts "You are missing a dependency required for meta-operations on this gem."
49 puts "#{boom.to_s.capitalize}."
51 task :default # No effect # Invisible
53 # Runs specs, generates rcov, and opens rcov in your browser.
55 Spec::Rake::SpecTask.new(:run) do |t|
56 t.spec_opts = ["--format", "specdoc", "--colour"]
57 t.spec_files = Dir['spec/**/*_spec.rb'].sort
60 t.rcov_opts = ['--exclude-only', '".*"', '--include-file', '^lib']
61 t.rcov_dir = 'meta' / 'coverage'
64 Spec::Rake::SpecTask.new(:plain) do |t|
65 t.spec_opts = ["--format", "specdoc"]
66 t.spec_files = Dir['spec/**/*_spec.rb'].sort
69 t.rcov_opts = ['--exclude-only', '".*"', '--include-file', '^lib']
70 t.rcov_dir = 'meta' / 'coverage'
73 RCov::VerifyTask.new(:verify) do |t|
75 t.index_html = 'meta' / 'coverage' / 'index.html'
76 t.require_exact_threshold = false
80 system 'open ' + 'meta' / 'coverage' / 'index.html' if PLATFORM['darwin']
85 YARD::Rake::YardocTask.new :generate do |t|
86 t.files = ['lib/**/*.rb']
87 t.options = ['--output-dir', "meta/documentation", '--readme', 'README.mkdn']
90 YARD::Rake::YardocTask.new :dot_yardoc do |t|
91 t.files = ['lib/**/*.rb']
92 t.options = ['--no-output', '--readme', 'README.mkdn']
96 system 'open ' + 'meta' / 'documentation' / 'index.html' if PLATFORM['darwin']
106 desc 'Check everything over before commiting'
107 task :aok => [:'yard:generate', :'yard:open',
109 :'rcov:run', :'rcov:verify', :'rcov:open',
112 # desc 'Task run during continuous integration' # Invisible
113 task :ci => [:'yard:generate', :'rcov:plain', :'rcov:verify']