dchelimsky / rspec

Behaviour Driven Development framework for Ruby

This URL has Read+Write access

rspec / Rakefile
d9b6ae83 » dchelimsky 2008-07-02 using hoe (more work to do) 1 # -*- ruby -*-
2
4cff4759 » dchelimsky 2008-04-03 remove everything but rspec... 3 require 'rubygems'
d9b6ae83 » dchelimsky 2008-07-02 using hoe (more work to do) 4 require 'hoe'
5 require './lib/spec'
6 require './lib/spec/rake/spectask'
7
8 Hoe.new('rspec', Spec::VERSION::STRING) do |p|
9 p.summary = Spec::VERSION::DESCRIPTION
10 p.rubyforge_name = 'rspec'
11 p.developer('RSpec Development Team', 'dev@rspec.info')
12 end
8c27e784 » dchelimsky 2007-10-30 got rid of the test/unit ou... 13
d9b6ae83 » dchelimsky 2008-07-02 using hoe (more work to do) 14 ['audit','test','test_deps','default'].each do |task|
15 Rake.application.instance_variable_get('@tasks').delete(task)
16 end
8c27e784 » dchelimsky 2007-10-30 got rid of the test/unit ou... 17
d9b6ae83 » dchelimsky 2008-07-02 using hoe (more work to do) 18 task :default => ['spec']
4cff4759 » dchelimsky 2008-04-03 remove everything but rspec... 19
d9b6ae83 » dchelimsky 2008-07-02 using hoe (more work to do) 20 # vim: syntax=Ruby
4cff4759 » dchelimsky 2008-04-03 remove everything but rspec... 21
d9b6ae83 » dchelimsky 2008-07-02 using hoe (more work to do) 22 # $:.unshift('lib')
23 # require 'rubygems'
24 # require 'rake/gempackagetask'
25 # require 'rake/contrib/rubyforgepublisher'
26 # require 'rake/clean'
27 # require 'rake/rdoctask'
28 # require 'rake/testtask'
29 # require 'spec/version'
30 # dir = File.dirname(__FILE__)
31 #
32 # # Some of the tasks are in separate files since they are also part of the website documentation
33 # load File.dirname(__FILE__) + '/rake_tasks/examples.rake'
34 # load File.dirname(__FILE__) + '/rake_tasks/examples_with_rcov.rake'
35 # load File.dirname(__FILE__) + '/rake_tasks/failing_examples_with_html.rake'
36 # load File.dirname(__FILE__) + '/rake_tasks/verify_rcov.rake'
37 #
38 # PKG_NAME = "rspec"
39 # PKG_VERSION = Spec::VERSION::STRING
40 # PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
41 # PKG_FILES = FileList[
42 # '[A-Z]*',
43 # 'lib/**/*.rb',
44 # 'spec/**/*',
45 # 'examples/**/*',
46 # 'failing_examples/**/*',
47 # 'plugins/**/*',
48 # 'stories/**/*',
49 # 'rake_tasks/**/*'
50 # ]
51 #
52 # task :default => [:verify_rcov]
53 # task :verify_rcov => [:spec, :stories]
54 #
4cff4759 » dchelimsky 2008-04-03 remove everything but rspec... 55 desc "Run all specs"
56 Spec::Rake::SpecTask.new do |t|
57 t.spec_files = FileList['spec/**/*_spec.rb']
58 t.spec_opts = ['--options', 'spec/spec.opts']
59 unless ENV['NO_RCOV']
60 t.rcov = true
61 t.rcov_dir = '../doc/output/coverage'
03cea68d » btakita 2008-06-01 Ignoring lib/spec/runner.rb... 62 t.rcov_opts = ['--exclude', 'lib/spec.rb,lib/spec/runner.rb,spec\/spec,bin\/spec,examples,\/var\/lib\/gems,\/Library\/Ruby,\.autotest']
4cff4759 » dchelimsky 2008-04-03 remove everything but rspec... 63 end
8c27e784 » dchelimsky 2007-10-30 got rid of the test/unit ou... 64 end
d9b6ae83 » dchelimsky 2008-07-02 using hoe (more work to do) 65 #
66 # desc "Run all stories"
67 # task :stories do
68 # html = 'story_server/prototype/rspec_stories.html'
69 # ruby "stories/all.rb --colour --format plain --format html:#{html}"
70 # unless IO.read(html) =~ /<span class="param">/m
71 # raise 'highlighted parameters are broken in story HTML'
72 # end
73 # end
74 #
75 # desc "Run all specs and store html output in doc/output/report.html"
76 # Spec::Rake::SpecTask.new('spec_html') do |t|
77 # t.spec_files = FileList['spec/**/*_spec.rb']
78 # t.spec_opts = ['--format html:../../../../doc/output/report.html', '--format progress','--backtrace']
79 # end
80 #
81 # desc "Run all failing examples"
82 # Spec::Rake::SpecTask.new('failing_examples') do |t|
83 # t.spec_files = FileList['failing_examples/**/*_spec.rb']
84 # end
85 #
86 # desc 'Generate RDoc'
87 # rd = Rake::RDocTask.new do |rdoc|
88 # rdoc.rdoc_dir = '../doc/output/rdoc'
89 # rdoc.options << '--title' << 'RSpec' << '--line-numbers' << '--inline-source' << '--main' << 'README'
90 # rdoc.rdoc_files.include('README', 'CHANGES', 'MIT-LICENSE', 'lib/**/*.rb')
91 # end
92 #
93 # spec = Gem::Specification.new do |s|
94 # s.name = PKG_NAME
95 # s.version = PKG_VERSION
96 # s.summary = Spec::VERSION::DESCRIPTION
97 # s.description = <<-EOF
98 # RSpec is a behaviour driven development (BDD) framework for Ruby. RSpec was
99 # created in response to Dave Astels' article _A New Look at Test Driven Development_
100 # which can be read at: http://daveastels.com/index.php?p=5 RSpec is intended to
101 # provide the features discussed in Dave's article.
102 # EOF
103 #
104 # s.files = PKG_FILES.to_a
105 # s.require_path = 'lib'
106 #
107 # s.has_rdoc = true
108 # s.rdoc_options = rd.options
109 # s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$|^EXAMPLES.rd$/ }.to_a
110 #
111 # s.bindir = 'bin'
112 # s.executables = ['spec', 'spec_translator', 'autospec']
113 # s.default_executable = 'spec'
114 # s.author = "RSpec Development Team"
115 # s.email = "rspec-devel@rubyforge.org"
116 # s.homepage = "http://rspec.rubyforge.org"
117 # s.platform = Gem::Platform::RUBY
118 # s.rubyforge_project = "rspec"
119 # end
120 #
121 # Rake::GemPackageTask.new(spec) do |pkg|
122 # pkg.need_zip = true
123 # pkg.need_tar = true
124 # end
125 #
126 # def egrep(pattern)
127 # Dir['**/*.rb'].each do |fn|
128 # count = 0
129 # open(fn) do |f|
130 # while line = f.gets
131 # count += 1
132 # if line =~ pattern
133 # puts "#{fn}:#{count}:#{line}"
134 # end
135 # end
136 # end
137 # end
138 # end
139 #
140 # desc "Look for TODO and FIXME tags in the code"
141 # task :todo do
142 # egrep /(FIXME|TODO|TBD)/
143 # end
144 #
145 # task :release => [:verify_committed, :verify_user, :spec, :publish_packages, :tag, :publish_news]
146 #
147 # desc "Verifies that there is no uncommitted code"
148 # task :verify_committed do
149 # IO.popen('git status') do |io|
150 # io.each_line do |line|
151 # raise "\n!!! Do a git commit first !!!\n\n" if line =~ /^#\s*modified:/
152 # end
153 # end
154 # end
155 #
156 # desc "Creates a tag in svn"
157 # task :tag do
158 # # from = `svn info #{File.dirname(__FILE__)}`.match(/URL: (.*)\/rspec/n)[1]
159 # # to = from.gsub(/trunk/, "tags/#{Spec::VERSION::TAG}")
160 # # current = from.gsub(/trunk/, "tags/CURRENT")
161 # #
162 # # puts "Creating tag in SVN"
163 # # tag_cmd = "svn cp #{from} #{to} -m \"Tag release #{Spec::VERSION::FULL_VERSION}\""
164 # # `#{tag_cmd}` ; raise "ERROR: #{tag_cmd}" unless $? == 0
165 # #
166 # # puts "Removing CURRENT"
167 # # remove_current_cmd = "svn rm #{current} -m \"Remove tags/CURRENT\""
168 # # `#{remove_current_cmd}` ; raise "ERROR: #{remove_current_cmd}" unless $? == 0
169 # #
170 # # puts "Re-Creating CURRENT"
171 # # create_current_cmd = "svn cp #{to} #{current} -m \"Copy #{Spec::VERSION::TAG} to tags/CURRENT\""
172 # # `#{create_current_cmd}` ; "ERROR: #{create_current_cmd}" unless $? == 0
173 # end
174 #
175 # task :verify_user do
176 # raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
177 # end
178 #
179 # desc "Upload Website to RubyForge"
180 # task :publish_website => [:verify_user, :website] do
181 # unless Spec::VERSION::RELEASE_CANDIDATE
182 # publisher = Rake::SshDirPublisher.new(
183 # "rspec-website@rubyforge.org",
184 # "/var/www/gforge-projects/#{PKG_NAME}",
185 # "../doc/output"
186 # )
187 # publisher.upload
188 # else
189 # puts "** Not publishing packages to RubyForge - this is a prerelease"
190 # end
191 # end
192 #
193 # desc "Upload Website archive to RubyForge"
194 # task :archive_website => [:verify_user, :website] do
195 # publisher = Rake::SshDirPublisher.new(
196 # "rspec-website@rubyforge.org",
197 # "/var/www/gforge-projects/#{PKG_NAME}/#{Spec::VERSION::TAG}",
198 # "../doc/output"
199 # )
200 # publisher.upload
201 # end
202 #
203 # desc "Package the Rails plugin"
204 # task :package_rspec_on_rails do
205 # mkdir 'pkg' rescue nil
206 # rm_rf "pkg/rspec-rails-#{PKG_VERSION}" rescue nil
207 # `git clone ../rspec-rails pkg/rspec-rails-#{PKG_VERSION}`
208 # rm_rf "pkg/rspec-rails-#{PKG_VERSION}/.git"
209 # Dir.chdir 'pkg' do
210 # `tar cvzf rspec-rails-#{PKG_VERSION}.tgz rspec-rails-#{PKG_VERSION}`
211 # end
212 # end
213 # task :pkg => :package_rspec_on_rails
214 #
215 # desc "Package the RSpec.tmbundle"
216 # task :package_tmbundle do
217 # mkdir 'pkg' rescue nil
218 # rm_rf "pkg/RSpec-#{PKG_VERSION}.tmbundle" rescue nil
219 # `git clone ../../../../RSpec.tmbundle pkg/RSpec-#{PKG_VERSION}.tmbundle`
220 # rm_rf "pkg/RSpec-#{PKG_VERSION}.tmbundle/.git"
221 # Dir.chdir 'pkg' do
222 # `tar cvzf RSpec-#{PKG_VERSION}.tmbundle.tgz RSpec-#{PKG_VERSION}.tmbundle`
223 # end
224 # end
225 # task :pkg => :package_tmbundle
226 #
227 # desc "Publish gem+tgz+zip on RubyForge. You must make sure lib/version.rb is aligned with the CHANGELOG file"
228 # task :publish_packages => [:verify_user, :package, :pkg] do
229 # release_files = FileList[
230 # "pkg/#{PKG_FILE_NAME}.gem",
231 # "pkg/#{PKG_FILE_NAME}.tgz",
232 # "pkg/rspec-rails-#{PKG_VERSION}.tgz",
233 # "pkg/#{PKG_FILE_NAME}.zip",
234 # "pkg/RSpec-#{PKG_VERSION}.tmbundle.tgz"
235 # ]
236 # unless Spec::VERSION::RELEASE_CANDIDATE
237 # require 'meta_project'
238 # require 'rake/contrib/xforge'
239 #
240 # Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |xf|
241 # # Never hardcode user name and password in the Rakefile!
242 # xf.user_name = ENV['RUBYFORGE_USER']
243 # xf.files = release_files.to_a
244 # xf.release_name = "RSpec #{PKG_VERSION}"
245 # end
246 # else
247 # puts "SINCE THIS IS A PRERELEASE, FILES ARE UPLOADED WITH SSH, NOT TO THE RUBYFORGE FILE SECTION"
248 # puts "YOU MUST TYPE THE PASSWORD #{release_files.length} TIMES..."
249 #
250 # host = "rspec-website@rubyforge.org"
251 # remote_dir = "/var/www/gforge-projects/#{PKG_NAME}"
252 #
253 # publisher = Rake::SshFilePublisher.new(
254 # host,
255 # remote_dir,
256 # File.dirname(__FILE__),
257 # *release_files
258 # )
259 # publisher.upload
260 #
261 # puts "UPLADED THE FOLLOWING FILES:"
262 # release_files.each do |file|
263 # name = file.match(/pkg\/(.*)/)[1]
264 # puts "* http://rspec.rubyforge.org/#{name}"
265 # end
266 #
267 # puts "They are not linked to anywhere, so don't forget to tell people!"
268 # end
269 # end
270 #
271 # desc "Publish news on RubyForge"
272 # task :publish_news => [:verify_user] do
273 # unless Spec::VERSION::RELEASE_CANDIDATE
274 # require 'meta_project'
275 # require 'rake/contrib/xforge'
276 # Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |news|
277 # # Never hardcode user name and password in the Rakefile!
278 # news.user_name = ENV['RUBYFORGE_USER']
279 # end
280 # else
281 # puts "** Not publishing news to RubyForge - this is a prerelease"
282 # end
283 # end