camping 2.1.532 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +72 -53
- data/Rakefile +25 -20
- data/bin/camping +1 -0
- data/book/01_introduction.md +6 -6
- data/book/02_getting_started.md +348 -267
- data/book/03_more_about_controllers.md +124 -0
- data/book/04_more_about_views.md +118 -0
- data/book/05_more_about_markaby.md +173 -0
- data/book/06_more_about_models.md +58 -0
- data/book/06_rules_of_thumb.md +143 -0
- data/book/07_philosophy.md +23 -0
- data/book/08_publishing_an_app.md +118 -0
- data/book/09_upgrade_notes.md +96 -0
- data/book/10_middleware.md +69 -0
- data/book/11_gear.md +50 -0
- data/examples/blog.rb +38 -38
- data/lib/camping/ar.rb +20 -5
- data/lib/camping/commands.rb +388 -0
- data/lib/camping/gear/filters.rb +48 -0
- data/lib/camping/gear/inspection.rb +32 -0
- data/lib/camping/gear/kuddly.rb +178 -0
- data/lib/camping/gear/nancy.rb +170 -0
- data/lib/camping/loads.rb +15 -0
- data/lib/camping/mab.rb +1 -1
- data/lib/camping/reloader.rb +22 -17
- data/lib/camping/server.rb +145 -70
- data/lib/camping/session.rb +8 -5
- data/lib/camping/template.rb +1 -2
- data/lib/camping/tools.rb +43 -0
- data/lib/camping/version.rb +6 -0
- data/lib/camping-unabridged.rb +360 -133
- data/lib/camping.rb +78 -47
- data/lib/campingtrip.md +341 -0
- data/test/app_camping_gear.rb +121 -0
- data/test/app_camping_tools.rb +1 -0
- data/test/app_config.rb +30 -0
- data/test/app_cookies.rb +1 -1
- data/test/app_file.rb +3 -3
- data/test/app_goes_meta.rb +23 -0
- data/test/app_inception.rb +39 -0
- data/test/app_markup.rb +5 -20
- data/test/app_migrations.rb +16 -0
- data/test/app_partials.rb +1 -1
- data/test/app_prefixed.rb +88 -0
- data/test/app_reloader.rb +1 -2
- data/test/app_route_generating.rb +69 -2
- data/test/app_sessions.rb +24 -2
- data/test/app_simple.rb +18 -18
- data/test/apps/migrations.rb +82 -82
- data/test/apps/misc.rb +1 -1
- data/test/gear/gear_nancy.rb +129 -0
- data/test/test_helper.rb +69 -12
- metadata +152 -92
- data/CHANGELOG +0 -145
- data/book/51_upgrading.md +0 -110
data/CHANGELOG
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
= 2.1
|
2
|
-
=== 19th Aug, 2010 (whyday)
|
3
|
-
* Helpers#R now calls to_param on any object it passes in
|
4
|
-
* Fix route generation issue with routes including "." (#22)
|
5
|
-
* Improved tests
|
6
|
-
* Improved 1.9 support
|
7
|
-
* Camping::Server is now built upon Rack::Server
|
8
|
-
* Add support for ERB, Haml etc through Tilt
|
9
|
-
* Introducing Camping.options and Camping#set
|
10
|
-
* Camping::Server only loads ActiveRecord when needed
|
11
|
-
|
12
|
-
= 2.0
|
13
|
-
=== 9th Apr, 2010
|
14
|
-
* Speed-up of Camping::Mab (thanks zimbatm!)
|
15
|
-
* @state is now an alias of @env['rack.session']
|
16
|
-
* Camping.use injects a Rack middleware.
|
17
|
-
* Update Flipbook to RDoc 2.4
|
18
|
-
* Removed old examples.
|
19
|
-
* Updated examples/blog.rb
|
20
|
-
* Camping::Apps returns!
|
21
|
-
* Session-cookies now timeout naturally (thanks jenna!)
|
22
|
-
* You can now `throw :halt` to halt the response in a helper.
|
23
|
-
* Camping::H#u is gone (was an alias to merge!)
|
24
|
-
* Camping::Session now uses session-cookies. The AR-backend is gone for now.
|
25
|
-
* camping/db.rb has been renamed to camping/ar.rb.
|
26
|
-
* Camping now uses Rack internally. Every app responds to #call.
|
27
|
-
|
28
|
-
= 1.6
|
29
|
-
=== Never released
|
30
|
-
|
31
|
-
* Camping::Apps removed, it wasn't reliable.
|
32
|
-
* bin/camping server kinds splitted in various files.
|
33
|
-
* NotFound and ServerError controllers changed to methods :
|
34
|
-
|
35
|
-
r404 : called when a controller was not found
|
36
|
-
r500 : called on uncaught exception
|
37
|
-
r501 : called on undefined method
|
38
|
-
|
39
|
-
All of those can be overridden at your taste.
|
40
|
-
|
41
|
-
* Markaby no longer required. Like AR, is it autoloaded on (Mab) usage.
|
42
|
-
* Camping::H is now inheriting from Hash instead of HashWithIndifferentAccess.
|
43
|
-
* Which made possible to remove the last strict dependency : active_support
|
44
|
-
* #errors_for removed, it wasn't really used
|
45
|
-
* Bug fixes !
|
46
|
-
|
47
|
-
= 1.5
|
48
|
-
=== 3rd Oct, 2006
|
49
|
-
|
50
|
-
* Camping::Apps stores an array of classes for all loaded apps.
|
51
|
-
* bin/camping can be given a directory. Like: <tt>camping examples/</tt>
|
52
|
-
* Console mode -- thank zimbatm. Use: camping -C yourapp.rb
|
53
|
-
* Call controllers with Camping.method_missing.
|
54
|
-
|
55
|
-
Tepee.get(:Index) #=> (Response)
|
56
|
-
Blog.post(:Delete, id) #=> (Response)
|
57
|
-
|
58
|
-
Blog.post(:Login, :input => {'username' => 'admin', 'password' => 'camping'})
|
59
|
-
#=> #<Blog::Controllers::Login @user=... >
|
60
|
-
|
61
|
-
Blog.get(:Info, :env => {:HTTP_HOST => 'wagon'})
|
62
|
-
#=> #<Blog::Controllers::Info @env={'HTTP_HOST'=>'wagon'} ...>
|
63
|
-
|
64
|
-
* Using \r\n instead of \n on output. FastCGI has these needs.
|
65
|
-
* ActiveRecord no longer required or installed.
|
66
|
-
* If you refer to Models::Base, however, ActiveRecord will be loaded with autoload. (see lib/camping/db.rb)
|
67
|
-
* new Camping::FastCGI.serve which will serve a whole directory of apps
|
68
|
-
(see http://code.whytheluckystiff.net/camping/wiki/TheCampingServer)
|
69
|
-
* ~/.campingrc can contain database connection info if you want your default to be something other than SQLite.
|
70
|
-
|
71
|
-
database:
|
72
|
-
adapter: mysql
|
73
|
-
username: camping
|
74
|
-
socket: /tmp/mysql.sock
|
75
|
-
password: NOFORESTFIRES
|
76
|
-
database: camping
|
77
|
-
|
78
|
-
* controllers are now *ordered*. uses the inherited hook to keep track of all
|
79
|
-
classes created with R. those classes are scanned, in order, when a request is
|
80
|
-
made. any other controllers are handled first. so if you plan on overriding the
|
81
|
-
urls method, be sure to subclass from R().
|
82
|
-
* Console mode will load .irbrc in the working directory, if present.
|
83
|
-
(for example, in my ~/git/balloon directory, i have this in the .irbrc:
|
84
|
-
include Balloon::Models
|
85
|
-
when camping -C balloon.rb gets run, the models all get included in main.)
|
86
|
-
* And, of course, many other bugfixes from myself and the loyal+kind zimbatm...
|
87
|
-
* Markaby updated to 0.5. (See its CHANGELOG.)
|
88
|
-
|
89
|
-
= 1.4.2
|
90
|
-
=== 18th May, 2006
|
91
|
-
|
92
|
-
* Efficient file uploads for multipart/form-data POSTs.
|
93
|
-
* Camping tool now uses Mongrel, if available. If not, sticks with WEBrick.
|
94
|
-
* Multiple apps can be loaded with the camping tool, each mounted according to their file name.
|
95
|
-
|
96
|
-
= 1.4.1
|
97
|
-
=== 3rd May, 2006
|
98
|
-
|
99
|
-
* Streaming HTTP support. If body is IO, will simply pass to the controller. Mongrel, in particular, supports this nicely.
|
100
|
-
|
101
|
-
= 1.4
|
102
|
-
=== 11th April, 2006
|
103
|
-
|
104
|
-
* Moved Camping::Controllers::Base to Camping::Base.
|
105
|
-
* Moved Camping::Controllers::R to Camping::R.
|
106
|
-
* New session library (lib/camping/session.rb).
|
107
|
-
* WEBrick handler (lib/camping/webrick.rb) and Mongrel handler (lib/camping/mongrel.rb).
|
108
|
-
* Helpers#URL, builds a complete URL for a route. Returns a URI object. This way relative links could just return self.URL.path.
|
109
|
-
* Base#initialize takes over some of Base#service's duties.
|
110
|
-
* ENV now available as @env in controllers and views.
|
111
|
-
* Beautiful multi-page docs without frames!
|
112
|
-
|
113
|
-
= 1.3
|
114
|
-
=== 28th January, 2006
|
115
|
-
|
116
|
-
* bin/camping: an application launcher.
|
117
|
-
* <tt>Camping.run(request, response)</tt> now changed to <tt>controller = Camping.run(request, env)</tt>
|
118
|
-
* This means outputting the response is the wrapper/server's job. See bin/camping, you can do a controller.to_s at the least.
|
119
|
-
* <tt>Controllers::Base.env</tt> is the new thread-safe home for <tt>ENV</tt>.
|
120
|
-
* The input hash now works more like Rails params. You can call keys
|
121
|
-
like methods or with symbols or strings.
|
122
|
-
* Queries are now parsed more like PHP/Rails, in that you can denote
|
123
|
-
structure with brackets: post[user]=_why;post[id]=2
|
124
|
-
* Auto-prefix table names, to help prevent name clash.
|
125
|
-
* Helpers.errors_for simple validation.
|
126
|
-
* Lots of empty :href and :action attributes, a bug.
|
127
|
-
* New single-page flipbook RDoc template.
|
128
|
-
|
129
|
-
= 1.2
|
130
|
-
=== 23rd January, 2006
|
131
|
-
|
132
|
-
* Camping.goes allows fresh modules build from all Camping parts.
|
133
|
-
* File uploads now supported (multipart/form-data).
|
134
|
-
* Helpers.R can rebuild routes.
|
135
|
-
* Helpers./ for tracing paths from the root.
|
136
|
-
|
137
|
-
= 1.1
|
138
|
-
=== 19th January, 2006
|
139
|
-
|
140
|
-
* Allowed request and response streams to be passed in, to allow WEBrick and FastCGI support.
|
141
|
-
|
142
|
-
= 1.0
|
143
|
-
=== 17th January, 2006
|
144
|
-
|
145
|
-
* Initial checkin, see announcement at http://redhanded.hobix.com/bits/campingAMicroframework.html.
|
data/book/51_upgrading.md
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
# Appendix I: Upgrade Notes
|
2
|
-
|
3
|
-
This document includes everything needed in order to *upgrade* your
|
4
|
-
applications. If you're looking for all the new features in a version, please
|
5
|
-
have a look at the CHANGELOG in the Camping source.
|
6
|
-
|
7
|
-
|
8
|
-
##From 2.0 to 2.1
|
9
|
-
###Options
|
10
|
-
|
11
|
-
In Camping 2.1 there is now a built-in way to store options and settings. If
|
12
|
-
you use cookie session, it means that you'll now have to change to:
|
13
|
-
|
14
|
-
module Nuts
|
15
|
-
set :secret, "Very secret text, which no-one else should know!"
|
16
|
-
include Camping::Session
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
|
-
##From 1.5 to 2.0
|
21
|
-
###Rack
|
22
|
-
|
23
|
-
The biggest change in 2.0 is that it now uses [Rack](http://rack.rubyforge.org/)
|
24
|
-
internally. This means that you'll now have to deploy Camping differently, but
|
25
|
-
hopefully more easily too. Now every Camping application is also a Rack
|
26
|
-
application, so simply check out the documentation to the server of your
|
27
|
-
choice.
|
28
|
-
|
29
|
-
###`require 'camping/db'`
|
30
|
-
|
31
|
-
In earlier versions of Camping, you loaded database support by:
|
32
|
-
|
33
|
-
require 'camping/db'
|
34
|
-
|
35
|
-
Actually, this loaded a very thin layer on top of ActiveRecord, and in the
|
36
|
-
future we want to experiment with other libraries. Therefore you should now
|
37
|
-
simply remove the line, and instead just inherit from Base right away. This
|
38
|
-
also means you'll have to place your migrations *after* the models.
|
39
|
-
|
40
|
-
We also encourage you to use <tt>Model.table_name</tt> instead of
|
41
|
-
<tt>:appname_model</tt>, just to make sure it's named correctly.
|
42
|
-
|
43
|
-
## Don't require anything:
|
44
|
-
# require 'camping/db'
|
45
|
-
|
46
|
-
module Nuts::Models
|
47
|
-
## Just inherit Base:
|
48
|
-
class Page < Base; end
|
49
|
-
|
50
|
-
## Migrations have to come *after* the models:
|
51
|
-
class CreateTheBasics < V 0.1
|
52
|
-
def self.up
|
53
|
-
create_table Page.table_name do |t|
|
54
|
-
...
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.down
|
59
|
-
drop_table Page.table_name
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
###Cookie Sessions
|
65
|
-
|
66
|
-
Camping 2.0 now uses a cookie-based session system, which means you now longer
|
67
|
-
need a database in order to use sessions. The disadvantage of this is that
|
68
|
-
you are restricted to only around 4k of data. See below for the changes
|
69
|
-
required, and see Camping::Session more details.
|
70
|
-
|
71
|
-
module Nuts
|
72
|
-
## Include Camping::Session as before:
|
73
|
-
include Camping::Session
|
74
|
-
|
75
|
-
## But also define a secret:
|
76
|
-
secret "Very secret text, which no-one else should know!"
|
77
|
-
end
|
78
|
-
|
79
|
-
def Nuts.create
|
80
|
-
## And remove the following line:
|
81
|
-
# Camping::Models::Session.create_schema
|
82
|
-
end
|
83
|
-
|
84
|
-
###Error handling
|
85
|
-
|
86
|
-
Camping now uses three methods in order to handle errors. These replaces the
|
87
|
-
old classes NotFound and ServerError.
|
88
|
-
|
89
|
-
* Camping::Base#r404 is called when a route can't be found.
|
90
|
-
* Camping::Base#r501 is called when a route is found, but doesn't respond to
|
91
|
-
the method.
|
92
|
-
* Camping::Base#r500 is called when an error happens.
|
93
|
-
|
94
|
-
You can override these in your application:
|
95
|
-
|
96
|
-
module Nuts
|
97
|
-
def r404(path)
|
98
|
-
"Sorry, but I can't find #{path}."
|
99
|
-
end
|
100
|
-
|
101
|
-
def r501(method)
|
102
|
-
"Sorry, but I can't respond to #{method}."
|
103
|
-
end
|
104
|
-
|
105
|
-
def r500(klass, method, ex)
|
106
|
-
"Sorry, but #{klass}##{method} failed with #{ex}."
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
It should be noted that this might change in the future.
|