resqued 0.7.9 → 0.7.10

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: c8e7be4711322272287bceeae0c9192c20231b21
4
- data.tar.gz: 259b3e8da585db42bc351d81ace7eaab284f8df0
3
+ metadata.gz: ce7631acfa66d7a6304040677347a590e4c8b228
4
+ data.tar.gz: 75ef7fb35ce15af4c6a822923ec87dafb045e459
5
5
  SHA512:
6
- metadata.gz: ab5c1d07edf8e9e1f500236de138da349d8f25b7608d03476208d307c282bce47540c2c354487229991f17ca1348b1911d0a7e82856b9dbf85a7cdb02e8c9dc5
7
- data.tar.gz: 99ceb6e83b86c23f0f605ebf41e30bc096b720c51647a5d8f8e23b00373b2b757cfae08303a4249f9c550611ff9b9be588ae42cf330d7ecee9c6b60377f1737b
6
+ metadata.gz: bb0b962f81017fd01923398777f08eea1d6de730dbe497aa5771e196eb4debb3cea73a2b24954e0f17ac49950a5bc600be3994d343303f54df9792dfa813afc5
7
+ data.tar.gz: 8c3a8685eb36b6f34ea2fcaf5d1376c16e08425e23216a6c630aad8dc1d229cc6d55555d3dd643db1f92e780fe1ddfa2e1fa67ca71868c4cb81968ddb86ad234
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  Starting with version 0.6.1, resqued uses semantic versioning to indicate incompatibilities between the master process, listener process, and configuration.
2
2
 
3
+ v0.7.10
4
+ -------
5
+
6
+ * Support require_relative in config files. (#31)
7
+
3
8
  0.7.9
4
9
  -----
5
10
 
@@ -18,7 +18,9 @@ module Resqued
18
18
  # Public: Apply the configuration from several files.
19
19
  def apply_all(configs)
20
20
  configs.each do |config|
21
- instance_eval(config[:content], config[:path])
21
+ with_current_path(config[:path]) do
22
+ instance_eval(config[:content], config[:path])
23
+ end
22
24
  end
23
25
  results
24
26
  end
@@ -28,6 +30,23 @@ module Resqued
28
30
  # Private: The results of applying the config.
29
31
  def results
30
32
  end
33
+
34
+ # Private: Set a base path for require_relative.
35
+ def with_current_path(path)
36
+ @current_path, old_current_path = path, @current_path
37
+ yield
38
+ ensure
39
+ @current_path = old_current_path
40
+ end
41
+
42
+ # Private: Override require_relative to work around https://bugs.ruby-lang.org/issues/4487
43
+ def require_relative(path)
44
+ if @current_path
45
+ require File.expand_path(path, File.dirname(@current_path))
46
+ else
47
+ super
48
+ end
49
+ end
31
50
  end
32
51
  end
33
52
  end
@@ -1,3 +1,3 @@
1
1
  module Resqued
2
- VERSION = '0.7.9'
2
+ VERSION = '0.7.10'
3
3
  end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+
3
+ require 'fileutils'
4
+ require 'tmpdir'
5
+
6
+ require 'resqued/config'
7
+
8
+ describe Resqued::Config do
9
+ context do
10
+ around do |example|
11
+ $test_val = :not_set
12
+ $other_test_val = :not_set
13
+ Dir.mktmpdir do |dir|
14
+ @config_file = make_file(dir, "config/resqued.rb", "require_relative '../lib/file'\nworker 'example'\n")
15
+ make_file(dir, "lib/file.rb", "require_relative 'file2'\n$test_val = :ok\n")
16
+ make_file(dir, "lib/file2.rb", "$other_test_val = :ok\n")
17
+ example.call
18
+ end
19
+ end
20
+ let(:config) { Resqued::Config.new([@config_file]) }
21
+
22
+ it("can require_relative") { config.build_workers ; expect($test_val).to eq(:ok) }
23
+ it("does not override require_relative in required files") { config.build_workers ; expect($other_test_val).to eq(:ok) }
24
+
25
+ def make_file(dir, relative_path, content)
26
+ File.join(dir, relative_path).tap do |path|
27
+ FileUtils.mkpath File.dirname(path)
28
+ File.write(path, content)
29
+ end
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resqued
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Burke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
11
+ date: 2014-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kgio
@@ -121,6 +121,7 @@ files:
121
121
  - spec/resqued/backoff_spec.rb
122
122
  - spec/resqued/config/fork_event_spec.rb
123
123
  - spec/resqued/config/worker_spec.rb
124
+ - spec/resqued/config_spec.rb
124
125
  - spec/resqued/sleepy_spec.rb
125
126
  - spec/resqued/test_case_spec.rb
126
127
  - spec/resqued/test_case_spec.rb.orig
@@ -161,6 +162,7 @@ test_files:
161
162
  - spec/resqued/backoff_spec.rb
162
163
  - spec/resqued/config/fork_event_spec.rb
163
164
  - spec/resqued/config/worker_spec.rb
165
+ - spec/resqued/config_spec.rb
164
166
  - spec/resqued/sleepy_spec.rb
165
167
  - spec/resqued/test_case_spec.rb
166
168
  - spec/resqued/test_case_spec.rb.orig