goat 0.3.42 → 0.3.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/goat.gemspec +1 -1
- data/lib/goat.rb +33 -21
- data/lib/goat/autoreload.rb +15 -6
- data/lib/goat/goat.js +2 -1
- metadata +4 -4
data/goat.gemspec
CHANGED
data/lib/goat.rb
CHANGED
@@ -351,31 +351,33 @@ module Goat
|
|
351
351
|
hook = find_hook(meth, path)
|
352
352
|
hdrs = {}
|
353
353
|
resp = nil
|
354
|
+
req = Rack::Request.new(env)
|
354
355
|
|
355
|
-
|
356
|
-
|
356
|
+
Dynamic.let(:current_request => req) do
|
357
|
+
begin
|
357
358
|
|
358
|
-
|
359
|
+
app = @app_class.new(req)
|
359
360
|
|
360
|
-
|
361
|
-
|
361
|
+
begin
|
362
|
+
run_before_handlers(app)
|
363
|
+
rescue Halt => halt
|
364
|
+
return halt.response.to_a
|
365
|
+
end
|
366
|
+
|
367
|
+
if hook
|
368
|
+
resp = hook.handle_request(app)
|
369
|
+
else
|
370
|
+
raise NotFoundError.new(path)
|
371
|
+
end
|
362
372
|
rescue Halt => halt
|
363
|
-
|
373
|
+
resp = halt.response
|
374
|
+
rescue Exception => e
|
375
|
+
resp = resp_for_error(e, app)
|
364
376
|
end
|
365
377
|
|
366
|
-
|
367
|
-
resp = hook.handle_request(app)
|
368
|
-
else
|
369
|
-
raise NotFoundError.new(path)
|
370
|
-
end
|
371
|
-
rescue Halt => halt
|
372
|
-
resp = halt.response
|
373
|
-
rescue Exception => e
|
374
|
-
resp = resp_for_error(e, app)
|
378
|
+
run_after_handlers(app)
|
375
379
|
end
|
376
380
|
|
377
|
-
run_after_handlers(app)
|
378
|
-
|
379
381
|
resp.to_a
|
380
382
|
end
|
381
383
|
end
|
@@ -590,12 +592,22 @@ module Goat
|
|
590
592
|
|
591
593
|
args << IndifferentHash.from_hash(reqargs)
|
592
594
|
|
593
|
-
|
594
|
-
|
595
|
+
had_error = false
|
596
|
+
begin
|
597
|
+
resp = app.respond_with_hook("rpc_#{rpc}", *args)
|
598
|
+
resp = opts[:is_get] ? resp.to_json : [200, {}, '']
|
599
|
+
rescue Exception => e
|
600
|
+
had_error = true
|
601
|
+
# even though the actual response returned here doesn't matter too much,
|
602
|
+
# we want to call the error handler to make sure any app logic for handling
|
603
|
+
# errors is called.
|
604
|
+
resp = req_handler.resp_for_error(e, app)
|
605
|
+
end
|
595
606
|
|
596
|
-
if opts[:live]
|
607
|
+
if opts[:live] && !had_error
|
597
608
|
component.update
|
598
609
|
end
|
610
|
+
|
599
611
|
end
|
600
612
|
end
|
601
613
|
end
|
@@ -1268,7 +1280,7 @@ module Goat
|
|
1268
1280
|
end
|
1269
1281
|
|
1270
1282
|
def live_spec
|
1271
|
-
@live_spec
|
1283
|
+
@live_spec
|
1272
1284
|
end
|
1273
1285
|
|
1274
1286
|
def erb(*args, &blk)
|
data/lib/goat/autoreload.rb
CHANGED
@@ -40,21 +40,24 @@ module Goat
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.command
|
43
|
-
@command ||
|
43
|
+
@command || (['ruby', $0] + ARGV)
|
44
44
|
end
|
45
45
|
|
46
|
-
def initialize(
|
47
|
-
@
|
46
|
+
def initialize(interval, opts={})
|
47
|
+
@dirs = opts[:dirs] || []
|
48
|
+
@files = opts[:files] || []
|
48
49
|
@interval = interval
|
49
50
|
@cache = {}
|
50
51
|
end
|
51
52
|
|
52
53
|
def filter_loadpaths
|
53
|
-
self.class.full_loadpaths.select
|
54
|
+
self.class.full_loadpaths.select do |f|
|
55
|
+
@dirs.any? { |d| f.downcase.start_with?(d.downcase) }
|
56
|
+
end
|
54
57
|
end
|
55
58
|
|
56
59
|
def watchpaths
|
57
|
-
@paths ||= filter_loadpaths
|
60
|
+
@paths ||= (filter_loadpaths + @files)
|
58
61
|
end
|
59
62
|
|
60
63
|
def update_cache
|
@@ -66,7 +69,13 @@ module Goat
|
|
66
69
|
def reload
|
67
70
|
EM.stop
|
68
71
|
IO.closefrom(3)
|
69
|
-
|
72
|
+
case self.class.command
|
73
|
+
when String: cmd = [self.class.command]
|
74
|
+
when Array: cmd = self.class.command
|
75
|
+
else
|
76
|
+
raise "Reload command must be a string or an array"
|
77
|
+
end
|
78
|
+
Kernel.exec(*cmd)
|
70
79
|
end
|
71
80
|
|
72
81
|
def maybe_reload
|
data/lib/goat/goat.js
CHANGED
@@ -215,11 +215,12 @@ Goat.LoadingIndicator = {
|
|
215
215
|
function show() {
|
216
216
|
ld.indicatorActive = true;
|
217
217
|
$(ld.where).prepend(ld.indicator);
|
218
|
+
$(ld.where).show();
|
218
219
|
}
|
219
220
|
|
220
221
|
function hide() {
|
221
222
|
if(ld.indicatorActive)
|
222
|
-
ld.
|
223
|
+
$(ld.where).hide();
|
223
224
|
}
|
224
225
|
|
225
226
|
$(document).ready(function() {
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 73
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 45
|
10
|
+
version: 0.3.45
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Collison
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-01 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|