bazinga 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/bazinga/bazinga-conf.rb +16 -10
- data/lib/bazinga/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3d702fda302d8b77b6bb0bcd7133e76da8a1b2c
|
4
|
+
data.tar.gz: 2e3f90b145b9614b9244e4553bfbb5e7df49c9f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
data/lib/bazinga/bazinga-conf.rb
CHANGED
@@ -1,15 +1,20 @@
|
|
1
1
|
module Bazinga
|
2
2
|
class Runner
|
3
3
|
COLOR_MAP = {
|
4
|
-
'red' => "\
|
5
|
-
'yellow' => "\
|
6
|
-
'green' => "\
|
7
|
-
'
|
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 "(#{
|
23
|
-
when 'staging' then "(#{
|
24
|
-
when 'development' then "(#{
|
25
|
-
else "(#{
|
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
|
data/lib/bazinga/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|