ruby_logo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +30 -0
- data/assets/ruby.png +0 -0
- data/lib/ruby_logo.rb +17 -0
- data/ruby_logo.gemspec +23 -0
- metadata +49 -0
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
Sick of not having massive glaring easter eggs that you can't do a thing about like in PHP? Be sick no more! The cure is here.
|
2
|
+
|
3
|
+
# What is?
|
4
|
+
|
5
|
+
PHP applications respond to a magic query string: `?=PHPE9568F34-D428-11d2-A769-00AA001ACF42`
|
6
|
+
|
7
|
+
(Yup, all of them: [Lookie](http://en.wikipedia.org/w/index.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42))
|
8
|
+
|
9
|
+
I thought ruby ones probably should too.
|
10
|
+
|
11
|
+
# This is badass. I need it in my production stack!
|
12
|
+
|
13
|
+
Too right you do! You'll want it near the start, so you can serve up these logos blazing fast without the overhead of rails:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
|
17
|
+
# Gemfile
|
18
|
+
|
19
|
+
```
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
|
23
|
+
gem "ruby_logo"
|
24
|
+
|
25
|
+
# config/application.rb
|
26
|
+
|
27
|
+
config.middleware.insert_before ActionDispatch::Static, RubyLogo
|
28
|
+
```
|
29
|
+
|
30
|
+
It's worth noting that when the Rails team say [3.2.3 Middleware stack is an array](http://guides.rubyonrails.org/rails_on_rack.html#configuring-middleware-stack) what they mean is that it is kinda like an array. In a very vague sense; so you'll need to jam it in behind something.
|
data/assets/ruby.png
ADDED
Binary file
|
data/lib/ruby_logo.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
class RubyLogo
|
2
|
+
|
3
|
+
def initialize(app)
|
4
|
+
@app = app
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(env)
|
8
|
+
if env["REQUEST_URI"].include? "?=PHPE9568F34-D428-11d2-A769-00AA001ACF42"
|
9
|
+
# Dump the ruby logo
|
10
|
+
[200, {"Content-Type" => "image/png"}, File.open(File.expand_path("../../assets/ruby.png", __FILE__))]
|
11
|
+
else
|
12
|
+
@app.call(env)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/ruby_logo.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# vim: ft=ruby
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "ruby_logo"
|
5
|
+
s.version = "0.0.1"
|
6
|
+
s.authors = ["Rich Healey"]
|
7
|
+
s.email = ["richo@99designs.com"]
|
8
|
+
s.homepage = "http://github.com/richo/ruby_logo"
|
9
|
+
s.summary = "Show the ruby logo if you have the right magic query string"
|
10
|
+
s.description = s.summary
|
11
|
+
|
12
|
+
#s.add_dependency "some_dependency"
|
13
|
+
|
14
|
+
#s.add_development_dependency "rake"
|
15
|
+
#s.add_development_dependency "mocha"
|
16
|
+
#s.add_development_dependency "rspec"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
22
|
+
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_logo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rich Healey
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-18 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Show the ruby logo if you have the right magic query string
|
15
|
+
email:
|
16
|
+
- richo@99designs.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- README.md
|
22
|
+
- assets/ruby.png
|
23
|
+
- lib/ruby_logo.rb
|
24
|
+
- ruby_logo.gemspec
|
25
|
+
homepage: http://github.com/richo/ruby_logo
|
26
|
+
licenses: []
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 1.8.24
|
46
|
+
signing_key:
|
47
|
+
specification_version: 3
|
48
|
+
summary: Show the ruby logo if you have the right magic query string
|
49
|
+
test_files: []
|