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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06d7aa28aba44269ffe7397686a8afdf2a239856
4
- data.tar.gz: 06e9d0183726001182722aaabcdabd2b1fcffffe
3
+ metadata.gz: 5c5bdf63636713fe90806dee0b0c5c4b6fa9b1ee
4
+ data.tar.gz: b5488f18a969d82fac453a664c6100d3a9dc3730
5
5
  SHA512:
6
- metadata.gz: 77342eedab7649f552741419a9b5bb550fa053e0f9dac8a65bdfa7df75dbcdb3d351b6c5e37661077f0c06980c370e91acf52d26742348d9d04650450be98b05
7
- data.tar.gz: 708d5924614dc7b80f71c994b21b65d5c7ec778ef94465a6e57e37feea17261b1eca5bb9fa61cc419f774e0d27f15d0a7288145e202a4bd6c0eb04c47493d8a8
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
@@ -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 = waitpid(spawn(listen(config)))
16
- write pid, config[:pidfile]
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 is_job?
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
- is_job? and job[:message].has_key?(:tries) and job[:message].has_key?(:run)
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
- is_job? and job.keys.count == 2
42
+ job.has_key?(:worker) and job.has_key?(:message)
47
43
  end
48
44
 
49
45
  def retry_valid?
@@ -1,3 +1,3 @@
1
1
  module Writefully
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end