2012-12-17 15:48:58 -05:00
|
|
|
begin
|
|
|
|
# optionally load `rake build/install/release tasks'
|
|
|
|
require 'bundler/gem_tasks'
|
|
|
|
rescue LoadError
|
2009-06-20 18:19:56 -04:00
|
|
|
end
|
|
|
|
|
2012-11-16 06:57:54 -05:00
|
|
|
require "rspec/core/rake_task"
|
2008-03-07 20:07:17 -05:00
|
|
|
|
|
|
|
desc "Run all specs"
|
2013-08-06 11:44:47 -04:00
|
|
|
RSpec::Core::RakeTask.new('spec')
|
2010-05-13 12:56:56 -04:00
|
|
|
|
|
|
|
desc "Run unit specs"
|
2012-11-16 06:57:54 -05:00
|
|
|
RSpec::Core::RakeTask.new('spec:unit') do |t|
|
2013-08-06 11:44:47 -04:00
|
|
|
t.pattern = 'spec/unit/*_spec.rb'
|
2008-03-07 20:07:17 -05:00
|
|
|
end
|
|
|
|
|
2010-05-13 12:56:56 -04:00
|
|
|
desc "Run integration specs"
|
2012-11-16 06:57:54 -05:00
|
|
|
RSpec::Core::RakeTask.new('spec:integration') do |t|
|
|
|
|
t.pattern = 'spec/integration/*_spec.rb'
|
2010-05-13 12:56:56 -04:00
|
|
|
end
|
|
|
|
|
2008-03-07 20:07:17 -05:00
|
|
|
desc "Print specdocs"
|
2012-11-16 06:57:54 -05:00
|
|
|
RSpec::Core::RakeTask.new(:doc) do |t|
|
|
|
|
t.rspec_opts = ["--format", "specdoc", "--dry-run"]
|
2013-08-06 11:44:47 -04:00
|
|
|
t.pattern = 'spec/**/*_spec.rb'
|
2008-03-07 20:07:17 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Run all examples with RCov"
|
2012-11-16 06:57:54 -05:00
|
|
|
RSpec::Core::RakeTask.new('rcov') do |t|
|
|
|
|
t.pattern = 'spec/*_spec.rb'
|
2010-02-08 16:08:18 -05:00
|
|
|
t.rcov = true
|
|
|
|
t.rcov_opts = ['--exclude', 'examples']
|
2008-03-07 20:07:17 -05:00
|
|
|
end
|
|
|
|
|
2014-03-31 23:34:30 -04:00
|
|
|
task :default do
|
|
|
|
sh 'rake -T'
|
|
|
|
end
|
|
|
|
|
|
|
|
def alias_task(alias_task, original)
|
|
|
|
desc "Alias for rake #{original}"
|
|
|
|
task alias_task, Rake.application[original].arg_names => original
|
|
|
|
end
|
|
|
|
alias_task(:test, :spec)
|
|
|
|
|
|
|
|
############################
|
|
|
|
|
|
|
|
WindowsPlatforms = %w{x86-mingw32 x64-mingw32 x86-mswin32}
|
|
|
|
|
|
|
|
desc "build all platform gems at once"
|
|
|
|
task :gems => [:rm_gems, 'ruby:gem'] + \
|
|
|
|
WindowsPlatforms.map {|p| "windows:#{p}:gem"}
|
|
|
|
|
|
|
|
task :rm_gems => ['ruby:clobber_package']
|
|
|
|
|
|
|
|
def built_gem_path
|
|
|
|
base = '.'
|
|
|
|
Dir[File.join(base, "#{name}-*.gem")].sort_by{|f| File.mtime(f)}.last
|
|
|
|
end
|
|
|
|
|
|
|
|
namespace :windows do
|
|
|
|
spec_path = File.join(File.dirname(__FILE__), 'rest-client.gemspec')
|
|
|
|
|
|
|
|
WindowsPlatforms.each do |platform|
|
|
|
|
namespace platform do
|
|
|
|
desc "build gem for #{platform}"
|
|
|
|
task 'build' do
|
|
|
|
orig_platform = ENV['BUILD_PLATFORM']
|
|
|
|
begin
|
|
|
|
ENV['BUILD_PLATFORM'] = platform
|
|
|
|
|
|
|
|
sh("gem build -V #{spec_path + '.windows'}") do |ok, res|
|
|
|
|
if !ok
|
|
|
|
puts "not OK: #{ok.inspect} #{res.inspect}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
ensure
|
|
|
|
ENV['BUILD_PLATFORM'] = orig_platform
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2008-03-08 01:18:28 -05:00
|
|
|
|
2009-06-20 18:19:56 -04:00
|
|
|
############################
|
2008-03-08 01:18:28 -05:00
|
|
|
|
2012-11-13 13:20:58 -05:00
|
|
|
require 'rdoc/task'
|
2008-03-08 01:18:28 -05:00
|
|
|
|
2008-03-09 16:31:52 -04:00
|
|
|
Rake::RDocTask.new do |t|
|
2010-02-08 16:08:18 -05:00
|
|
|
t.rdoc_dir = 'rdoc'
|
|
|
|
t.title = "rest-client, fetch RESTful resources effortlessly"
|
|
|
|
t.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
|
|
|
|
t.options << '--charset' << 'utf-8'
|
|
|
|
t.rdoc_files.include('README.rdoc')
|
|
|
|
t.rdoc_files.include('lib/*.rb')
|
2008-03-09 16:31:52 -04:00
|
|
|
end
|
|
|
|
|