bazinga 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2fe14d64ab0ce75c5594518c773aac178104f85
4
- data.tar.gz: 6a55b77c68243c8d1beb5898fb2db9e0abb9ad00
3
+ metadata.gz: e3d702fda302d8b77b6bb0bcd7133e76da8a1b2c
4
+ data.tar.gz: 2e3f90b145b9614b9244e4553bfbb5e7df49c9f2
5
5
  SHA512:
6
- metadata.gz: 2d61aaa2d1dc3dc4373af1ba17eb36ad2e770f7a32831de023730e356b76a9d66e42a0f3ed6a3dc4f1a4022ac2988c2b64af056b34bbff7cbc3ab15b83625ae6
7
- data.tar.gz: d357dde619d0bca0b5473578643e24989b02ed23ad979587ff2fa951403d4eb1bfd2805e96f8dadb9f8133bf2b682cdb186e7b3f0dedd746eba4c391cb2ba49e
6
+ metadata.gz: 7e0e8c0579a5802bd7c2583e232b6150447d7c294425f31dbdd1728e4b364493eef116f7f21b0d51f529f618e057815ecd7751bf15a5d3589e784b85eb927dd4
7
+ data.tar.gz: 3c640c30099b41e5b7577b5670bd0560c1a0d2583d559aca90b247cc29770fce7f51374c15093445a4d1cbfe339fd81a94fc53ba12bb2ce1364ccc04d23b59c7
data/README.md CHANGED
@@ -19,7 +19,7 @@ Just run `rails console`.
19
19
  You can modify the app name by adding the following in your project's `config/application.rb` (inside `class Application`) :
20
20
  ```ruby
21
21
  console do
22
- Bazinga::APP_NAME = 'railsApp'
22
+ Bazinga::APP_NAME = 'railsApp' if defined? Bazinga
23
23
  end
24
24
  ```
25
25
  or start the console by customized environment tag:
@@ -1,15 +1,20 @@
1
1
  module Bazinga
2
2
  class Runner
3
3
  COLOR_MAP = {
4
- 'red' => "\033[0;31m",
5
- 'yellow' => "\033[0;33m",
6
- 'green' => "\033[0;32m",
7
- 'black' => "\033[0;30m",
8
- 'reset' => "\033[0;0m"
4
+ 'red' => "\001\e[1m\e[31m\002",
5
+ 'yellow' => "\001\e[1m\e[33m\002",
6
+ 'green' => "\001\e[1m\e[32m\002",
7
+ 'reset' => "\001\e[0m\002"
9
8
  }
10
9
 
11
10
  class << self
12
11
 
12
+ # Issue: readline breaks. Fixed.
13
+ # Credits: http://stackoverflow.com/questions/8806643/colorized-output-breaks-linewrapping-with-readline
14
+ def colorize(text, color)
15
+ "#{COLOR_MAP[color]}#{text}#{COLOR_MAP['reset']}"
16
+ end
17
+
13
18
  def run
14
19
  env_tag = (ENV['RAILS_ENV'] && ENV['RAILS_ENV'].downcase) || (Rails && Rails.env && Rails.env.downcase)
15
20
 
@@ -19,14 +24,14 @@ module Bazinga
19
24
  Rails.application.class.parent_name.underscore.gsub("_", "-")
20
25
 
21
26
  console_tag = case env_tag
22
- when 'production' then "(#{COLOR_MAP['red']}prod#{COLOR_MAP['reset']})"
23
- when 'staging' then "(#{COLOR_MAP['yellow']}staging#{COLOR_MAP['reset']})"
24
- when 'development' then "(#{COLOR_MAP['green']}dev#{COLOR_MAP['reset']})"
25
- else "(#{COLOR_MAP['yellow']}#{env_tag})#{COLOR_MAP['reset']}"
27
+ when 'production' then "(#{colorize('prod', 'red')})"
28
+ when 'staging' then "(#{colorize('staging', 'yellow')})"
29
+ when 'development' then "(#{colorize('dev', 'green')})"
30
+ else "(#{colorize(env_tag, 'yellow')})"
26
31
  end
27
32
 
28
33
  IRB.conf[:PROMPT][:RAILS_ENV] = {
29
- :PROMPT_I => "#{app_name}#{console_tag} :%03n> ",
34
+ :PROMPT_I => "#{app_name}#{console_tag} :%03n > ",
30
35
  :PROMPT_N => "#{app_name}#{console_tag} :%03n?> ",
31
36
  :PROMPT_S => "",
32
37
  :PROMPT_C => "#{app_name}#{console_tag} :%03n?> ",
@@ -34,6 +39,7 @@ module Bazinga
34
39
  }
35
40
 
36
41
  IRB.conf[:PROMPT_MODE] = :RAILS_ENV
42
+ puts "#{COLOR_MAP['red']}Logged in on Production#{COLOR_MAP['reset']}" if env_tag.eql? 'production'
37
43
  end
38
44
  end
39
45
  end
@@ -1,3 +1,3 @@
1
1
  module Bazinga
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bazinga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankur Goel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-07 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler