camping 3.2.0 → 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +10 -0
- data/lib/camping/commands.rb +1 -72
- data/lib/camping/gear/firewatch.rb +6 -1
- data/lib/camping/gear/kuddly.rb +1 -1
- data/lib/camping/gear/nancy.rb +2 -2
- data/lib/camping/server.rb +6 -6
- data/lib/camping/tools.rb +1 -2
- data/lib/camping-unabridged.rb +21 -5
- data/lib/camping.rb +1 -1
- data/test/app_logger.rb +3 -2
- data/test/integration/Gemfile +21 -0
- data/test/integration/Gemfile.lock +95 -0
- data/test/integration/README.md +7 -0
- data/test/integration/Rakefile +16 -0
- data/test/integration/camp.rb +47 -0
- data/test/integration/config.kdl +2 -0
- data/test/integration/test/test_helper.r +64 -0
- data/test/integration/test/test_helper.rb +56 -0
- data/test/test_helper.rb +1 -1
- metadata +65 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f5615f332dcf7362345f6d628b4d9d90adf93862cecddce4168b6609e684b87
|
4
|
+
data.tar.gz: 0d6454ca641d2a2ff03d097c0c6b62df9971517ddde4b72fea2b18b108ca3f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57eeda38ff38008fe71e9437bbd0484582c06bacd2d75cadc77134ec5e7cbd216cbd2ac25723a493c6a06268e5739e9942fdfef084055960241bc4b9f0db908e
|
7
|
+
data.tar.gz: 19563aba78678ed871ee40cd004dbdfeff4039d30b515304dbeefc8bd33a070c0a982f8828ef4102f2fda8b441809b5457410a1ebf1241042e2164759db8812e
|
data/Rakefile
CHANGED
@@ -92,6 +92,16 @@ Rake::TestTask.new(:configreloader) do |t|
|
|
92
92
|
t.test_files = FileList['test/config_*.rb']
|
93
93
|
end
|
94
94
|
|
95
|
+
Rake::TestTask.new(:integration) do |t|
|
96
|
+
`gem build`
|
97
|
+
gem = Dir.glob("camping*.gem").first
|
98
|
+
exit if gem == nil
|
99
|
+
`cd test/integration`
|
100
|
+
`gem install ../../#{gem}`
|
101
|
+
t.libs << "/"
|
102
|
+
t.test_files = FileList['test/test_*.rb']
|
103
|
+
end
|
104
|
+
|
95
105
|
## Diff
|
96
106
|
desc "Compare camping and camping-unabridged"
|
97
107
|
task :diff do
|
data/lib/camping/commands.rb
CHANGED
@@ -240,76 +240,6 @@ namespace 'test' do
|
|
240
240
|
t.test_files = FileList['test/test_*.rb']
|
241
241
|
end
|
242
242
|
end
|
243
|
-
TXT
|
244
|
-
end
|
245
|
-
|
246
|
-
# writes a test_helper
|
247
|
-
def make_test_helper
|
248
|
-
write 'test/test_helper.r', <<-TXT
|
249
|
-
# Test Helper
|
250
|
-
$:.unshift File.dirname(__FILE__) + '/../'
|
251
|
-
|
252
|
-
begin
|
253
|
-
require 'rubygems'
|
254
|
-
rescue LoadError
|
255
|
-
end
|
256
|
-
|
257
|
-
require 'minitest/autorun'
|
258
|
-
require 'rack/test'
|
259
|
-
require 'minitest/reporters'
|
260
|
-
require 'minitest/hooks'
|
261
|
-
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
262
|
-
|
263
|
-
# Default TestCase with some helpers.
|
264
|
-
# The same stuff we use for Camping itself.
|
265
|
-
class TestCase < MiniTest::Test
|
266
|
-
include Rack::Test::Methods
|
267
|
-
include Minitest::Hooks
|
268
|
-
|
269
|
-
def self.inherited(mod)
|
270
|
-
mod.app = Object.const_get(mod.to_s[/\w+/])
|
271
|
-
super
|
272
|
-
end
|
273
|
-
|
274
|
-
class << self
|
275
|
-
attr_accessor :app
|
276
|
-
end
|
277
|
-
|
278
|
-
def setup
|
279
|
-
super
|
280
|
-
Camping.make_camp
|
281
|
-
end
|
282
|
-
|
283
|
-
def body() last_response.body end
|
284
|
-
def app() self.class.app end
|
285
|
-
|
286
|
-
def response_body() last_response.to_a end
|
287
|
-
|
288
|
-
def assert_reverse
|
289
|
-
begin
|
290
|
-
yield
|
291
|
-
rescue Exception
|
292
|
-
else
|
293
|
-
assert false, "Block didn't fail"
|
294
|
-
end
|
295
|
-
end
|
296
|
-
|
297
|
-
def assert_body(str, message="")
|
298
|
-
case str
|
299
|
-
when Regexp
|
300
|
-
assert_match(str, last_response.body.strip, message)
|
301
|
-
else
|
302
|
-
assert_equal(str.to_s, last_response.body.strip, message)
|
303
|
-
end
|
304
|
-
end
|
305
|
-
|
306
|
-
def assert_status(code, message="")
|
307
|
-
assert_equal(code, last_response.status, message)
|
308
|
-
end
|
309
|
-
|
310
|
-
def test_silly; end
|
311
|
-
end
|
312
|
-
|
313
243
|
TXT
|
314
244
|
end
|
315
245
|
|
@@ -383,7 +313,7 @@ require 'rack/test'
|
|
383
313
|
require "minitest/reporters"
|
384
314
|
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
385
315
|
|
386
|
-
class TestCase <
|
316
|
+
class TestCase < Minitest::Test
|
387
317
|
include Rack::Test::Methods
|
388
318
|
|
389
319
|
def self.inherited(mod)
|
@@ -460,7 +390,6 @@ RUBY
|
|
460
390
|
Generators::make_readme()
|
461
391
|
Generators::make_public_folder()
|
462
392
|
Generators::make_test_folder()
|
463
|
-
Generators::make_test_helper()
|
464
393
|
|
465
394
|
# optionally add omnibus support
|
466
395
|
# add src/ folder
|
@@ -30,7 +30,12 @@ module Camping
|
|
30
30
|
# If +logger+ is nil, Firewatch(CommonLogger) will fall back <tt>env['rack.errors']</tt>.
|
31
31
|
def initialize(app, logger = nil)
|
32
32
|
@app = app
|
33
|
-
|
33
|
+
if logger == nil
|
34
|
+
@logger = Camping::Firewatch.default_logger
|
35
|
+
else
|
36
|
+
@logger = logger
|
37
|
+
end
|
38
|
+
# @logger = Camping::Firewatch.logger = logger.nil? ? Camping::Firewatch.default_logger : logger
|
34
39
|
end
|
35
40
|
|
36
41
|
end
|
data/lib/camping/gear/kuddly.rb
CHANGED
@@ -147,7 +147,7 @@ module Gear
|
|
147
147
|
# Then parses it, and merges the data based on the current environment.
|
148
148
|
def get_config(provided_config_file = nil)
|
149
149
|
|
150
|
-
config_file,
|
150
|
+
config_file, merged_configs = provided_config_file, {}
|
151
151
|
config_file = get_root_config_file() unless provided_config_file != nil
|
152
152
|
|
153
153
|
# If the config file is just nil then we probably don't have one.
|
data/lib/camping/gear/nancy.rb
CHANGED
@@ -32,7 +32,7 @@ module Gear
|
|
32
32
|
rs.chop!
|
33
33
|
|
34
34
|
symbol = s.to_sym
|
35
|
-
{
|
35
|
+
{rs: rs, symbol: symbol}
|
36
36
|
end
|
37
37
|
|
38
38
|
# ensures an app exists for the controllers.
|
@@ -64,7 +64,7 @@ module Gear
|
|
64
64
|
|
65
65
|
meth = method.to_s
|
66
66
|
|
67
|
-
self.normalize_routes(routes) => {
|
67
|
+
self.normalize_routes(routes) => {rs:, symbol:}
|
68
68
|
|
69
69
|
m = self.ensure_app app
|
70
70
|
|
data/lib/camping/server.rb
CHANGED
@@ -3,7 +3,7 @@ require 'erb'
|
|
3
3
|
require 'rack'
|
4
4
|
require 'rackup'
|
5
5
|
require 'camping/version'
|
6
|
-
require 'camping/firewatch'
|
6
|
+
require 'camping/gear/firewatch'
|
7
7
|
require 'camping/loader'
|
8
8
|
require 'camping/commands'
|
9
9
|
|
@@ -111,13 +111,16 @@ module Camping
|
|
111
111
|
# redefine logging middleware
|
112
112
|
class << self
|
113
113
|
def logging_middleware
|
114
|
-
|
114
|
+
lambda { |server|
|
115
|
+
/CGI/.match?(server.server.name) || server.options[:quiet] ? nil : [Camping::Firewatch, $stderr]
|
116
|
+
}
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
118
120
|
def middleware
|
119
121
|
h = super
|
120
122
|
h["development"] << [XSendfile]
|
123
|
+
h["deployment"] << [XSendfile]
|
121
124
|
h
|
122
125
|
end
|
123
126
|
|
@@ -125,7 +128,6 @@ module Camping
|
|
125
128
|
# referencing their documentation would be a good idea.
|
126
129
|
# @file: String, file location for a camp.rb file.
|
127
130
|
def start(file = nil)
|
128
|
-
|
129
131
|
commands = ARGV
|
130
132
|
|
131
133
|
# Parse commands
|
@@ -143,8 +145,6 @@ module Camping
|
|
143
145
|
@reloader.reload!
|
144
146
|
r = @reloader
|
145
147
|
|
146
|
-
logger = r.apps.first.options[:logger]
|
147
|
-
|
148
148
|
if options[:routes] == true
|
149
149
|
eval("self", TOPLEVEL_BINDING).meta_def(:reload!) { r.reload!; nil }
|
150
150
|
ARGV.clear
|
@@ -161,7 +161,7 @@ module Camping
|
|
161
161
|
else
|
162
162
|
name = server.name[/\w+$/]
|
163
163
|
puts "** Starting #{name} on #{options[:Host]}:#{options[:Port]}"
|
164
|
-
super
|
164
|
+
super()
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
data/lib/camping/tools.rb
CHANGED
data/lib/camping-unabridged.rb
CHANGED
@@ -768,11 +768,11 @@ module Camping
|
|
768
768
|
# end
|
769
769
|
#
|
770
770
|
# This piece of code feels a bit confusing, but let's walk through it.
|
771
|
-
# Rack apps all implement a Call method. This is how
|
772
|
-
#
|
771
|
+
# Rack apps all implement a Call method. This is how Ruby web servers
|
772
|
+
# call the app, or code that you've set up. In our case, our camping
|
773
773
|
# apps.
|
774
774
|
#
|
775
|
-
# The Use method is setting up a new middleware, it
|
775
|
+
# The Use method is setting up a new middleware, it shifts the first
|
776
776
|
# argument supplied to Use, which should be the Middleware name, then
|
777
777
|
# initializes it. That's your new middleware. Rack based middleware accept
|
778
778
|
# a single argument to their initialize methods, which is an app. Optionally
|
@@ -828,6 +828,22 @@ module Camping
|
|
828
828
|
# end
|
829
829
|
# end
|
830
830
|
#
|
831
|
+
# Camping gear can also provide Helper methods to our controllers:
|
832
|
+
#
|
833
|
+
# module MyGear
|
834
|
+
# module HelperMethods
|
835
|
+
# # Define Helper Methods here
|
836
|
+
# end
|
837
|
+
#
|
838
|
+
# # This is plumbing in our Gear to add our Helper methods.
|
839
|
+
# class << self
|
840
|
+
# def included(mod)
|
841
|
+
# mod::Helpers.include(HelperMethods)
|
842
|
+
# end
|
843
|
+
# end
|
844
|
+
# end
|
845
|
+
#
|
846
|
+
# Helper methods are available in our controllers.
|
831
847
|
def pack(*a, &b)
|
832
848
|
G << g = a.shift
|
833
849
|
include g
|
@@ -868,7 +884,7 @@ module Camping
|
|
868
884
|
# which enables you to create a Camping-based application within
|
869
885
|
# another module.
|
870
886
|
#
|
871
|
-
# Here's an example of
|
887
|
+
# Here's an example of name spacing your web interface and
|
872
888
|
# code for a worker process together:
|
873
889
|
#
|
874
890
|
# module YourApplication
|
@@ -916,7 +932,7 @@ module Camping
|
|
916
932
|
|
917
933
|
# setup caller data
|
918
934
|
sp = caller[0].split('`')[0].split(":")
|
919
|
-
fl, ln
|
935
|
+
fl, ln = sp[0]+' <Cam\ping App> ', sp[1].to_i
|
920
936
|
|
921
937
|
# Create the app
|
922
938
|
Apps << a = eval(S.gsub(/Camping/,m.to_s), g, fl, 1)
|
data/lib/camping.rb
CHANGED
@@ -27,7 +27,7 @@ def render v,*a,&b;if t=lookup(v);r=@_r;@_r=o=Hash===a[-1]?a.pop: {};s=(t==true)
|
|
27
27
|
send v,*a,&b}: t.render(self,o[:locals]||{},&b);s=render(L,o.merge(L=>false)){s
|
28
28
|
} if o[L] or o[L].nil?&&lookup(L)&&!r&&v.to_s[0]!=?_;s else raise "no template: #{v}"
|
29
29
|
end end
|
30
|
-
def mab
|
30
|
+
def mab(&b)extend Mab;mab(&b)end
|
31
31
|
def r s,b,h={};b,h=h,b if Hash===b;@status=s;@headers.merge!(h);@body=b end
|
32
32
|
def redirect *a;r 302,'','Location'=>URL(*a).to_s;end
|
33
33
|
def r404 p;P%"#{p} not found"end
|
data/test/app_logger.rb
CHANGED
@@ -13,6 +13,7 @@ module Loggy::Controllers
|
|
13
13
|
log.debug("Created Logger")
|
14
14
|
log.info("Program Started")
|
15
15
|
log.warn("Nothing to do!")
|
16
|
+
log "what up"
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -50,14 +51,14 @@ class Loggy::Test < TestCase
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def test_change_log_location
|
53
|
-
Camping::Firewatch.logger = Dry.Logger(:Camping, template: Camping::Firewatch
|
54
|
+
Camping::Firewatch.logger = Dry.Logger(:Camping, template: Camping::Firewatch::default_template).add_backend(stream: "logs/production.log")
|
54
55
|
puts Camping::Firewatch.logger
|
55
56
|
get '/'
|
56
57
|
lags = File.read Dir["./**/logs/production.log"].first
|
57
58
|
assert(/(INFO).*Program Started$/.match?(lags), "Log level of INFO not found.")
|
58
59
|
|
59
60
|
# the end of the test means we set it back.
|
60
|
-
Camping::Firewatch.logger = Dry.Logger(:Camping, template: Camping::Firewatch
|
61
|
+
Camping::Firewatch.logger = Dry.Logger(:Camping, template: Camping::Firewatch::default_template).add_backend(stream: "logs/development.log")
|
61
62
|
end
|
62
63
|
|
63
64
|
# def test_changing_loggging_formatter
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source 'https://rubygems.org'
|
3
|
+
|
4
|
+
gem 'camping'
|
5
|
+
gem 'puma'
|
6
|
+
gem 'rake'
|
7
|
+
|
8
|
+
group :production do
|
9
|
+
gem 'rack-ssl-enforcer'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
end
|
14
|
+
|
15
|
+
group :test do
|
16
|
+
gem 'minitest', '~> 5.0'
|
17
|
+
gem 'minitest-reporters'
|
18
|
+
gem 'rack-test'
|
19
|
+
gem 'minitest-hooks'
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ansi (1.5.0)
|
5
|
+
base64 (0.2.0)
|
6
|
+
bigdecimal (3.1.8)
|
7
|
+
builder (3.3.0)
|
8
|
+
camping (3.2.2)
|
9
|
+
dry-logger (~> 1.0.4)
|
10
|
+
kdl (~> 1.0, >= 1.0.5)
|
11
|
+
listen (~> 3.9.0, >= 3.9.0)
|
12
|
+
mab (~> 0.0, >= 0.0.3)
|
13
|
+
rack (~> 3.0, >= 3.0.4.1)
|
14
|
+
rack-session (~> 2.0, >= 2.0.0)
|
15
|
+
rackup (~> 2.1.0)
|
16
|
+
rake (~> 13.2.1)
|
17
|
+
tilt (~> 2.3.0)
|
18
|
+
zeitwerk (~> 2.6.15, >= 2.6.15)
|
19
|
+
dry-logger (1.0.4)
|
20
|
+
ffi (1.17.0)
|
21
|
+
ffi (1.17.0-aarch64-linux-gnu)
|
22
|
+
ffi (1.17.0-aarch64-linux-musl)
|
23
|
+
ffi (1.17.0-arm-linux-gnu)
|
24
|
+
ffi (1.17.0-arm-linux-musl)
|
25
|
+
ffi (1.17.0-arm64-darwin)
|
26
|
+
ffi (1.17.0-x86-linux-gnu)
|
27
|
+
ffi (1.17.0-x86-linux-musl)
|
28
|
+
ffi (1.17.0-x86_64-darwin)
|
29
|
+
ffi (1.17.0-x86_64-linux-gnu)
|
30
|
+
ffi (1.17.0-x86_64-linux-musl)
|
31
|
+
kdl (1.0.5)
|
32
|
+
base64 (~> 0.2.0)
|
33
|
+
bigdecimal (~> 3.1.6)
|
34
|
+
racc (~> 1.5)
|
35
|
+
simpleidn (~> 0.2.1)
|
36
|
+
listen (3.9.0)
|
37
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
38
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
39
|
+
mab (0.0.3)
|
40
|
+
minitest (5.23.1)
|
41
|
+
minitest-hooks (1.5.1)
|
42
|
+
minitest (> 5.3)
|
43
|
+
minitest-reporters (1.6.1)
|
44
|
+
ansi
|
45
|
+
builder
|
46
|
+
minitest (>= 5.0)
|
47
|
+
ruby-progressbar
|
48
|
+
nio4r (2.7.3)
|
49
|
+
puma (6.4.2)
|
50
|
+
nio4r (~> 2.0)
|
51
|
+
racc (1.8.0)
|
52
|
+
rack (3.0.11)
|
53
|
+
rack-session (2.0.0)
|
54
|
+
rack (>= 3.0.0)
|
55
|
+
rack-ssl-enforcer (0.2.9)
|
56
|
+
rack-test (2.1.0)
|
57
|
+
rack (>= 1.3)
|
58
|
+
rackup (2.1.0)
|
59
|
+
rack (>= 3)
|
60
|
+
webrick (~> 1.8)
|
61
|
+
rake (13.2.1)
|
62
|
+
rb-fsevent (0.11.2)
|
63
|
+
rb-inotify (0.11.1)
|
64
|
+
ffi (~> 1.0)
|
65
|
+
ruby-progressbar (1.13.0)
|
66
|
+
simpleidn (0.2.3)
|
67
|
+
tilt (2.3.0)
|
68
|
+
webrick (1.8.1)
|
69
|
+
zeitwerk (2.6.15)
|
70
|
+
|
71
|
+
PLATFORMS
|
72
|
+
aarch64-linux-gnu
|
73
|
+
aarch64-linux-musl
|
74
|
+
arm-linux-gnu
|
75
|
+
arm-linux-musl
|
76
|
+
arm64-darwin
|
77
|
+
ruby
|
78
|
+
x86-linux-gnu
|
79
|
+
x86-linux-musl
|
80
|
+
x86_64-darwin
|
81
|
+
x86_64-linux-gnu
|
82
|
+
x86_64-linux-musl
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
camping
|
86
|
+
minitest (~> 5.0)
|
87
|
+
minitest-hooks
|
88
|
+
minitest-reporters
|
89
|
+
puma
|
90
|
+
rack-ssl-enforcer
|
91
|
+
rack-test
|
92
|
+
rake
|
93
|
+
|
94
|
+
BUNDLED WITH
|
95
|
+
2.5.11
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Rakefile
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'tempfile'
|
6
|
+
require 'open3'
|
7
|
+
|
8
|
+
task :default => :test
|
9
|
+
task :test => 'test:all'
|
10
|
+
|
11
|
+
namespace 'test' do
|
12
|
+
Rake::TestTask.new('all') do |t|
|
13
|
+
t.libs << 'test'
|
14
|
+
t.test_files = FileList['test/test_*.rb']
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'camping'
|
2
|
+
|
3
|
+
Camping.goes :Dummy
|
4
|
+
|
5
|
+
module Dummy
|
6
|
+
module Models
|
7
|
+
end
|
8
|
+
|
9
|
+
module Controllers
|
10
|
+
class Index
|
11
|
+
def get
|
12
|
+
@title = "Dummy"
|
13
|
+
render :index
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
module Helpers
|
19
|
+
end
|
20
|
+
|
21
|
+
module Views
|
22
|
+
|
23
|
+
def layout
|
24
|
+
html do
|
25
|
+
head do
|
26
|
+
title 'Dummy'
|
27
|
+
link :rel => 'stylesheet', :type => 'text/css',
|
28
|
+
:href => '/styles.css', :media => 'screen'
|
29
|
+
end
|
30
|
+
body do
|
31
|
+
h1 'Dummy'
|
32
|
+
|
33
|
+
div.wrapper! do
|
34
|
+
self << yield
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def index
|
41
|
+
h2 "Let's go Camping"
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Test Helper
|
2
|
+
$:.unshift File.dirname(__FILE__) + '/../'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'minitest/autorun'
|
10
|
+
require 'rack/test'
|
11
|
+
require 'minitest/reporters'
|
12
|
+
require 'minitest/hooks'
|
13
|
+
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
14
|
+
|
15
|
+
# Default TestCase with some helpers.
|
16
|
+
# The same stuff we use for Camping itself.
|
17
|
+
class TestCase < MiniTest::Test
|
18
|
+
include Rack::Test::Methods
|
19
|
+
include Minitest::Hooks
|
20
|
+
|
21
|
+
def self.inherited(mod)
|
22
|
+
mod.app = Object.const_get(mod.to_s[/w+/])
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
attr_accessor :app
|
28
|
+
end
|
29
|
+
|
30
|
+
def setup
|
31
|
+
super
|
32
|
+
Camping.make_camp
|
33
|
+
end
|
34
|
+
|
35
|
+
def body() last_response.body end
|
36
|
+
def app() self.class.app end
|
37
|
+
|
38
|
+
def response_body() last_response.to_a end
|
39
|
+
|
40
|
+
def assert_reverse
|
41
|
+
begin
|
42
|
+
yield
|
43
|
+
rescue Exception
|
44
|
+
else
|
45
|
+
assert false, "Block didn't fail"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def assert_body(str, message="")
|
50
|
+
case str
|
51
|
+
when Regexp
|
52
|
+
assert_match(str, last_response.body.strip, message)
|
53
|
+
else
|
54
|
+
assert_equal(str.to_s, last_response.body.strip, message)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def assert_status(code, message="")
|
59
|
+
assert_equal(code, last_response.status, message)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_silly; end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__) + '/../'
|
2
|
+
# shift to act like we're in the regular degular directory
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubygems'
|
6
|
+
rescue LoadError
|
7
|
+
end
|
8
|
+
|
9
|
+
require 'camping'
|
10
|
+
require 'minitest/autorun'
|
11
|
+
require 'minitest'
|
12
|
+
require 'rack/test'
|
13
|
+
require "minitest/reporters"
|
14
|
+
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
15
|
+
|
16
|
+
class TestCase < MiniTest::Test
|
17
|
+
include Rack::Test::Methods
|
18
|
+
|
19
|
+
def self.inherited(mod)
|
20
|
+
mod.app = Object.const_get(mod.to_s[/w+/])
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
class << self
|
25
|
+
attr_accessor :app
|
26
|
+
end
|
27
|
+
|
28
|
+
def body() last_response.body end
|
29
|
+
def app() self.class.app end
|
30
|
+
|
31
|
+
def assert_reverse
|
32
|
+
begin
|
33
|
+
yield
|
34
|
+
rescue Exception
|
35
|
+
else
|
36
|
+
assert false, "Block didn't fail"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def assert_body(str)
|
41
|
+
case str
|
42
|
+
when Regexp
|
43
|
+
assert_match(str, last_response.body.strip)
|
44
|
+
else
|
45
|
+
assert_equal(str.to_s, last_response.body.strip)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def assert_status(code)
|
50
|
+
assert_equal(code, last_response.status)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_silly; end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- why the lucky stiff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 13.2.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 13.2.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: mab
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -30,6 +44,20 @@ dependencies:
|
|
30
44
|
- - ">="
|
31
45
|
- !ruby/object:Gem::Version
|
32
46
|
version: 0.0.3
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: tilt
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.3.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.3.0
|
33
61
|
- !ruby/object:Gem::Dependency
|
34
62
|
name: rack
|
35
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,7 +121,7 @@ dependencies:
|
|
93
121
|
version: '1.0'
|
94
122
|
- - ">="
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.0.
|
124
|
+
version: 1.0.5
|
97
125
|
type: :runtime
|
98
126
|
prerelease: false
|
99
127
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -103,47 +131,61 @@ dependencies:
|
|
103
131
|
version: '1.0'
|
104
132
|
- - ">="
|
105
133
|
- !ruby/object:Gem::Version
|
106
|
-
version: 1.0.
|
134
|
+
version: 1.0.5
|
107
135
|
- !ruby/object:Gem::Dependency
|
108
136
|
name: zeitwerk
|
109
137
|
requirement: !ruby/object:Gem::Requirement
|
110
138
|
requirements:
|
111
139
|
- - "~>"
|
112
140
|
- !ruby/object:Gem::Version
|
113
|
-
version: 2.6.
|
141
|
+
version: 2.6.15
|
114
142
|
- - ">="
|
115
143
|
- !ruby/object:Gem::Version
|
116
|
-
version: 2.6.
|
144
|
+
version: 2.6.15
|
117
145
|
type: :runtime
|
118
146
|
prerelease: false
|
119
147
|
version_requirements: !ruby/object:Gem::Requirement
|
120
148
|
requirements:
|
121
149
|
- - "~>"
|
122
150
|
- !ruby/object:Gem::Version
|
123
|
-
version: 2.6.
|
151
|
+
version: 2.6.15
|
124
152
|
- - ">="
|
125
153
|
- !ruby/object:Gem::Version
|
126
|
-
version: 2.6.
|
154
|
+
version: 2.6.15
|
127
155
|
- !ruby/object:Gem::Dependency
|
128
156
|
name: listen
|
129
157
|
requirement: !ruby/object:Gem::Requirement
|
130
158
|
requirements:
|
131
159
|
- - "~>"
|
132
160
|
- !ruby/object:Gem::Version
|
133
|
-
version: 3.
|
161
|
+
version: 3.9.0
|
134
162
|
- - ">="
|
135
163
|
- !ruby/object:Gem::Version
|
136
|
-
version: 3.
|
164
|
+
version: 3.9.0
|
137
165
|
type: :runtime
|
138
166
|
prerelease: false
|
139
167
|
version_requirements: !ruby/object:Gem::Requirement
|
140
168
|
requirements:
|
141
169
|
- - "~>"
|
142
170
|
- !ruby/object:Gem::Version
|
143
|
-
version: 3.
|
171
|
+
version: 3.9.0
|
144
172
|
- - ">="
|
145
173
|
- !ruby/object:Gem::Version
|
146
|
-
version: 3.
|
174
|
+
version: 3.9.0
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
name: dry-logger
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - "~>"
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: 1.0.4
|
182
|
+
type: :runtime
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - "~>"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: 1.0.4
|
147
189
|
description:
|
148
190
|
email: why@ruby-lang.org
|
149
191
|
executables:
|
@@ -244,10 +286,19 @@ files:
|
|
244
286
|
- test/apps/sessions.rb
|
245
287
|
- test/config_reloader.rb
|
246
288
|
- test/gear/gear_nancy.rb
|
289
|
+
- test/integration/Gemfile
|
290
|
+
- test/integration/Gemfile.lock
|
291
|
+
- test/integration/README.md
|
292
|
+
- test/integration/Rakefile
|
293
|
+
- test/integration/camp.rb
|
294
|
+
- test/integration/config.kdl
|
295
|
+
- test/integration/test/test_helper.r
|
296
|
+
- test/integration/test/test_helper.rb
|
247
297
|
- test/reload_reloader.rb
|
248
298
|
- test/test_helper.rb
|
249
299
|
homepage: http://rubycamping.org/
|
250
|
-
licenses:
|
300
|
+
licenses:
|
301
|
+
- MIT
|
251
302
|
metadata: {}
|
252
303
|
post_install_message:
|
253
304
|
rdoc_options:
|
@@ -272,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
323
|
- !ruby/object:Gem::Version
|
273
324
|
version: '0'
|
274
325
|
requirements: []
|
275
|
-
rubygems_version: 3.
|
326
|
+
rubygems_version: 3.3.9
|
276
327
|
signing_key:
|
277
328
|
specification_version: 4
|
278
329
|
summary: miniature rails for anyone
|