coffeeshop 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/bin/coffeeshop +18 -7
- data/foo.coffee +1 -0
- data/index.html +1 -0
- data/lib/coffeeshop/version.rb +2 -2
- data/lib/coffeeshop.rb +1 -1
- data/test/index.html +1 -0
- data/test.html +1 -0
- metadata +13 -8
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# coffeeshop
|
2
2
|
|
3
|
-
`coffeeshop` is a simple Sinatra app that serves up all CoffeeScript files in a directory as JavaScript. For example, if you had `/my/project/src/rad.coffee`, and ran `coffeeshop` in `/my/project` you could hit `http://localhost:4567/src/rad.
|
3
|
+
`coffeeshop` is a simple Sinatra app that serves up all CoffeeScript files in a directory as JavaScript. For example, if you had `/my/project/src/rad.coffee`, and ran `coffeeshop` in `/my/project` you could hit `http://localhost:4567/src/rad.js` and it will be served up as JavaScript.
|
4
4
|
|
5
5
|
`coffeeshop` uses Redis for simple 1-hour caching of the generated JavaScript to keep things snappy.
|
6
6
|
|
data/bin/coffeeshop
CHANGED
@@ -1,16 +1,27 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
2
|
require "bundler"
|
4
3
|
require "sinatra"
|
5
4
|
require_relative "../lib/coffeeshop"
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
set :static, true
|
7
|
+
set :public_folder, ENV["PWD"]
|
8
|
+
set :root, ENV["PWD"]
|
9
|
+
|
10
|
+
not_found do
|
11
|
+
path = settings.root + env["PATH_INFO"]
|
12
|
+
coffee_path = path.sub( /\.js$/, ".coffee" )
|
10
13
|
|
11
|
-
if File.exists?(
|
12
|
-
|
14
|
+
if path =~ /\.js$/ && File.exists?( coffee_path )
|
15
|
+
content_type "text/javascript"
|
16
|
+
Coffeeshop.to_js( coffee_path )
|
13
17
|
else
|
14
|
-
|
18
|
+
if path =~ /\/$/
|
19
|
+
index_path = "#{path}index.html"
|
20
|
+
else
|
21
|
+
index_path = "#{path}/index.html"
|
22
|
+
end
|
23
|
+
if File.exists?( index_path )
|
24
|
+
File.read( index_path )
|
25
|
+
end
|
15
26
|
end
|
16
27
|
end
|
data/foo.coffee
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rad.cool()
|
data/index.html
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
index
|
data/lib/coffeeshop/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.0.
|
1
|
+
module Coffeeshop
|
2
|
+
VERSION = "0.0.3"
|
3
3
|
end
|
data/lib/coffeeshop.rb
CHANGED
data/test/index.html
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
fsdhfs
|
data/test.html
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
test
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coffeeshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &70222942618800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70222942618800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: coffee-script
|
27
|
-
requirement: &
|
27
|
+
requirement: &70222942617600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70222942617600
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: redis
|
38
|
-
requirement: &
|
38
|
+
requirement: &70222942616580 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70222942616580
|
47
47
|
description: coffeeshop is a quick and dirty Sinatra app that serves up any CoffeeScript
|
48
48
|
in a directory as JavaScript. It uses Redis for basic caching because that's how
|
49
49
|
I roll.
|
@@ -60,8 +60,12 @@ files:
|
|
60
60
|
- Rakefile
|
61
61
|
- bin/coffeeshop
|
62
62
|
- coffeeshop.gemspec
|
63
|
+
- foo.coffee
|
64
|
+
- index.html
|
63
65
|
- lib/coffeeshop.rb
|
64
66
|
- lib/coffeeshop/version.rb
|
67
|
+
- test.html
|
68
|
+
- test/index.html
|
65
69
|
homepage: http://github.com/tysontate/coffeeshop
|
66
70
|
licenses: []
|
67
71
|
post_install_message:
|
@@ -86,4 +90,5 @@ rubygems_version: 1.8.11
|
|
86
90
|
signing_key:
|
87
91
|
specification_version: 3
|
88
92
|
summary: Simple Sinatra app to serve up CoffeeScript as JavaScript quickly.
|
89
|
-
test_files:
|
93
|
+
test_files:
|
94
|
+
- test/index.html
|