Sha256: b27dc127e8f390ae7814c90b52e226f2045995c5ffbde0b6a2cec5e81f5bc5e5

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

require 'optparse'

trap("INT"){exit}

OptionParser.new do |o|
  o.on("-d DIRECTORY", "--directory", "The directory to start in") {|dir| @dir = dir}
end.parse!

def dir
  @dir ||= "."
  File.absolute_path @dir
end

def os
  if (/Windows/ =~ ENV['OS']) != nil
    return :windows
  elsif (/darwin/ =~ RUBY_PLATFORM) != nil
    return :darwin
  else
    return :linux
  end
end

def gemload name
    libroot = File.expand_path "../../gems", __FILE__
    $:.unshift Dir[libroot + "/#{name}-*/lib"][0]
end

gemload "rubyzip"
require_relative '../version'

puts "HotPlate CLI Version #{HotPlate::VERSION}"
puts
puts "Error: No option selected!" unless ARGV.length > 0
first_arg = ARGV.shift

begin
  (puts "recursion is a bad idea idea idea idea"; exit;) if first_arg == 'main'
  require_relative "#{first_arg}"
rescue LoadError
  puts "Invalid Option: #{first_arg}"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hotplate-0.1.1 lib/hotplate/cli/main.rb