Sha256: 38513dd721edd7d7ac2841c5a76238be5c5ef4e2a70a255f84739843ac59f91b
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require 'kangaroo/commands/base' require 'irb' require 'irb/completion' require 'hirb' require 'kangaroo/commands/endpoint' module IRB mattr_accessor :prompt class << self alias init_config_old init_config end def IRB.init_config(ap_path) init_config_old ap_path @@prompt ||= "kang" @CONF[:PROMPT] = { :CUSTOM => { :PROMPT_I => "#{@@prompt} > ", :PROMPT_S => "#{@@prompt} %l> ", :PROMPT_C => "#{@@prompt} .. ", :PROMPT_N => "#{@@prompt} .. ", :RETURN => "=> %s\n" } } @CONF[:PROMPT_MODE] = :CUSTOM @CONF[:AUTO_INDENT] = true end end module Kangaroo module Commands class CLI < Base def run super initialize_global_endpoint start_irb end protected def initialize_global_endpoint ::Kang.connect configuration, logger ::Kang.load_models! end def start_irb ARGV.clear IRB.prompt = ::Kang.configuration['database'].values_at('user', 'name').join("@") ::Hirb.enable ::IRB.start end def banner "".tap do |s| s << 'kang - The Kangaroo command line interface' s << "\n\n" s << 'Usage:' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kangaroo-0.1.0.alpha1 | lib/kangaroo/commands/cli.rb |