camping 3.0.2 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -9
- data/Rakefile +13 -1
- data/lib/camping/campguide.rb +14 -0
- data/lib/camping/commands.rb +121 -40
- data/lib/camping/gear/filters.rb +39 -39
- data/lib/camping/gear/kuddly.rb +0 -1
- data/lib/camping/{reloader.rb → loader.rb} +89 -16
- data/lib/camping/loads.rb +1 -1
- data/lib/camping/server.rb +4 -9
- data/lib/camping/session.rb +2 -2
- data/lib/camping/version.rb +1 -1
- data/lib/camping-unabridged.rb +3 -2
- data/lib/camping.rb +1 -1
- data/test/app_config.rb +2 -4
- data/test/app_generator.rb +39 -0
- data/test/app_inception.rb +7 -0
- data/test/app_loader.rb +53 -0
- data/test/app_sessions.rb +4 -4
- data/test/apps/loader/apps/donuts/controllers/index.rb +18 -0
- data/test/apps/loader/apps/donuts.rb +15 -0
- data/test/apps/loader/camp.rb +35 -0
- data/test/apps/reloader/config.ru +1 -1
- data/test/apps/reloader/reload_me.rb +0 -1
- data/test/apps/{reloader.rb → reloader/reloader.rb} +1 -2
- data/test/config_reloader.rb +78 -0
- data/test/reload_reloader.rb +81 -0
- data/test/test_helper.rb +42 -1
- metadata +51 -5
- data/test/app_reloader.rb +0 -69
data/lib/camping-unabridged.rb
CHANGED
@@ -724,7 +724,6 @@ module Camping
|
|
724
724
|
#
|
725
725
|
# See: https://github.com/rack/rack/blob/main/SPEC.rdoc
|
726
726
|
def call(e)
|
727
|
-
make_camp # TODO: Find a better, more consistent place for setting everything up.
|
728
727
|
k,m,*a=X.D e["PATH_INFO"],e['REQUEST_METHOD'].downcase,e
|
729
728
|
k.new(e,m,prx).service(*a).to_a
|
730
729
|
rescue
|
@@ -752,8 +751,9 @@ module Camping
|
|
752
751
|
def method_missing(m, c, *a)
|
753
752
|
h = Hash === a[-1] ? a.pop : {}
|
754
753
|
e = H[Rack::MockRequest.env_for('',h.delete(:env)||{})]
|
755
|
-
# puts "method missing failure for controller: #{c}, method: #{m} "
|
756
754
|
k = X.const_get(c).new(e,m.to_s,prx)
|
755
|
+
# rescue => error # : wrong number of arguments
|
756
|
+
# Campguide::make_sense error.message
|
757
757
|
h.each { |i, v| k.send("#{i}=", v) }
|
758
758
|
k.service(*a)
|
759
759
|
end
|
@@ -914,6 +914,7 @@ module Camping
|
|
914
914
|
# setup caller data
|
915
915
|
sp = caller[0].split('`')[0].split(":")
|
916
916
|
fl, ln, pr = sp[0], sp[1].to_i, nil
|
917
|
+
# ln = 0
|
917
918
|
|
918
919
|
# Create the app
|
919
920
|
Apps << a = eval(S.gsub(/Camping/,m.to_s), g, fl, ln)
|
data/lib/camping.rb
CHANGED
@@ -66,7 +66,7 @@ k.meta_def(:urls){[A.(k,"#{c.to_s.scan(/.[^A-Z]*/).map(&N.method(:[]))*'/'}",p)]
|
|
66
66
|
.respond_to?(:urls) || mu==true)};end end;I=R()end;X=Controllers
|
67
67
|
class<<self;def make_camp;X.M prx;Apps.map(&:make_camp) end;def routes;(Apps.map(&:routes)<<X.v).flatten end
|
68
68
|
def prx;@_prx||=CampTools.normalize_slashes(O[:url_prefix])end
|
69
|
-
def call e;
|
69
|
+
def call e;k,m,*a=X.D e["PATH_INFO"],e['REQUEST_METHOD'].
|
70
70
|
downcase,e;k.new(e,m,prx).service(*a).to_a;rescue;r500(:I,k,m,$!,:env=>e).to_a end
|
71
71
|
def method_missing m,c,*a;h=Hash===a[-1]?a.pop : {};e=H[Rack::MockRequest.
|
72
72
|
env_for('',h.delete(:env)||{})];k=X.const_get(c).new(e,m.to_s,prx);h.each{|i,v|
|
data/test/app_config.rb
CHANGED
@@ -5,16 +5,14 @@ module Config end
|
|
5
5
|
|
6
6
|
class Config::Test < TestCase
|
7
7
|
|
8
|
-
def
|
8
|
+
def before_all
|
9
9
|
write_config()
|
10
10
|
Camping.goes :Config
|
11
11
|
@options = Camping::Apps.select{|a| a.name == "Config" }.first.options
|
12
|
-
super
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
14
|
+
def after_all
|
16
15
|
trash_config()
|
17
|
-
super
|
18
16
|
end
|
19
17
|
|
20
18
|
def test_config
|
data/test/app_generator.rb
CHANGED
@@ -40,4 +40,43 @@ class Generator::Test < TestCase
|
|
40
40
|
|
41
41
|
end
|
42
42
|
|
43
|
+
# Generates expected directory Structure
|
44
|
+
#
|
45
|
+
# Camping has an expected directory structure:
|
46
|
+
#
|
47
|
+
# .gitignore
|
48
|
+
# .ruby-version
|
49
|
+
# Gemfile
|
50
|
+
# Rakefile
|
51
|
+
# camp.rb
|
52
|
+
# config.kdl
|
53
|
+
# src/
|
54
|
+
# lib/
|
55
|
+
# public/
|
56
|
+
# test/
|
57
|
+
# apps/
|
58
|
+
#
|
59
|
+
# This test checks to make certain that the generator command creates this
|
60
|
+
# directory structure.
|
61
|
+
def test_app_generates_directory_structure
|
62
|
+
move_to_tmp
|
63
|
+
Camping::Commands.new_cmd
|
64
|
+
|
65
|
+
res, ignored = [Dir.glob('*').select {|f| !File.directory? f },
|
66
|
+
Dir.glob('*').select {|f| File.directory? f }], Dir.glob(".*")
|
67
|
+
|
68
|
+
assert res[0].include?('Gemfile'), "mising Gemfile"
|
69
|
+
assert res[0].include?('README.md'), "missing README.md"
|
70
|
+
assert res[0].include?('Rakefile'), "missing Rakefile"
|
71
|
+
assert res[0].include?('camp.rb'), "missing camp.rb"
|
72
|
+
assert res[0].include?('config.kdl'), "missing config.kdl"
|
73
|
+
assert res[1].include?('public'), "missing public folder."
|
74
|
+
assert res[1].include?('test'), "missing test folder."
|
75
|
+
|
76
|
+
assert ignored.include?('.gitignore'), ".gitignore is missing."
|
77
|
+
assert ignored.include?('.ruby-version'), ".ruby-version is missing."
|
78
|
+
|
79
|
+
leave_tmp
|
80
|
+
end
|
81
|
+
|
43
82
|
end
|
data/test/app_inception.rb
CHANGED
@@ -2,6 +2,13 @@ require 'test_helper'
|
|
2
2
|
require 'camping'
|
3
3
|
require 'camping/commands'
|
4
4
|
|
5
|
+
# The idea behind the inception stuff is that you can inherit settings
|
6
|
+
# templates, etc... from a Camping app and just... extend it.
|
7
|
+
# This is a tabled, but not abandoned idea. It became a little difficult
|
8
|
+
# to inherit all of these things, along with views, Models, etc... that's
|
9
|
+
# associated with a camping app. Getting this to work would mean a big
|
10
|
+
# rewrite of Camping's core, which is a no no.
|
11
|
+
|
5
12
|
Camping.goes :Inception
|
6
13
|
# Inception.goes :Leonardo
|
7
14
|
# Leonardo.goes :Donatello
|
data/test/app_loader.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'camping/loader'
|
4
|
+
|
5
|
+
module Donuts end
|
6
|
+
module Loader end
|
7
|
+
|
8
|
+
# for Reloading stuff
|
9
|
+
module TestCaseLoaderToo
|
10
|
+
def loader
|
11
|
+
@loader ||= Camping::Loader.new(file)
|
12
|
+
end
|
13
|
+
|
14
|
+
def before_all
|
15
|
+
super
|
16
|
+
move_to_loader
|
17
|
+
loader.reload!
|
18
|
+
end
|
19
|
+
|
20
|
+
def after_all
|
21
|
+
leave_loader
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Donuts::Test < TestCase
|
27
|
+
include TestCaseLoaderToo
|
28
|
+
BASE = File.expand_path('../apps/loader/camp', __FILE__)
|
29
|
+
def file; BASE + '.rb' end
|
30
|
+
|
31
|
+
def test_that_our_apps_are_there
|
32
|
+
assert loader.apps.include?(:Donuts), "Donuts not found: #{loader.apps}"
|
33
|
+
assert loader.apps.include?(:Loader), "Loader not found: #{loader.apps}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_output
|
37
|
+
# Checks that the view is overwritten successfully more than once.
|
38
|
+
get '/'
|
39
|
+
assert_body "chunky bacon", "Response is wrong in the loader."
|
40
|
+
assert_equal "text/html", last_response.headers['content-type']
|
41
|
+
|
42
|
+
# Checks that the view is not overwritten, because it's not reopened.
|
43
|
+
get '/post'
|
44
|
+
assert_body "_why", "Response is wrong in the loader."
|
45
|
+
assert_equal "text/html", last_response.headers['content-type']
|
46
|
+
|
47
|
+
# Checks that a downstream view is loaded properly.
|
48
|
+
get '/people'
|
49
|
+
assert_body "People are great am I right?", "Response is wrong in the loader."
|
50
|
+
assert_equal "text/html", last_response.headers['content-type']
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/test/app_sessions.rb
CHANGED
@@ -44,8 +44,8 @@ class Sessions::Test < TestCase
|
|
44
44
|
app.set :secret, "whateverloser"
|
45
45
|
begin
|
46
46
|
app.include Camping::Session
|
47
|
-
rescue
|
48
|
-
message = "
|
47
|
+
rescue InsecureSecretError => e
|
48
|
+
message = "Your Session Secret is too short. Minimum length is 64."
|
49
49
|
assert_equal(e.message, message, "You're session secret wasn't long enough.")
|
50
50
|
end
|
51
51
|
|
@@ -54,11 +54,11 @@ class Sessions::Test < TestCase
|
|
54
54
|
begin
|
55
55
|
app.set :secret, "whateverloserwhateverloserwhateverloserwhateverloserwhateverloser"
|
56
56
|
app.include Camping::Session
|
57
|
-
rescue
|
57
|
+
rescue InsecureSecretError => e
|
58
58
|
message = e
|
59
59
|
end
|
60
60
|
|
61
|
-
assert_equal(e, message, "
|
61
|
+
assert_equal(e, message, "Your session secret wasn't long enough.")
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'camping'
|
2
|
+
|
3
|
+
Camping.goes :Loader
|
4
|
+
|
5
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
6
|
+
|
7
|
+
Camping.goes :Donuts
|
8
|
+
|
9
|
+
module Donuts
|
10
|
+
module Controllers
|
11
|
+
class Index
|
12
|
+
def get
|
13
|
+
render :index
|
14
|
+
end
|
15
|
+
end
|
16
|
+
class Post
|
17
|
+
def get
|
18
|
+
render :post
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# how to add a layout to every page
|
24
|
+
module Views
|
25
|
+
|
26
|
+
def index
|
27
|
+
"_why"
|
28
|
+
end
|
29
|
+
|
30
|
+
def post
|
31
|
+
"_why"
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'camping/loader'
|
4
|
+
|
5
|
+
$counter = 0
|
6
|
+
|
7
|
+
# for Reloading stuff
|
8
|
+
module TestCaseLoader
|
9
|
+
|
10
|
+
def loader
|
11
|
+
@loader ||= Camping::Loader.new(file)
|
12
|
+
end
|
13
|
+
|
14
|
+
def before_all
|
15
|
+
super
|
16
|
+
move_to_reloader
|
17
|
+
loader.reload!
|
18
|
+
assert Object.const_defined?(:Reloader), "Reloader didn't load app"
|
19
|
+
# puts "before_all called"
|
20
|
+
end
|
21
|
+
|
22
|
+
def after_all
|
23
|
+
# puts "after_all called"
|
24
|
+
assert Object.const_defined?(:Reloader), "Test removed app"
|
25
|
+
loader.remove_constants
|
26
|
+
# breaks in CI for some reason.
|
27
|
+
# assert !Object.const_defined?(:Reloader), "Loader didn't remove app"
|
28
|
+
leave_reloader
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class TestConfigRu < TestCase
|
35
|
+
include TestCaseLoader
|
36
|
+
|
37
|
+
BASE = File.expand_path('../apps/reloader', __FILE__)
|
38
|
+
def file; BASE + '/config.ru' end
|
39
|
+
|
40
|
+
def setup
|
41
|
+
super
|
42
|
+
$counter = 0
|
43
|
+
loader.reload!
|
44
|
+
# puts "setup called"
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_counter
|
48
|
+
assert_equal 1, $counter
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_forced_reload
|
52
|
+
loader.reload!
|
53
|
+
assert_equal 2, $counter
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_that_touch_was_touched
|
57
|
+
FileUtils.touch(BASE + '/reloader.rb')
|
58
|
+
assert_equal 1, $counter
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_mtime_reload
|
62
|
+
loader.reload
|
63
|
+
assert_equal 1, $counter
|
64
|
+
|
65
|
+
FileUtils.touch(BASE + '/reloader.rb')
|
66
|
+
loader.reload
|
67
|
+
assert_equal 2, $counter
|
68
|
+
|
69
|
+
FileUtils.touch(BASE + '/reload_me.rb')
|
70
|
+
loader.reload
|
71
|
+
assert_equal 3, $counter
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_name
|
75
|
+
assert_equal Reloader, loader.apps[:reloader]
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'camping/loader'
|
4
|
+
|
5
|
+
$counter = 0
|
6
|
+
|
7
|
+
# for Reloading stuff
|
8
|
+
module TestCaseLoader
|
9
|
+
|
10
|
+
def loader
|
11
|
+
@loader ||= Camping::Loader.new(file)
|
12
|
+
end
|
13
|
+
|
14
|
+
def before_all
|
15
|
+
super
|
16
|
+
move_to_reloader
|
17
|
+
loader.reload!
|
18
|
+
assert Object.const_defined?(:Reloader), "Reloader didn't load app"
|
19
|
+
# puts "before_all called"
|
20
|
+
end
|
21
|
+
|
22
|
+
def after_all
|
23
|
+
# puts "after_all called"
|
24
|
+
assert Object.const_defined?(:Reloader), "Test removed app"
|
25
|
+
loader.remove_constants
|
26
|
+
assert !Object.const_defined?(:Reloader), "Loader didn't remove app"
|
27
|
+
leave_reloader
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
class TestLoader < TestCase
|
34
|
+
include TestCaseLoader
|
35
|
+
|
36
|
+
BASE = File.expand_path('../apps/reloader', __FILE__)
|
37
|
+
def file; BASE + '/reloader.rb' end
|
38
|
+
|
39
|
+
def setup
|
40
|
+
super
|
41
|
+
$counter = 0
|
42
|
+
loader.reload!
|
43
|
+
# puts "setup called"
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_counter
|
47
|
+
assert_equal 1, $counter
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_forced_reload
|
51
|
+
loader.reload!
|
52
|
+
assert_equal 2, $counter
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_that_touch_was_touched
|
56
|
+
FileUtils.touch(BASE + '/reloader.rb')
|
57
|
+
assert_equal 1, $counter
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_mtime_reload
|
61
|
+
loader.reload
|
62
|
+
assert_equal 1, $counter
|
63
|
+
|
64
|
+
FileUtils.touch(BASE + '/reloader.rb')
|
65
|
+
loader.reload
|
66
|
+
assert_equal 2, $counter
|
67
|
+
|
68
|
+
FileUtils.touch(BASE + '/reload_me.rb')
|
69
|
+
loader.reload
|
70
|
+
assert_equal 3, $counter
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# class TestConfigRu < TestLoader
|
75
|
+
# BASE = File.expand_path('../apps/reloader', __FILE__)
|
76
|
+
# def file; BASE + '/config.ru' end
|
77
|
+
|
78
|
+
# def test_name
|
79
|
+
# assert_equal Reloader, loader.apps[:reloader]
|
80
|
+
# end
|
81
|
+
# end
|
data/test/test_helper.rb
CHANGED
@@ -14,7 +14,8 @@ end
|
|
14
14
|
|
15
15
|
require 'minitest/autorun'
|
16
16
|
require 'rack/test'
|
17
|
-
require
|
17
|
+
require 'minitest/reporters'
|
18
|
+
require 'minitest/hooks'
|
18
19
|
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
19
20
|
|
20
21
|
|
@@ -32,6 +33,40 @@ module CommandLineCommands
|
|
32
33
|
`rm -rf test/tmp` if File.exist?('test/tmp')
|
33
34
|
end
|
34
35
|
|
36
|
+
# reloader helpers:
|
37
|
+
# move_to_apps
|
38
|
+
# moves to the apps directory in /test
|
39
|
+
def move_to_reloader
|
40
|
+
@original_dir = Dir.pwd
|
41
|
+
Dir.chdir "test"
|
42
|
+
Dir.chdir "apps"
|
43
|
+
Dir.chdir "reloader"
|
44
|
+
Dir.mkdir("apps") unless Dir.exist?("apps")
|
45
|
+
Dir.mkdir("lib") unless Dir.exist?("lib")
|
46
|
+
end
|
47
|
+
|
48
|
+
# deletes the temporary directories found in the /apps directory for reloader testing.
|
49
|
+
def leave_reloader
|
50
|
+
Dir.chdir @original_dir
|
51
|
+
`rm -rf test/apps/reloader/apps` if File.exist?('test/apps/reloader/apps')
|
52
|
+
`rm -rf test/apps/reloader/lib` if File.exist?('test/apps/reloader/lib')
|
53
|
+
end
|
54
|
+
|
55
|
+
# Moves to the loader directory
|
56
|
+
def move_to_loader
|
57
|
+
@original_dir = Dir.pwd
|
58
|
+
Dir.chdir "test"
|
59
|
+
Dir.chdir "apps"
|
60
|
+
Dir.chdir "loader"
|
61
|
+
Dir.mkdir("apps") unless Dir.exist?("apps")
|
62
|
+
Dir.mkdir("lib") unless Dir.exist?("lib")
|
63
|
+
end
|
64
|
+
|
65
|
+
# deletes the temporary directories found in the /apps directory for reloader testing.
|
66
|
+
def leave_loader
|
67
|
+
Dir.chdir @original_dir
|
68
|
+
end
|
69
|
+
|
35
70
|
def write(file, content)
|
36
71
|
raise "cannot write nil" unless file
|
37
72
|
file = tmp_file(file)
|
@@ -70,6 +105,7 @@ end
|
|
70
105
|
class TestCase < MiniTest::Test
|
71
106
|
include Rack::Test::Methods
|
72
107
|
include CommandLineCommands
|
108
|
+
include Minitest::Hooks
|
73
109
|
|
74
110
|
def self.inherited(mod)
|
75
111
|
mod.app = Object.const_get(mod.to_s[/\w+/])
|
@@ -80,6 +116,11 @@ class TestCase < MiniTest::Test
|
|
80
116
|
attr_accessor :app
|
81
117
|
end
|
82
118
|
|
119
|
+
def setup
|
120
|
+
super
|
121
|
+
Camping.make_camp
|
122
|
+
end
|
123
|
+
|
83
124
|
def body() last_response.body end
|
84
125
|
def app() self.class.app end
|
85
126
|
|
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.
|
4
|
+
version: 3.1.2
|
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: 2023-
|
11
|
+
date: 2023-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mab
|
@@ -104,6 +104,46 @@ dependencies:
|
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: 1.0.3
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: zeitwerk
|
109
|
+
requirement: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 2.6.8
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 2.6.8
|
117
|
+
type: :runtime
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 2.6.8
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.6.8
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: listen
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - "~>"
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 3.8.0
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: 3.8.0
|
137
|
+
type: :runtime
|
138
|
+
prerelease: false
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 3.8.0
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 3.8.0
|
107
147
|
description:
|
108
148
|
email: why@ruby-lang.org
|
109
149
|
executables:
|
@@ -153,14 +193,15 @@ files:
|
|
153
193
|
- lib/camping-unabridged.rb
|
154
194
|
- lib/camping.rb
|
155
195
|
- lib/camping/ar.rb
|
196
|
+
- lib/camping/campguide.rb
|
156
197
|
- lib/camping/commands.rb
|
157
198
|
- lib/camping/gear/filters.rb
|
158
199
|
- lib/camping/gear/inspection.rb
|
159
200
|
- lib/camping/gear/kuddly.rb
|
160
201
|
- lib/camping/gear/nancy.rb
|
202
|
+
- lib/camping/loader.rb
|
161
203
|
- lib/camping/loads.rb
|
162
204
|
- lib/camping/mab.rb
|
163
|
-
- lib/camping/reloader.rb
|
164
205
|
- lib/camping/server.rb
|
165
206
|
- lib/camping/session.rb
|
166
207
|
- lib/camping/template.rb
|
@@ -177,25 +218,30 @@ files:
|
|
177
218
|
- test/app_helpers.rb
|
178
219
|
- test/app_inception.rb
|
179
220
|
- test/app_inline_templates.rb
|
221
|
+
- test/app_loader.rb
|
180
222
|
- test/app_markup.rb
|
181
223
|
- test/app_migrations.rb
|
182
224
|
- test/app_partials.rb
|
183
225
|
- test/app_prefixed.rb
|
184
|
-
- test/app_reloader.rb
|
185
226
|
- test/app_route_generating.rb
|
186
227
|
- test/app_sessions.rb
|
187
228
|
- test/app_simple.rb
|
188
229
|
- test/apps/env_debug.rb
|
189
230
|
- test/apps/forms.rb
|
190
231
|
- test/apps/forward_to_other_controller.rb
|
232
|
+
- test/apps/loader/apps/donuts.rb
|
233
|
+
- test/apps/loader/apps/donuts/controllers/index.rb
|
234
|
+
- test/apps/loader/camp.rb
|
191
235
|
- test/apps/migrations.rb
|
192
236
|
- test/apps/misc.rb
|
193
|
-
- test/apps/reloader.rb
|
194
237
|
- test/apps/reloader/config.ru
|
195
238
|
- test/apps/reloader/reload_me.rb
|
239
|
+
- test/apps/reloader/reloader.rb
|
196
240
|
- test/apps/reloader_indirect.rb
|
197
241
|
- test/apps/sessions.rb
|
242
|
+
- test/config_reloader.rb
|
198
243
|
- test/gear/gear_nancy.rb
|
244
|
+
- test/reload_reloader.rb
|
199
245
|
- test/test_helper.rb
|
200
246
|
homepage: http://camping.rubyforge.org/
|
201
247
|
licenses: []
|
data/test/app_reloader.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'camping/reloader'
|
4
|
-
|
5
|
-
$counter = 0
|
6
|
-
|
7
|
-
module TestCaseReloader
|
8
|
-
def reloader
|
9
|
-
@reloader ||= Camping::Reloader.new(file)
|
10
|
-
end
|
11
|
-
|
12
|
-
def setup
|
13
|
-
super
|
14
|
-
reloader.reload!
|
15
|
-
assert Object.const_defined?(:Reloader), "Reloader didn't load app"
|
16
|
-
end
|
17
|
-
|
18
|
-
def teardown
|
19
|
-
super
|
20
|
-
assert Object.const_defined?(:Reloader), "Test removed app"
|
21
|
-
reloader.remove_apps
|
22
|
-
assert !Object.const_defined?(:Reloader), "Reloader didn't remove app"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
class TestReloader < TestCase
|
27
|
-
include TestCaseReloader
|
28
|
-
BASE = File.expand_path('../apps/reloader', __FILE__)
|
29
|
-
|
30
|
-
def file; BASE + '.rb' end
|
31
|
-
|
32
|
-
def setup
|
33
|
-
$counter = 0
|
34
|
-
super
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_counter
|
38
|
-
assert_equal 1, $counter
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_forced_reload
|
42
|
-
reloader.reload!
|
43
|
-
assert_equal 2, $counter
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_mtime_reload
|
47
|
-
reloader.reload
|
48
|
-
assert_equal 1, $counter
|
49
|
-
|
50
|
-
FileUtils.touch(BASE + '.rb')
|
51
|
-
sleep 1
|
52
|
-
reloader.reload
|
53
|
-
assert_equal 2, $counter
|
54
|
-
|
55
|
-
FileUtils.touch(BASE + '/reload_me.rb')
|
56
|
-
sleep 1
|
57
|
-
reloader.reload
|
58
|
-
assert_equal 3, $counter
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
class TestConfigRu < TestReloader
|
63
|
-
BASE = File.expand_path('../apps/reloader', __FILE__)
|
64
|
-
def file; BASE + '/config.ru' end
|
65
|
-
|
66
|
-
def test_name
|
67
|
-
assert_equal Reloader, reloader.apps[:reloader]
|
68
|
-
end
|
69
|
-
end
|