camping 3.2.4 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -16
- data/book/01_introduction.md +2 -3
- data/book/02_getting_started.md +39 -77
- data/lib/camping/loader.rb +6 -5
- data/lib/camping/version.rb +1 -1
- data/test/app_loader.rb +13 -0
- data/test/config_reloader.rb +3 -3
- data/test/integration/Rakefile +0 -27
- data/test/reload_reloader.rb +7 -10
- data/test/test_helper.rb +0 -20
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 915bc9e71d2023113e730ce571ac0b6327946cc9d230eb4f3f4c5803b71551ec
|
4
|
+
data.tar.gz: 0b7246146b74d7937ae77115c093605cd59a2e505465968effeacfe95ab3a666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af96a7f36ce4893de7af94c448cd96013fe7a85812abc2e55a98932129a4575cd3513dbc7894f49f3a312ba2c248a41180684897034a976577db18c840181ab6
|
7
|
+
data.tar.gz: cb1d95c481f217eb848934fe022a5409a21b9bb31e4f7d6eb3874ba9774797a32470fd9c4179e006879948f76c6a682063ed962294feb170753b3f77beb6d0b3
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
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
|
-
# Camping, a Microframework
|
3
|
+
# ⛺️ Camping, a Microframework
|
4
4
|
|
5
5
|
Camping is a micro web framework which stays as small as possible.
|
6
6
|
You can probably view the complete source code on a single page. But, you
|
@@ -72,12 +72,6 @@ Line and enter:
|
|
72
72
|
gem install camping
|
73
73
|
```
|
74
74
|
|
75
|
-
Also make certain to have Bundler installed:
|
76
|
-
|
77
|
-
```
|
78
|
-
gem install bundler
|
79
|
-
```
|
80
|
-
|
81
75
|
~~Even better, install the Camping Omnibus, a full package of recommended libs:~~ Camping Omnibus will return for summer vacation.
|
82
76
|
|
83
77
|
Now make a new directory filled with your camp essentials using the `camping new` command:
|
@@ -109,10 +103,16 @@ documentation for all the different parts of Camping.
|
|
109
103
|
useful tricks that we've collected over the years. Don't be afraid to share
|
110
104
|
your own discoveries; the more, the better!
|
111
105
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
106
|
+
We have a Discord channel over at the Ruby Punks community, so if you feel
|
107
|
+
like chatting with us, you should join [#camping](https://discord.gg/JSmPBsWgFt). Once our chattin' leads to action, we open up an issue on Github and move the conversation over there.
|
108
|
+
|
109
|
+
## Contributing
|
110
|
+
|
111
|
+
Camping is under active development, and we'd love some help!. Our current focus is bug fixes, documentation, and tests. We have a [number of issues](https://github.com/camping/camping/issues?q=is%3Aissue+is%3Aopen+label%3A%22Great+for+new+Contributors%22) open for new contributors to get crackin!
|
112
|
+
|
113
|
+
To begin contributing, [Fork Camping](https://github.com/camping/camping/fork), Then make a new branch, (`git checkout -b my_branch_name`) with your changes. When you're ready to bring all that hard work on over, open a draft PR and ping Karl to take a look, He'll help you fix any issues and help you get it inside of old Camping.
|
114
|
+
|
115
|
+
Have a suggestion? Open an issue with what you think we ought to be doing with our lives, and we'll talk about it. Don't be shy.
|
116
116
|
|
117
117
|
## Running Tests
|
118
118
|
|
@@ -120,11 +120,8 @@ Tests should be run using bundler and rake: `bundle exec rake`.
|
|
120
120
|
|
121
121
|
## Minting Releases
|
122
122
|
|
123
|
-
We use Ruby Gems to distribute versions of Camping.
|
123
|
+
We use Ruby Gems to distribute versions of Camping. When you're ready to mint a release, run: `gem build -o camping.gem`, then `gem push camping.gem`.
|
124
124
|
|
125
125
|
## Authors
|
126
126
|
|
127
|
-
Camping was originally crafted by [why the lucky stiff](http://en.wikipedia.org/wiki/Why_the_lucky_stiff),
|
128
|
-
but is now maintained by the _community_. This simply means that if we like your
|
129
|
-
patch, it will be applied. Everything is managed through [the mailing list](http://rubyforge.org/mailman/listinfo/camping-list),
|
130
|
-
so just subscribe and you can instantly take part in shaping Camping.
|
127
|
+
Camping was originally crafted by [why the lucky stiff](http://en.wikipedia.org/wiki/Why_the_lucky_stiff), but is now maintained by the _community_. This simply means that if we like your patch, it will be applied. Everything is managed through this Github repo, so just [open an issue](https://github.com/camping/camping/issues/new) and you can instantly take part in shaping Camping.
|
data/book/01_introduction.md
CHANGED
@@ -11,9 +11,8 @@ currently a very much work in progress, and we'll be very grateful if you want
|
|
11
11
|
to help out.)
|
12
12
|
|
13
13
|
If you at any moment need some help or have any questions or comments, we
|
14
|
-
highly recommend [
|
15
|
-
|
16
|
-
at [#camping @ irc.freenode.net](http://java.freenode.net/?channel=camping)
|
14
|
+
highly recommend [opening an issue](https://github.com/camping/camping/issues/new) to ask for help. We've got plenty of nice people willing to help. We also have a Discord channel
|
15
|
+
at [rubypunks](https://discord.gg/JSmPBsWgFt)
|
17
16
|
if you're into that sort of thing.
|
18
17
|
|
19
18
|
Enough talk. Ready? Let's ["get started"](02_getting_started.md).
|
data/book/02_getting_started.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Getting Started
|
2
2
|
|
3
|
+
You'll need Ruby Gems to get camping. Install camping like so:
|
4
|
+
|
5
|
+
```bash
|
6
|
+
gem install camping
|
7
|
+
```
|
8
|
+
|
3
9
|
Start a new text file called camp.rb. Here's what you put inside:
|
4
10
|
|
5
11
|
```ruby
|
@@ -10,7 +16,7 @@ Camping.goes :Nuts
|
|
10
16
|
Save it. Then, open a command prompt in the same directory. You'll want to
|
11
17
|
run:
|
12
18
|
|
13
|
-
```
|
19
|
+
```bash
|
14
20
|
$ camping
|
15
21
|
```
|
16
22
|
|
@@ -20,8 +26,7 @@ And you should get a message which reads:
|
|
20
26
|
** Camping running on 0.0.0.0:3301.
|
21
27
|
```
|
22
28
|
|
23
|
-
This means that right now The Camping Server is running on port 3301 on your
|
24
|
-
machine. Open your browser and visit http://localhost:3301/.
|
29
|
+
This means that right now The Camping Server is running on port 3301 on your machine. Open your browser and visit http://localhost:3301/.
|
25
30
|
|
26
31
|
Your browser window should show:
|
27
32
|
|
@@ -31,29 +36,23 @@ Camping Problem!
|
|
31
36
|
/ Not found
|
32
37
|
```
|
33
38
|
|
34
|
-
No problem with that. The Camping Server is running, but it doesn't know what
|
35
|
-
to show. Let's tell them.
|
39
|
+
No problem with that. The Camping Server is running, but it doesn't know what to show. Let's tell them.
|
36
40
|
|
37
41
|
## Hello clock
|
38
42
|
|
39
|
-
So, you've got Camping installed and it's running. Keep it running. You can
|
40
|
-
edit files and The Camping Server will reload automatically. When you need to
|
41
|
-
stop the server, press Control-C.
|
43
|
+
So, you've got Camping installed and it's running. Keep it running. You can edit files and The Camping Server will reload automatically. When you need to stop the server, press **Control-C**.
|
42
44
|
|
43
45
|
Let's show something. At the bottom of camp.rb add:
|
44
46
|
|
45
47
|
```ruby
|
46
48
|
module Nuts::Controllers
|
47
49
|
class Index < R '/'
|
48
|
-
def get
|
49
|
-
Time.now.to_s
|
50
|
-
end
|
50
|
+
def get = Time.now.to_s
|
51
51
|
end
|
52
52
|
end
|
53
53
|
```
|
54
54
|
|
55
|
-
Save the file and refresh the browser window. Your browser window should show
|
56
|
-
the time, e.g.
|
55
|
+
Save the file and refresh the browser window. Your browser window should show the time, e.g.
|
57
56
|
|
58
57
|
```
|
59
58
|
Sun Jul 15 12:56:15 +0200 2007
|
@@ -61,9 +60,7 @@ Sun Jul 15 12:56:15 +0200 2007
|
|
61
60
|
|
62
61
|
## Enjoying the view
|
63
62
|
|
64
|
-
The Camping microframework allows us to separate our code using the MVC
|
65
|
-
(Model-View-Controller) design pattern. Let's add a view to our Nuts
|
66
|
-
application. Replace the <tt>module Nuts::Controllers</tt> with:
|
63
|
+
The Camping microframework allows us to separate our code using the MVC (Model-View-Controller) design pattern. Let's add a view to our Nuts application. Replace the <tt>module Nuts::Controllers</tt> with:
|
67
64
|
|
68
65
|
```ruby
|
69
66
|
module Nuts::Controllers
|
@@ -76,6 +73,8 @@ module Nuts::Controllers
|
|
76
73
|
end
|
77
74
|
```
|
78
75
|
|
76
|
+
And below it add:
|
77
|
+
|
79
78
|
```ruby
|
80
79
|
module Nuts::Views
|
81
80
|
def layout
|
@@ -87,14 +86,11 @@ module Nuts::Views
|
|
87
86
|
end
|
88
87
|
end
|
89
88
|
|
90
|
-
def sundial
|
91
|
-
p "The current time is: #{@time}"
|
92
|
-
end
|
89
|
+
def sundial = p "The current time is: #{@time}"
|
93
90
|
end
|
94
91
|
```
|
95
92
|
|
96
|
-
Save the file, refresh your browser window and it should show a message
|
97
|
-
like:
|
93
|
+
Save the file, refresh your browser window and it should show a message like:
|
98
94
|
|
99
95
|
```
|
100
96
|
The current time is: Sun Jul 15 13:05:41 +0200 2013
|
@@ -102,59 +98,39 @@ The current time is: Sun Jul 15 13:05:41 +0200 2013
|
|
102
98
|
|
103
99
|
And the window title reads "Nuts And GORP".
|
104
100
|
|
105
|
-
Here you can see we call <tt>render :sundial</tt> from our controller. This
|
106
|
-
does exactly what it says, and renders our <tt>sundial</tt> method. We've also
|
107
|
-
added a special method called <tt>layout</tt> which Camping will automatically
|
108
|
-
wrap our sundial output in. If you're familiar with HTML, you'll see that our
|
109
|
-
view contains what looks HTML tag names. This is Markaby, which is like
|
110
|
-
writing HTML using Ruby!
|
101
|
+
Here you can see we call <tt>render :sundial</tt> from our controller. This does exactly what it says, and renders our <tt>sundial</tt> method. We've also added a special method called <tt>layout</tt> which Camping will automatically wrap our sundial output in. If you're familiar with HTML, you'll see that our view contains what looks HTML tag names. This is Markaby, which is like writing HTML using Ruby!
|
111
102
|
|
112
|
-
Soon enough, you'll find that you can return anything from the controller, and
|
113
|
-
it will be sent to the browser. But let's keep that for later and start
|
114
|
-
investigating the routes.
|
103
|
+
Soon enough, you'll find that you can return anything from the controller, and it will be sent to the browser. But let's keep that for later and start investigating the routes.
|
115
104
|
|
116
105
|
## Routes
|
117
106
|
|
118
|
-
You probably noticed the weird <tt>R '/'</tt> syntax in the previous page.
|
119
|
-
This is an uncommon feature of Ruby that is used in our favorite
|
120
|
-
microframework, to describe the routes which the controller can be accessed
|
121
|
-
on.
|
107
|
+
You probably noticed the weird <tt>R '/'</tt> syntax in the previous page. This is an uncommon feature of Ruby that is used in our favorite microframework, to describe the routes which the controller can be accessed on.
|
122
108
|
|
123
|
-
These routes can be very powerful, but we're going to have look at the
|
124
|
-
simplest ones first.
|
109
|
+
These routes can be very powerful, but we're going to have look at the simplest ones first.
|
125
110
|
|
126
111
|
```ruby
|
127
112
|
module Nuts::Controllers
|
128
113
|
class Words < R '/welcome/to/my/site'
|
129
|
-
def get
|
130
|
-
"You got here by: /welcome/to/my/site"
|
131
|
-
end
|
114
|
+
def get = "You got here by: /welcome/to/my/site"
|
132
115
|
end
|
133
116
|
|
134
117
|
class Digits < R '/nuts/(\d+)'
|
135
|
-
def get(number)
|
136
|
-
"You got here by: /nuts/#{number}"
|
137
|
-
end
|
118
|
+
def get(number) = "You got here by: /nuts/#{number}"
|
138
119
|
end
|
139
120
|
|
140
121
|
class Segment < R '/gorp/([^/]+)'
|
141
|
-
def get(everything_else_than_a_slash)
|
142
|
-
"You got here by: /gorp/#{everything_else_than_a_slash}"
|
143
|
-
end
|
122
|
+
def get(everything_else_than_a_slash) = "You got here by: /gorp/#{everything_else_than_a_slash}"
|
144
123
|
end
|
145
124
|
|
146
125
|
class DigitsAndEverything < R '/nuts/(\d+)/([^/]+)'
|
147
|
-
def get(number, everything)
|
148
|
-
"You got here by: /nuts/#{number}/#{everything}"
|
149
|
-
end
|
126
|
+
def get(number, everything) = "You got here by: /nuts/#{number}/#{everything}"
|
150
127
|
end
|
151
128
|
end
|
152
129
|
```
|
153
130
|
|
154
|
-
Add this to `
|
131
|
+
Add this to `camp.rb` and try if you can hit all of the controllers.
|
155
132
|
|
156
|
-
Also notice how everything inside a parenthesis gets passed into the method,
|
157
|
-
and is ready at your disposal.
|
133
|
+
Also notice how everything inside a parenthesis gets passed into the method, and is ready at your disposal.
|
158
134
|
|
159
135
|
### Simpler routes
|
160
136
|
|
@@ -163,44 +139,32 @@ This just in:
|
|
163
139
|
```ruby
|
164
140
|
module Nuts::Controllers
|
165
141
|
class Index
|
166
|
-
def get
|
167
|
-
"You got here by: /"
|
168
|
-
end
|
142
|
+
def get = "You got here by: /"
|
169
143
|
end
|
170
144
|
|
171
145
|
class WelcomeToMySite
|
172
|
-
def get
|
173
|
-
"You got here by: /welcome/to/my/site"
|
174
|
-
end
|
146
|
+
def get = "You got here by: /welcome/to/my/site"
|
175
147
|
end
|
176
148
|
|
177
149
|
class NutsN
|
178
|
-
def get(number)
|
179
|
-
"You got here by: /nuts/#{number}"
|
180
|
-
end
|
150
|
+
def get(number)= "You got here by: /nuts/#{number}"
|
181
151
|
end
|
182
152
|
|
183
153
|
class GorpX
|
184
|
-
def get(everything_else_than_a_slash)
|
185
|
-
"You got here by: /gorp/#{everything_else_than_a_slash}"
|
186
|
-
end
|
154
|
+
def get(everything_else_than_a_slash) = "You got here by: /gorp/#{everything_else_than_a_slash}"
|
187
155
|
end
|
188
156
|
|
189
157
|
class NutsNX
|
190
|
-
def get(number, everything)
|
191
|
-
"You got here by: /nuts/#{number}/#{everything}"
|
192
|
-
end
|
158
|
+
def get(number, everything) = "You got here by: /nuts/#{number}/#{everything}"
|
193
159
|
end
|
194
160
|
end
|
195
161
|
```
|
196
162
|
|
197
|
-
Drop the <tt>< R</tt>-part and it
|
198
|
-
succeed, but it can simplify your application once in a while.
|
163
|
+
Drop the <tt>< R</tt>-part and it attempts to read your mind. It won't always succeed, but it can simplify your application once in a while.
|
199
164
|
|
200
165
|
## Modeling the world
|
201
166
|
|
202
|
-
You can get pretty far with what you've learned now, and hopefully you've been
|
203
|
-
playing a bit off-book, but it's time to take the next step: Storing data.
|
167
|
+
You can get pretty far with what you've learned now, and hopefully you've been playing a bit off-book, but it's time to take the next step: Storing data.
|
204
168
|
|
205
169
|
Let's start over again.
|
206
170
|
|
@@ -213,8 +177,7 @@ module Nuts::Models
|
|
213
177
|
end
|
214
178
|
```
|
215
179
|
|
216
|
-
Obviously, this won't do anything, since we don't have any controllers, but
|
217
|
-
let's rather have a look at what we _do_ have.
|
180
|
+
Obviously, this won't do anything, since we don't have any controllers, but let's rather have a look at what we _do_ have.
|
218
181
|
|
219
182
|
We have a model named Page. This means we now can store wiki pages and
|
220
183
|
retrieve them later. In fact, we can have as many models as we want. Need one
|
@@ -278,7 +241,7 @@ class AddTagColumn < V 1.1
|
|
278
241
|
end
|
279
242
|
```
|
280
243
|
|
281
|
-
Now we just need to tell Camping to use our migration. Write this at the bottom of
|
244
|
+
Now we just need to tell Camping to use our migration. Write this at the bottom of camp.rb
|
282
245
|
|
283
246
|
```ruby
|
284
247
|
def Nuts.create
|
@@ -292,7 +255,7 @@ we only want to create our skeleton (or upgrade if needed). Start The Camping
|
|
292
255
|
Server again and observe:
|
293
256
|
|
294
257
|
```bash
|
295
|
-
$ camping
|
258
|
+
$ camping camp.rb
|
296
259
|
** Starting Mongrel on 0.0.0.0:3301
|
297
260
|
-- create_table("nuts_schema_infos")
|
298
261
|
-> 0.1035s
|
@@ -315,7 +278,7 @@ is good way to familiarize with your models. Test your models adding some
|
|
315
278
|
data by bare hand before addin it to the application.
|
316
279
|
|
317
280
|
```bash
|
318
|
-
$ camping -C
|
281
|
+
$ camping -C camp.rb
|
319
282
|
** Starting console
|
320
283
|
>>
|
321
284
|
```
|
@@ -354,8 +317,7 @@ Now I have two pages: One about hiking and one about fishing.
|
|
354
317
|
|
355
318
|
## Wrapping it up
|
356
319
|
|
357
|
-
Wouldn't it be nice if we could show this wonderful our pages in a browser?
|
358
|
-
Update nuts.rb so it also contains something like this:
|
320
|
+
Wouldn't it be nice if we could show this wonderful our pages in a browser? Update camp.rb so it also contains something like this:
|
359
321
|
|
360
322
|
```ruby
|
361
323
|
module Nuts::Controllers
|
data/lib/camping/loader.rb
CHANGED
@@ -66,10 +66,10 @@ module Camping
|
|
66
66
|
|
67
67
|
# pass through methods to the Listener.
|
68
68
|
# for testing purposes.
|
69
|
-
def processing_events
|
70
|
-
def stop
|
71
|
-
def pause
|
72
|
-
def start
|
69
|
+
def processing_events? = @listener.processing?
|
70
|
+
def stop = @listener.stop
|
71
|
+
def pause = @listener.pause
|
72
|
+
def start = @listener.start
|
73
73
|
|
74
74
|
def name
|
75
75
|
@name ||= begin
|
@@ -108,9 +108,10 @@ module Camping
|
|
108
108
|
key = app.name.to_sym
|
109
109
|
hash[key] = app
|
110
110
|
|
111
|
-
apps.
|
111
|
+
if !@apps.include?(key)
|
112
112
|
@callback.call(app) if @callback
|
113
113
|
app.create if app.respond_to?(:create)
|
114
|
+
app.kindling if app.respond_to?(:kindling)
|
114
115
|
end
|
115
116
|
|
116
117
|
hash
|
data/lib/camping/version.rb
CHANGED
data/test/app_loader.rb
CHANGED
@@ -5,6 +5,11 @@ require 'camping/loader'
|
|
5
5
|
module Donuts end
|
6
6
|
module Loader end
|
7
7
|
|
8
|
+
def Loader.create
|
9
|
+
puts "creating..."
|
10
|
+
options.my_name = "slim shady"
|
11
|
+
end
|
12
|
+
|
8
13
|
# for Reloading stuff
|
9
14
|
module TestCaseLoaderToo
|
10
15
|
def loader
|
@@ -50,4 +55,12 @@ class Donuts::Test < TestCase
|
|
50
55
|
assert_equal "text/html", last_response.headers['content-type']
|
51
56
|
end
|
52
57
|
|
58
|
+
def test_create_method
|
59
|
+
# Tests that our app even has a create method
|
60
|
+
assert(Loader.respond_to?(:create), "test/app_loader.rb: Loader doesn't respond to create method")
|
61
|
+
|
62
|
+
# Test that our create method code is actually run and that It has an effect.
|
63
|
+
assert_equal("slim shady", Loader.options.my_name, "test/app_loader.rb: create method wasn't even loaded.")
|
64
|
+
end
|
65
|
+
|
53
66
|
end
|
data/test/config_reloader.rb
CHANGED
@@ -2,6 +2,9 @@ require_relative 'test_helper'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'camping/loader'
|
4
4
|
|
5
|
+
# This test file is mostly the same as reload_reloader.rb.
|
6
|
+
# Except this checks to see if a config.ru app is reloaded correctly.
|
7
|
+
|
5
8
|
$counter = 0
|
6
9
|
|
7
10
|
# for Reloading stuff
|
@@ -16,11 +19,9 @@ module TestCaseLoader
|
|
16
19
|
move_to_reloader
|
17
20
|
loader.reload!
|
18
21
|
assert Object.const_defined?(:Reloader), "Reloader didn't load app"
|
19
|
-
# puts "before_all called"
|
20
22
|
end
|
21
23
|
|
22
24
|
def after_all
|
23
|
-
# puts "after_all called"
|
24
25
|
assert Object.const_defined?(:Reloader), "Test removed app"
|
25
26
|
loader.remove_constants
|
26
27
|
# breaks in CI for some reason.
|
@@ -41,7 +42,6 @@ class TestConfigRu < TestCase
|
|
41
42
|
super
|
42
43
|
$counter = 0
|
43
44
|
loader.reload!
|
44
|
-
# puts "setup called"
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_counter
|
data/test/integration/Rakefile
CHANGED
@@ -15,30 +15,3 @@ namespace 'test' do
|
|
15
15
|
end
|
16
16
|
end
|
17
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
|
data/test/reload_reloader.rb
CHANGED
@@ -16,11 +16,9 @@ module TestCaseLoader
|
|
16
16
|
move_to_reloader
|
17
17
|
loader.reload!
|
18
18
|
assert Object.const_defined?(:Reloader), "Reloader didn't load app"
|
19
|
-
# puts "before_all called"
|
20
19
|
end
|
21
20
|
|
22
21
|
def after_all
|
23
|
-
# puts "after_all called"
|
24
22
|
assert Object.const_defined?(:Reloader), "Test removed app"
|
25
23
|
loader.remove_constants
|
26
24
|
assert !Object.const_defined?(:Reloader), "Loader didn't remove app"
|
@@ -40,7 +38,6 @@ class TestLoader < TestCase
|
|
40
38
|
super
|
41
39
|
$counter = 0
|
42
40
|
loader.reload!
|
43
|
-
# puts "setup called"
|
44
41
|
end
|
45
42
|
|
46
43
|
def test_counter
|
@@ -71,11 +68,11 @@ class TestLoader < TestCase
|
|
71
68
|
end
|
72
69
|
end
|
73
70
|
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
class TestConfigRu < TestLoader
|
72
|
+
BASE = File.expand_path('../apps/reloader', __FILE__)
|
73
|
+
def file; BASE + '/config.ru' end
|
77
74
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
75
|
+
def test_name
|
76
|
+
assert_equal Reloader, loader.apps[:reloader]
|
77
|
+
end
|
78
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -18,7 +18,6 @@ require 'minitest/reporters'
|
|
18
18
|
require 'minitest/hooks'
|
19
19
|
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
20
20
|
|
21
|
-
|
22
21
|
module CommandLineCommands
|
23
22
|
|
24
23
|
def move_to_tmp
|
@@ -52,25 +51,6 @@ module CommandLineCommands
|
|
52
51
|
`rm -rf test/apps/reloader/lib` if File.exist?('test/apps/reloader/lib')
|
53
52
|
end
|
54
53
|
|
55
|
-
# move_to_app
|
56
|
-
# Moves to an app directory,
|
57
|
-
# @app_name: String,
|
58
|
-
def move_to_app(app_name = "")
|
59
|
-
@original_dir = Dir.pwd
|
60
|
-
Dir.chdir "test"
|
61
|
-
Dir.chdir "apps"
|
62
|
-
Dir.chdir directory
|
63
|
-
Dir.mkdir("apps") unless Dir.exist?("apps")
|
64
|
-
Dir.mkdir("lib") unless Dir.exist?("lib")
|
65
|
-
end
|
66
|
-
|
67
|
-
def leave_app(app_name = "", purge_directorys = [])
|
68
|
-
Dir.chdir @original_dir
|
69
|
-
purge_directorys.each do |dir|
|
70
|
-
`rm -rf test/apps/#{app_name}/#{dir}` if File.exist?('test/apps/#{app_name}/#{dir}')
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
54
|
# Moves to the loader directory
|
75
55
|
def move_to_loader
|
76
56
|
@original_dir = Dir.pwd
|
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.5
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -321,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
321
321
|
- !ruby/object:Gem::Version
|
322
322
|
version: '0'
|
323
323
|
requirements: []
|
324
|
-
rubygems_version: 3.
|
324
|
+
rubygems_version: 3.3.9
|
325
325
|
signing_key:
|
326
326
|
specification_version: 4
|
327
327
|
summary: miniature rails for anyone
|