bazinga 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2fe14d64ab0ce75c5594518c773aac178104f85
4
+ data.tar.gz: 6a55b77c68243c8d1beb5898fb2db9e0abb9ad00
5
+ SHA512:
6
+ metadata.gz: 2d61aaa2d1dc3dc4373af1ba17eb36ad2e770f7a32831de023730e356b76a9d66e42a0f3ed6a3dc4f1a4022ac2988c2b64af056b34bbff7cbc3ab15b83625ae6
7
+ data.tar.gz: d357dde619d0bca0b5473578643e24989b02ed23ad979587ff2fa951403d4eb1bfd2805e96f8dadb9f8133bf2b682cdb186e7b3f0dedd746eba4c391cb2ba49e
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bazinga.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Ankur Goel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # Bazinga
2
+ Inspired by [marco-polo](https://github.com/arches/marco-polo), Bazinga gives color-coded tags of your Rails app name and environment in _console_, to prevent devs' bad karma to balance on production.
3
+
4
+ ## Installation
5
+
6
+ Add this line to your Rails project's Gemfile:
7
+
8
+ gem 'bazinga'
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ ## Usage
15
+ Just run `rails console`.
16
+ ![dev](https://www.dropbox.com/s/7hdoy6b21qnm3or/Screenshot%202016-02-07%2018.58.28.png?raw=1)
17
+ ![staging](https://www.dropbox.com/s/3o4jmna8bd9dsyk/Screenshot%202016-02-07%2019.02.46.png?raw=1)
18
+ ## Customization:
19
+ You can modify the app name by adding the following in your project's `config/application.rb` (inside `class Application`) :
20
+ ```ruby
21
+ console do
22
+ Bazinga::APP_NAME = 'railsApp'
23
+ end
24
+ ```
25
+ or start the console by customized environment tag:
26
+ `BAZINGA_APP_NAME=myAwesomeApp rails console production`
27
+
28
+ ## Pipeline
29
+ * Add support for `pry-rails`
30
+ * Prevent sql write queries in _production_.
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it ( https://github.com/AnkurGel/bazinga/fork )
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create a new Pull Request
39
+
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bazinga/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bazinga"
8
+ spec.version = Bazinga::VERSION
9
+ spec.authors = ["Ankur Goel"]
10
+ spec.email = ["ankurgel@gmail.com"]
11
+ spec.summary = %q{Saving rails console from devs}
12
+ spec.description = %q{Saving rails console from devs}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,9 @@
1
+ require "bazinga/version"
2
+
3
+ module Bazinga
4
+ class Railtie < Rails::Railtie
5
+ console do
6
+ ARGV.push '-r', File.join(File.dirname(__FILE__), 'bazinga', 'bazinga-conf.rb')
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,42 @@
1
+ module Bazinga
2
+ class Runner
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"
9
+ }
10
+
11
+ class << self
12
+
13
+ def run
14
+ env_tag = (ENV['RAILS_ENV'] && ENV['RAILS_ENV'].downcase) || (Rails && Rails.env && Rails.env.downcase)
15
+
16
+ app_name =
17
+ ENV['BAZINGA_APP_NAME'] ||
18
+ (Bazinga::APP_NAME rescue nil) ||
19
+ Rails.application.class.parent_name.underscore.gsub("_", "-")
20
+
21
+ 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']}"
26
+ end
27
+
28
+ IRB.conf[:PROMPT][:RAILS_ENV] = {
29
+ :PROMPT_I => "#{app_name}#{console_tag} :%03n> ",
30
+ :PROMPT_N => "#{app_name}#{console_tag} :%03n?> ",
31
+ :PROMPT_S => "",
32
+ :PROMPT_C => "#{app_name}#{console_tag} :%03n?> ",
33
+ :RETURN => "=> %s\n"
34
+ }
35
+
36
+ IRB.conf[:PROMPT_MODE] = :RAILS_ENV
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ Bazinga::Runner.run
@@ -0,0 +1,3 @@
1
+ module Bazinga
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bazinga
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ankur Goel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Saving rails console from devs
42
+ email:
43
+ - ankurgel@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - bazinga.gemspec
54
+ - lib/bazinga.rb
55
+ - lib/bazinga/bazinga-conf.rb
56
+ - lib/bazinga/version.rb
57
+ homepage: ''
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.2.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Saving rails console from devs
81
+ test_files: []