writefully 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/writefully/hooks_controller.rb +1 -3
- data/lib/writefully/cli.rb +7 -7
- data/lib/writefully/tools/dispatcher.rb +3 -7
- data/lib/writefully/version.rb +1 -1
- data/spec/dummy/log/test.log +9869 -0
- data/spec/lib/writefully/tools/dispatcher_spec.rb +8 -29
- data/spec/lib/writefully/workers/journalist_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c5bdf63636713fe90806dee0b0c5c4b6fa9b1ee
|
4
|
+
data.tar.gz: b5488f18a969d82fac453a664c6100d3a9dc3730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae7c527d36e3eb56b6bed64165aff2408ad8a142ee095d15861e60f1ddd463686ebddbee4c9c3a1ee9e06cb16b1ee759eaf65276cc075c79d5774421649887c8
|
7
|
+
data.tar.gz: 7e3958cdec08dcabb2d8ae9050338f475c49d92036a959560965802a871d9d602dc29ab93c2350194fe14e65ca827ef9f89cd42bb432b2dc4ec948b4a22db94b
|
@@ -11,16 +11,15 @@ module Writefully
|
|
11
11
|
|
12
12
|
def create
|
13
13
|
self.__send__ request.headers["X-Github-Event"].to_sym
|
14
|
+
head :ok
|
14
15
|
end
|
15
16
|
|
16
17
|
def ping
|
17
|
-
head :ok
|
18
18
|
end
|
19
19
|
|
20
20
|
def push
|
21
21
|
Writefully.add_job :handyman, { task: :synchronize,
|
22
22
|
site_slug: body.repository.name } if branch_match?
|
23
|
-
head :ok
|
24
23
|
end
|
25
24
|
|
26
25
|
def member
|
@@ -28,7 +27,6 @@ module Writefully
|
|
28
27
|
unless authorship
|
29
28
|
Authorship.create_from_data(body.member)
|
30
29
|
end
|
31
|
-
head :ok
|
32
30
|
end
|
33
31
|
|
34
32
|
protected
|
data/lib/writefully/cli.rb
CHANGED
@@ -9,13 +9,13 @@ module Writefully
|
|
9
9
|
|
10
10
|
def start(file)
|
11
11
|
config = Writefully.config_from(file)
|
12
|
-
|
12
|
+
|
13
13
|
if options.daemonize?
|
14
|
-
Process.daemon(true, true)
|
15
|
-
pid
|
16
|
-
|
14
|
+
::Process.daemon(true, true)
|
15
|
+
write(::Process.pid, config[:pidfile])
|
16
|
+
spawn(listen(config))
|
17
17
|
else
|
18
|
-
Signal.trap("INT") { $stdout.puts "Writefully exiting..."; exit }
|
18
|
+
::Signal.trap("INT") { $stdout.puts "Writefully exiting..."; exit }
|
19
19
|
listen(config)
|
20
20
|
end
|
21
21
|
end
|
@@ -25,7 +25,7 @@ module Writefully
|
|
25
25
|
config = Writefully.config_from(file)
|
26
26
|
|
27
27
|
pid = open(config[:pidfile]).read.strip.to_i
|
28
|
-
Process.kill("HUP", pid)
|
28
|
+
::Process.kill("HUP", pid)
|
29
29
|
true
|
30
30
|
rescue Errno::ENOENT
|
31
31
|
$stdout.puts "#{pidfile} does not exist: Errno::ENOENT"
|
@@ -52,7 +52,7 @@ module Writefully
|
|
52
52
|
end
|
53
53
|
rescue ::Exception => e
|
54
54
|
$stderr.puts "While writing the PID to file, unexpected #{e.class}: #{e}"
|
55
|
-
Process.kill "HUP", pid
|
55
|
+
::Process.kill "HUP", pid
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -17,7 +17,7 @@ module Writefully
|
|
17
17
|
|
18
18
|
def heartbeat
|
19
19
|
@job = Marshal.load(get_job_data)
|
20
|
-
run_job if
|
20
|
+
run_job if job_valid?
|
21
21
|
end
|
22
22
|
|
23
23
|
def run_job
|
@@ -34,16 +34,12 @@ module Writefully
|
|
34
34
|
Celluloid::Actor[:retryer].retry(job)
|
35
35
|
end
|
36
36
|
|
37
|
-
def is_job?
|
38
|
-
job.has_key?(:worker) and job.has_key?(:message)
|
39
|
-
end
|
40
|
-
|
41
37
|
def is_retry?
|
42
|
-
|
38
|
+
job_valid? and job[:message].has_key?(:tries) and job[:message].has_key?(:run)
|
43
39
|
end
|
44
40
|
|
45
41
|
def job_valid?
|
46
|
-
|
42
|
+
job.has_key?(:worker) and job.has_key?(:message)
|
47
43
|
end
|
48
44
|
|
49
45
|
def retry_valid?
|
data/lib/writefully/version.rb
CHANGED