remi-rack-staticifier 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -2
- data/VERSION.yml +1 -1
- metadata +22 -35
- data/bin/staticify +0 -94
data/Rakefile
CHANGED
@@ -15,8 +15,6 @@ begin
|
|
15
15
|
s.description = 'Staticly cache requests to any Rack application - perfect for creating static sites/blogs/etc!'
|
16
16
|
s.authors = %w( remi )
|
17
17
|
s.files = FileList['[A-Z]*', '{lib,spec,bin,examples}/**/*']
|
18
|
-
s.add_dependency 'remi-rackbox'
|
19
|
-
s.executables << 'staticify'
|
20
18
|
# s.rubyforge_project = 'gemname'
|
21
19
|
# s.extra_rdoc_files = %w( README.rdoc )
|
22
20
|
end
|
data/VERSION.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remi-rack-staticifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- remi
|
@@ -9,50 +9,35 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
13
|
-
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: remi-rackbox
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
12
|
+
date: 2009-06-15 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
25
16
|
description: Staticly cache requests to any Rack application - perfect for creating static sites/blogs/etc!
|
26
17
|
email: remi@remitaylor.com
|
27
|
-
executables:
|
28
|
-
- staticify
|
29
|
-
extensions: []
|
18
|
+
executables: []
|
30
19
|
|
31
|
-
|
20
|
+
extensions: []
|
32
21
|
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
33
24
|
files:
|
25
|
+
- README.rdoc
|
34
26
|
- Rakefile
|
35
27
|
- VERSION.yml
|
36
|
-
-
|
28
|
+
- examples/blog-to-staticify/config.ru
|
29
|
+
- examples/blog-to-staticify/my-blog.rb
|
30
|
+
- examples/blog-to-staticify/paths-to-cache
|
31
|
+
- examples/blog-to-staticify/posts/first.mkd
|
32
|
+
- examples/blog-to-staticify/posts/second.mkd
|
33
|
+
- examples/sinatra-blog-with-built-in-caching/my-sinatra-blog.rb
|
37
34
|
- lib/rack-staticifier.rb
|
38
|
-
- lib/rack
|
39
35
|
- lib/rack/staticifier.rb
|
40
36
|
- spec/rack-staticifier_spec.rb
|
41
|
-
|
42
|
-
- examples/sinatra-blog-with-built-in-caching
|
43
|
-
- examples/sinatra-blog-with-built-in-caching/my-sinatra-blog.rb
|
44
|
-
- examples/blog-to-staticify
|
45
|
-
- examples/blog-to-staticify/posts
|
46
|
-
- examples/blog-to-staticify/posts/first.mkd
|
47
|
-
- examples/blog-to-staticify/posts/second.mkd
|
48
|
-
- examples/blog-to-staticify/my-blog.rb
|
49
|
-
- examples/blog-to-staticify/config.ru
|
50
|
-
- examples/blog-to-staticify/paths-to-cache
|
51
|
-
has_rdoc: true
|
37
|
+
has_rdoc: false
|
52
38
|
homepage: http://github.com/remi/rack-staticifier
|
53
39
|
post_install_message:
|
54
40
|
rdoc_options:
|
55
|
-
- --inline-source
|
56
41
|
- --charset=UTF-8
|
57
42
|
require_paths:
|
58
43
|
- lib
|
@@ -73,7 +58,9 @@ requirements: []
|
|
73
58
|
rubyforge_project:
|
74
59
|
rubygems_version: 1.2.0
|
75
60
|
signing_key:
|
76
|
-
specification_version:
|
61
|
+
specification_version: 3
|
77
62
|
summary: Staticly cache requests to any Rack application
|
78
|
-
test_files:
|
79
|
-
|
63
|
+
test_files:
|
64
|
+
- spec/rack-staticifier_spec.rb
|
65
|
+
- examples/blog-to-staticify/my-blog.rb
|
66
|
+
- examples/sinatra-blog-with-built-in-caching/my-sinatra-blog.rb
|
data/bin/staticify
DELETED
@@ -1,94 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Simple script for staticifying your Rack applications
|
4
|
-
#
|
5
|
-
# Checks for config.ru / Rails by defualt, otherwise you can:
|
6
|
-
#
|
7
|
-
# $ staticify -r myapp.rb --app 'lambda {|env| [200, {}, "hi!"] }' info
|
8
|
-
# $ staticify -r myapp.rb,another-file.rb --app 'Sinatra::Application' get '/'
|
9
|
-
# $ staticify -r myapp --app 'MyApp.new' '/'
|
10
|
-
#
|
11
|
-
%w( rubygems rackbox optparse fileutils ).each {|lib| require lib }
|
12
|
-
|
13
|
-
require File.dirname(__FILE__) + '/../lib/rack-staticifier'
|
14
|
-
|
15
|
-
def usage
|
16
|
-
puts <<USAGE
|
17
|
-
|
18
|
-
staticify == %{ For staticifying your Rack applications }
|
19
|
-
|
20
|
-
Usage:
|
21
|
-
staticify # print this usage information
|
22
|
-
staticify . # staticify Rack app in current directory
|
23
|
-
|
24
|
-
Options:
|
25
|
-
-d, --dir some/directory # directory to save files to
|
26
|
-
-a, --app "MyApp.new" # ruby to eval to get Rack app
|
27
|
-
-r, --require file[.rb] # ruby file(s) to require
|
28
|
-
|
29
|
-
USAGE
|
30
|
-
end
|
31
|
-
|
32
|
-
if ARGV.empty?
|
33
|
-
usage
|
34
|
-
exit
|
35
|
-
end
|
36
|
-
|
37
|
-
#### ==== Option Parsing ==== ####
|
38
|
-
|
39
|
-
files_to_require = []
|
40
|
-
ruby_to_run = nil
|
41
|
-
path_to_cache_to = '.site'
|
42
|
-
|
43
|
-
opts = OptionParser.new do |opts|
|
44
|
-
opts.on('-r', '--require [file]') {|x| files_to_require << x }
|
45
|
-
opts.on('-a', '--app [ruby]') {|x| ruby_to_run = x }
|
46
|
-
opts.on('-d', '--dir [dir]') {|x| path_to_cache_to = x }
|
47
|
-
end
|
48
|
-
opts.parse! ARGV
|
49
|
-
|
50
|
-
app_directory = ARGV.shift
|
51
|
-
unless File.directory? app_directory
|
52
|
-
puts "App directory not found: #{ app_directory }\n\n"
|
53
|
-
usage
|
54
|
-
exit
|
55
|
-
end
|
56
|
-
FileUtils.cd app_directory
|
57
|
-
|
58
|
-
files_to_require.each {|file| require file }
|
59
|
-
if ruby_to_run
|
60
|
-
begin
|
61
|
-
RackBox.app = eval(ruby_to_run)
|
62
|
-
rescue Exception => ex
|
63
|
-
puts "Tried running Ruby code to set Rack app: #{ ruby_to_run.inspect }"
|
64
|
-
raise ex
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
unless RackBox.app(:silent => true)
|
69
|
-
puts "Cannot find your Rack application\n\n"
|
70
|
-
usage
|
71
|
-
exit
|
72
|
-
end
|
73
|
-
|
74
|
-
#### ==== Get Routes to Cache ==== ####
|
75
|
-
|
76
|
-
paths_to_cache = []
|
77
|
-
while path = gets
|
78
|
-
paths_to_cache << path.strip
|
79
|
-
end
|
80
|
-
|
81
|
-
puts "Caching to #{ path_to_cache_to }"
|
82
|
-
|
83
|
-
puts "#{ paths_to_cache.length } paths to cache:"
|
84
|
-
|
85
|
-
#### ==== Cache the Routes ==== ####"
|
86
|
-
|
87
|
-
FileUtils.rm_rf path_to_cache_to
|
88
|
-
|
89
|
-
RackBox.app = Rack::Staticifier.new(RackBox.app, :root => path_to_cache_to)
|
90
|
-
|
91
|
-
paths_to_cache.each do |path|
|
92
|
-
response = RackBox.request path
|
93
|
-
puts " #{ response.status } #{ path }"
|
94
|
-
end
|