rubycas-server 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +38 -0
- data/Manifest.txt +4 -11
- data/README.txt +1 -1
- data/Rakefile +2 -2
- data/bin/rubycas-server +16 -47
- data/bin/rubycas-server-ctl +13 -154
- data/config.example.yml +113 -64
- data/lib/casserver.rb +78 -80
- data/lib/casserver/authenticators/active_directory_ldap.rb +3 -0
- data/lib/casserver/authenticators/ldap.rb +14 -1
- data/lib/casserver/authenticators/sql_encrypted.rb +75 -0
- data/lib/casserver/controllers.rb +19 -8
- data/lib/casserver/environment.rb +23 -0
- data/lib/casserver/models.rb +104 -53
- data/lib/casserver/utils.rb +0 -24
- data/lib/casserver/version.rb +2 -2
- data/lib/casserver/views.rb +28 -0
- data/lib/rubycas-server.rb +1 -0
- metadata +77 -68
- data/vendor/camping-1.5.180/CHANGELOG +0 -99
- data/vendor/camping-1.5.180/COPYING +0 -18
- data/vendor/camping-1.5.180/README +0 -119
- data/vendor/camping-1.5.180/Rakefile +0 -117
- data/vendor/camping-1.5.180/lib/camping-unabridged.rb +0 -762
- data/vendor/camping-1.5.180/lib/camping.rb +0 -55
- data/vendor/camping-1.5.180/lib/camping/db.rb +0 -78
- data/vendor/camping-1.5.180/lib/camping/fastcgi.rb +0 -244
- data/vendor/camping-1.5.180/lib/camping/reloader.rb +0 -163
- data/vendor/camping-1.5.180/lib/camping/session.rb +0 -123
- data/vendor/camping-1.5.180/lib/camping/webrick.rb +0 -68
data/lib/casserver/utils.rb
CHANGED
@@ -26,29 +26,5 @@ module CASServer
|
|
26
26
|
$LOG.debug("Processing #{controller}::#{method} #{params2.inspect}")
|
27
27
|
end
|
28
28
|
module_function :log_controller_action
|
29
|
-
|
30
|
-
class Logger < ::Logger
|
31
|
-
def initialize(logdev, shift_age = 0, shift_size = 1048576)
|
32
|
-
begin
|
33
|
-
super
|
34
|
-
rescue Exception
|
35
|
-
puts "WARNING: Couldn't create Logger with output '#{logdev}'. Logger output will be redirected to STDOUT."
|
36
|
-
super(STDOUT, shift_age, shift_size)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def format_message(severity, datetime, progrname, msg)
|
41
|
-
(@formatter || @default_formatter).call(severity, datetime, progname, msg)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class LogFormatter < ::Logger::Formatter
|
47
|
-
Format = "[%s#%d] %5s -- %s: %s\n"
|
48
|
-
|
49
|
-
def call(severity, time, progname, msg)
|
50
|
-
Format % [format_datetime(time), $$, severity, progname,
|
51
|
-
msg2str(msg)]
|
52
|
-
end
|
53
29
|
end
|
54
30
|
end
|
data/lib/casserver/version.rb
CHANGED
data/lib/casserver/views.rb
CHANGED
@@ -98,6 +98,34 @@ module CASServer::Views
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
+
# 2.3.2
|
102
|
+
def logout
|
103
|
+
@use_layout = true
|
104
|
+
|
105
|
+
table(:id => "login-box") do
|
106
|
+
tr do
|
107
|
+
td(:colspan => 2) do
|
108
|
+
div(:id => "headline-container") do
|
109
|
+
strong organization
|
110
|
+
text " Central Login"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
if @message
|
115
|
+
tr do
|
116
|
+
td(:colspan => 2, :id => "messagebox-container") do
|
117
|
+
div(:class => "messagebox #{@message[:type]}") { @message[:message] }
|
118
|
+
if @continue_url
|
119
|
+
p do
|
120
|
+
a(:href => @continue_url) { @continue_url }
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
101
129
|
# 2.4.2
|
102
130
|
# CAS 1.0 validate response.
|
103
131
|
def validate
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'lib/casserver'
|
metadata
CHANGED
@@ -1,35 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.2
|
3
|
-
specification_version: 1
|
4
2
|
name: rubycas-server
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-12-20 00:00:00 -05:00
|
8
|
-
summary: Provides single sign on for web applications using the CAS protocol.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email:
|
12
|
-
- matt at roughest dot net
|
13
|
-
homepage: http://rubycas-server.rubyforge.org
|
14
|
-
rubyforge_project: rubycas-server
|
15
|
-
description: Provides single sign on for web applications using the CAS protocol.
|
16
|
-
autorequire:
|
17
|
-
default_executable:
|
18
|
-
bindir: bin
|
19
|
-
has_rdoc: true
|
20
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
|
-
requirements:
|
22
|
-
- - ">"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 0.0.0
|
25
|
-
version:
|
4
|
+
version: 0.6.0
|
26
5
|
platform: ruby
|
27
|
-
signing_key:
|
28
|
-
cert_chain:
|
29
|
-
post_install_message:
|
30
6
|
authors:
|
31
7
|
- Matt Zukowski
|
32
8
|
- Jason Zylks
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2008-08-21 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: activesupport
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.4.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activerecord
|
27
|
+
version_requirement:
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.15.3
|
33
|
+
version:
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: picnic
|
36
|
+
version_requirement:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.6.3
|
42
|
+
version:
|
43
|
+
description: Provides single sign on for web applications using the CAS protocol.
|
44
|
+
email:
|
45
|
+
- matt at roughest dot net
|
46
|
+
executables:
|
47
|
+
- rubycas-server
|
48
|
+
- rubycas-server-ctl
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- CHANGELOG.txt
|
53
|
+
- LICENSE.txt
|
54
|
+
- Manifest.txt
|
55
|
+
- README.txt
|
33
56
|
files:
|
34
57
|
- CHANGELOG.txt
|
35
58
|
- LICENSE.txt
|
@@ -45,15 +68,18 @@ files:
|
|
45
68
|
- lib/casserver/authenticators/base.rb
|
46
69
|
- lib/casserver/authenticators/ldap.rb
|
47
70
|
- lib/casserver/authenticators/sql.rb
|
71
|
+
- lib/casserver/authenticators/sql_encrypted.rb
|
48
72
|
- lib/casserver/authenticators/test.rb
|
49
73
|
- lib/casserver/cas.rb
|
50
74
|
- lib/casserver/conf.rb
|
51
75
|
- lib/casserver/controllers.rb
|
76
|
+
- lib/casserver/environment.rb
|
52
77
|
- lib/casserver/models.rb
|
53
78
|
- lib/casserver/postambles.rb
|
54
79
|
- lib/casserver/utils.rb
|
55
80
|
- lib/casserver/version.rb
|
56
81
|
- lib/casserver/views.rb
|
82
|
+
- lib/rubycas-server.rb
|
57
83
|
- lib/themes/cas.css
|
58
84
|
- lib/themes/notice.png
|
59
85
|
- lib/themes/ok.png
|
@@ -68,18 +94,8 @@ files:
|
|
68
94
|
- lib/themes/warning.png
|
69
95
|
- resources/init.d.sh
|
70
96
|
- setup.rb
|
97
|
+
- test/test_cas.rb
|
71
98
|
- test/test_casserver.rb
|
72
|
-
- vendor/camping-1.5.180/CHANGELOG
|
73
|
-
- vendor/camping-1.5.180/COPYING
|
74
|
-
- vendor/camping-1.5.180/README
|
75
|
-
- vendor/camping-1.5.180/Rakefile
|
76
|
-
- vendor/camping-1.5.180/lib/camping-unabridged.rb
|
77
|
-
- vendor/camping-1.5.180/lib/camping.rb
|
78
|
-
- vendor/camping-1.5.180/lib/camping/db.rb
|
79
|
-
- vendor/camping-1.5.180/lib/camping/fastcgi.rb
|
80
|
-
- vendor/camping-1.5.180/lib/camping/reloader.rb
|
81
|
-
- vendor/camping-1.5.180/lib/camping/session.rb
|
82
|
-
- vendor/camping-1.5.180/lib/camping/webrick.rb
|
83
99
|
- vendor/isaac_0.9.1/LICENSE
|
84
100
|
- vendor/isaac_0.9.1/README
|
85
101
|
- vendor/isaac_0.9.1/TODO
|
@@ -88,40 +104,33 @@ files:
|
|
88
104
|
- vendor/isaac_0.9.1/isaac.gemspec
|
89
105
|
- vendor/isaac_0.9.1/setup.rb
|
90
106
|
- vendor/isaac_0.9.1/test/TC_ISAAC.rb
|
91
|
-
|
92
|
-
-
|
93
|
-
|
107
|
+
has_rdoc: true
|
108
|
+
homepage: http://rubycas-server.rubyforge.org
|
109
|
+
post_install_message:
|
94
110
|
rdoc_options:
|
95
111
|
- --main
|
96
112
|
- README.txt
|
97
|
-
|
98
|
-
-
|
99
|
-
|
100
|
-
|
101
|
-
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: "0"
|
120
|
+
version:
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
version:
|
107
127
|
requirements: []
|
108
128
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
version: 1.4.0
|
118
|
-
version:
|
119
|
-
- !ruby/object:Gem::Dependency
|
120
|
-
name: activerecord
|
121
|
-
version_requirement:
|
122
|
-
version_requirements: !ruby/object:Gem::Version::Requirement
|
123
|
-
requirements:
|
124
|
-
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: 1.15.3
|
127
|
-
version:
|
129
|
+
rubyforge_project: rubycas-server
|
130
|
+
rubygems_version: 1.0.1
|
131
|
+
signing_key:
|
132
|
+
specification_version: 2
|
133
|
+
summary: Provides single sign on for web applications using the CAS protocol.
|
134
|
+
test_files:
|
135
|
+
- test/test_cas.rb
|
136
|
+
- test/test_casserver.rb
|
@@ -1,99 +0,0 @@
|
|
1
|
-
= 1.5
|
2
|
-
=== 3rd Oct, 2006
|
3
|
-
|
4
|
-
* Camping::Apps stores an array of classes for all loaded apps.
|
5
|
-
* bin/camping can be given a directory. Like: <tt>camping examples/</tt>
|
6
|
-
* Console mode -- thank zimbatm. Use: camping -C yourapp.rb
|
7
|
-
* Call controllers with Camping.method_missing.
|
8
|
-
|
9
|
-
Tepee.get(:Index) #=> (Response)
|
10
|
-
Blog.post(:Delete, id) #=> (Response)
|
11
|
-
|
12
|
-
Blog.post(:Login, :input => {'username' => 'admin', 'password' => 'camping'})
|
13
|
-
#=> #<Blog::Controllers::Login @user=... >
|
14
|
-
|
15
|
-
Blog.get(:Info, :env => {:HTTP_HOST => 'wagon'})
|
16
|
-
#=> #<Blog::Controllers::Info @env={'HTTP_HOST'=>'wagon'} ...>
|
17
|
-
|
18
|
-
* Using \r\n instead of \n on output. FastCGI has these needs.
|
19
|
-
* ActiveRecord no longer required or installed.
|
20
|
-
* If you refer to Models::Base, however, ActiveRecord will be loaded with autoload. (see lib/camping/db.rb)
|
21
|
-
* new Camping::FastCGI.serve which will serve a whole directory of apps
|
22
|
-
(see http://code.whytheluckystiff.net/camping/wiki/TheCampingServer)
|
23
|
-
* ~/.campingrc can contain database connection info if you want your default to be something other than SQLite.
|
24
|
-
|
25
|
-
database:
|
26
|
-
adapter: mysql
|
27
|
-
username: camping
|
28
|
-
socket: /tmp/mysql.sock
|
29
|
-
password: NOFORESTFIRES
|
30
|
-
database: camping
|
31
|
-
|
32
|
-
* controllers are now *ordered*. uses the inherited hook to keep track of all
|
33
|
-
classes created with R. those classes are scanned, in order, when a request is
|
34
|
-
made. any other controllers are handled first. so if you plan on overriding the
|
35
|
-
urls method, be sure to subclass from R().
|
36
|
-
* Console mode will load .irbrc in the working directory, if present.
|
37
|
-
(for example, in my ~/git/balloon directory, i have this in the .irbrc:
|
38
|
-
include Balloon::Models
|
39
|
-
when camping -C balloon.rb gets run, the models all get included in main.)
|
40
|
-
* And, of course, many other bugfixes from myself and the loyal+kind zimbatm...
|
41
|
-
* Markaby updated to 0.5. (See its CHANGELOG.)
|
42
|
-
|
43
|
-
= 1.4.2
|
44
|
-
=== 18th May, 2006
|
45
|
-
|
46
|
-
* Efficient file uploads for multipart/form-data POSTs.
|
47
|
-
* Camping tool now uses Mongrel, if available. If not, sticks with WEBrick.
|
48
|
-
* Multiple apps can be loaded with the camping tool, each mounted according to their file name.
|
49
|
-
|
50
|
-
= 1.4.1
|
51
|
-
=== 3rd May, 2006
|
52
|
-
|
53
|
-
* Streaming HTTP support. If body is IO, will simply pass to the controller. Mongrel, in particular, supports this nicely.
|
54
|
-
|
55
|
-
= 1.4
|
56
|
-
=== 11th April, 2006
|
57
|
-
|
58
|
-
* Moved Camping::Controllers::Base to Camping::Base.
|
59
|
-
* Moved Camping::Controllers::R to Camping::R.
|
60
|
-
* New session library (lib/camping/session.rb).
|
61
|
-
* WEBrick handler (lib/camping/webrick.rb) and Mongrel handler (lib/camping/mongrel.rb).
|
62
|
-
* Helpers#URL, builds a complete URL for a route. Returns a URI object. This way relative links could just return self.URL.path.
|
63
|
-
* Base#initialize takes over some of Base#service's duties.
|
64
|
-
* ENV now available as @env in controllers and views.
|
65
|
-
* Beautiful multi-page docs without frames!
|
66
|
-
|
67
|
-
= 1.3
|
68
|
-
=== 28th January, 2006
|
69
|
-
|
70
|
-
* bin/camping: an application launcher.
|
71
|
-
* <tt>Camping.run(request, response)</tt> now changed to <tt>controller = Camping.run(request, env)</tt>
|
72
|
-
* This means outputting the response is the wrapper/server's job. See bin/camping, you can do a controller.to_s at the least.
|
73
|
-
* <tt>Controllers::Base.env</tt> is the new thread-safe home for <tt>ENV</tt>.
|
74
|
-
* The input hash now works more like Rails params. You can call keys
|
75
|
-
like methods or with symbols or strings.
|
76
|
-
* Queries are now parsed more like PHP/Rails, in that you can denote
|
77
|
-
structure with brackets: post[user]=_why;post[id]=2
|
78
|
-
* Auto-prefix table names, to help prevent name clash.
|
79
|
-
* Helpers.errors_for simple validation.
|
80
|
-
* Lots of empty :href and :action attributes, a bug.
|
81
|
-
* New single-page flipbook RDoc template.
|
82
|
-
|
83
|
-
= 1.2
|
84
|
-
=== 23rd January, 2006
|
85
|
-
|
86
|
-
* Camping.goes allows fresh modules build from all Camping parts.
|
87
|
-
* File uploads now supported (multipart/form-data).
|
88
|
-
* Helpers.R can rebuild routes.
|
89
|
-
* Helpers./ for tracing paths from the root.
|
90
|
-
|
91
|
-
= 1.1
|
92
|
-
=== 19th January, 2006
|
93
|
-
|
94
|
-
* Allowed request and response streams to be passed in, to allow WEBrick and FastCGI support.
|
95
|
-
|
96
|
-
= 1.0
|
97
|
-
=== 17th January, 2006
|
98
|
-
|
99
|
-
* Initial checkin, see announcement at http://redhanded.hobix.com/bits/campingAMicroframework.html.
|
@@ -1,18 +0,0 @@
|
|
1
|
-
Copyright (c) 2006 why the lucky stiff
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to
|
5
|
-
deal in the Software without restriction, including without limitation the
|
6
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
-
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,119 +0,0 @@
|
|
1
|
-
== Camping, a Microframework
|
2
|
-
|
3
|
-
Camping is a web framework which consistently stays at less than 4kb of code.
|
4
|
-
You can probably view the complete source code on a single page. But, you know,
|
5
|
-
it's so small that, if you think about it, what can it really do?
|
6
|
-
|
7
|
-
The idea here is to store a complete fledgling web application in a single file
|
8
|
-
like many small CGIs. But to organize it as a Model-View-Controller application
|
9
|
-
like Rails does. You can then easily move it to Rails once you've got it going.
|
10
|
-
|
11
|
-
== A Camping Skeleton
|
12
|
-
|
13
|
-
A skeletal Camping blog could look like this:
|
14
|
-
|
15
|
-
require 'camping'
|
16
|
-
|
17
|
-
Camping.goes :Blog
|
18
|
-
|
19
|
-
module Blog::Models
|
20
|
-
class Post < Base; belongs_to :user; end
|
21
|
-
class Comment < Base; belongs_to :user; end
|
22
|
-
class User < Base; end
|
23
|
-
end
|
24
|
-
|
25
|
-
module Blog::Controllers
|
26
|
-
class Index < R '/'
|
27
|
-
def get
|
28
|
-
@posts = Post.find :all
|
29
|
-
render :index
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
module Blog::Views
|
35
|
-
def layout
|
36
|
-
html do
|
37
|
-
body do
|
38
|
-
self << yield
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def index
|
44
|
-
for post in @posts
|
45
|
-
h1 post.title
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
Some things you might have noticed:
|
51
|
-
|
52
|
-
* Camping::Models uses ActiveRecord to do its work. We love ActiveRecord!
|
53
|
-
* Camping::Controllers can be assigned URLs in the class definition. Neat?
|
54
|
-
* Camping::Views describes HTML using pure Ruby. Markup as Ruby, which we
|
55
|
-
call Markaby.
|
56
|
-
* You use Camping::goes to make a copy of the Camping framework under your
|
57
|
-
own module name (in this case: <tt>Blog</tt>.)
|
58
|
-
|
59
|
-
<b>NOTE:</b> Camping auto-prefixes table names. If your class is named
|
60
|
-
<tt>Blog::Models::Post</tt>, your table will be called <b>blog_posts</b>.
|
61
|
-
Since many Camping apps can be attached to a database at once, this helps
|
62
|
-
prevent name clash.
|
63
|
-
|
64
|
-
(If you want to see the full blog example, check out <tt>examples/blog/blog.rb</tt>
|
65
|
-
for the complete code.)
|
66
|
-
|
67
|
-
If you want to write larger applications with Camping, you are encouraged to
|
68
|
-
split the application into distinct parts which can be mounted at URLs on your
|
69
|
-
web server. You might have a blog at /blog and a wiki at /wiki. Each
|
70
|
-
self-contained. But you can certainly share layouts and models by storing them
|
71
|
-
in plain Ruby scripts.
|
72
|
-
|
73
|
-
Interested yet? Okay, okay, one step at a time.
|
74
|
-
|
75
|
-
== Installation
|
76
|
-
|
77
|
-
* <tt>gem install camping</tt>
|
78
|
-
|
79
|
-
Or for the bleeding edge:
|
80
|
-
|
81
|
-
* <tt>gem install camping --source code.whytheluckystiff.net</tt>
|
82
|
-
|
83
|
-
You are encourage to install Camping and SQLite3, since it is a small database
|
84
|
-
which fits perfectly with our compact bylaws, works well with the examples.
|
85
|
-
|
86
|
-
* See http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3 for instructions.
|
87
|
-
|
88
|
-
== Running Camping Apps
|
89
|
-
|
90
|
-
The blog example above and most Camping applications look a lot like CGI scripts.
|
91
|
-
If you run them from the commandline, you'll probably just see a pile of HTML.
|
92
|
-
|
93
|
-
Camping comes with an tool for launching apps from the commandline:
|
94
|
-
|
95
|
-
* Run: <tt>camping blog.rb</tt>
|
96
|
-
* Visit http://localhost:3301/blog/ to use the app.
|
97
|
-
|
98
|
-
== How the Camping Tool Works
|
99
|
-
|
100
|
-
If your application isn't working with the <tt>camping</tt> tool, keep in mind
|
101
|
-
that the tool expects the following conventions to be used:
|
102
|
-
|
103
|
-
1. You must have SQLite3 and SQLite3-ruby installed. (Once again, please see
|
104
|
-
http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3 for instructions.)
|
105
|
-
2. If your script is called <tt>test.rb</tt>, Camping expects your application to
|
106
|
-
be stored in a module called <tt>Test</tt>. Case is not imporant, though. The
|
107
|
-
module can be called <tt>TeSt</tt> or any other permutation.
|
108
|
-
3. Your script's postamble (anything enclosed in <tt>if __FILE__ == $0</tt>) will be
|
109
|
-
ignored by the tool, since the tool will create an SQLite3 database at
|
110
|
-
<tt>~/.camping.db</tt>. Or, on Windows, <tt>$USER/Application Data/Camping.db</tt>.
|
111
|
-
4. If your application's module has a <tt>create</tt> method, it will be executed before
|
112
|
-
the web server starts up.
|
113
|
-
|
114
|
-
== The Rules of Thumb
|
115
|
-
|
116
|
-
Once you've started writing your own Camping app, I'd highly recommend that you become familiar
|
117
|
-
with the Camping Rules of Thumb which are listed on the wiki:
|
118
|
-
http://code.whytheluckystiff.net/camping/wiki/CampingRulesOfThumb
|
119
|
-
|