camping 3.2.2 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +1 -10
- data/lib/camping/commands.rb +1 -72
- data/lib/camping/gear/kuddly.rb +1 -1
- data/lib/camping/gear/nancy.rb +2 -2
- data/lib/camping/tools.rb +1 -2
- data/lib/camping/version.rb +1 -1
- data/lib/camping-unabridged.rb +4 -2
- data/lib/camping.rb +4 -4
- data/test/app_camping_gear.rb +1 -1
- data/test/integration/Gemfile +18 -0
- data/test/integration/README.md +7 -0
- data/test/integration/Rakefile +44 -0
- data/test/integration/camp.rb +47 -0
- data/test/integration/config.kdl +2 -0
- data/test/integration/test/test_helper.rb +55 -0
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eb683f17e8a1026e536396b517135abfeae0597453b99202662a7ad92e055d5
|
4
|
+
data.tar.gz: 4f38e1736732750ff070e988863dd7de1410ec18e5f81a3176469ace840016d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d11e1328dd9c227b030bc5bf5594f5ce59b370ea850a2439d10c128cf472f7afc2b7f75bd8e49305b3944b2a28f128f6d719d936e3125249fb05376cdd60e70f
|
7
|
+
data.tar.gz: 6197f2e9a11a19a3f85a4b71c254ae055c85d61c98717d85aec5efb1d8005498750b68dd2291d284f454352ee10fa3b343dc05885232b6141996eab4cd4a851d
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
![Build Status](https://github.com/camping/camping/actions/workflows/
|
1
|
+
![Build Status](https://github.com/camping/camping/actions/workflows/camping.yml/badge.svg) ![Build Status](https://github.com/camping/camping/actions/workflows/integration.yml/badge.svg)
|
2
2
|
|
3
3
|
# Camping, a Microframework
|
4
4
|
|
data/Rakefile
CHANGED
@@ -86,21 +86,12 @@ Rake::TestTask.new(:reloader) do |t|
|
|
86
86
|
t.test_files = FileList['test/reload_*.rb']
|
87
87
|
end
|
88
88
|
|
89
|
-
## Reloader Tests
|
89
|
+
## Config Reloader Tests
|
90
90
|
Rake::TestTask.new(:configreloader) do |t|
|
91
91
|
t.libs << "test"
|
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
|
-
t.libs << "/"
|
101
|
-
t.test_files = FileList['test/test_*.rb']
|
102
|
-
end
|
103
|
-
|
104
95
|
## Diff
|
105
96
|
desc "Compare camping and camping-unabridged"
|
106
97
|
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
|
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/tools.rb
CHANGED
data/lib/camping/version.rb
CHANGED
data/lib/camping-unabridged.rb
CHANGED
@@ -932,7 +932,7 @@ module Camping
|
|
932
932
|
|
933
933
|
# setup caller data
|
934
934
|
sp = caller[0].split('`')[0].split(":")
|
935
|
-
fl, ln
|
935
|
+
fl, ln = sp[0]+' <Cam\ping App> ', sp[1].to_i
|
936
936
|
|
937
937
|
# Create the app
|
938
938
|
Apps << a = eval(S.gsub(/Camping/,m.to_s), g, fl, 1)
|
@@ -945,7 +945,8 @@ module Camping
|
|
945
945
|
# setup parental data
|
946
946
|
a.set :_meta, H[file: fl, line_number: ln, parent: self, root: (name != "Cam\ping" ? '/' + CampTools.to_snake(name) : '/')]
|
947
947
|
|
948
|
-
#
|
948
|
+
# configures the app, using the kuddly options and
|
949
|
+
# settings provided.
|
949
950
|
C.configure(a)
|
950
951
|
end
|
951
952
|
end
|
@@ -1024,6 +1025,7 @@ module Camping
|
|
1024
1025
|
pack Gear::Filters
|
1025
1026
|
pack Gear::Nancy
|
1026
1027
|
pack Gear::Kuddly
|
1028
|
+
pack Gear::Firewatch
|
1027
1029
|
|
1028
1030
|
C
|
1029
1031
|
end
|
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
|
@@ -74,8 +74,8 @@ k.send"#{i}=",v};k.service(*a)end
|
|
74
74
|
def use*a,&b;m=a.shift.new(method(:call),*a,&b);meta_def(:call){|e|m.call(e)};m;end
|
75
75
|
def pack*a,&b;G<< g=a.shift;include g;g.setup(self,*a,&b)end
|
76
76
|
def gear;G end;def options;O;end;def set k,v;O[k]=v end
|
77
|
-
def goes m,g=TOPLEVEL_BINDING;sp=caller[0].split('`')[0].split(":");fl,ln
|
78
|
-
sp[0]+' <Cam\ping App> ',sp[1].to_i
|
77
|
+
def goes m,g=TOPLEVEL_BINDING;sp=caller[0].split('`')[0].split(":");fl,ln=
|
78
|
+
sp[0]+' <Cam\ping App> ',sp[1].to_i;Apps<< a=eval(S.gsub(/Camping/,m.to_s),g,fl,1);caller[0]=~/:/
|
79
79
|
IO.read(a.set:__FILE__,$`)=~/^__END__/&&(b=$'.split(/^@@\s*(.+?)\s*\r?\n/m)
|
80
80
|
).shift rescue nil;a.set :_t,H[*b||[]]
|
81
81
|
a.set :_meta, H[file: fl, line_number: ln, parent: self,
|
@@ -83,4 +83,4 @@ root: (name != "Cam\ping" ? '/' + CampTools.to_snake(name) : '/')];C.configure(a
|
|
83
83
|
module Views;include X,Helpers end;module Models
|
84
84
|
Helpers.include(X,self) end;autoload:Mab,'camping/mab'
|
85
85
|
autoload:Template,'camping/template';pack Gear::Inspection;pack Gear::Filters
|
86
|
-
pack Gear::Nancy;pack Gear::Kuddly;C end
|
86
|
+
pack Gear::Nancy;pack Gear::Kuddly;pack Gear::Firewatch;C end
|
data/test/app_camping_gear.rb
CHANGED
@@ -83,7 +83,7 @@ class Packing::Test < TestCase
|
|
83
83
|
|
84
84
|
def test_gear_packed
|
85
85
|
list = Packing::G
|
86
|
-
assert (list.length ==
|
86
|
+
assert (list.length == 6), "Proper number of Gear was not packed! Gear: #{list.length}"
|
87
87
|
end
|
88
88
|
|
89
89
|
def test_right_gear_packed
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
source 'https://rubygems.org'
|
3
|
+
|
4
|
+
gem 'bundler'
|
5
|
+
gem 'rake'
|
6
|
+
gem 'puma'
|
7
|
+
gem "camping", :path => "../../"
|
8
|
+
|
9
|
+
group :production do
|
10
|
+
gem 'rack-ssl-enforcer'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'minitest', '~> 5.0'
|
15
|
+
gem 'minitest-reporters'
|
16
|
+
gem 'rack-test'
|
17
|
+
gem 'minitest-hooks'
|
18
|
+
end
|
@@ -0,0 +1,44 @@
|
|
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
|
17
|
+
|
18
|
+
# def delete_file(filename="")
|
19
|
+
# return if !File.exist? filename
|
20
|
+
# begin
|
21
|
+
# f = File.open(filename, 'r')
|
22
|
+
# ensure
|
23
|
+
# f.close unless f.nil? or f.closed?
|
24
|
+
# File.delete(filename) if File.exist? filename
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
|
28
|
+
## Integration Test
|
29
|
+
# desc "Perform an integration test"
|
30
|
+
# task :integration do
|
31
|
+
# `bundle install` # remove gems
|
32
|
+
# `bundle clean --force` # remove gems
|
33
|
+
# puts Dir.pwd
|
34
|
+
# # `gem install` # add bundler.
|
35
|
+
# `bundle install` # rewrites Gemfile.lock
|
36
|
+
# `bundle add camping --path=../../`
|
37
|
+
# # `bundle add camping puma`
|
38
|
+
# # `bundle add minitest -g=test`
|
39
|
+
# # `bundle add minitest-reporters -g=test`
|
40
|
+
# # `bundle add rack-test -g=test`
|
41
|
+
# # `bundle add minitest-hooks -g=test`
|
42
|
+
# # t.libs << "/"
|
43
|
+
# # t.test_files = FileList['test/test_*.rb']
|
44
|
+
# 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,55 @@
|
|
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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -286,10 +286,17 @@ files:
|
|
286
286
|
- test/apps/sessions.rb
|
287
287
|
- test/config_reloader.rb
|
288
288
|
- test/gear/gear_nancy.rb
|
289
|
+
- test/integration/Gemfile
|
290
|
+
- test/integration/README.md
|
291
|
+
- test/integration/Rakefile
|
292
|
+
- test/integration/camp.rb
|
293
|
+
- test/integration/config.kdl
|
294
|
+
- test/integration/test/test_helper.rb
|
289
295
|
- test/reload_reloader.rb
|
290
296
|
- test/test_helper.rb
|
291
297
|
homepage: http://rubycamping.org/
|
292
|
-
licenses:
|
298
|
+
licenses:
|
299
|
+
- MIT
|
293
300
|
metadata: {}
|
294
301
|
post_install_message:
|
295
302
|
rdoc_options:
|
@@ -314,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
314
321
|
- !ruby/object:Gem::Version
|
315
322
|
version: '0'
|
316
323
|
requirements: []
|
317
|
-
rubygems_version: 3.
|
324
|
+
rubygems_version: 3.5.11
|
318
325
|
signing_key:
|
319
326
|
specification_version: 4
|
320
327
|
summary: miniature rails for anyone
|