Sha256: 3e6fd33a3b00be0a1ca40f06a32ff6bf08f26c4919183639e666aef3e4296e61

Contents?: true

Size: 828 Bytes

Versions: 5

Compression:

Stored size: 828 Bytes

Contents

namespace :rails do
  desc 'Execute rails console'
  task :console do
    on roles(:app) do
      within release_path do
        with rails_env: fetch(:rails_env) do
          row , command = '', nil
          execute(:rails, :console) do |ch, data|
            row += data
            if command && row.include?(command)
              row.sub!(/#{command}(\r\n)?/, '')
              command = nil
            end

            if row.include?('irb(main):')
              print row
              row     = ''
              command = $stdin.gets
              command = "exit\n" if command == nil
              ch.send_data command
              command.chomp!
            end

            if row.include?("\n")
              print row
              row = ''
            end

          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
j-cap-recipes-0.0.14 lib/j-cap-recipes/tasks/rails.rake
j-cap-recipes-0.0.13 lib/j-cap-recipes/tasks/rails.rake
j-cap-recipes-0.0.12 lib/j-cap-recipes/tasks/rails.rake
j-cap-recipes-0.0.11 lib/j-cap-recipes/tasks/rails.rake
j-cap-recipes-0.0.10 lib/j-cap-recipes/tasks/rails.rake