cangrejo 0.0.9 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: daef61a793c8f8e3af5117cd75cb6e500bac6db4
4
- data.tar.gz: 8062ccd24d70ed67ef8e26e8836067cf831697c3
3
+ metadata.gz: 703b2df6a02a87298a6cffa637d2388824701c4c
4
+ data.tar.gz: 52dd0656452b865a3736f6b1c66243ae9392bf39
5
5
  SHA512:
6
- metadata.gz: 56fedf1bdc2c7e0cf3087865170f7bd9bf575919fc0119288924a347900d9a7c70c93537fa2cf29045d2053a97333fddf08a2b2f9baa02c811ab3884cc82cb84
7
- data.tar.gz: b9ea2e85c2ec1c6e9113419ddec7c055788c036e748f71d9cb04c9abc53231ecea1dfa799864797f2196125703d9a46c0e5cfc07bca0702f353aa4eddeba33e3
6
+ metadata.gz: 003cabe21d5e3433468359f4cfd07212bf0a50e5f20ac3b08edf4fa7eef622abbab7b14d5301b1e42f187c85aa07b50397ba4a6ee19c740f5008e0755e2ab786
7
+ data.tar.gz: d3e425085e90f6ad4e82bba68c4040d9de6915171b5b414faac96cfb8546b9ff7c10e7763b489a25d8ef1ef101c50e40ea618aa6e599fac2d8a1b6a53a082d2b
@@ -39,6 +39,10 @@ module Cangrejo
39
39
  File.join cache_path, @name
40
40
  end
41
41
 
42
+ def gemfile_path
43
+ File.join(deploy_path, 'Gemfile')
44
+ end
45
+
42
46
  def ensure_repo_clone
43
47
  unless File.exists? File.join(repo_path, '.git')
44
48
  ::Git.clone(@url, @name, :path => cache_path)
@@ -56,7 +60,7 @@ module Cangrejo
56
60
  end
57
61
 
58
62
  def ensure_deps
59
- %x[cd '#{deploy_path}' && bundle install] if @needs_bundle
63
+ system({ 'BUNDLE_GEMFILE' => gemfile_path }, 'bundle install', chdir: deploy_path) if @needs_bundle
60
64
  @needs_bundle = false
61
65
  end
62
66
  end
@@ -4,7 +4,14 @@ module Cangrejo
4
4
  module Support
5
5
  class Launcher
6
6
 
7
- KILL_TIMEOUT = 5.0
7
+ class LaunchTimeout < Cangrejo::Error
8
+ def initialize(_msg)
9
+ super "Timed out trying to start crawler"
10
+ end
11
+ end
12
+
13
+ SPAWN_TIMEOUT = 5
14
+ KILL_TIMEOUT = 5
8
15
 
9
16
  def initialize(_path, _options=nil)
10
17
  @path = _path
@@ -38,7 +45,10 @@ module Cangrejo
38
45
  end
39
46
 
40
47
  def wait_for_socket
41
- sleep 0.1 while not File.exist? @socket_file
48
+ Timeout::timeout(SPAWN_TIMEOUT, LaunchTimeout) do
49
+ # TODO: detect if the process crashes before timeout
50
+ sleep 0.1 while not File.exist? @socket_file
51
+ end
42
52
  end
43
53
 
44
54
  def safe_kill _pid
@@ -1,3 +1,3 @@
1
1
  module Cangrejo
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cangrejo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client