Sha256: 77195886af0b54a73305bc992be23fc6e70f3220346761f8d6e103e8d354e0fd

Contents?: true

Size: 881 Bytes

Versions: 1

Compression:

Stored size: 881 Bytes

Contents

#!/usr/bin/env ruby

require 'bundler'
require 'readline'
require 'shellwords'

begin
  Bundler.require(:default, (ENV['RAILS_ENV'] || 'development'))
rescue Bundler::GemfileNotFound => e
  puts "Gemfile Not Found, executing IRB instead"
  exec("irb")
end


child = nil

Signal.trap("INT") do
  unless child
    puts "Skip is terminating..."
    exit(0)
  end
end


while args = Readline.readline("skip> ", true) do
  ARGV.clear
  ARGV.push(*Shellwords.split(args))

  exec = ARGV.shift

  time = Time.now
  child = fork do
    case exec
    when 'rails'
      load './script/rails'
    when 'rake'
      require 'rake'
      Rake.application.run
    when 'ruby'
      Skip.setup_ruby
      file = ARGV.shift
      load file
    end
  end
  puts "Waiting for child #{child}"
  Process.waitpid(child)
  puts "Done in #{(Time.now - time).to_f}"
  child = nil
end

puts "Terminated"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skip-0.0.1 bin/skip