forked from eadz/typus
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
71 lines (59 loc) · 1.93 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
62
63
64
65
66
67
68
69
70
71
require 'rubygems'
require 'rake/testtask'
require 'rake/rdoctask'
require File.expand_path('../lib/typus/version', __FILE__)
$LOAD_PATH.unshift 'lib'
require 'typus'
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 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 <<-MSG
\nFinished in #{Time.now - timer} seconds.
#{count} specifications documented.
MSG
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.description = "Effortless backend interface for Ruby on Rails applications. (Admin scaffold generator.)"
gemspec.email = "[email protected]"
gemspec.homepage = "http://intraducibles.com/projects/typus"
gemspec.authors = ["Francesc Esplugas"]
gemspec.version = Typus::VERSION::STRING
end
rescue LoadError
puts "Jeweler not available."
puts "Install it with: gem install jeweler -s http://gemcutter.org"
end
desc "Generate package."
task :package => [ :gemspec, :build ]
desc "Push a new version to Gemcutter"
task :publish => [ :package ] do
version = Typus::VERSION::STRING
system "git tag v#{version}"
system "git push origin v#{version}"
system "gem push pkg/typus-#{version}.gem"
system "git clean -fd"
end