Sha256: cab1eb73d3fd9db634a3100ca516651d2835d474d3bac5b43bcb4446b24b1283

Contents?: true

Size: 1.73 KB

Versions: 6

Compression:

Stored size: 1.73 KB

Contents

# GEM TASK
require 'find'

# Unfortunately Rake::GemPackageTest cannot deal with files that are generated
# by Rake targets. So we have to write our own packaging task.
desc 'Build the gem package'
task :gem => [:clobber] do
  Rake::Task[:vim].invoke
  Rake::Task[:manual].invoke
  Rake::Task[:changelog].invoke
  Rake::Task[:permissions].invoke

  load 'taskjuggler.gemspec';

  # Build the gem file according to the loaded spec.
  Gem::Builder.new(GEM_SPEC).build
  pkgBase = "#{GEM_SPEC.name}-#{GEM_SPEC.version}"
  # Create a pkg directory if it doesn't exist already.
  FileUtils.mkdir_p('pkg')
  # Move the gem file into the pkg directory.
  verbose(true) { FileUtils.mv("#{pkgBase}.gem", "pkg/#{pkgBase}.gem")}
  # Create a tar file with all files that are in the gem.
  FileUtils.rm_f("pkg/#{pkgBase}.tar")
  FileUtils.rm_f("pkg/#{pkgBase}.tar.gz")
  verbose(false) {GEM_SPEC.files.each { |f| `tar rf pkg/#{pkgBase}.tar "#{f}"` } }
  # And gzip the file.
  `gzip pkg/#{pkgBase}.tar`
end

desc 'Make sure all files and directories are readable'
task :permissions do
  # Find the bin and test directories relative to this file.
  baseDir = File.expand_path('..', File.dirname(__FILE__))

  execs = Dir.glob("#{baseDir}/bin/*") +
          Dir.glob("#{baseDir}/test/**/genrefs")

  Find.find(baseDir) do |f|
    # Ignore the whoke pkg directory as it may contain links to the other
    # directories.
    next if Regexp.new("#{baseDir}/pkg/*").match(f)

    FileUtils.chmod_R((FileTest.directory?(f) ||
                       execs.include?(f) ? 0755 : 0644), f)
  end
end

desc 'Run all tests and build scripts and create the gem package'
task :release do
  Rake::Task[:test].invoke
  Rake::Task[:spec].invoke
  Rake::Task[:rdoc].invoke
  Rake::Task[:gem].invoke
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
taskjuggler-3.4.0 tasks/gem.rake
taskjuggler-3.3.0 tasks/gem.rake
taskjuggler-3.2.0 tasks/gem.rake
taskjuggler-3.1.0 tasks/gem.rake
taskjuggler-3.0.0 tasks/gem.rake
taskjuggler-0.2.2 tasks/gem.rake