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
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Camping Tools is a toolbox for Camping
|
4
|
+
module Camping
|
5
|
+
module Tools
|
6
|
+
class << self
|
7
|
+
# to_snake
|
8
|
+
# Accepts a string and snake Cases it.
|
9
|
+
# Also accepts symbols and coerces them into a string.
|
10
|
+
def to_snake(string)
|
11
|
+
string = string.to_s if string.class == Symbol
|
12
|
+
string.gsub(/::/, '/').
|
13
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
14
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
15
|
+
tr("-", "_").
|
16
|
+
downcase
|
17
|
+
end
|
18
|
+
|
19
|
+
# Normalize Slashes
|
20
|
+
# normalizes the leading and trailing slashes of a string to only have a
|
21
|
+
# single trailing slash and no leading slashes.
|
22
|
+
def normalize_slashes(string)
|
23
|
+
f = string.dup
|
24
|
+
return "" if f == "" # Short circuit for blank prefixes.
|
25
|
+
f.chop!until f[-1] != "/"
|
26
|
+
f.slice!(0)until f[0] != "/"
|
27
|
+
f << "/"
|
28
|
+
end
|
29
|
+
|
30
|
+
alias norms normalize_slashes
|
31
|
+
|
32
|
+
# A Regex to descape escaped characters.
|
33
|
+
# used to correct URLs that are escpaed using Rack Util's escape function.
|
34
|
+
def descape
|
35
|
+
/\\(.)/
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
🏕 = Camping::Tools
|
43
|
+
CampTools = Camping::Tools
|