forked from eadz/typus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
61 lines (52 loc) · 1.82 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the typus plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the typus plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.add ['README.rdoc', 'MIT-LICENSE', 'lib/**/*.rb']
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'Typus documentation'
rdoc.main = 'README.rdoc'
rdoc.options << '--charset=UTF-8'
rdoc.options << '--inline-source'
rdoc.options << '--line-numbers'
end
desc 'Generate specdoc-style documentation from tests'
task :specs do
puts 'Started'
timer, count = Time.now, 0
File.open('SPECDOC', 'w') do |file|
Dir.glob('test/**/*_test.rb').each do |test|
test =~ /.*\/([^\/].*)_test.rb$/
file.puts "#{$1.gsub('_', ' ').capitalize} should:" if $1
File.read(test).map { |line| /test_(.*)$/.match line }.compact.each do |spec|
file.puts "- #{spec[1].gsub('_', ' ')}"
sleep 0.001; print '.'; $stdout.flush; count += 1
end
file.puts
end
end
puts "\nFinished in #{Time.now - timer} seconds.\n"
puts "#{count} specifications documented"
end
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "typus"
gemspec.summary = "Effortless backend interface for Ruby on Rails applications. (Admin scaffold generator.)"
gemspec.email = "[email protected]"
gemspec.homepage = "http://intraducibles.com/projects/typus"
gemspec.description = "Effortless backend interface for Ruby on Rails applications. (Admin scaffold generator.)"
gemspec.authors = ["Francesc Esplugas"]
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install jeweler -s http://gemcutter.org"
end