Sha256: 3e8b9397972bf182115c01b2debd34d12f656d49b096cbe8aaa2a84fcabae1d5
Contents?: true
Size: 1.92 KB
Versions: 3
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 to Opal\'s load path.', 'E.g.: opal-build --require opal-browser browser`', 'Will build browser.rb from the Opal gem opal-browser') 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 options 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
opal-0.6.3 | bin/opal-build |
opal-0.6.2 | bin/opal-build |
opal-0.6.1 | bin/opal-build |