Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.0.2
Fetching contributors…

Cannot retrieve contributors at this time

file 62 lines (53 sloc) 1.765 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
desc 'runs the specs (except integration)'
task :spec do
  specs = (Dir['spec/*/'] - ['spec/integration/']).join(' ')
  coverage = 'export COVERAGE=true && ' if ENV['COVERAGE']
  raise 'FAILED: Specs' unless system "#{coverage}rspec #{specs}"
end

desc 'runs integration specs'
task :integration do
  raise 'FAILED: Integration' unless system 'rspec spec/integration'
end

desc 'builds the gem'
task :build do
  raise 'FAILED: Unable to build gem' unless system 'gem build merrol.gemspec'
end

desc 'builds and installs the gem'
task :install => :build do
  system "gem uninstall -x merrol"
  raise 'FAILED: Unable to install gem' unless system "gem install #{gem_name}"
end

desc 'run local app. Loads application.rb by default. Override with f=file,file,file'
task :run do
  require_relative 'lib/merrol'
  module Merrol
    files = %w(lib/merrol/lib/application.rb README.md lib/merrol/lib/widget_builder.rb)
    Application.new WORKING_DIR, (ENV['f'] && ENV['f'].split(',')) || files
    Gtk.main
  end
end

desc 'tests, builds, installs and runs the app'
task :default => [:spec, :integration, :build, :install] do
  system 'm'
end

desc 'code coverage'
task :coverage do
  ENV['COVERAGE'] = 'true'
  Rake::Task['spec'].invoke
end

desc 'takes the version in the gemspec creates a git tag and sends the gem to rubygems'
task :release do
  name, version = gemspec_details
  system "git tag -f -a v#{version} -m 'Version #{version}'"
  system "gem push #{name}-#{version}.gem"
end

def gem_name
  name, version = gemspec_details
  "#{name}-#{version}.gem"
end

def gemspec_details
  gemspec = File.read('merrol.gemspec')
  name = gemspec.scan(/s\.name.*=.*"(.*)"/).first.first
  version = gemspec.scan(/s\.version.*=.*"(.*)"/).first.first
  [name, version]
end
Something went wrong with that request. Please try again.