lib/opal/command.rb in opal-0.3.9 vs lib/opal/command.rb in opal-0.3.10

- old
+ new

@@ -1,11 +1,11 @@ module Opal class Command # Valid command line arguments - COMMANDS = [:help, :irb, :compile, :bundle, :exec, :eval] + COMMANDS = [:help, :irb, :compile, :bundle, :exec, :eval, :install] def initialize(args) command = args.shift if command and COMMANDS.include?(command.to_sym) @@ -38,15 +38,27 @@ def compile(path) puts Opal::Parser.new(File.read(path)).parse!.generate_top end - # desc "bundle", "Bundle the gem in the given directory ready for browser" - # method_options :out => :string + def install + install = RBP::Install.new + install.install + end + + # Bundle the gem (browserify) ready for the browser def bundle - opts = options - bundle = Opal::Bundle.new(Opal::Gem.new(Dir.getwd)) - bundle.build opts + # lazy load incase user does not have rbp installed + require 'opal/bundle' + + path = File.join Dir.getwd, 'package.yml' + package = Rbp::Package.load_path path + bundle = Bundle.new package + + puts bundle + puts bundle.package + + puts bundle.build end end end