-
Notifications
You must be signed in to change notification settings - Fork 6
/
Rakefile
37 lines (30 loc) · 1.04 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
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
begin
require 'bundler'
Bundler::GemHelper.install_tasks
rescue LoadError => e
$stderr.puts e
end
desc "run specs"
task(:spec) { ruby '-S rspec spec' }
desc "generate gemspec"
task 'active_merchant_payu_in.gemspec' do
require 'active_merchant_payu_in/version'
content = File.read 'active_merchant_payu_in.gemspec'
fields = {
:authors => `git shortlog -sn`.scan(/[^\d\s].*/),
:email => `git shortlog -sne`.scan(/[^<]+@[^>]+/),
:files => `git ls-files`.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
}
fields.each do |field, values|
updated = " s.#{field} = ["
updated << values.map { |v| "\n %p" % v }.join(',')
updated << "\n ]"
content.sub!(/ s\.#{field} = \[\n( .*\n)* \]/, updated)
end
content.sub! /(s\.version.*=\s+).*/, "\\1\"#{ActiveMerchantPayuIn::VERSION}\""
File.open('active_merchant_payu_in.gemspec', 'w') { |f| f << content }
end
task :gemspec => 'active_merchant_payu_in.gemspec'
task :default => :spec
task :test => :spec