allora 0.0.7 → 0.1.7

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: ff281f838230fe1451b49f7abfc6777bf7d5b81d
4
- data.tar.gz: 9ae0d34c81ad01051b15b9ccd50e669e717aeb64
3
+ metadata.gz: 1eacbacaec66296ab84d3bfc4e0cc5923a1e2498
4
+ data.tar.gz: 3ea1d12abb16a7ac44cf4351b962a841ef9ff02e
5
5
  SHA512:
6
- metadata.gz: 4ed7af5cd33bcf5e15fc60b209dd8c63078d22962bac70e4f2361d8a7ee8430e8a07171d319b805825539655e2d6c50306401e65c6f819175257eee4cde85078
7
- data.tar.gz: 38df2e96d42d0c31ad62d5dd18d56be61de404a377ece63d8124f18e3e3a0ae352922707fe371f0e6c68c75e6b1c37358d894cd29f4e19ea5b87568c8e427972
6
+ metadata.gz: 1fb32dedc278e182b9b3b9734d9b23ca1bef12d35aecea339b32597021cf1740490672350003aadc8a492b84976883ee97289a6be52713470434cc771141ab43
7
+ data.tar.gz: 35903bda8120eab4fe1c23461e6af665a35116d681339b2c69388a518e72ba2d91a937c5dbea6f684d30336b7ce57c5e32f6cdba0b905d54a17898d19e053fa2
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 0.1.7
2
+
3
+ * Allow passing more connection options to Redis. [lsimoneau]
data/README.md CHANGED
@@ -43,7 +43,7 @@ Create a file, for example "schedule.rb":
43
43
  Allora.start(:join => true) do |s|
44
44
  # a job that runs hourly
45
45
  s.add("empty_cache", :every => 1.hour) { `rm -f /path/to/cache/*` }
46
-
46
+
47
47
  # a job that runs based on a cron string
48
48
  s.add("update_stats", :cron => "0 2,14 * * *") { Resque.enqueue(UpdateStatsJob) }
49
49
  end
@@ -58,16 +58,16 @@ In the following example, we specify to use a Redis backend, which is safe to ru
58
58
  multiple machines:
59
59
 
60
60
  require "redis"
61
-
61
+
62
62
  Allora.start(:backend => :redis, :host => "redis.lan", :join => true) do |s|
63
63
  # a job that runs hourly
64
64
  s.add("empty_cache", :every => 1.hour) { `rm -f /path/to/cache/*` }
65
-
65
+
66
66
  # a job that runs based on a cron string
67
67
  s.add("update_stats", :cron => "0 2,14 * * *") { Resque.enqueue(UpdateStatsJob) }
68
68
  end
69
69
 
70
- We specify a redis host (and port) so that schedule data can be shared.
70
+ We specify a redis host (and port) so that schedule data can be shared. The following options will be passed through to `Redis.new` and can be used to customize your connection settings: `:url`, `:port`, `:host`, `:db`, `:path`, `:password`.
71
71
 
72
72
  Note that you must load redis yourself. Allora does not directly depend on it, so that users
73
73
  may choose not to use it.
@@ -67,11 +67,12 @@ module Allora
67
67
  def create_redis(opts)
68
68
  return opts[:client] if opts.key?(:client)
69
69
 
70
- ::Redis.new(
71
- :host => opts.fetch(:host, "localhost"),
72
- :port => opts.fetch(:port, 6379),
73
- :thread_safe => true
74
- )
70
+ ::Redis.new(redis_opts(opts).merge(:thread_safe => true))
71
+ end
72
+
73
+ def redis_opts(opts)
74
+ keys = [:host, :port, :db, :url, :path, :password]
75
+ keys.each_with_object({}) { |k, hash| hash[k] = opts[k] if opts.has_key?(k) }
75
76
  end
76
77
 
77
78
  # Forces all job data to be re-entered into Redis at the next poll
@@ -22,5 +22,5 @@
22
22
  ##
23
23
 
24
24
  module Allora
25
- VERSION = "0.0.7"
25
+ VERSION = "0.1.7"
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allora
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - d11wtq
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-02 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -38,6 +38,7 @@ extensions: []
38
38
  extra_rdoc_files: []
39
39
  files:
40
40
  - .gitignore
41
+ - CHANGELOG.md
41
42
  - Gemfile
42
43
  - LICENSE
43
44
  - README.md
@@ -72,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  version: '0'
73
74
  requirements: []
74
75
  rubyforge_project: allora
75
- rubygems_version: 2.0.3
76
+ rubygems_version: 2.0.14
76
77
  signing_key:
77
78
  specification_version: 4
78
79
  summary: A ruby scheduler that keeps it simple, with support for distributed schedules