Class: Nib::Console

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/nib/console.rb

Constant Summary collapse

IRBRC =
"require \\\"rubygems\\\"\nrequire \\\"irb/completion\\\"\nrequire \\\"irb/ext/save-history\\\"\n# irb configuration\nIRB.conf[:PROMPT_MODE] = :SIMPLE\nIRB.conf[:AUTO_INDENT] = true\n# irb history\nIRB.conf[:EVAL_HISTORY] = 10\nIRB.conf[:SAVE_HISTORY] = 1000\nIRB.conf[:HISTORY_FILE] = \\\"\#{Dir.pwd}/tmp/irb_history\\\"\n".freeze
PRYRC =
'Pry.config.history.file = \"#{Dir.pwd}/tmp/irb_history\"'.freeze
SCRIPT =
"echo '\#{IRBRC}' > /root/.irbrc\necho '\#{PRYRC}' > /root/.pryrc\nhas_pry=false\nhas_boot=false\nif hash pry 2>/dev/null ; then\n  has_pry=true\nfi\nif [ -f config/boot.rb ]; then\n  has_boot=true\nfi\nif [ -f bin/console ]; then\n  bin/console\nelif [ -f bin/rails ]; then\n  rails console\nelif [ \\\\$has_boot = true ] && [ \\\\$has_pry = true ]; then\n  pry -r ./config/boot\nelif [ \\\\$has_boot = true ]; then\n  irb -r ./config/boot\nelif [ \\\\$has_pry = true ]; then\n  bundle config console pry\n  bundle console\nelse\n  bundle console\nfi\n".freeze

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#executeObject



46
47
48
49
# File 'lib/nib/console.rb', line 46

def execute
  system('mkdir', '-p', './tmp')
  super
end

#scriptObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/nib/console.rb', line 51

def script
  @script ||= "    docker-compose \\\n      run \\\n      --rm \\\n      -e HISTFILE=./tmp/shell_history \\\n      \#{service} \\\n      \#{command}\n  SCRIPT\nend\n"