Sha256: 9d0233dc66f5cc530f8b34ab6f1653a1119e9275b6ddf41953fc0d99528d29c9

Contents?: true

Size: 693 Bytes

Versions: 4

Compression:

Stored size: 693 Bytes

Contents

require 'rake'
require "bundler/gem_tasks"

desc "Start the application"
task :default do
  start_application!
end

def start_application!
  stop_application! if application_running?

  fail "Failed to start app" unless system "thin start -d -p 3000" 
  wait_until do
    application_running?
  end
end

def stop_application!
  system "kill -9 #{application_process_id}"
end

def application_running?
  not `lsof -i tcp:3000 | grep LISTEN`.empty?
end

def application_process_id
  `lsof -i tcp:3000 | grep LISTEN`.split[1]
end

def wait_until timeout=60
  start_time = Time.now
  until Time.now > start_time + timeout
    return if yield
    sleep 0.5
  end
  raise "action took too long"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unused_css-1.0.0 Rakefile
unused_css-0.2.0 Rakefile
unused_css-0.1.0 Rakefile
unused_css-0.0.1 Rakefile