rackson-five 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -14,6 +14,7 @@
14
14
  background: url('/rackson-five/tile.png');
15
15
  background-position: bottom left;
16
16
  background-repeat: repeat-x;
17
+ z-index: 9999;
17
18
  }
18
19
 
19
20
  #rackson-five img {
@@ -1,9 +1,5 @@
1
1
  module Rack
2
- class RacksonFive < Struct.new :options
3
- def initialize(app)
4
- @app = app
5
- end
6
-
2
+ class RacksonFive < Struct.new :app, :options
7
3
  def call(env)
8
4
  request = Rack::Request.new(env)
9
5
  if request.path_info =~ /^\/rackson-five\/(.+)$/
@@ -13,37 +9,34 @@ module Rack
13
9
  end
14
10
  end
15
11
 
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 == "tile.png"
21
- data = ::File.open(::File.join(::File.dirname(__FILE__),"images","tile.png"),"r").read
22
- [200, {"Content-Type" => "image/png"},data]
23
- elsif path == "rackson-five.mid"
24
- data = ::File.open(::File.join(::File.dirname(__FILE__),"midi","want_you_back.mid"),"r").read
25
- [200, {"Content-Type" => "audio/midi"},data]
12
+ private
13
+ def rackson_five_request(path)
14
+ if path == "rackson-five.png"
15
+ [200, {"Content-Type" => "image/png"}, read_file("images", "group.png")]
16
+ elsif path == "tile.png"
17
+ [200, {"Content-Type" => "image/png"}, read_file("images","tile.png")]
18
+ elsif path == "rackson-five.mid"
19
+ [200, {"Content-Type" => "audio/midi"}, read_file("midi","want_you_back.mid")]
20
+ end
26
21
  end
27
- end
28
22
 
29
- def jacksonify(env)
30
- status, headers, response = @app.call(env)
31
- if headers["Content-Type"] =~ /text\/html|application\/xhtml\+xml/
32
- body = ""
33
- response.each { |part| body << part }
34
- index = body.rindex("</body>")
35
- if index
36
- body.insert(index, ::File.open(::File.join(::File.dirname(__FILE__),"html","rackson-five.html"),"r").read)
37
- headers["Content-Length"] = body.length.to_s
38
- response = [body]
23
+ def jacksonify(env)
24
+ status, headers, response = app.call(env)
25
+ if headers["Content-Type"] =~ /text\/html|application\/xhtml\+xml/
26
+ body = ""
27
+ response.each { |part| body << part }
28
+ index = body.rindex("</body>")
29
+ if index
30
+ body.insert(index, read_file("html", "rackson-five.html"))
31
+ headers["Content-Length"] = body.length.to_s
32
+ response = [body]
33
+ end
39
34
  end
35
+ [status, headers, response]
36
+ end
37
+
38
+ def read_file(type, filename)
39
+ [::File.open(::File.join(::File.dirname(__FILE__),type.to_s,filename),"r").read]
40
40
  end
41
- [status, headers, response]
42
- end
43
-
44
- def member
45
- all_members = [:group, :micheal, :tito, :jermaine, :randy, :marlon, :jackie]
46
- available_members = all_members - (all_members - options[:members])
47
- end
48
41
  end
49
42
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackson-five
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Adam Holt
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-03-12 00:00:00 +00:00
18
+ date: 2011-01-12 00:00:00 +00:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -41,21 +47,27 @@ rdoc_options:
41
47
  require_paths:
42
48
  - lib
43
49
  required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
44
51
  requirements:
45
52
  - - ">="
46
53
  - !ruby/object:Gem::Version
54
+ hash: 3
55
+ segments:
56
+ - 0
47
57
  version: "0"
48
- version:
49
58
  required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
50
60
  requirements:
51
61
  - - ">="
52
62
  - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
53
66
  version: "0"
54
- version:
55
67
  requirements: []
56
68
 
57
69
  rubyforge_project:
58
- rubygems_version: 1.3.5
70
+ rubygems_version: 1.3.7
59
71
  signing_key:
60
72
  specification_version: 3
61
73
  summary: Add some Jackson 5 love to your rack based website. It's as easy as 1-2-3