Sha256: 90ce86ac91806a133be962abb16241ee4887a9101d8ff534fc4c1495001e785b

Contents?: true

Size: 1.04 KB

Versions: 20

Compression:

Stored size: 1.04 KB

Contents

#!/usr/bin/env ruby
# encoding: utf-8
#
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!(ARGV)
end

libs =  " -r irb/completion"
libs << %( -r "picky" )

mapping = {
  'p' => 'production',
  'd' => 'development',
  't' => 'test'
}
given_env = ARGV.first
ENV['PICKY_ENV'] = mapping[given_env] || given_env || ENV['PICKY_ENV'] || 'development'

puts "Use \x1b[1;30mLoader.load_application\x1b[m to load app."
puts "Use \x1b[1;30mIndexes.load_from_cache\x1b[m after that to load indexes."
puts "Copy the following line to do just that:"
puts "\x1b[1;30mLoader.load_application; Indexes.load_from_cache; nil\x1b[m"
puts ""
puts "Now you can for example create a query instance."
puts "\x1b[1;30mbooks = Search.new(Indexes[:books]); nil\x1b[m"
puts "and search on it"
puts "\x1b[1;30mbooks.search_with_text 'bla'\x1b[m"
exec "#{options[:irb]} #{libs} --simple-prompt"

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
picky-generators-3.0.0.pre1 prototypes/server/shared_unicorn/script/console
picky-generators-2.7.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.6.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.5.2 prototypes/server/shared_unicorn/script/console
picky-generators-2.5.1 prototypes/server/shared_unicorn/script/console
picky-generators-2.5.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.4.3 prototypes/server/shared_unicorn/script/console
picky-generators-2.4.2 prototypes/server/shared_unicorn/script/console
picky-generators-2.4.1 prototypes/server/shared_unicorn/script/console
picky-generators-2.4.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.3.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.2.1 prototypes/server/shared_unicorn/script/console
picky-generators-2.2.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.1.2 prototypes/server/shared_unicorn/script/console
picky-generators-2.1.1 prototypes/server/shared_unicorn/script/console
picky-generators-2.1.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.0.0 prototypes/server/shared_unicorn/script/console
picky-generators-2.0.0.pre3 prototypes/server/shared_unicorn/script/console
picky-generators-2.0.0.pre2 prototypes/server/shared_unicorn/script/console
picky-generators-2.0.0.pre1 prototypes/server/shared_unicorn/script/console