Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
46 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,4 +1,4 @@ | |||
ruby -e "\ | #!/usr/bin/env ruby -KU | ||
require 'rubygems'; require 'jabs' |
|
||
puts Jabs::Engine.new(STDIN.read).render | require 'jabs' | ||
" | puts Jabs::Engine.new(STDIN.read).render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
require 'lib/jabs' | |||
require 'pathname' | |||
|
|||
puts Pathname.new(__FILE__).dirname.expand_path+'src' | |||
puts "OF" | |||
|
|||
use Jabs::Rack::Static, :urls => '/src', :root => Pathname.new(__FILE__).dirname.expand_path | |||
run lambda { |env| | |||
[200, {'Content-Type'=>'text/html'}, "JABS"] | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
module Jabs | |||
|
|||
module Rack | |||
class Static < ::Rack::Static | |||
def initialize(app, options={}) | |||
super(app, options) | |||
root = options[:root] || Dir.pwd | |||
@file_server = Jabs::Rack::File.new(root) | |||
end | |||
end | |||
|
|||
class File < ::Rack::File | |||
def serving | |||
@path += ".jabs" unless @path[/\.jabs$/] | |||
status, headers, body = * super | |||
return [status, headers, body] unless status == 200 | |||
|
|||
jabs = Jabs::Engine.new(open(body.path).read).render | |||
|
|||
headers['Content-Type'] = 'text/javascript' | |||
headers['Content-Length'] = jabs.size.to_s | |||
|
|||
[status, headers, jabs] | |||
end | |||
end | |||
end | |||
end |
This file was deleted.
Oops, something went wrong.