1 ($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
5 module AttrSplat; Version = -1; end
8 # =======================
9 # = Gem packaging tasks =
10 # =======================
14 task :package => :'package:package'
15 task :install => :'package:install'
16 task :manifest => :'package:manifest'
18 Echoe.new('attr_splat', AttrSplat::Version) do |g|; g.name = 'attr_*'
19 g.project = 'attr-splat'
20 g.author = ['elliottcable']
21 g.email = ['attr_*@elliottcable.com']
22 g.summary = "attr_* puts Ruby Core's attr_accessor, attr_reader, and attr_reader on steroids"
23 g.url = 'http://by.elliottcable.name/attr_splat.xhtml'
24 g.development_dependencies = ['elliottcable-echoe >= 3.0.2', 'rspec', 'rcov', 'yard', 'stringray']
25 g.manifest_name = '.manifest'
26 g.retain_gemspec = true
27 g.rakefile_name = 'Rakefile.rb'
28 g.ignore_pattern = /^\.git\/|^meta\/|\.gemspec/
31 desc 'tests packaged files to ensure they are all present'
32 task :verify => :package do
33 # An error message will be displayed if files are missing
34 if system %(ruby -e "require 'rubygems'; require 'pkg/attr_splat-#{AttrSplat::Version}/lib/attr_splat'")
35 puts "\nThe library files are present"
41 desc 'You need the `elliottcable-echoe` gem to package attr_*'
45 # =======================
46 # = Spec/Coverage tasks =
47 # =======================
51 require 'spec/rake/spectask'
53 task :default => :'coverage:run'
54 task :coverage => :'coverage:run'
55 namespace :coverage do
56 Spec::Rake::SpecTask.new(:run) do |t|
57 t.spec_opts = ["--format", "specdoc"]
58 t.spec_opts << "--colour" unless ENV['CI']
59 t.spec_files = Dir['spec/**/*_spec.rb'].sort
62 t.rcov_opts = [ '--include-file', '"^lib"', '--exclude-only', '".*"']
63 t.rcov_dir = File.join('meta', 'coverage')
67 require 'spec/rake/verify_rcov'
68 # For the moment, this is the only way I know of to fix RCov. I may
69 # release the fix as it's own gem at some point in the near future.
70 require 'stringray/core_ext/spec/rake/verify_rcov'
71 RCov::VerifyTask.new(:verify) do |t|
73 t.index_html = File.join('meta', 'coverage', 'index.html')
74 t.require_exact_threshold = false
77 desc 'You need the `stringray` gem to verify coverage'
82 system 'open ' + File.join('meta', 'coverage', 'index.html') if PLATFORM['darwin']
87 desc 'You need the `rcov` and `rspec` gems to run specs/coverage'
91 # =======================
92 # = Documentation tasks =
93 # =======================
96 require 'yard/rake/yardoc_task'
98 task :documentation => :'documentation:generate'
99 namespace :documentation do
100 YARD::Rake::YardocTask.new :generate do |t|
101 t.files = ['lib/**/*.rb']
102 t.options = ['--output-dir', File.join('meta', 'documentation'),
103 '--readme', 'README.markdown']
106 YARD::Rake::YardocTask.new :dotyardoc do |t|
107 t.files = ['lib/**/*.rb']
108 t.options = ['--no-output',
109 '--readme', 'README.markdown']
113 system 'open ' + File.join('meta', 'documentation', 'index.html') if PLATFORM['darwin']
118 desc 'You need the `yard` gem to generate documentation'
125 desc 'Removes all meta producs'
127 `rm -rf #{File.expand_path(File.join( File.dirname(__FILE__), 'meta' ))}`
130 desc 'Check everything over before commiting'
131 task :aok => [:'documentation:generate', :'documentation:open',
132 :'package:manifest', :'package:package',
133 :'coverage:run', :'coverage:open', :'coverage:verify']
135 task :ci => [:'documentation:generate', :'coverage:run', :'coverage:verify']