Sha256: 98c2d85aab92e24623ad60eac7215fcf25ab8c29d40b69cd28b6927b6b2dd827
Contents?: true
Size: 1.92 KB
Versions: 85
Compression:
Stored size: 1.92 KB
Contents
#!/usr/bin/env ruby require 'optparse' module Opal class BuilderOptions < OptionParser def initialize @options = {} super do |opts| opts.banner = 'Usage: opal-build [options] -- [libname]' opts.separator '' opts.separator 'Options:' opts.on("-h", "--help", "Show this message") do puts opts exit end opts.on('-g', '--gem GEM_NAME', String, 'Adds the specified GEM_NAME lib dir to Opal\'s load path.', 'E.g.: opal-build --gem erubis -- erubis`', 'Will build erubis.rb from the regular "erubis" gem') do |g| options[:gems] ||= [] options[:gems] << g end opts.on('-s', '--stub STUB', String) do |stub| options[:stubs] ||= [] options[:stubs] << stub end opts.on('-r', '--require LIBRARY', String, 'Require the library before executing your script', 'E.g.: opal-build --require opal-browser browser`', 'Will build browser.rb from the Opal gem opal-browser') do |library| options[:requires] ||= [] options[:requires] << library end opts.on('-o', '--output FILE', String, 'Write the built lib to a file (defaults to STDOUT)') do |file| options[:output] = file end end end attr_reader :options end end option_parser = Opal::BuilderOptions.new option_parser.parse! if ARGV.empty? puts option_parser else require 'opal' options = option_parser.options if options[:gems] require 'rubygems' options[:gems].each { |gem_name| Opal.use_gem gem_name } end if options[:requires] options[:requires].each { |required_lib| require required_lib } end lib_name = ARGV.first output = options[:output] ? File.open(options[:output], 'w') : $stdout output.puts Opal::Builder.build(lib_name.dup.untaint) end
Version data entries
85 entries across 85 versions & 3 rubygems
Version | Path |
---|---|
opal-0.7.0.beta3 | bin/opal-build |
opal-0.7.0.beta2 | bin/opal-build |
opal-cj-0.7.0.beta2 | bin/opal-build |
opal-cj-0.7.0.beta1 | bin/opal-build |
opal-0.7.0.beta1 | bin/opal-build |