2014-04-01 00:49:24 -04:00
|
|
|
# load `rake build/install/release tasks'
|
|
|
|
require 'bundler/setup'
|
2014-04-02 02:59:12 -04:00
|
|
|
require_relative './lib/restclient/version'
|
|
|
|
|
|
|
|
namespace :ruby do
|
|
|
|
Bundler::GemHelper.install_tasks(:name => 'rest-client')
|
|
|
|
end
|
2009-06-20 18:19:56 -04:00
|
|
|
|
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
|
|
|
|
|
2015-04-14 16:00:07 -04:00
|
|
|
desc 'Regenerate authors file'
|
|
|
|
task :authors do
|
|
|
|
Dir.chdir(File.dirname(__FILE__)) do
|
|
|
|
File.open('AUTHORS', 'w') do |f|
|
|
|
|
f.write( <<-EOM
|
|
|
|
The Ruby REST Client would not be what it is today without the help of
|
|
|
|
the following kind souls:
|
|
|
|
|
|
|
|
EOM
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
sh 'git shortlog -s | cut -f 2 >> AUTHORS'
|
|
|
|
end
|
|
|
|
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}
|
|
|
|
|
2014-04-02 02:59:12 -04:00
|
|
|
namespace :all do
|
|
|
|
|
|
|
|
desc "Build rest-client #{RestClient::VERSION} for all platforms"
|
|
|
|
task :build => ['ruby:build'] + \
|
|
|
|
WindowsPlatforms.map {|p| "windows:#{p}:build"}
|
2014-03-31 23:34:30 -04:00
|
|
|
|
2014-04-02 02:59:12 -04:00
|
|
|
desc "Create tag v#{RestClient::VERSION} and for all platforms build and push " \
|
|
|
|
"rest-client #{RestClient::VERSION} to Rubygems"
|
|
|
|
task :release => ['build', 'ruby:release'] + \
|
|
|
|
WindowsPlatforms.map {|p| "windows:#{p}:push"}
|
2014-03-31 23:34:30 -04:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
namespace :windows do
|
2014-04-01 00:49:24 -04:00
|
|
|
spec_path = File.join(File.dirname(__FILE__), 'rest-client.windows.gemspec')
|
2014-03-31 23:34:30 -04:00
|
|
|
|
|
|
|
WindowsPlatforms.each do |platform|
|
|
|
|
namespace platform do
|
2014-04-02 02:59:12 -04:00
|
|
|
gem_filename = "rest-client-#{RestClient::VERSION}-#{platform}.gem"
|
|
|
|
base = File.dirname(__FILE__)
|
|
|
|
pkg_dir = File.join(base, 'pkg')
|
|
|
|
gem_file_path = File.join(pkg_dir, gem_filename)
|
|
|
|
|
|
|
|
desc "Build #{gem_filename} into the pkg directory"
|
2014-03-31 23:34:30 -04:00
|
|
|
task 'build' do
|
|
|
|
orig_platform = ENV['BUILD_PLATFORM']
|
|
|
|
begin
|
|
|
|
ENV['BUILD_PLATFORM'] = platform
|
|
|
|
|
2014-04-01 00:49:24 -04:00
|
|
|
sh("gem build -V #{spec_path}") do |ok, res|
|
2014-04-02 02:59:12 -04:00
|
|
|
if ok
|
|
|
|
FileUtils.mkdir_p(pkg_dir)
|
|
|
|
FileUtils.mv(File.join(base, gem_filename), pkg_dir)
|
2014-07-08 06:54:01 -04:00
|
|
|
Bundler.ui.confirm("rest-client #{RestClient::VERSION} " \
|
2014-04-02 02:59:12 -04:00
|
|
|
"built to pkg/#{gem_filename}")
|
|
|
|
else
|
|
|
|
abort "Command `gem build` failed: #{res}"
|
2014-03-31 23:34:30 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
ensure
|
|
|
|
ENV['BUILD_PLATFORM'] = orig_platform
|
|
|
|
end
|
|
|
|
end
|
2014-04-02 02:59:12 -04:00
|
|
|
|
|
|
|
desc "Push #{gem_filename} to Rubygems"
|
|
|
|
task 'push' do
|
|
|
|
sh("gem push #{gem_file_path}")
|
|
|
|
end
|
2014-03-31 23:34:30 -04:00
|
|
|
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'
|
2016-06-05 23:28:26 -04:00
|
|
|
t.rdoc_files.include('README.md')
|
2010-02-08 16:08:18 -05:00
|
|
|
t.rdoc_files.include('lib/*.rb')
|
2008-03-09 16:31:52 -04:00
|
|
|
end
|