Sha256: a4d406963189215262b98c1855609e3432ff7dc2f10533e7fb68e09c90217841

Contents?: true

Size: 863 Bytes

Versions: 15

Compression:

Stored size: 863 Bytes

Contents

class JefferiesTube::Console
  def self.prompt_base
    rails_env = JefferiesTube.configuration.environment
    if rails_env
      color = "\e[0m" #Default to white text on no background
      current_app = JefferiesTube.configuration.prompt_name

      if rails_env == "development"
      elsif rails_env == "dev"
        color = "\e[0;37m\e[1;44m" #White on blue
      elsif ["test", "qa", "staging"].include? rails_env
        color = "\e[0;37m\e[1;43m" #White on yellow
      elsif rails_env == "production"
        color = "\e[0;37m\e[1;41m" #White on red
      end

      base = "#{color}#{current_app}(#{rails_env})\e[0m"
      return "#{base}"
    else
      return "#{current_app}"
    end
  end

  def self.pry_prompts
    [
      # wait_proc
      proc { prompt_base + " > " },
      # incomplete_proc
      proc { prompt_base + "*> "}
    ]
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jefferies_tube-1.7.1 lib/jefferies_tube/console.rb
jefferies_tube-1.7.0 lib/jefferies_tube/console.rb
jefferies_tube-1.6.9 lib/jefferies_tube/console.rb
jefferies_tube-1.6.8 lib/jefferies_tube/console.rb
jefferies_tube-1.6.7 lib/jefferies_tube/console.rb
jefferies_tube-1.6.6 lib/jefferies_tube/console.rb
jefferies_tube-1.6.5 lib/jefferies_tube/console.rb
jefferies_tube-1.6.4 lib/jefferies_tube/console.rb
jefferies_tube-1.6.3.2 lib/jefferies_tube/console.rb
jefferies_tube-1.6.3.1 lib/jefferies_tube/console.rb
jefferies_tube-1.6.3 lib/jefferies_tube/console.rb
jefferies_tube-1.6.2 lib/jefferies_tube/console.rb
jefferies_tube-1.6.1 lib/jefferies_tube/console.rb
jefferies_tube-1.6.0 lib/jefferies_tube/console.rb
jefferies_tube-1.5.4 lib/jefferies_tube/console.rb