Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 104 lines (90 sloc) 2.435 kB
4b7bc22 rake partiioning
Greg Weber authored
1 $project = 'quicktest'
2 require 'tasks/helpers'
794e44f update rakefile and helpers
Greg Weber authored
3 $rcov_index_html = 'coverage/lib-quicktest_rb.html'
4b7bc22 rake partiioning
Greg Weber authored
4
19fcdfd updated rake tasks
Greg Weber authored
5 def test_dir; Dir.chdir('spec') {|dir| yield dir } end
6
4b7bc22 rake partiioning
Greg Weber authored
7 class String
8 def split_join( splitter=$/ )
9 yield( split( splitter ) ).join( splitter )
10 end
19fcdfd updated rake tasks
Greg Weber authored
11 end
e4792e0 quicktest version 3.2
Greg Weber authored
12
13 desc "test"
14 task :test do
19fcdfd updated rake tasks
Greg Weber authored
15 t = 'spec -r ../lib/quicktest test.rb'
d968a85 progress towards removing the quicktest method automatically when tes…
Greg Weber authored
16 test_dir do
17 (puts (run "#{t} >| test_result.txt || #{t}"))
18 (puts (run '../bin/quickspec test.rb'))
19 (puts (run '../bin/quickspec __test.rb --quicktest __test'))
20 end
e4792e0 quicktest version 3.2
Greg Weber authored
21 end
22
23 namespace :test do
24 run = '../bin/quickspec test.rb'
25 task :generate do
19fcdfd updated rake tasks
Greg Weber authored
26 test_dir {run "#{run} >| test_result.txt"}
e4792e0 quicktest version 3.2
Greg Weber authored
27 end
28
29 desc "test quickspec executable"
30 task :quickspec => :generate do
19fcdfd updated rake tasks
Greg Weber authored
31 test_dir {(puts (run "#{run}"))}
e4792e0 quicktest version 3.2
Greg Weber authored
32 end
33
34 desc "test readme file"
4dfe826 updated
Greg Weber authored
35 task :readme do
19fcdfd updated rake tasks
Greg Weber authored
36 (puts (run "./bin/quickspec README"))
37 end
38 end
39
b902310 readme and rakefile
Greg Weber authored
40 def decode_readme &block
41 fail unless block_given?
42 begin
43 old_readme = nil
44 File.read_write( 'README' ) do |text|
45 old_readme = text
46 text.split_join do |arr|
47 arr.reject {|l| l =~ /^=(?:begin|end)/}
48 end
49 end
50 block.call
51 ensure
52 File.write( 'README', old_readme ) if old_readme
53 end
54 end
55
56 desc "generate documentation"
57 task :rdoc do
58 decode_readme do
59 fail unless system 'rdoc --force-update --quiet README lib/*'
60 end
61 end
62
63 namespace :readme do
64 desc "dump modified README"
65 task :decode do
66 decode_readme do
67 puts File.read('README')
68 end
69 end
70
16cb908 better defaults for testing of module instance methods
Greg Weber authored
71 desc "create html for website using coderay, use --silent option"
19fcdfd updated rake tasks
Greg Weber authored
72 task :html do
73 rm_rf 'doc'
74 decode_readme do
75 fail unless system 'rdoc --force-update --quiet README'
76 end
b902310 readme and rakefile
Greg Weber authored
77 require 'hpricot'
4b7bc22 rake partiioning
Greg Weber authored
78 require 'htmlentities'
b902310 readme and rakefile
Greg Weber authored
79 doc = open( 'doc/files/README.html' ) { |f| Hpricot(f) }
80 # find example code
0c7fdaa better html
Greg Weber authored
81 doc.at('#description').search('pre').
82 select {|elem| elem.inner_html =~ /class |module /}.each do |ex|
83 # add coderay and undo what rdoc has done in the example code
4b7bc22 rake partiioning
Greg Weber authored
84 ex.swap("<coderay lang='ruby'>#{HTMLEntities.new.decode ex.inner_html}</coderay>")
0c7fdaa better html
Greg Weber authored
85 end
86 puts doc.at('#description').to_html
b902310 readme and rakefile
Greg Weber authored
87 end
88 end
e4792e0 quicktest version 3.2
Greg Weber authored
89
90 require 'rubygems'
91 require 'rake/gempackagetask'
cd884bc make gemspec buildable on github
Greg Weber authored
92 require 'quicktest.gemspec.rb'
e4792e0 quicktest version 3.2
Greg Weber authored
93
cd884bc make gemspec buildable on github
Greg Weber authored
94 Rake::GemPackageTask.new($gem_specification) do |pkg|
e4792e0 quicktest version 3.2
Greg Weber authored
95 pkg.need_tar = false
96 end
cd884bc make gemspec buildable on github
Greg Weber authored
97
98 desc "generate the gem specification"
99 task :gem_specification do
100 File.open('quicktest.gemspec', 'w') do |fh|
101 fh.puts $gem_specification.to_ruby
102 end
103 end
Something went wrong with that request. Please try again.