Sha256: ebadf53dac56b8849200399ed8d2246241d9d4e0aa3b5fe7d4a9ad510e3a870a

Contents?: true

Size: 1.73 KB

Versions: 1

Compression:

Stored size: 1.73 KB

Contents

#!/usr/bin/env ruby

unless $:.include?(File.dirname(__FILE__) + '/lib/')
  $: << File.dirname(__FILE__) + '/lib'
end

require 'fileutils'
require 'rake'

require 'resque/tasks'

Dir['tasks/**/*.rake'].each { |t| load t }

require 'cucumber'
require 'cucumber/rake/task'
require 'colorize'
Cucumber::Rake::Task.new(:features) do |t|
  t.cucumber_opts = "features --format pretty"
end

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

task :default => :spec


desc "build gem"
task :build => :verify do
  build_output = `gem build flapjack.gemspec`
  puts build_output

  gem_filename = build_output[/File: (.*)/,1]
  pkg_path = "pkg"
  FileUtils.mkdir_p(pkg_path)
  FileUtils.mv(gem_filename, pkg_path)

  puts "Gem built in #{pkg_path}/#{gem_filename}".green
end

desc "push gem"
task :push do
  filenames = Dir.glob("pkg/*.gem")
  filenames_with_times = filenames.map do |filename|
    [filename, File.mtime(filename)]
  end

  newest = filenames_with_times.sort_by { |tuple| tuple.last }.last
  newest_filename = newest.first

  command = "gem push #{newest_filename}"
  system(command)
end

desc "clean up various generated files"
task :clean do
  [ "pkg/"].each do |filename|
    puts "Removing #{filename}"
    FileUtils.rm_rf(filename)
  end
end

namespace :verify do
  task :uncommitted do
    uncommitted = `git ls-files -m`.split("\n")
    if uncommitted.size > 0
      puts "The following files are uncommitted:".red
      uncommitted.each do |filename|
        puts " - #{filename}".red
      end
      exit 1
    end
  end

  task :all => [ :uncommitted ]
end

# FIXME: getting that intermittent gherken lexing error so removing :features from verify list
#task :verify => [ 'verify:all', :spec, :features]
task :verify => [ 'verify:all', :spec]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flapjack-0.6.23 Rakefile