rackson-five 0.0.1

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.
data/LICENCE ADDED
File without changes
data/README.mdown ADDED
@@ -0,0 +1,18 @@
1
+ # Rackson Five
2
+
3
+ Add some jackson five love into your app
4
+
5
+ ## Installation
6
+
7
+ [sudo] gem install rackson-five
8
+
9
+ ## Usage
10
+
11
+ require 'rubygems'
12
+ require 'rack/rackson-five'
13
+
14
+ use Rack::RacksonFive
15
+
16
+ app = lambda {|env| [200,{'Content-Type' => "text/html"},"<html><head><title>Rackson-Five Test</title></head><body>Hello World</body><html>"]}
17
+
18
+ run app
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "rackson-five"
8
+ gem.summary = %Q{Add some Jackson 5 love to your rack based website. It's as easy as 1-2-3}
9
+ gem.description = %Q{Embeds Jackson Five members into your rack based application}
10
+ gem.email = "ads.noob@gmail.com"
11
+ gem.homepage = "http://github.com/omgitsads/rackson-five"
12
+ gem.files = FileList["[A-Z]*","lib/**/*"]
13
+ gem.authors = ["Adam Holt"]
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
Binary file
Binary file
@@ -0,0 +1,46 @@
1
+ module Rack
2
+ class RacksonFive < Struct.new :options
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ def call(env)
8
+ request = Rack::Request.new(env)
9
+ if request.path_info =~ /^\/rackson-five\/(.+)$/
10
+ rackson_five_request($1)
11
+ else
12
+ jacksonify(env)
13
+ end
14
+ end
15
+
16
+ def rackson_five_request(path)
17
+ if path == "rackson-five.png"
18
+ data = ::File.open(::File.join(::File.dirname(__FILE__),"images","group.png"),"r").read
19
+ [200, {"Content-Type" => "image/png"},data]
20
+ elsif path == "rackson-five.mid"
21
+ data = ::File.open(::File.join(::File.dirname(__FILE__),"midi","want_you_back.mid"),"r").read
22
+ [200, {"Content-Type" => "audio/midi"},data]
23
+ end
24
+ end
25
+
26
+ def jacksonify(env)
27
+ status, headers, response = @app.call(env)
28
+ if headers["Content-Type"] =~ /text\/html|application\/xhtml\+xml/
29
+ body = ""
30
+ response.each { |part| body << part }
31
+ index = body.rindex("</body>")
32
+ if index
33
+ body.insert(index, '<img src="/rackson-five/rackson-five.png" style="position:absolute; bottom:0; right:0;" /><embed src="/rackson-five/rackson-five.mid" autostart="true" loop="-1" hidden="true" />')
34
+ headers["Content-Length"] = body.length.to_s
35
+ response = [body]
36
+ end
37
+ end
38
+ [status, headers, response]
39
+ end
40
+
41
+ def member
42
+ all_members = [:group, :micheal, :tito, :jermaine, :randy, :marlon, :jackie]
43
+ available_members = all_members - (all_members - options[:members])
44
+ end
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rackson-five
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Adam Holt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-12 00:00:00 +00:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Embeds Jackson Five members into your rack based application
17
+ email: ads.noob@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.mdown
24
+ files:
25
+ - LICENCE
26
+ - README.mdown
27
+ - Rakefile
28
+ - VERSION
29
+ - lib/rack/images/group.png
30
+ - lib/rack/midi/want_you_back.mid
31
+ - lib/rack/rackson-five.rb
32
+ has_rdoc: true
33
+ homepage: http://github.com/omgitsads/rackson-five
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --charset=UTF-8
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements: []
54
+
55
+ rubyforge_project:
56
+ rubygems_version: 1.3.5
57
+ signing_key:
58
+ specification_version: 3
59
+ summary: Add some Jackson 5 love to your rack based website. It's as easy as 1-2-3
60
+ test_files: []
61
+