camping 1.5.180 → 2.0.rc0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +35 -0
- data/README +43 -68
- data/Rakefile +155 -86
- data/bin/camping +64 -246
- data/book/01_introduction +19 -0
- data/book/02_getting_started +443 -0
- data/book/51_upgrading +93 -0
- data/doc/api.html +1953 -0
- data/doc/book.html +73 -0
- data/doc/book/01_introduction.html +57 -0
- data/doc/book/02_getting_started.html +573 -0
- data/doc/book/51_upgrading.html +146 -0
- data/doc/created.rid +1 -0
- data/{extras → doc/images}/Camping.gif +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/{extras → doc/images}/permalink.gif +0 -0
- data/doc/index.html +148 -0
- data/doc/js/camping.js +79 -0
- data/doc/js/jquery.js +32 -0
- data/doc/rdoc.css +117 -0
- data/examples/blog.rb +280 -181
- data/extras/images/badge.gif +0 -0
- data/extras/images/boys-life.png +0 -0
- data/extras/images/deerputer.png +0 -0
- data/extras/images/diagram.png +0 -0
- data/extras/images/hill.png +0 -0
- data/extras/images/i-wish.png +0 -0
- data/extras/images/latl.png +0 -0
- data/extras/images/little-wheels.png +0 -0
- data/extras/images/square-badge.png +0 -0
- data/extras/images/uniform.png +0 -0
- data/extras/images/whale-bounce.png +0 -0
- data/extras/rdoc/generator/singledarkfish.rb +205 -0
- data/extras/rdoc/generator/template/flipbook/images/Camping.gif +0 -0
- data/extras/rdoc/generator/template/flipbook/images/loadingAnimation.gif +0 -0
- data/extras/rdoc/generator/template/flipbook/images/permalink.gif +0 -0
- data/extras/rdoc/generator/template/flipbook/js/camping.js +79 -0
- data/extras/rdoc/generator/template/flipbook/js/jquery.js +32 -0
- data/extras/rdoc/generator/template/flipbook/page.rhtml +30 -0
- data/extras/rdoc/generator/template/flipbook/rdoc.css +117 -0
- data/extras/rdoc/generator/template/flipbook/readme.rhtml +31 -0
- data/extras/rdoc/generator/template/flipbook/reference.rhtml +71 -0
- data/extras/rdoc/generator/template/flipbook/toc.rhtml +43 -0
- data/lib/camping-unabridged.rb +420 -481
- data/lib/camping.rb +40 -55
- data/lib/camping/{db.rb → ar.rb} +5 -8
- data/lib/camping/mab.rb +26 -0
- data/lib/camping/reloader.rb +175 -147
- data/lib/camping/server.rb +178 -0
- data/lib/camping/session.rb +34 -121
- data/test/apps/env_debug.rb +65 -0
- data/test/apps/forms.rb +95 -0
- data/test/apps/forward_to_other_controller.rb +60 -0
- data/test/apps/migrations.rb +97 -0
- data/test/apps/misc.rb +86 -0
- data/test/apps/sessions.rb +38 -0
- metadata +120 -80
- data/doc/camping.1.gz +0 -0
- data/examples/campsh.rb +0 -630
- data/examples/tepee.rb +0 -242
- data/extras/flipbook_rdoc.rb +0 -491
- data/lib/camping/fastcgi.rb +0 -244
- data/lib/camping/webrick.rb +0 -65
- data/test/test_xhtml_trans.rb +0 -55
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'camping'
|
2
|
+
|
3
|
+
Camping.goes :ForwardToOtherController
|
4
|
+
|
5
|
+
module ForwardToOtherController
|
6
|
+
|
7
|
+
module Controllers
|
8
|
+
|
9
|
+
class Index < R '/'
|
10
|
+
attr_accessor :msg
|
11
|
+
|
12
|
+
def get
|
13
|
+
puts "msg=#{@msg}"
|
14
|
+
puts "input=#{input.inspect}"
|
15
|
+
render :index
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Start < R '/start'
|
20
|
+
def get
|
21
|
+
render :start
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class Welcome < R '/welcome'
|
26
|
+
def post
|
27
|
+
if input.name == '_why'
|
28
|
+
msg = "Wow you're back _why! This is front-page news!"
|
29
|
+
r *ForwardToOtherController.get(:Index, :msg => msg, :input => input )
|
30
|
+
end
|
31
|
+
|
32
|
+
@result = "Welcome #{input.name}!"
|
33
|
+
render :welcome
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
module Views
|
40
|
+
def index
|
41
|
+
h1 @msg if @msg && !@msg.empty?
|
42
|
+
a "Start", :href=> "/start"
|
43
|
+
end
|
44
|
+
|
45
|
+
def start
|
46
|
+
h3 "Start"
|
47
|
+
|
48
|
+
form :action=>R(Welcome), :method=>:post do
|
49
|
+
label "Who are you?", :for=>:name
|
50
|
+
div "Note: type _why if you want to test the forward logic otherwise just type your name", :style=>"color:green;font-size:8pt;"
|
51
|
+
input :type=>:text, :name=>:name; br
|
52
|
+
input :type=>:submit
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def welcome
|
57
|
+
div "#{@result}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require "camping"
|
2
|
+
|
3
|
+
Camping.goes :Migrations
|
4
|
+
|
5
|
+
module Migrations
|
6
|
+
module Models
|
7
|
+
class BadDude < Base; end
|
8
|
+
class TableCreation < V 1.0
|
9
|
+
def self.up
|
10
|
+
puts "FORCE THE TABLES"
|
11
|
+
create_table BadDude.table_name, :force=>true do |t|
|
12
|
+
t.string :name, :limit => 255
|
13
|
+
t.integer :bad
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
end
|
17
|
+
def self.down
|
18
|
+
drop_table BadDude.table_name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
class StartingDudes < V 1.3
|
22
|
+
def self.up
|
23
|
+
puts "There is only one way to make sure Bruce is the baddest"
|
24
|
+
BadDude.create :name => "Bruce", :bad => 1
|
25
|
+
BadDude.create :name => "Bruce", :bad => 2
|
26
|
+
BadDude.create :name => "Bruce", :bad => 5
|
27
|
+
end
|
28
|
+
def self.down
|
29
|
+
BadDude.delete_by_name "Bruce"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
class WeNeedMoreDudes < V 2.7
|
33
|
+
def self.up
|
34
|
+
puts "Maybe a non Bruce would help our worst case scenario planning"
|
35
|
+
BadDude.create :name => "Bob", :bad => 3
|
36
|
+
BadDude.create :name => "Samantha", :bad => 3
|
37
|
+
end
|
38
|
+
def self.down
|
39
|
+
BadDude.delete_by_name "Bob"
|
40
|
+
BadDude.delete_by_name "Samantha"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
class NoIMeanWeNeedBadderDudes < V 3.14159
|
44
|
+
def self.up
|
45
|
+
puts "just in case things get ugly"
|
46
|
+
sam = BadDude.find_by_name "Samantha"
|
47
|
+
sam.bad = 9001
|
48
|
+
sam.save
|
49
|
+
end
|
50
|
+
def self.down
|
51
|
+
sam = BadDude.find_by_name "Samantha"
|
52
|
+
sam.bad = 3
|
53
|
+
sam.save
|
54
|
+
end
|
55
|
+
end
|
56
|
+
class WaitWeShouldDoThisEarlier < V 3.11
|
57
|
+
def self.up
|
58
|
+
puts "for workgroups"
|
59
|
+
bruce = BadDude.find_by_name "Bob"
|
60
|
+
bruce.bad = 45
|
61
|
+
bruce.save
|
62
|
+
end
|
63
|
+
def self.down
|
64
|
+
bruce = BadDude.find_by_name "Bob"
|
65
|
+
bruce.bad = 3
|
66
|
+
bruce.save
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
module Controllers
|
71
|
+
class Bad < R '/(\d+)?'
|
72
|
+
def get enough
|
73
|
+
@dudes = BadDude.all :conditions => ["bad >= ?", enough.to_i]
|
74
|
+
@howbad = enough
|
75
|
+
render :savethepresident
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
module Views
|
80
|
+
def savethepresident
|
81
|
+
h1.ohnoes "The President Has Been Kidnapped By #{@howbad} Ninjas!"
|
82
|
+
if @dudes.empty?
|
83
|
+
div "None of the dudes are bad enough to rescue him, We are doomed!"
|
84
|
+
else
|
85
|
+
div "Please get the following dudes:"
|
86
|
+
ul.dudes do
|
87
|
+
@dudes.each do |dude|
|
88
|
+
li.dude dude.name
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
def Migrations.create
|
96
|
+
Migrations::Models.create_schema
|
97
|
+
end
|
data/test/apps/misc.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
require "camping"
|
2
|
+
|
3
|
+
Camping.goes :Misc
|
4
|
+
|
5
|
+
module Misc
|
6
|
+
module Controllers
|
7
|
+
class Index < R '/'
|
8
|
+
def get; render :index end
|
9
|
+
end
|
10
|
+
class RenderPartial
|
11
|
+
def get; render :_partial; end
|
12
|
+
end
|
13
|
+
class Xsendfile
|
14
|
+
def get
|
15
|
+
@headers["X-Sendfile"] = File.expand_path(__FILE__)
|
16
|
+
"You shouldn't get this text"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
class Links < R '/links', '/links/(\w+)/with/(\d+)/args'
|
20
|
+
def get(*args); render :links; end
|
21
|
+
end
|
22
|
+
class Redirect
|
23
|
+
def get; redirect(RR) end
|
24
|
+
end
|
25
|
+
class RR
|
26
|
+
def get; render :rr; end
|
27
|
+
end
|
28
|
+
class BadLinks
|
29
|
+
def get; render :bad_links; end
|
30
|
+
end
|
31
|
+
class BadMethod; end
|
32
|
+
end
|
33
|
+
|
34
|
+
module Views
|
35
|
+
def layout
|
36
|
+
html do
|
37
|
+
head{ title C }
|
38
|
+
body do
|
39
|
+
ul do
|
40
|
+
li{ a "index", :href=>R(Index)}
|
41
|
+
li{ a "render partial", :href=>R(RenderPartial)}
|
42
|
+
li{ a "X-Sendfile", :href=>R(Xsendfile)}
|
43
|
+
li{ a "Links", :href=>R(Links)}
|
44
|
+
li{ a "BadLinks", :href=>R(BadLinks)}
|
45
|
+
li{ a "Redirect", :href=>R(Redirect)}
|
46
|
+
li{ a "BadMethod", :href=>R(BadMethod)}
|
47
|
+
end
|
48
|
+
p { yield }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def _partial
|
54
|
+
a "go back to index", :href=>R(Index)
|
55
|
+
end
|
56
|
+
|
57
|
+
def index
|
58
|
+
h1 "Welcome on the Camping test app"
|
59
|
+
end
|
60
|
+
|
61
|
+
def links
|
62
|
+
a "plain", :href=>R(Links); br
|
63
|
+
a "with args and hash", :href=>R(Links, "moo", 3, :with=>"Hash"); br
|
64
|
+
a "with args and mult. hash", :href=>R(Links, "hoi", 8, :with=>"multiple", 3=>"hash"); br
|
65
|
+
# TODO : with <AR::Base object
|
66
|
+
end
|
67
|
+
|
68
|
+
def bad_links
|
69
|
+
a "null controller", :href=>R(nil)
|
70
|
+
a "bad arity", :href=>R(RR, :moo)
|
71
|
+
a "bad args", :href=>R(Links, 3, "moo")
|
72
|
+
end
|
73
|
+
|
74
|
+
def rr
|
75
|
+
p "got redirected"
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# For CGI
|
83
|
+
if $0 == __FILE__
|
84
|
+
Misc.create
|
85
|
+
Misc.run
|
86
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "camping"
|
5
|
+
|
6
|
+
Camping.goes :Sessions
|
7
|
+
require 'camping/session'
|
8
|
+
|
9
|
+
module Sessions
|
10
|
+
include Camping::Session
|
11
|
+
module Controllers
|
12
|
+
class One < R('/')
|
13
|
+
def get
|
14
|
+
@state = C::H['one',rand(100)]
|
15
|
+
puts "1:" + @state.inspect
|
16
|
+
redirect R(Two)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Two < R('/steptwo')
|
21
|
+
def get
|
22
|
+
@state['two'] = "This is in two"
|
23
|
+
puts "2:" + @state.inspect
|
24
|
+
redirect R(Three)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class Three < R('/stepthree')
|
29
|
+
def get
|
30
|
+
@state['three'] = "This is in three"
|
31
|
+
puts "3:" + @state.inspect
|
32
|
+
return "Accumulated state across redirects: #{@state.inspect}"
|
33
|
+
redirect R(Three)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
metadata
CHANGED
@@ -1,106 +1,146 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0.8
|
3
|
-
specification_version: 1
|
4
2
|
name: camping
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
-
|
11
|
-
|
12
|
-
homepage: http://code.whytheluckystiff.net/camping/
|
13
|
-
rubyforge_project:
|
14
|
-
description: minature rails for stay-at-home moms
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.8.2
|
24
|
-
version:
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 2
|
7
|
+
- 0
|
8
|
+
- rc0
|
9
|
+
version: 2.0.rc0
|
25
10
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
11
|
authors:
|
30
12
|
- why the lucky stiff
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-03 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rack
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 0
|
30
|
+
version: "1.0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description:
|
34
|
+
email: why@ruby-lang.org
|
35
|
+
executables:
|
36
|
+
- camping
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- README
|
41
|
+
- CHANGELOG
|
42
|
+
- COPYING
|
43
|
+
- book/01_introduction
|
44
|
+
- book/02_getting_started
|
45
|
+
- book/51_upgrading
|
31
46
|
files:
|
32
47
|
- COPYING
|
33
48
|
- README
|
34
49
|
- Rakefile
|
35
50
|
- bin/camping
|
36
|
-
- doc/
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
51
|
+
- doc/api.html
|
52
|
+
- doc/book/01_introduction.html
|
53
|
+
- doc/book/02_getting_started.html
|
54
|
+
- doc/book/51_upgrading.html
|
55
|
+
- doc/book.html
|
56
|
+
- doc/created.rid
|
57
|
+
- doc/images/Camping.gif
|
58
|
+
- doc/images/loadingAnimation.gif
|
59
|
+
- doc/images/permalink.gif
|
60
|
+
- doc/index.html
|
61
|
+
- doc/js/camping.js
|
62
|
+
- doc/js/jquery.js
|
63
|
+
- doc/rdoc.css
|
64
|
+
- test/apps/env_debug.rb
|
65
|
+
- test/apps/forms.rb
|
66
|
+
- test/apps/forward_to_other_controller.rb
|
67
|
+
- test/apps/migrations.rb
|
68
|
+
- test/apps/misc.rb
|
69
|
+
- test/apps/sessions.rb
|
70
|
+
- lib/camping/ar.rb
|
71
|
+
- lib/camping/mab.rb
|
41
72
|
- lib/camping/reloader.rb
|
42
|
-
- lib/camping/
|
73
|
+
- lib/camping/server.rb
|
43
74
|
- lib/camping/session.rb
|
44
|
-
- lib/camping
|
45
|
-
- lib/camping
|
46
|
-
- extras/
|
47
|
-
- extras/
|
48
|
-
- extras/
|
49
|
-
-
|
50
|
-
-
|
75
|
+
- lib/camping-unabridged.rb
|
76
|
+
- lib/camping.rb
|
77
|
+
- extras/images/badge.gif
|
78
|
+
- extras/images/boys-life.png
|
79
|
+
- extras/images/deerputer.png
|
80
|
+
- extras/images/diagram.png
|
81
|
+
- extras/images/hill.png
|
82
|
+
- extras/images/i-wish.png
|
83
|
+
- extras/images/latl.png
|
84
|
+
- extras/images/little-wheels.png
|
85
|
+
- extras/images/square-badge.png
|
86
|
+
- extras/images/uniform.png
|
87
|
+
- extras/images/whale-bounce.png
|
88
|
+
- extras/rdoc/generator/singledarkfish.rb
|
89
|
+
- extras/rdoc/generator/template/flipbook/images/Camping.gif
|
90
|
+
- extras/rdoc/generator/template/flipbook/images/loadingAnimation.gif
|
91
|
+
- extras/rdoc/generator/template/flipbook/images/permalink.gif
|
92
|
+
- extras/rdoc/generator/template/flipbook/js/camping.js
|
93
|
+
- extras/rdoc/generator/template/flipbook/js/jquery.js
|
94
|
+
- extras/rdoc/generator/template/flipbook/page.rhtml
|
95
|
+
- extras/rdoc/generator/template/flipbook/rdoc.css
|
96
|
+
- extras/rdoc/generator/template/flipbook/readme.rhtml
|
97
|
+
- extras/rdoc/generator/template/flipbook/reference.rhtml
|
98
|
+
- extras/rdoc/generator/template/flipbook/toc.rhtml
|
99
|
+
- book/01_introduction
|
100
|
+
- book/02_getting_started
|
101
|
+
- book/51_upgrading
|
51
102
|
- examples/blog.rb
|
52
103
|
- CHANGELOG
|
53
|
-
|
104
|
+
has_rdoc: true
|
105
|
+
homepage: http://camping.rubyforge.org/
|
106
|
+
licenses: []
|
54
107
|
|
108
|
+
post_install_message:
|
55
109
|
rdoc_options:
|
56
|
-
- --quiet
|
57
|
-
- --title
|
58
|
-
- Camping, the Documentation
|
59
|
-
- --opname
|
60
|
-
- index.html
|
61
110
|
- --line-numbers
|
111
|
+
- --quiet
|
62
112
|
- --main
|
63
113
|
- README
|
64
|
-
- --inline-source
|
65
114
|
- --exclude
|
66
115
|
- ^(examples|extras)\/
|
67
116
|
- --exclude
|
68
117
|
- lib/camping.rb
|
69
|
-
|
70
|
-
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
-
|
75
|
-
|
76
|
-
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
segments:
|
125
|
+
- 1
|
126
|
+
- 8
|
127
|
+
- 2
|
128
|
+
version: 1.8.2
|
129
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
segments:
|
134
|
+
- 1
|
135
|
+
- 3
|
136
|
+
- 1
|
137
|
+
version: 1.3.1
|
77
138
|
requirements: []
|
78
139
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: 1.3.1
|
88
|
-
version:
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: markaby
|
91
|
-
version_requirement:
|
92
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: "0.5"
|
97
|
-
version:
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: metaid
|
100
|
-
version_requirement:
|
101
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">"
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: 0.0.0
|
106
|
-
version:
|
140
|
+
rubyforge_project: camping
|
141
|
+
rubygems_version: 1.3.6
|
142
|
+
signing_key:
|
143
|
+
specification_version: 3
|
144
|
+
summary: minature rails for stay-at-home moms
|
145
|
+
test_files: []
|
146
|
+
|