hirefireapp 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/hirefireapp.gemspec CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |gem|
4
4
 
5
5
  # General configuration / information
6
6
  gem.name = 'hirefireapp'
7
- gem.version = '0.0.4'
7
+ gem.version = '0.0.5'
8
8
  gem.platform = Gem::Platform::RUBY
9
9
  gem.authors = 'Michael van Rooijen'
10
10
  gem.email = 'meskyanichi@gmail.com'
@@ -40,9 +40,9 @@ module HireFireApp
40
40
  out << "[HireFire][Worker] #{worker_ok} (Library: #{worker_library}, Mapper: #{mapper_library})\n\n"
41
41
 
42
42
  if worker_library =~ /Not Found/
43
- out << "HireFire is able to auto-scale your web dynos, but not your worker dynos.\n"
43
+ out << "HireFire is able to manage your web dynos, but not your worker dynos.\n"
44
44
  else
45
- out << "HireFire is able to auto-scale both your web, as well as your worker dynos."
45
+ out << "HireFire is able to manage both your web, as well as your worker dynos."
46
46
  end
47
47
 
48
48
  block.call out
@@ -73,8 +73,8 @@ module HireFireApp
73
73
 
74
74
  ##
75
75
  # Makes Delayed::Job count the amount of currently pending jobs.
76
- # It'll use the ActiveRecord ORM, or the Mongoid ODM depending on
77
- # which is defined.
76
+ # It'll use the ActiveRecord ORM, Mongoid ODM or MongoMapper ODM
77
+ # depending on which is defined.
78
78
  #
79
79
  # If ActiveRecord 2 (or earlier) is being used, ActiveRecord::Relation doesn't
80
80
  # exist, and we'll have to use the old :conditions hash notation.
@@ -82,7 +82,7 @@ module HireFireApp
82
82
  # @returns [Fixnum] delayed_job_count the amount of jobs currently pending
83
83
  #
84
84
  def count_delayed_job
85
- if defined?(ActiveRecord) and Delayed::Worker.backend.to_s =~ /ActiveRecord/
85
+ if defined?(ActiveRecord) and backend?(/ActiveRecord/)
86
86
  if defined?(ActiveRecord::Relation)
87
87
  Delayed::Job.
88
88
  where(:failed_at => nil).
@@ -94,7 +94,12 @@ module HireFireApp
94
94
  ]
95
95
  ).count
96
96
  end
97
- elsif defined?(Mongoid) and Delayed::Worker.backend.to_s =~ /Mongoid/
97
+ elsif defined?(Mongoid) and backend?(/Mongoid/)
98
+ Delayed::Job.where(
99
+ :failed_at => nil,
100
+ :run_at.lte => Time.now
101
+ ).count
102
+ elsif defined?(MongoMapper) and backend?(/MongoMapper/)
98
103
  Delayed::Job.where(
99
104
  :failed_at => nil,
100
105
  :run_at.lte => Time.now
@@ -122,10 +127,12 @@ module HireFireApp
122
127
  if defined?(Redis) and defined?(Resque)
123
128
  "Redis"
124
129
  elsif defined?(Delayed::Worker)
125
- if defined?(ActiveRecord) and Delayed::Worker.backend.to_s =~ /ActiveRecord/
130
+ if defined?(ActiveRecord) and backend?(/ActiveRecord/)
126
131
  "Active Record"
127
- elsif defined?(Mongoid) and Delayed::Worker.backend.to_s =~ /Mongoid/
132
+ elsif defined?(Mongoid) and backend?(/Mongoid/)
128
133
  "Mongoid"
134
+ elsif defined?(MongoMapper) and backend?(/MongoMapper/)
135
+ "Mongo Mapper"
129
136
  else
130
137
  "Not Found"
131
138
  end
@@ -164,6 +171,16 @@ module HireFireApp
164
171
  end
165
172
  end
166
173
 
174
+ ##
175
+ # Returns "true" if the mapper is used by Delayed::Job backend
176
+ #
177
+ # @returns [Boolean]
178
+ #
179
+ def backend?(mapper)
180
+ return true if Delayed::Worker.backend.to_s =~ mapper
181
+ false
182
+ end
183
+
167
184
  ##
168
185
  # Returns true if the PATH_INFO matches the test url
169
186
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hirefireapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-25 00:00:00.000000000 Z
12
+ date: 2011-09-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: HireFireApp.com - The Heroku Process Manager - Autoscaling your web and
15
15
  worker dynos saving you time and money!
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  version: '0'
47
47
  requirements: []
48
48
  rubyforge_project:
49
- rubygems_version: 1.8.6
49
+ rubygems_version: 1.8.10
50
50
  signing_key:
51
51
  specification_version: 3
52
52
  summary: HireFireApp.com - The Heroku Process Manager - Autoscaling your web and worker