resque-approval 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
1
  *.gem
2
2
  Gemfile.lock
3
3
  .rvmrc
4
- spec/tmp
4
+ *.pid
5
+ *.swp
6
+ *.swo
@@ -0,0 +1,8 @@
1
+ ## 1.0.1 (2012-06-06)
2
+
3
+ * Bug fixes:
4
+ * Make return values from .approve and .reject more explicit.
5
+
6
+ ## 1.0.0 (2012-06-06)
7
+
8
+ * Initial release
@@ -55,6 +55,8 @@ module Resque
55
55
  Resque.redis.hdel('pending_jobs', key)
56
56
  Resque.redis.lrem('queue:approval_required', 1, job.to_json)
57
57
  Resque.push(Resque.queue_from_class(self), job)
58
+
59
+ true
58
60
  end
59
61
 
60
62
  def reject(key)
@@ -66,6 +68,8 @@ module Resque
66
68
 
67
69
  Resque.redis.hdel('pending_jobs', key)
68
70
  Resque.redis.lrem('queue:approval_required', 1, job.to_json)
71
+
72
+ true
69
73
  end
70
74
  end
71
75
  end
@@ -1,7 +1,7 @@
1
1
  module Resque
2
2
  module Plugins
3
3
  module Approval
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
6
6
  end
7
7
  end
@@ -1,21 +1,41 @@
1
1
  require 'resque-approval'
2
2
 
3
- ROOT_PATH = File.expand_path('..', __FILE__)
4
- TMP_PATH = '/tmp'
5
-
6
3
  def start_redis
7
- puts 'Starting redis for testing at localhost:9736...'
8
- `redis-server #{ROOT_PATH}/redis-test.conf`
9
- Resque.redis = 'localhost:9736'
10
- sleep 0.1
4
+ redis_config = <<END
5
+ daemonize yes
6
+ pidfile #{redis_pid_file}
7
+ port #{redis_port}
8
+ END
9
+
10
+ puts "Starting Redis for testing on port #{redis_port}"
11
+ IO.popen("redis-server -", 'w+') do |server|
12
+ server.write(redis_config)
13
+ server.close_write
14
+ end
15
+ Resque.redis = "localhost:#{redis_port}"
16
+
17
+ sleep 0.1 # give Redis time to start
18
+
19
+ puts "Redis is running with PID #{redis_pid}"
11
20
  end
12
21
 
13
22
  def stop_redis
14
- puts "\nKilling test redis server..."
15
- %x{
16
- cat #{TMP_PATH}/redis-test.pid | xargs kill -QUIT
17
- rm -f #{TMP_PATH}/redis-test-dump.rdb
18
- }
23
+ if redis_pid
24
+ puts "\nSending TERM signal to Redis (#{redis_pid})"
25
+ Process.kill("TERM", redis_pid)
26
+ end
27
+ end
28
+
29
+ def redis_port
30
+ 9736
31
+ end
32
+
33
+ def redis_pid_file
34
+ File.expand_path('../redis-test.pid', __FILE__)
35
+ end
36
+
37
+ def redis_pid
38
+ File.exist?(redis_pid_file) && File.read(redis_pid_file).to_i
19
39
  end
20
40
 
21
41
  RSpec.configure do |config|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-approval
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque
16
- requirement: &12740880 !ruby/object:Gem::Requirement
16
+ requirement: &12083540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *12740880
24
+ version_requirements: *12083540
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &12740240 !ruby/object:Gem::Requirement
27
+ requirement: &12082920 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *12740240
35
+ version_requirements: *12082920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &12739480 !ruby/object:Gem::Requirement
38
+ requirement: &12082180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *12739480
46
+ version_requirements: *12082180
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard
49
- requirement: &12737500 !ruby/object:Gem::Requirement
49
+ requirement: &12080700 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *12737500
57
+ version_requirements: *12080700
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-rspec
60
- requirement: &12732800 !ruby/object:Gem::Requirement
60
+ requirement: &12078080 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *12732800
68
+ version_requirements: *12078080
69
69
  description: ! "A Resque plugin allowing jobs to be sent to a temporary\n queue
70
70
  to await approval. Once the job is approved, it\n is placed
71
71
  on its normal queue."
@@ -76,6 +76,7 @@ extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
78
  - .gitignore
79
+ - CHANGELOG.md
79
80
  - Gemfile
80
81
  - Guardfile
81
82
  - LICENSE
@@ -85,7 +86,6 @@ files:
85
86
  - lib/resque-approval/version.rb
86
87
  - resque-approval.gemspec
87
88
  - spec/lib/resque-approval_spec.rb
88
- - spec/redis-test.conf
89
89
  - spec/spec_helper.rb
90
90
  homepage: https://github.com/eclubb/resque-approval
91
91
  licenses: []
@@ -113,5 +113,4 @@ specification_version: 3
113
113
  summary: A Resque plugin allowing jobs to be sent to a temporary queue to await approval.
114
114
  test_files:
115
115
  - spec/lib/resque-approval_spec.rb
116
- - spec/redis-test.conf
117
116
  - spec/spec_helper.rb
@@ -1,7 +0,0 @@
1
- daemonize yes
2
- pidfile /tmp/redis-test.pid
3
- port 9736
4
- dbfilename redis-test-dump.rdb
5
- dir /tmp
6
- loglevel debug
7
- logfile stdout