camping 3.2.0 → 3.2.2

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: be886915ade584cc08bca9944defc3985ff28fb9c67ea4bff803f4f5ad5c3b6a
4
- data.tar.gz: 1d0919e7257a74b7c84cb38253fbfdcee3db82f2af4c9c525db735c93cc817ff
3
+ metadata.gz: e8f510e735548917a248d02aec9a7a36f21c3c527919799c23dc32c2c717396d
4
+ data.tar.gz: 2535878776ceb1093fd24b621db216ae5917addd76a9bc0f7f8fff33abc6f4e6
5
5
  SHA512:
6
- metadata.gz: 6f59a0936824edc6d51bbb6063e839d747bba292a58f022fe539fdc9c66de660065bc84050c26829fbc3497b50394c66a34db67f96025eeb4213c624c1de6bca
7
- data.tar.gz: 143a53c658cefb5f6cc5d6195aa9096c4c26a1a5581725474bc20a3945179021fb8d817f4194391060860c033d1146476d550a52512a45a47df7824006c3f879
6
+ metadata.gz: 99b49c530feed07ee899e83d1e442b708cb44e383d8e23437896cbeea0ed945b0500edd794bd887b2d59a9be957b13556d61600d6c2d38a0389625dd1b2c6222
7
+ data.tar.gz: 1eb83d984b72e38e5a475555dd80503fbf9dcd2ca43ca6770e1b744f4f41b360698432f08c35162bc4ff422f249813a705f93e0b00a471181ba7e73b9fb74905
data/Rakefile CHANGED
@@ -92,6 +92,15 @@ 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
+ t.libs << "/"
101
+ t.test_files = FileList['test/test_*.rb']
102
+ end
103
+
95
104
  ## Diff
96
105
  desc "Compare camping and camping-unabridged"
97
106
  task :diff do
@@ -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
- @logger = Camping::Firewatch.logger = logger.nil? ? Camping::Firewatch.default_logger : logger
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
@@ -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
- @logger ||= Camping::Firewatch.logger
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
 
@@ -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 Rub web servers
772
- # pass call the app, or code that you're set up. In our case, our camping
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 first shifts the first
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 namespacing your web interface and
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
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.default_template).add_backend(stream: "logs/production.log")
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.default_template).add_backend(stream: "logs/development.log")
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
data/test/test_helper.rb CHANGED
@@ -121,7 +121,7 @@ TXT
121
121
 
122
122
  end
123
123
 
124
- class TestCase < MiniTest::Test
124
+ class TestCase < Minitest::Test
125
125
  include Rack::Test::Methods
126
126
  include CommandLineCommands
127
127
  include Minitest::Hooks
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.0
4
+ version: 3.2.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: 2024-06-06 00:00:00.000000000 Z
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.4
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.4
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.8
141
+ version: 2.6.15
114
142
  - - ">="
115
143
  - !ruby/object:Gem::Version
116
- version: 2.6.8
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.8
151
+ version: 2.6.15
124
152
  - - ">="
125
153
  - !ruby/object:Gem::Version
126
- version: 2.6.8
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.8.0
161
+ version: 3.9.0
134
162
  - - ">="
135
163
  - !ruby/object:Gem::Version
136
- version: 3.8.0
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.8.0
171
+ version: 3.9.0
144
172
  - - ">="
145
173
  - !ruby/object:Gem::Version
146
- version: 3.8.0
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:
@@ -272,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
314
  - !ruby/object:Gem::Version
273
315
  version: '0'
274
316
  requirements: []
275
- rubygems_version: 3.5.10
317
+ rubygems_version: 3.3.9
276
318
  signing_key:
277
319
  specification_version: 4
278
320
  summary: miniature rails for anyone