Sha256: c81d68e7eb2bfa0d49b67fc625fd37979243ec910fdd1449ea1d9a8dfc258c5d

Contents?: true

Size: 1.62 KB

Versions: 6

Compression:

Stored size: 1.62 KB

Contents

require 'rake/clean'
require 'rake/testtask'

task :default => :test

# TESTS #######################################################################

Rake::TestTask.new(:test) do |t|
  t.test_files = FileList['test/*_test.rb']
end

# DOCS ########################################################################

desc "Generate API documentation"
task :api => FileList['lib/**/*.rb'] do |t|
  output_dir = ENV['OUTPUT_DIR'] || 'api'
  rm_rf output_dir
  sh((<<-SH).gsub(/[\s\n]+/, ' ').strip)
  hanna
    --op #{output_dir}
    --promiscuous
    --charset utf8
    --fmt html
    --inline-source
    --line-numbers
    --accessor option_accessor=RW
    --main Rack::Accept
    --title 'Rack::Accept API Documentation'
    #{t.prerequisites.join(' ')}
  SH
end

CLEAN.include 'api'

# PACKAGING & INSTALLATION ####################################################

if defined?(Gem)
  $spec = eval("#{File.read('rack-accept.gemspec')}")

  directory 'dist'

  def package(ext='')
    "dist/#{$spec.name}-#{$spec.version}" + ext
  end

  file package('.gem') => %w< dist > + $spec.files do |f|
    sh "gem build rack-accept.gemspec"
    mv File.basename(f.name), f.name
  end

  file package('.tar.gz') => %w< dist > + $spec.files do |f|
    sh "git archive --format=tar HEAD | gzip > #{f.name}"
  end

  desc "Build packages"
  task :package => %w< .gem .tar.gz >.map {|e| package(e) }

  desc "Build and install as local gem"
  task :install => package('.gem') do |t|
    sh "gem install #{package('.gem')}"
  end

  desc "Upload gem to rubygems.org"
  task :release => package('.gem') do |t|
    sh "gem push #{package('.gem')}"
  end
end

CLOBBER.include 'dist'

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rack-accept-0.4.5/Rakefile
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/rack-accept-0.4.5/Rakefile
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/rack-accept-0.4.5/Rakefile
rack-accept-0.4.5 Rakefile
rack-accept-0.4.4 Rakefile
rack-accept-0.4.3 Rakefile