Sha256: d6cf5c4edbddcc26dc80694ef32b539222119e55907e0f6187ae5a10d33a1824

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

desc 'console [TARGET]', 'Open a Rails console locally or on a Capistrano deploy target'
long_desc <<-LONGDESC
Local (development): `geordi console`

Remote: `geordi console staging`

Selecting the server: `geordi console staging -s` shows a menu with all available
servers. When passed a number, directly connects to the selected server.

IRB flags can be given as `irb_flags: '...'` in the global Geordi config file (`~/.config/geordi/global.yml`).
LONGDESC

# This option is duplicated in shelll.rb
option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
  desc: 'Select a server to connect to'

def console(target = 'development', *_args)
  require 'geordi/remote'

  Hint.did_you_know [
    :shelll,
    [:console, :select_server],
    'You only need to type the unique prefix of a command to run it. `geordi con` will work as well.',
  ]

  if target == 'development'
    invoke_geordi 'bundle_install'
    invoke_geordi 'yarn_install'

    Interaction.announce 'Opening a local Rails console'

    command = Util.console_command(target)
    # Exec has better behavior on Ctrl + C
    Util.run!(command, exec: true)
  else
    Interaction.announce 'Opening a Rails console on ' + target

    Geordi::Remote.new(target).console(options)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
geordi-11.2.1 lib/geordi/commands/console.rb
geordi-11.2.0 lib/geordi/commands/console.rb
geordi-11.1.0 lib/geordi/commands/console.rb
geordi-11.0.0 lib/geordi/commands/console.rb
geordi-10.1.0 lib/geordi/commands/console.rb
geordi-10.0.1 lib/geordi/commands/console.rb
geordi-10.0.0 lib/geordi/commands/console.rb