Sha256: db9b74592442ca72a6ab47c3813d3df32de8246c8e1b86c8ae450313be8d12ee
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
#!/usr/bin/env ruby # encoding: utf-8 # module Picky # TODO Improve. # class Console def self.start *args irb = 'irb' require 'optparse' options = { :sandbox => false, :irb => irb } OptionParser.new do |opt| opt.banner = "Usage: console [environment] [options]" opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v } opt.parse!(args) end libs = " -r irb/completion" libs << %( -r "#{File.expand_path('../../picky.rb', __FILE__)}" ) mapping = { 'p' => 'production', 'd' => 'development', 't' => 'test' } given_env = args.first ENV['PICKY_ENV'] = mapping[given_env] || given_env || ENV['PICKY_ENV'] || 'development' puts "Use \x1b[1;30mPicky::Loader.load_application\x1b[m to load app." puts "Use \x1b[1;30mPicky::Indexes.load\x1b[m after that to load indexes." puts "Copy the following line to do just that:" puts "\x1b[1;30mPicky::Loader.load_application; Picky::Indexes.load; p\x1b[m" exec "#{options[:irb]} #{libs} --simple-prompt" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
picky-3.6.10 | lib/picky/console.rb |