Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 111 lines (95 sloc) 3.055 kb
24fc4f5 @dchelimsky use Bundler gem tasks
authored
1 require 'bundler'
2 Bundler::GemHelper.install_tasks
c45c173 @dchelimsky silly versions
authored
3
643bdd9 @dchelimsky trust the load path (more to do, but good start)
authored
4 $:.unshift 'lib'
c45c173 @dchelimsky silly versions
authored
5
42e7e99 @dchelimsky add lib to load path
authored
6 require 'spec/version'
7 require 'spec/rake/spectask'
43e7299 @dchelimsky include _all_ of the dev dependencies
authored
8 require 'spec/ruby'
d9b6ae8 @dchelimsky using hoe (more work to do)
authored
9
d2a38da @dchelimsky reorg the rake tasks a bit
authored
10 # Some of the tasks are in separate files since they are also part of the website documentation
643bdd9 @dchelimsky trust the load path (more to do, but good start)
authored
11 load 'resources/rake/examples.rake'
12 load 'resources/rake/examples_with_rcov.rake'
13 load 'resources/rake/failing_examples_with_html.rake'
14 load 'resources/rake/verify_rcov.rake'
2989ddf @dchelimsky replaced custom tasks w/ hoe tasks
authored
15
c2291af @spicycode Enabling aggregate coverage information
spicycode authored
16 task :cleanup_rcov_files do
17 rm_rf 'coverage.data'
18 end
19
43a3e89 @dchelimsky Only run rcov and heckle with ruby 1.8 when running rspec's own specs
authored
20 if RUBY_VERSION =~ /^1.8/
c2291af @spicycode Enabling aggregate coverage information
spicycode authored
21 task :default => [:cleanup_rcov_files, :features, :verify_rcov]
43a3e89 @dchelimsky Only run rcov and heckle with ruby 1.8 when running rspec's own specs
authored
22 else
23 task :default => [:spec, :features]
24 end
d2a38da @dchelimsky reorg the rake tasks a bit
authored
25
24fc4f5 @dchelimsky use Bundler gem tasks
authored
26 desc "Run all specs"
27 Spec::Rake::SpecTask.new(:spec) do |t|
28 t.spec_files = FileList['spec/**/*_spec.rb']
29 t.spec_opts = ['--options', 'spec/spec.opts']
30 end
c2291af @spicycode Enabling aggregate coverage information
spicycode authored
31
24fc4f5 @dchelimsky use Bundler gem tasks
authored
32 namespace :spec do
d2a38da @dchelimsky reorg the rake tasks a bit
authored
33 desc "Run all specs with rcov"
c2291af @spicycode Enabling aggregate coverage information
spicycode authored
34 Spec::Rake::SpecTask.new(:rcov) do |t|
d2a38da @dchelimsky reorg the rake tasks a bit
authored
35 t.spec_files = FileList['spec/**/*_spec.rb']
36 t.spec_opts = ['--options', 'spec/spec.opts']
4cff475 @dchelimsky remove everything but rspec (core) from main rspec repo
authored
37 t.rcov = true
bee4810 @dchelimsky add example and fix coverage problem with have_spec
authored
38 t.rcov_dir = 'coverage'
c2291af @spicycode Enabling aggregate coverage information
spicycode authored
39 t.rcov_opts = ['--exclude', "features,kernel,load-diff-lcs\.rb,instance_exec\.rb,lib/spec.rb,lib/spec/runner.rb,^spec/*,bin/spec,examples,/gems,/Library/Ruby,\.autotest,#{ENV['GEM_HOME']}"]
ff22ee4 @spicycode Final rcov options
spicycode authored
40 t.rcov_opts << '--sort coverage --text-summary --aggregate coverage.data'
4cff475 @dchelimsky remove everything but rspec (core) from main rspec repo
authored
41 end
8863b14 @dchelimsky add spec:focused rake task
authored
42
43 desc "Run files listed in spec/spec_files.txt"
036701e @dchelimsky check for spec/spec_files.txt first
authored
44 Spec::Rake::SpecTask.new(:focus) do |t|
45 if File.exists?('spec/spec_files.txt')
46 t.spec_files = File.readlines('spec/spec_files.txt').collect{|f| f.chomp}
47 end
8863b14 @dchelimsky add spec:focused rake task
authored
48 end
8c27e78 got rid of the test/unit output in TextMate
dchelimsky authored
49 end
2989ddf @dchelimsky replaced custom tasks w/ hoe tasks
authored
50
a643d8f @devrandom make Rakefile work without cucumber installed
devrandom authored
51 begin
52 require 'cucumber/rake/task'
53 desc "Run Cucumber features"
54 if RUBY_VERSION =~ /^1.8/
55 Cucumber::Rake::Task.new :features do |t|
56 t.rcov = true
57 t.rcov_opts = ['--exclude', "features,kernel,load-diff-lcs\.rb,instance_exec\.rb,lib/spec.rb,lib/spec/runner.rb,^spec/*,bin/spec,examples,/gems,/Library/Ruby,\.autotest,#{ENV['GEM_HOME']}"]
58 t.rcov_opts << '--no-html --aggregate coverage.data'
59 t.cucumber_opts = %w{--format progress}
60 end
61 else
62 task :features do
63 sh 'cucumber --profile no_heckle'
64 end
c2291af @spicycode Enabling aggregate coverage information
spicycode authored
65 end
a643d8f @devrandom make Rakefile work without cucumber installed
devrandom authored
66 rescue LoadError
67 puts "You need cucumber installed to run cucumber tasks"
43a3e89 @dchelimsky Only run rcov and heckle with ruby 1.8 when running rspec's own specs
authored
68 end
a8ae31d @dchelimsky begin migrating stories to cucumber features
authored
69
2989ddf @dchelimsky replaced custom tasks w/ hoe tasks
authored
70 desc "Run failing examples (see failure output)"
71 Spec::Rake::SpecTask.new('failing_examples') do |t|
72 t.spec_files = FileList['failing_examples/**/*_spec.rb']
73 t.spec_opts = ['--options', 'spec/spec.opts']
74 end
75
76 def egrep(pattern)
77 Dir['**/*.rb'].each do |fn|
78 count = 0
79 open(fn) do |f|
80 while line = f.gets
81 count += 1
82 if line =~ pattern
83 puts "#{fn}:#{count}:#{line}"
84 end
85 end
86 end
87 end
88 end
89
90 desc "Look for TODO and FIXME tags in the code"
91 task :todo do
92 egrep /(FIXME|TODO|TBD)/
93 end
94
95 desc "Verifies that there is no uncommitted code"
96 task :verify_committed do
97 IO.popen('git status') do |io|
98 io.each_line do |line|
99 raise "\n!!! Do a git commit first !!!\n\n" if line =~ /^#\s*modified:/
100 end
101 end
ee978a9 @dchelimsky tasks to automate updating the manifest and gemspec
authored
102 end
103
b9891bb @dchelimsky remove tmp dir with rake clobber
authored
104 task :clobber => :clobber_tmp
105
106 task :clobber_tmp do
107 cmd = %q[rm -r tmp]
108 puts cmd
109 system cmd if test ?d, 'tmp'
110 end
Something went wrong with that request. Please try again.