Browse files

Remove builder/compiler support from opal command

The opal command just duplicated all the Builder and BuilderTask
features so this commit reduces the opal command to be purely for
compiling a single file (or stdin) and printing back to stdout.
  • Loading branch information...
1 parent e9fdf34 commit b38f7bbb3018b9e7b9cda4f74c619551146ecf76 Adam Beynon committed May 19, 2012
Showing with 8 additions and 36 deletions.
  1. +8 −36 bin/opal
View
44 bin/opal
@@ -1,43 +1,15 @@
#! /usr/bin/env ruby
-require 'optparse'
require 'opal'
-options = {}
-
-OptionParser.new do |opts|
- opts.on('-c', '--compile', 'Compile ruby') do
- options[:compile] = true
- end
-
- opts.on('-o', '--out FILE', 'Output file') do |o|
- options[:out] = o
- end
-
- opts.on('-p', '--print', 'Print result') do
- options[:print] = true
- end
-
- opts.on_tail("-v", "--version", "Show version") do
- puts Opal::VERSION
- exit
- end
-end.parse! rescue abort("See `opal --help' for usage information.")
-
-if options[:compile]
- puts "No sources given" if ARGV.empty?
-
- ARGV.each do |s|
- puts "need to compile #{s}"
- end
-
-elsif options[:print]
- puts "No sources given" if ARGV.empty?
-
- ARGV.each do |s|
- puts Opal.parse s
- end
+first = ARGV.first
+if first.nil?
+ puts "Usage: opal path/to/file.rb"
+elsif first == '-v' or first == '--version'
+ puts Opal::VERSION
+elsif File.exist? first
+ puts Opal.parse File.read(first)
else
- puts "No sources given"
+ puts Opal.parse(first)
end

0 comments on commit b38f7bb

Please sign in to comment.