Sha256: 2b8cfe0d7d16eff53904a6b12f3e58f0bd517376d7da4b43406ab4949cc777a7

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

ENV['RACK_ENV'] = "development"

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task :default => :spec

task :pry do
  require 'pry'; binding.pry
end

namespace :assets do
  task :precompile do
    require 'bait'
    Bait.assets.compile!
  end
end

def git_master?
  `git branch | grep '* master'`
  $?.exitstatus == 0
end

namespace :git do
  task :dirty do
    if `git status --porcelain`.match(/M /)
      puts "Dirty working tree! Commit first before building!"
      exit
    end
  end
end

namespace :gem do
  task :build do
    `bundle install`
    Rake::Task['git:dirty'].invoke
    if !git_master?
      puts "I'll only build the gem on the master branch"
    else
      puts "On master branch, running test suite; please wait."
      `rspec spec`
      if $?.exitstatus != 0
        puts "Uhh.. you have failing specs -- not building the gem"
      else
        puts "Specs pass. you're ready"
        Rake::Task['assets:precompile'].invoke
        Rake::Task['git:dirty'].invoke
        puts `gem build bait.gemspec`
        puts "Done! You can gem push that now"
      end
    end
  end

  task :push => :build do
    require "bait/version"
    gem = "bait-#{Bait::VERSION}.gem"
    if File.exists?(gem)
      begin
        puts "Press any key to push to Rubygems"
        STDIN.gets
        puts "Pushing gem to rubygems"
        puts `gem push #{gem}`
      rescue Interrupt
        puts "ancelled"
      end
    else
      puts "File not found #{gem}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bait-0.5.12 Rakefile
bait-0.5.11 Rakefile
bait-0.5.10 Rakefile
bait-0.5.9 Rakefile
bait-0.5.6 Rakefile
bait-0.5.5 Rakefile