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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8f510e735548917a248d02aec9a7a36f21c3c527919799c23dc32c2c717396d
4
- data.tar.gz: 2535878776ceb1093fd24b621db216ae5917addd76a9bc0f7f8fff33abc6f4e6
3
+ metadata.gz: 6eb683f17e8a1026e536396b517135abfeae0597453b99202662a7ad92e055d5
4
+ data.tar.gz: 4f38e1736732750ff070e988863dd7de1410ec18e5f81a3176469ace840016d3
5
5
  SHA512:
6
- metadata.gz: 99b49c530feed07ee899e83d1e442b708cb44e383d8e23437896cbeea0ed945b0500edd794bd887b2d59a9be957b13556d61600d6c2d38a0389625dd1b2c6222
7
- data.tar.gz: 1eb83d984b72e38e5a475555dd80503fbf9dcd2ca43ca6770e1b744f4f41b360698432f08c35162bc4ff422f249813a705f93e0b00a471181ba7e73b9fb74905
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/ruby.yml/badge.svg)
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
@@ -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 < MiniTest::Test
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
@@ -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, kdl_doc, merged_configs = provided_config_file, nil, {}
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.
@@ -32,7 +32,7 @@ module Gear
32
32
  rs.chop!
33
33
 
34
34
  symbol = s.to_sym
35
- {s: s, rs: rs, symbol: symbol}
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) => {s:, rs:, symbol:}
67
+ self.normalize_routes(routes) => {rs:, symbol:}
68
68
 
69
69
  m = self.ensure_app app
70
70
 
data/lib/camping/tools.rb CHANGED
@@ -39,5 +39,4 @@ module Camping
39
39
  end
40
40
  end
41
41
 
42
- 🏕 = Camping::Tools
43
- CampTools = Camping::Tools
42
+ CampTools = 🏕 = Camping::Tools
@@ -1,5 +1,5 @@
1
1
  module Camping
2
- VERSION = "3.2"
2
+ VERSION = "3.2.4"
3
3
  def self.version
4
4
  VERSION
5
5
  end
@@ -932,7 +932,7 @@ module Camping
932
932
 
933
933
  # setup caller data
934
934
  sp = caller[0].split('`')[0].split(":")
935
- fl, ln, pr = sp[0]+' <Cam\ping App> ' , sp[1].to_i, nil
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
- # configure the app?
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 &b;extend Mab;mab &b;end
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,pr=
78
- sp[0]+' <Cam\ping App> ',sp[1].to_i,nil;Apps<< a=eval(S.gsub(/Camping/,m.to_s),g,fl,1);caller[0]=~/:/
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
@@ -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 == 5), "Proper number of Gear was not packed! Gear: #{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,7 @@
1
+ # Camping
2
+ Camping is really fun and I hope you enjoy it.
3
+
4
+ Start camping by running: `camping` in the root directory.
5
+
6
+ To start Camping in development mode run: `camping -e development
7
+
@@ -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,2 @@
1
+ // config.kdl
2
+ hostname "localhost"
@@ -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.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-10 00:00:00.000000000 Z
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.3.9
324
+ rubygems_version: 3.5.11
318
325
  signing_key:
319
326
  specification_version: 4
320
327
  summary: miniature rails for anyone