Sha256: 9c8d8e2f67e6270b9fbdb966e41d99d2e0b0763a237cde9a974d841fffee1f85

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Boson
  class ReplRunner < Runner
    class <<self
      def start(options={})
        @options = options
        init unless @initialized
        Manager.load(@options[:libraries], load_options) if @options[:libraries]
      end

      def init
        super
        define_autoloader if @options[:autoload_libraries]
        @initialized = true
      end

      def bin_start(repl, libraries)
        start :no_defaults=>true, :libraries=>libraries
        repl = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb' unless repl.is_a?(String)
        unless repl.index('/') == 0 || (repl = Util.which(repl))
          $stderr.puts "Repl not found. Please specify full path of repl."
          return
        end
        ARGV.replace ['-f']
        Kernel.load $0 = repl
      end

      def default_libraries
        defaults = super
        unless @options[:no_defaults]
          new_defaults = Boson.repos.map {|e| e.config[:defaults] }.flatten
          new_defaults = detected_libraries if new_defaults.empty?
          defaults += new_defaults
          defaults.uniq!
        end
        defaults
      end
    end
  end
end
  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
boson-0.0.1 lib/boson/runners/repl_runner.rb