Sha256: dbe1451126a5f8451e9f72658cf48abcc01e8c8fb3d94291cf6afa9d176571b7

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# =============================================================================
#  
# MODULE      : rakefile.rb
# PROJECT     : FolderTemplate
# DESCRIPTION : 
#
# Copyright (c) 2016, Marc-Antoine Argenton.  All rights reserved.
# =============================================================================

require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new do |t|
  t.libs << '.' << 'test'
  t.test_files = FileList['test/**/test_*.rb']
  t.verbose = false
end

begin
  require 'watch'
  w = `tput cols`.to_i || 80

  def tty_red(str);           "\e[31m#{str}\e[0m" end
  def tty_green(str);         "\e[32m#{str}\e[0m" end
  def tty_blink(str);         "\e[5m#{str}\e[25m" end
  def tty_reverse_color(str); "\e[7m#{str}\e[27m" end
  
  
  desc 'Run unit tests everytime a source or test file is changed'
  task :autotest do
    Watch.new( '**/*.rb' ) do
      success = system "clear && rake test"
      
      puts tty_green( "-" * w ) if success
      puts tty_reverse_color(tty_red( "-" * w )) if !success
    end
  end

rescue Exception => e
end

task :default => [:test, :build]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
folder_template-0.1.1 rakefile.rb