camping 2.1.532 → 3.0.1
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.
- 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 +138 -92
- data/CHANGELOG +0 -145
- data/book/51_upgrading.md +0 -110
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.
|