vanilla 1.9.16 → 1.9.17

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/Rakefile CHANGED
@@ -25,7 +25,7 @@ if Object.const_defined?(:Gem)
25
25
 
26
26
  # Change these as appropriate
27
27
  s.name = "vanilla"
28
- s.version = "1.9.16"
28
+ s.version = "1.9.17"
29
29
  s.summary = "A bliki-type web content thing."
30
30
  s.author = "James Adam"
31
31
  s.email = "james@lazyatom.com.com"
data/config.ru CHANGED
@@ -1,5 +1,6 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__), *%w[lib])
2
2
  require 'vanilla'
3
+ require 'vanilla/static'
3
4
 
4
5
  app = Vanilla::App.new(ENV['VANILLA_CONFIG'])
5
6
 
@@ -15,6 +16,6 @@ use Warden::Manager do |manager|
15
16
  manager.failure_app = Vanilla::Authentication::Warden::FailApp.new
16
17
  end
17
18
 
18
- use Rack::Static, :urls => ["/public"], :root => File.join(File.dirname(__FILE__))
19
+ use Vanilla::Static, File.join(File.dirname(__FILE__), 'public')
19
20
 
20
21
  run app
@@ -8,9 +8,9 @@ system.main_template = <<-HTML
8
8
  <head>
9
9
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
10
10
  <title>{current_snip name}</title>
11
- <script language="javascript" src="/public/javascripts/jquery.js"></script>
12
- <script language="javascript" src="/public/javascripts/jquery.autogrow-textarea.js"></script>
13
- <script language="javascript" src="/public/javascripts/vanilla.js"></script>
11
+ <script language="javascript" src="/javascripts/jquery.js"></script>
12
+ <script language="javascript" src="/javascripts/jquery.autogrow-textarea.js"></script>
13
+ <script language="javascript" src="/javascripts/vanilla.js"></script>
14
14
  <link rel="stylesheet" type="text/css" media="screen" href="<%= url_to("system", "css.css") %>" />
15
15
  </head>
16
16
  <body>
@@ -33,8 +33,8 @@ system.login_template = <<-HTML
33
33
  <body id="login">
34
34
  <form action='' method='post'>
35
35
  <h1>Login</h1><p class="message">MESSAGE</p>
36
- <label>Name: <input type="text" name="name"></input></label>
37
- <label>Password: <input type="password" name="password"></input></label>
36
+ <label>Name: <input type="text" name="login[username]"></input></label>
37
+ <label>Password: <input type="password" name="login[password]"></input></label>
38
38
  <button>login</button>
39
39
  </form>
40
40
  </body>
@@ -0,0 +1,28 @@
1
+ require 'rack/utils'
2
+
3
+ # Heavily based on ActionDispatch::Static
4
+ module Vanilla
5
+ class Static
6
+ def initialize(app, root)
7
+ @app = app
8
+ @file_server = ::Rack::File.new(root)
9
+ end
10
+
11
+ def call(env)
12
+ path = env['PATH_INFO'].chomp('/')
13
+ method = env['REQUEST_METHOD']
14
+
15
+ if %w(GET HEAD).include?(method) && file_exist?(path)
16
+ @file_server.call(env)
17
+ else
18
+ @app.call(env)
19
+ end
20
+ end
21
+
22
+ private
23
+ def file_exist?(path)
24
+ full_path = File.join(@file_server.root, ::Rack::Utils.unescape(path))
25
+ File.file?(full_path) && File.readable?(full_path)
26
+ end
27
+ end
28
+ end
@@ -1,7 +1,7 @@
1
1
  CurrentSnip--- # Soup attributes
2
- :created_at: 2009-11-30 23:14:12.070423 +00:00
2
+ :created_at: 2010-01-04 13:54:23.700595 +00:00
3
+ :updated_at: 2010-01-04 13:54:23.700596 +00:00
3
4
  :name: current_snip
4
- :updated_at: 2009-11-30 23:14:12.070425 +00:00
5
5
  :render_as: Ruby
6
6
  :usage: |-
7
7
  The current_snip dyna normally returns the result of rendering the snip named by the
@@ -1,5 +1,5 @@
1
1
  --- # Soup attributes
2
- :created_at: 2009-11-30 23:14:12.071138 +00:00
2
+ :created_at: 2010-01-04 13:54:23.701146 +00:00
3
+ :updated_at: 2010-01-04 13:54:23.701148 +00:00
3
4
  :name: system
4
- :updated_at: 2009-11-30 23:14:12.071141 +00:00
5
5
  :main_template: "{current_snip}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.16
4
+ version: 1.9.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Adam
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-16 00:00:00 +00:00
12
+ date: 2010-01-04 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -171,6 +171,7 @@ files:
171
171
  - lib/vanilla/snips/system.rb
172
172
  - lib/vanilla/snips/tutorial.rb
173
173
  - lib/vanilla/soup_with_timestamps.rb
174
+ - lib/vanilla/static.rb
174
175
  - lib/vanilla.rb
175
176
  - bin/vanilla
176
177
  - public/hatch.png