forked from btakita/rr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
88 lines (79 loc) · 3.03 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
require "rake"
require 'rake/contrib/rubyforgepublisher'
require 'rake/clean'
require 'rake/testtask'
require 'rake/rdoctask'
desc "Runs the Rspec suite"
task(:default) do
run_suite
end
desc "Runs the Rspec suite"
task(:spec) do
run_suite
end
def run_suite
dir = File.dirname(__FILE__)
system("ruby #{dir}/spec/spec_suite.rb") || raise("Spec Suite failed")
end
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "rr"
s.summary = "RR (Double Ruby) is a double framework that features a rich " <<
"selection of double techniques and a terse syntax. " <<
"http://xunitpatterns.com/Test%20Double.html"
s.email = "[email protected]"
s.homepage = "http://pivotallabs.com"
s.description = "RR (Double Ruby) is a double framework that features a rich " <<
"selection of double techniques and a terse syntax. " <<
"http://xunitpatterns.com/Test%20Double.html"
s.authors = ["Brian Takita"]
s.files = FileList[
'[A-Z]*',
'*.rb',
'lib/**/*.rb',
'spec/**/*.rb'
].to_a
s.test_files = Dir.glob('spec/*_spec.rb')
s.has_rdoc = true
s.extra_rdoc_files = [ "README.rdoc", "CHANGES" ]
s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
s.rubyforge_project = "pivotalrb"
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
RUBYFORGE_PACKAGE_NAME = "rr (Double Ruby)"
# The package was renamed from "rr (Double R)" to "rr (Double Ruby)".
# When this was last run, the script did not work for the new name but it did work for the old name.
# Perhaps more time was needed for the name change to propagate?
#RUBYFORGE_PACKAGE_NAME = "rr (Double R)"
# This is hacked to get around the 3 character limitation for package names on Rubyforge.
# http://rubyforge.org/tracker/index.php?func=detail&aid=27026&group_id=5&atid=102
class Jeweler
module Commands
class ReleaseToRubyforge
def run
raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project
@rubyforge.configure rescue nil
output.puts 'Logging in rubyforge'
@rubyforge.login
@rubyforge.userconfig['release_notes'] = @gemspec.description if @gemspec.description
@rubyforge.userconfig['preformatted'] = true
output.puts "Releasing #{@gemspec.name}-#{@version} to #{@gemspec.rubyforge_project}"
begin
@rubyforge.add_release(@gemspec.rubyforge_project, RUBYFORGE_PACKAGE_NAME, @version.to_s, @gemspec_helper.gem_path)
rescue StandardError => e
case e.message
when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/
raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project
when /no <package_id> configured for <#{Regexp.escape @gemspec.name}>/i
raise MissingRubyForgePackageError, @gemspec.name
else
raise
end
end
end
end
end
end