Sha256: 34d437f8db6bf58aab87a7a3f52b2a31e1ab9f46fc5e156bfaec8fff8a9350aa

Contents?: true

Size: 1.66 KB

Versions: 6

Compression:

Stored size: 1.66 KB

Contents

require 'fileutils'

task :default do
  system("rake -T")
end

def version
  `git describe --tags  --abbrev=0`.chomp.sub('v','')
end

def next_version(type = :patch)
  section = [:major,:minor,:patch].index type

  n = version.split '.'
  n[section] = n[section].to_i + 1
  n.join '.'
end

desc "Build Docker image"
task 'docker' do
  Dir.chdir('build') do
    system("docker build -t binford2k/showoff:#{version} -t binford2k/showoff:latest .")
  end
  puts
  puts 'Start container with: docker run -p 9090:9090 binford2k/showoff'
end

desc "Upload image to Docker Hub"
task 'docker:push' => ['docker'] do
  system("docker push binford2k/showoff:#{version}")
  system("docker push binford2k/showoff:latest")
end

desc "Build HTML documentation"
task :doc do
  FileUtils.rm_rf('doc')
  Dir.chdir('documentation') do
    system("rdoc --main -HOME.rdoc /*.rdoc --op ../doc")
  end
end

desc "Update docs for webpage"
task 'doc:website' => [:doc] do
  if system('git checkout gh-pages')
    FileUtils.rm_rf('documentation')
    FileUtils.mv('doc', 'documentation')
    system('git add documentation')
    system('git commit -m "updating docs"')
    system('git checkout -')

    puts "Publish updates by pushing to Github:"
    puts
    puts "    git push upstream gh-pages"
    puts
  end
end

desc "Run tests"
task :test do
  require 'rake/testtask'

  Rake::TestTask.new do |t|
    t.libs << 'lib'
    t.pattern = 'test/**/*_test.rb'
    t.verbose = false
  end

  suffix = "-n #{ENV['TEST']}" if ENV['TEST']
  sh "turn test/*_test.rb #{suffix}"
end

begin
  require 'mg'
  MG.new("showoff.gemspec")
rescue LoadError
  puts "'gem install mg' to get helper gem publishing tasks. (optional)"
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
showoff-0.14.2 Rakefile
showoff-0.14.1 Rakefile
showoff-0.14.0 Rakefile
showoff-0.13.4 Rakefile
showoff-0.13.3 Rakefile
showoff-0.13.2 Rakefile