Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fc709fddda
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 74 lines (62 sloc) 2.949 kb
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
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with this
# work for additional information regarding copyright ownership. The ASF
# licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.


require 'rake/gempackagetask'


package = Rake::GemPackageTask.new(spec) do |pkg|
  pkg.need_tar = true
  pkg.need_zip = true
end

desc "Install Buildr from source"
task :install=>["#{package.package_dir}/#{package.gem_file}"] do |task|
  print "Installing #{spec.name} ... "
  args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_file}"
  args.unshift('sudo') if sudo_needed?
  sh *args
  puts "[x] Installed Buildr #{spec.version}"
end

desc "Uninstall previous rake install"
task :uninstall do |task|
  puts "Uninstalling #{spec.name} ... "
  args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s
  args.unshift('sudo') if sudo_needed?
  sh *args
  puts "[x] Uninstalled Buildr #{spec.version}"
end


desc "Compile Java libraries used by Buildr"
task :compile do
  puts "Compiling Java libraries ..."
  args = Config::CONFIG['ruby_install_name'], File.expand_path(RUBY_PLATFORM[/java/] ? '_jbuildr' : '_buildr'), '--buildfile', 'buildr.buildfile', 'compile'
  args << '--trace' if Rake.application.options.trace
  sh *args
end
file Rake::GemPackageTask.new(spec).package_dir=>:compile
file Rake::GemPackageTask.new(spec).package_dir_path=>:compile

# We also need the other packages (JRuby if building on Ruby, and vice versa)
# Must call new with block, even if block does nothing, otherwise bad things happen.
@specs.values.each do |s|
  Rake::GemPackageTask.new(s) { |task| }
end


desc "Upload snapshot packages over to people.apache.org"
task :snapshot=>[:package] do
  rm_rf '_snapshot' # Always start with empty directory
  puts "Copying existing gems from Apache"
  sh 'rsync', '--progress', '--recursive', 'people.apache.org:public_html/buildr/snapshot/', '_snapshot/'
  puts "Copying new gems over"
  cp FileList['pkg/{*.gem,*.tgz,*.zip}'], '_snapshot/gems'
  puts "Generating gem index ..."
  sh 'gem', 'generate_index', '--directory', '_snapshot'
  puts "Copying gem and index back to Apache"
  sh 'rsync', '--progress', '--recursive', '_snapshot/', 'people.apache.org:public_html/buildr/snapshot/'
end
task(:clobber) { rm_rf '_snapshot' }
Something went wrong with that request. Please try again.