Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8cf473312841
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e0300123ee05
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Feb 3, 2015

  1. Copy the full SHA
    fab683b View commit details
  2. Copy the full SHA
    a62adbe View commit details
  3. Copy the full SHA
    e030012 View commit details
Showing with 14 additions and 4 deletions.
  1. +6 −1 lib/opal/cli.rb
  2. +8 −3 lib/opal/cli_options.rb
7 changes: 6 additions & 1 deletion lib/opal/cli.rb
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ module Opal
class CLI
attr_reader :options, :file, :compiler_options, :evals, :load_paths, :argv,
:output, :requires, :gems, :stubs, :verbose, :port, :preload,
:filename
:filename, :debug

def compile?
@compile
@@ -45,6 +45,7 @@ def initialize options = nil
@preload = options.delete(:preload) || []
@output = options.delete(:output) || self.class.stdout || $stdout
@verbose = options.fetch(:verbose, false); options.delete(:verbose)
@debug = options.fetch(:debug, false); options.delete(:debug)
@filename = options.fetch(:filename) { @file && @file.path }; options.delete(:filename)
@skip_opal_require = options.delete(:skip_opal_require)
@compiler_options = Hash[
@@ -95,6 +96,10 @@ def compiled_source

preload.each { |path| builder.build_require(path) }

# FLAGS
builder.build_str '$VERBOSE = true', '(flags)' if verbose
builder.build_str '$DEBUG = true', '(flags)' if debug

# REQUIRES: -r
requires.each do |local_require|
builder.build(local_require)
11 changes: 8 additions & 3 deletions lib/opal/cli_options.rb
Original file line number Diff line number Diff line change
@@ -12,11 +12,16 @@ def initialize

on('-v', '--verbose', 'print version number, then turn on verbose mode') do
print_version
options[:verbose] = true # TODO: print some warnings when verbose = true
exit if ARGV.empty?
options[:verbose] = true
end

on('--verbose', 'turn on verbose mode') do
options[:verbose] = true # TODO: print some warnings when verbose = true
on('--verbose', 'turn on verbose mode (set $VERBOSE to true)') do
options[:verbose] = true
end

on('-d', '--debug', 'turn on debug mode (set $DEBUG to true)') do
options[:debug] = true
end

on('--version', 'Print the version') do