Permalink
Browse files

pretty colors and a gemspec

  • Loading branch information...
1 parent 272aa29 commit dc1cb254a95d7ed9459b7485b7f61bab9e3ccdf9 @jacobo jacobo committed Mar 16, 2012
Showing with 39 additions and 4 deletions.
  1. +1 −2 Gemfile
  2. +7 −1 Gemfile.lock
  3. +8 −1 lib/request_visualizer.rb
  4. +3 −0 lib/request_visualizer/version.rb
  5. +20 −0 request_visualizer.gemspec
View
@@ -1,7 +1,6 @@
source 'http://rubygems.org'
-#TODO: move this to gemspec:
-gem 'colored'
+gemspec
group :test do
gem 'ey_api_hmac', '>= 0.4.0'
View
@@ -1,3 +1,9 @@
+PATH
+ remote: .
+ specs:
+ request_visualizer (0.0.1)
+ colored
+
GEM
remote: http://rubygems.org/
specs:
@@ -56,7 +62,7 @@ PLATFORMS
DEPENDENCIES
capybara
- colored
ey_api_hmac (>= 0.4.0)
+ request_visualizer!
rspec
sinatra
@@ -6,7 +6,14 @@ def initialize(app, &lookup)
end
def parse(string)
- ((@lookup && @lookup.call(string.to_s)) || string.to_s).black_on_cyan
+ colorize((@lookup && @lookup.call(string.to_s)) || string.to_s)
+ end
+
+ def colorize(string)
+ @@colors ||= [:black_on_cyan, :black_on_magenta, :black_on_yellow, :black_on_green]
+ @@colorized_before ||= {}
+ @@colorized_before[string] ||= string.send(@@colors.pop || :black_on_white)
+ @@colorized_before[string]
end
def indent
@@ -0,0 +1,3 @@
+class RequestVisualizer
+ VERSION = "0.0.1"
+end
View
@@ -0,0 +1,20 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "request_visualizer/version"
+
+Gem::Specification.new do |s|
+ s.name = "request_visualizer"
+ s.version = RequestVisualizer::VERSION
+ s.authors = ["Jacob Burkhart"]
+ s.email = ["jacob@engineyard.com"]
+ s.homepage = ""
+ s.summary = %q{Rack middleware for visualizing HTTP/JSON requests}
+ s.description = %q{Rack middleware for visualizing HTTP/JSON requests, and stuff}
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ s.add_dependency 'colored'
+end

0 comments on commit dc1cb25

Please sign in to comment.