workless 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,21 +5,51 @@
5
5
  This is an addon for delayed_job (> 2.0.0) http://github.com/collectiveidea/delayed_job
6
6
  It is designed to be used when you're using Heroku as a host and have the need to do background work with delayed job but you don't want to leave the workers running all the time as it costs money.
7
7
 
8
- You basically add the gem to your project and the rest is taken care of for you given a few CONFIG vars set on Heroku.
8
+ By adding the gem to your project and configuring our Heroku app with some config variables workless should do the rest.
9
9
 
10
- There are already a few of these out there, notably @mtravers' cheepnis http://github.com/mtravers/cheepnis and the autoscale branch of delayed_job by @pedro http://github.com/pedro/delayed_job/tree/autoscaling
10
+ ## Update
11
11
 
12
- Workless takes ideas from both and is helping me understand gem and plugin development. Prior to version 1.0.0 it was originally built for rails 3 on the delayed_job 2.1.0.pre2 but since 1.0.0 is compatible with rails 2.3.x, 3.0.x, 3.1.x and 3.2.x
12
+ Version 1.0.0 has been released, this brings compatibility with delayed_job 3 and compatibility with Rails 2.3.x and up.
13
+
14
+ ## Compatibility
15
+
16
+ Workless should work correctly with Rubies 1.8.7, ree, 1.9.2 and 1.9.3. It is compatible with Delayed Job since version 2.0.7 up to the latest version 3.0.1, the table below shows tested compatibility with ruby, rails and delayed_job
17
+
18
+ Ruby | Rails | Delayed Job
19
+ ---------- | ------ | -----
20
+ 1.8.7-ree | 2.1.14 | 2.0.7
21
+ 1.9.2 | 3.2 | 2.1.4
22
+ 1.9.2 | 3.2 | 3.0.1
13
23
 
14
24
  ## Installation
15
25
 
16
26
  Add the workless gem and the delayed_job gem to your project Gemfile and update your bundle. Its is recommended to specify the gem version for delayed_job especially if you are using rails 2.3.x which doesn't work with the latest delayed_job
17
27
 
28
+ ### For rails 2.3.x the latest compatible delayed_job is 2.0.7
29
+
18
30
  <pre>
19
- gem "workless"
31
+ gem "delayed_job", "2.0.7"
32
+ gem "workless", "~> 1.0.1"
20
33
  </pre>
21
34
 
22
- Add your Heroku username / password as config vars to your Heroku instance, the same one you log in to Heroku with
35
+ ### For rails 3.x with delayed_job 2.1.x
36
+
37
+ <pre>
38
+ gem "delayed_job", "~> 2.1.4"
39
+ gem "workless", "~> 1.0.1"
40
+ </pre>
41
+
42
+ ### For rails 3.x with latest delayed_job 3.x using active record
43
+
44
+ <pre>
45
+ gem "delayed_job_active_record"
46
+ gem "workless", "~> 1.0.1"
47
+ </pre>
48
+
49
+ If you don't specify delayed_job in your Gemfile workless will bring it in, most likly the latest version (3.0.1)
50
+
51
+ Add your Heroku username / password as config vars to your Heroku instance, the same one you log in to Heroku with.
52
+ [You may also use your API key as the password](https://github.com/heroku/heroku/issues/103).
23
53
 
24
54
  <pre>
25
55
  heroku config:add HEROKU_USER=yourusername HEROKU_PASSWORD=yourpassword
@@ -19,8 +19,14 @@ module Delayed
19
19
 
20
20
  module ClassMethods
21
21
  def scaler
22
- @scaler ||= if ENV.include?("HEROKU_UPID")
23
- Scaler::Heroku
22
+ @scaler ||= if ENV.include?("HEROKU_USER")
23
+ client = ::Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD'])
24
+ case client.info(ENV["APP_NAME"])[:stack]
25
+ when "cedar"
26
+ Scaler::HerokuCedar
27
+ else
28
+ Scaler::Heroku
29
+ end
24
30
  else
25
31
  Scaler::Local
26
32
  end
@@ -11,7 +11,6 @@ module Delayed
11
11
  end
12
12
 
13
13
  module HerokuClient
14
- require 'heroku'
15
14
 
16
15
  def client
17
16
  @client ||= ::Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD'])
data/lib/workless.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "heroku"
1
2
  require File.dirname(__FILE__) + "/workless/scalers/base"
2
3
  require File.dirname(__FILE__) + "/workless/scaler"
3
4
  require File.dirname(__FILE__) + "/workless/railtie" if defined?(Rails::Railtie)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-30 00:00:00.000000000Z
12
+ date: 2011-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70302927745660 !ruby/object:Gem::Requirement
16
+ requirement: &70192881277980 !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: *70302927745660
24
+ version_requirements: *70192881277980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: heroku
27
- requirement: &70302927744820 !ruby/object:Gem::Requirement
27
+ requirement: &70192881277400 !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: :runtime
34
34
  prerelease: false
35
- version_requirements: *70302927744820
35
+ version_requirements: *70192881277400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rush
38
- requirement: &70302927744340 !ruby/object:Gem::Requirement
38
+ requirement: &70192881276860 !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: :runtime
45
45
  prerelease: false
46
- version_requirements: *70302927744340
46
+ version_requirements: *70192881276860
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: delayed_job
49
- requirement: &70302927743700 !ruby/object:Gem::Requirement
49
+ requirement: &70192881276240 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.0.7
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70302927743700
57
+ version_requirements: *70192881276240
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70302927743240 !ruby/object:Gem::Requirement
60
+ requirement: &70192881275520 !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: *70302927743240
68
+ version_requirements: *70192881275520
69
69
  description: Extension to Delayed Job to enable workers to scale up when needed
70
70
  email: paul.crabtree@gmail.com
71
71
  executables: []
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: 1.3.6
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 1.8.10
107
+ rubygems_version: 1.8.6
108
108
  signing_key:
109
109
  specification_version: 3
110
110
  summary: Use delayed job workers only when theyre needed on Heroku