zuk-picnic 0.8.0.20090427 → 0.8.0.20090430

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.
Files changed (33) hide show
  1. data/Manifest.txt +26 -26
  2. data/Rakefile +1 -1
  3. data/lib/picnic/conf.rb +9 -1
  4. data/lib/picnic/server.rb +18 -21
  5. data/lib/picnic.rb +1 -1
  6. data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping/reloader.rb +6 -2
  7. metadata +30 -30
  8. /data/{README.txt → README.rdoc} +0 -0
  9. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/CHANGELOG +0 -0
  10. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/COPYING +0 -0
  11. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/README +0 -0
  12. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/Rakefile +0 -0
  13. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/bin/camping +0 -0
  14. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/doc/camping.1.gz +0 -0
  15. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/examples/README +0 -0
  16. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/examples/blog.rb +0 -0
  17. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/examples/campsh.rb +0 -0
  18. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/examples/tepee.rb +0 -0
  19. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/extras/Camping.gif +0 -0
  20. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/extras/permalink.gif +0 -0
  21. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping/ar/session.rb +0 -0
  22. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping/ar.rb +0 -0
  23. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping/mab.rb +0 -0
  24. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping/server.rb +0 -0
  25. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping/session.rb +0 -0
  26. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping-unabridged.rb +0 -0
  27. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/lib/camping.rb +0 -0
  28. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/setup.rb +0 -0
  29. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/test/apps/env_debug.rb +0 -0
  30. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/test/apps/forms.rb +0 -0
  31. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/test/apps/misc.rb +0 -0
  32. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/test/apps/sessions.rb +0 -0
  33. /data/vendor/{camping-2.0.20090421 → zuk-camping-2.0.20090429}/test/test_camping.rb +0 -0
data/Manifest.txt CHANGED
@@ -17,29 +17,29 @@ picnic.gemspec
17
17
  setup.rb
18
18
  test/picnic_test.rb
19
19
  test/test_helper.rb
20
- vendor/camping-2.0.20090421/CHANGELOG
21
- vendor/camping-2.0.20090421/COPYING
22
- vendor/camping-2.0.20090421/README
23
- vendor/camping-2.0.20090421/Rakefile
24
- vendor/camping-2.0.20090421/bin/camping
25
- vendor/camping-2.0.20090421/doc/camping.1.gz
26
- vendor/camping-2.0.20090421/examples/README
27
- vendor/camping-2.0.20090421/examples/blog.rb
28
- vendor/camping-2.0.20090421/examples/campsh.rb
29
- vendor/camping-2.0.20090421/examples/tepee.rb
30
- vendor/camping-2.0.20090421/extras/Camping.gif
31
- vendor/camping-2.0.20090421/extras/permalink.gif
32
- vendor/camping-2.0.20090421/lib/camping-unabridged.rb
33
- vendor/camping-2.0.20090421/lib/camping.rb
34
- vendor/camping-2.0.20090421/lib/camping/ar.rb
35
- vendor/camping-2.0.20090421/lib/camping/ar/session.rb
36
- vendor/camping-2.0.20090421/lib/camping/mab.rb
37
- vendor/camping-2.0.20090421/lib/camping/reloader.rb
38
- vendor/camping-2.0.20090421/lib/camping/server.rb
39
- vendor/camping-2.0.20090421/lib/camping/session.rb
40
- vendor/camping-2.0.20090421/setup.rb
41
- vendor/camping-2.0.20090421/test/apps/env_debug.rb
42
- vendor/camping-2.0.20090421/test/apps/forms.rb
43
- vendor/camping-2.0.20090421/test/apps/misc.rb
44
- vendor/camping-2.0.20090421/test/apps/sessions.rb
45
- vendor/camping-2.0.20090421/test/test_camping.rb
20
+ vendor/zuk-camping-2.0.20090429/CHANGELOG
21
+ vendor/zuk-camping-2.0.20090429/COPYING
22
+ vendor/zuk-camping-2.0.20090429/README
23
+ vendor/zuk-camping-2.0.20090429/Rakefile
24
+ vendor/zuk-camping-2.0.20090429/bin/camping
25
+ vendor/zuk-camping-2.0.20090429/doc/camping.1.gz
26
+ vendor/zuk-camping-2.0.20090429/examples/README
27
+ vendor/zuk-camping-2.0.20090429/examples/blog.rb
28
+ vendor/zuk-camping-2.0.20090429/examples/campsh.rb
29
+ vendor/zuk-camping-2.0.20090429/examples/tepee.rb
30
+ vendor/zuk-camping-2.0.20090429/extras/Camping.gif
31
+ vendor/zuk-camping-2.0.20090429/extras/permalink.gif
32
+ vendor/zuk-camping-2.0.20090429/lib/camping-unabridged.rb
33
+ vendor/zuk-camping-2.0.20090429/lib/camping.rb
34
+ vendor/zuk-camping-2.0.20090429/lib/camping/ar.rb
35
+ vendor/zuk-camping-2.0.20090429/lib/camping/ar/session.rb
36
+ vendor/zuk-camping-2.0.20090429/lib/camping/mab.rb
37
+ vendor/zuk-camping-2.0.20090429/lib/camping/reloader.rb
38
+ vendor/zuk-camping-2.0.20090429/lib/camping/server.rb
39
+ vendor/zuk-camping-2.0.20090429/lib/camping/session.rb
40
+ vendor/zuk-camping-2.0.20090429/setup.rb
41
+ vendor/zuk-camping-2.0.20090429/test/apps/env_debug.rb
42
+ vendor/zuk-camping-2.0.20090429/test/apps/forms.rb
43
+ vendor/zuk-camping-2.0.20090429/test/apps/misc.rb
44
+ vendor/zuk-camping-2.0.20090429/test/apps/sessions.rb
45
+ vendor/zuk-camping-2.0.20090429/test/test_camping.rb
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ ENV['NODOT'] = '1'
22
22
 
23
23
  NAME = "picnic"
24
24
  REV = nil
25
- #REV = Time.now.strftime('%Y%m%d%H%M')
25
+ REV = Time.now.strftime('%Y%m%d%H%M')
26
26
  #REV = `svn info`[/Revision: (\d+)/, 1] rescue nil
27
27
  VERS = ENV['VERSION'] || (Picnic::VERSION::STRING + (REV ? ".#{REV}" : ""))
28
28
  CLEAN.include ['**/.*.sw?', '*.gem', '.config']
data/lib/picnic/conf.rb CHANGED
@@ -108,6 +108,11 @@ module Picnic
108
108
  " suit your needs and then run #{app_name} again.\n"
109
109
  exit 1
110
110
  end
111
+
112
+ # Business logic for deriving the current config file name.
113
+ def determine_config_filename(app_name, app_root, config_file = nil)
114
+ config_file || "/etc/#{app_name.to_s.downcase}/config.yml"
115
+ end
111
116
 
112
117
  # Loads the configuration from the YAML file for the given app.
113
118
  #
@@ -117,7 +122,7 @@ module Picnic
117
122
  #
118
123
  # By default, the configuration will be loaded from <tt>/etc/<app_name>/config.yml</tt>.
119
124
  def load_from_file(app_name, app_root, config_file = nil)
120
- conf_file = config_file || "/etc/#{app_name.to_s.downcase}/config.yml"
125
+ conf_file = determine_config_filename(app_name, app_root, config_file)
121
126
 
122
127
  puts "Loading configuration for #{app_name.inspect} from #{conf_file.inspect}..."
123
128
 
@@ -147,5 +152,8 @@ module Picnic
147
152
  def merge_defaults(defaults)
148
153
  @conf = HashWithIndifferentAccess.new(HashWithIndifferentAccess.new(defaults).merge(@conf))
149
154
  end
155
+
156
+ class Error < StandardError
157
+ end
150
158
  end
151
159
  end
data/lib/picnic/server.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'camping/server'
2
2
 
3
3
  module Picnic::Server
4
- class Base < Camping::Server::Base
4
+ class Base < Camping::Server
5
5
  def start
6
6
  handler, conf = case @conf.server
7
7
  when "console"
@@ -13,21 +13,31 @@ module Picnic::Server
13
13
  when "webrick"
14
14
  prep_webrick
15
15
  end
16
-
17
- rapp = apps.first
16
+
17
+ # preload the apps in order to show any startup errors when
18
+ # the app is run from the command line (otherwise they would only
19
+ # show up after the first request to the web server)
20
+ reload!
21
+
22
+ handler.run(self, conf)
23
+ end
24
+
25
+
26
+ def app
27
+ reload!
28
+
29
+ rapp = apps.values.first
30
+
31
+ rapp = Rack::Static.new(rapp, @conf[:static]) if @conf[:static]
18
32
 
19
33
  if @conf.uri_path
20
34
  rapp = Rack::URLMap.new(@conf.uri_path => rapp)
21
35
  end
22
-
23
- rapp = Rack::Static.new(rapp, @conf[:static]) if @conf[:static]
36
+
24
37
  rapp = Rack::ContentLength.new(rapp)
25
- rapp = FixContentLength.new(rapp)
26
38
  rapp = Rack::Lint.new(rapp)
27
39
  rapp = Camping::Server::XSendfile.new(rapp)
28
40
  rapp = Rack::ShowExceptions.new(rapp)
29
-
30
- handler.run(rapp, conf)
31
41
  end
32
42
 
33
43
 
@@ -83,17 +93,4 @@ module Picnic::Server
83
93
 
84
94
  end
85
95
 
86
- class FixContentLength
87
- def initialize(app)
88
- @app = app
89
- end
90
-
91
- def call(env)
92
- status, headers, body = @app.call(env)
93
- if headers.has_key?('Content-Length') && headers['Content-Length'].to_i == 0
94
- headers['Content-Length'] = body.body.length.to_s
95
- end
96
- [status, headers, body]
97
- end
98
- end
99
96
  end
data/lib/picnic.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'activesupport'
3
3
 
4
4
  $: << File.dirname(__FILE__)
5
- $: << File.dirname(__FILE__) + "/../vendor/camping-2.0.20090421/lib"
5
+ $: << File.dirname(__FILE__) + "/../vendor/zuk-camping-2.0.20090429/lib"
6
6
 
7
7
  require "camping"
8
8
 
@@ -132,8 +132,12 @@ module Camping
132
132
 
133
133
  # Figures out the full path of a required file.
134
134
  def full_path(req)
135
- dir = File.expand_path($LOAD_PATH.detect { |l| File.exists?(File.join(l, req)) })
136
- File.join(dir, req)
135
+ dir = $LOAD_PATH.detect { |l| File.exists?(File.join(l, req)) }
136
+ if dir
137
+ File.join(File.expand_path(dir), req)
138
+ else
139
+ req
140
+ end
137
141
  end
138
142
  end
139
143
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuk-picnic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.20090427
4
+ version: 0.8.0.20090430
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zukowski
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-27 00:00:00 -07:00
12
+ date: 2009-04-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -63,13 +63,13 @@ extra_rdoc_files:
63
63
  - History.txt
64
64
  - LICENSE.txt
65
65
  - Manifest.txt
66
- - README.txt
66
+ - README.rdoc
67
67
  files:
68
68
  - CHANGELOG.txt
69
69
  - History.txt
70
70
  - LICENSE.txt
71
71
  - Manifest.txt
72
- - README.txt
72
+ - README.rdoc
73
73
  - Rakefile
74
74
  - lib/picnic.rb
75
75
  - lib/picnic/authentication.rb
@@ -83,32 +83,32 @@ files:
83
83
  - setup.rb
84
84
  - test/picnic_test.rb
85
85
  - test/test_helper.rb
86
- - vendor/camping-2.0.20090421/CHANGELOG
87
- - vendor/camping-2.0.20090421/COPYING
88
- - vendor/camping-2.0.20090421/README
89
- - vendor/camping-2.0.20090421/Rakefile
90
- - vendor/camping-2.0.20090421/bin/camping
91
- - vendor/camping-2.0.20090421/doc/camping.1.gz
92
- - vendor/camping-2.0.20090421/examples/README
93
- - vendor/camping-2.0.20090421/examples/blog.rb
94
- - vendor/camping-2.0.20090421/examples/campsh.rb
95
- - vendor/camping-2.0.20090421/examples/tepee.rb
96
- - vendor/camping-2.0.20090421/extras/Camping.gif
97
- - vendor/camping-2.0.20090421/extras/permalink.gif
98
- - vendor/camping-2.0.20090421/lib/camping-unabridged.rb
99
- - vendor/camping-2.0.20090421/lib/camping.rb
100
- - vendor/camping-2.0.20090421/lib/camping/ar.rb
101
- - vendor/camping-2.0.20090421/lib/camping/ar/session.rb
102
- - vendor/camping-2.0.20090421/lib/camping/mab.rb
103
- - vendor/camping-2.0.20090421/lib/camping/reloader.rb
104
- - vendor/camping-2.0.20090421/lib/camping/server.rb
105
- - vendor/camping-2.0.20090421/lib/camping/session.rb
106
- - vendor/camping-2.0.20090421/setup.rb
107
- - vendor/camping-2.0.20090421/test/apps/env_debug.rb
108
- - vendor/camping-2.0.20090421/test/apps/forms.rb
109
- - vendor/camping-2.0.20090421/test/apps/misc.rb
110
- - vendor/camping-2.0.20090421/test/apps/sessions.rb
111
- - vendor/camping-2.0.20090421/test/test_camping.rb
86
+ - vendor/zuk-camping-2.0.20090429/CHANGELOG
87
+ - vendor/zuk-camping-2.0.20090429/COPYING
88
+ - vendor/zuk-camping-2.0.20090429/README
89
+ - vendor/zuk-camping-2.0.20090429/Rakefile
90
+ - vendor/zuk-camping-2.0.20090429/bin/camping
91
+ - vendor/zuk-camping-2.0.20090429/doc/camping.1.gz
92
+ - vendor/zuk-camping-2.0.20090429/examples/README
93
+ - vendor/zuk-camping-2.0.20090429/examples/blog.rb
94
+ - vendor/zuk-camping-2.0.20090429/examples/campsh.rb
95
+ - vendor/zuk-camping-2.0.20090429/examples/tepee.rb
96
+ - vendor/zuk-camping-2.0.20090429/extras/Camping.gif
97
+ - vendor/zuk-camping-2.0.20090429/extras/permalink.gif
98
+ - vendor/zuk-camping-2.0.20090429/lib/camping-unabridged.rb
99
+ - vendor/zuk-camping-2.0.20090429/lib/camping.rb
100
+ - vendor/zuk-camping-2.0.20090429/lib/camping/ar.rb
101
+ - vendor/zuk-camping-2.0.20090429/lib/camping/ar/session.rb
102
+ - vendor/zuk-camping-2.0.20090429/lib/camping/mab.rb
103
+ - vendor/zuk-camping-2.0.20090429/lib/camping/reloader.rb
104
+ - vendor/zuk-camping-2.0.20090429/lib/camping/server.rb
105
+ - vendor/zuk-camping-2.0.20090429/lib/camping/session.rb
106
+ - vendor/zuk-camping-2.0.20090429/setup.rb
107
+ - vendor/zuk-camping-2.0.20090429/test/apps/env_debug.rb
108
+ - vendor/zuk-camping-2.0.20090429/test/apps/forms.rb
109
+ - vendor/zuk-camping-2.0.20090429/test/apps/misc.rb
110
+ - vendor/zuk-camping-2.0.20090429/test/apps/sessions.rb
111
+ - vendor/zuk-camping-2.0.20090429/test/test_camping.rb
112
112
  has_rdoc: true
113
113
  homepage: http://picnic.rubyforge.org
114
114
  post_install_message:
File without changes