forked from airbrake/airbrake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
118 lines (97 loc) · 3.31 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'cucumber/rake/task'
desc 'Default: run unit tests.'
task :default => [:test, :cucumber]
desc 'Test the hoptoad_notifier gem.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Run ginger tests'
task :ginger do
$LOAD_PATH << File.join(*%w[vendor ginger lib])
ARGV.clear
ARGV << 'test'
load File.join(*%w[vendor ginger bin ginger])
end
begin
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', 'TESTING.rdoc']
end
rescue LoadError
end
GEM_ROOT = File.dirname(__FILE__).freeze
VERSION_FILE = File.join(GEM_ROOT, 'lib', 'hoptoad_notifier', 'version')
require VERSION_FILE
gemspec = Gem::Specification.new do |s|
s.name = %q{hoptoad_notifier}
s.version = HoptoadNotifier::VERSION
s.summary = %q{Send your application errors to our hosted service and reclaim your inbox.}
s.files = FileList['[A-Z]*', 'generators/**/*.*', 'lib/**/*.rb',
'test/**/*.rb', 'rails/**/*.rb', 'script/*',
'lib/templates/*.erb']
s.require_path = 'lib'
s.test_files = Dir[*['test/**/*_test.rb']]
s.has_rdoc = true
s.extra_rdoc_files = ["README.rdoc"]
s.rdoc_options = ['--line-numbers', "--main", "README.rdoc"]
s.authors = ["thoughtbot, inc"]
s.email = %q{support@hoptoadapp.com}
s.homepage = "http://www.hoptoadapp.com"
s.platform = Gem::Platform::RUBY
end
Rake::GemPackageTask.new gemspec do |pkg|
pkg.need_tar = true
pkg.need_zip = true
end
desc "Clean files generated by rake tasks"
task :clobber => [:clobber_rdoc, :clobber_package]
desc "Generate a gemspec file"
task :gemspec do
File.open("#{gemspec.name}.gemspec", 'w') do |f|
f.write gemspec.to_ruby
end
end
LOCAL_GEM_ROOT = File.join(GEM_ROOT, 'tmp', 'local_gems').freeze
RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
LOCAL_GEMS = [['sham_rack', nil], ['capistrano', nil], ['sqlite3-ruby', nil]] +
RAILS_VERSIONS.collect { |version| ['rails', version] }
task :vendor_test_gems do
LOCAL_GEMS.each do |gem_name, version|
gem_file_pattern = [gem_name, version || '*'].compact.join('-')
version_option = version ? "-v #{version}" : ''
pattern = File.join(LOCAL_GEM_ROOT, 'gems', "#{gem_file_pattern}")
existing = Dir.glob(pattern).first
unless existing
command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc #{version_option} #{gem_name}"
puts "Vendoring #{gem_file_pattern}..."
unless system(command)
$stderr.puts "Command failed: #{command}"
end
end
end
end
Cucumber::Rake::Task.new(:cucumber) do |t|
t.fork = true
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
end
task :cucumber => [:gemspec, :vendor_test_gems]
OLD_RAILS_VERSIONS = RAILS_VERSIONS[0...-1]
namespace :cucumber do
namespace :rails do
OLD_RAILS_VERSIONS.each do |version|
desc "Test integration of the gem with Rails #{version}"
task version do
ENV['RAILS_VERSION'] = version
system("cucumber --format progress features/rails.feature")
end
end
desc "Test integration of the gem with all Rails versions"
task :all => [:cucumber, *OLD_RAILS_VERSIONS]
end
end