Permalink
Browse files

moved methods to App module and added NimbleNodes#reporter for loadin…

…g filter vs middleware
  • Loading branch information...
1 parent 87faa63 commit 70b0cbcfb1cd0064824a68a68ed7084df3a4126b Jordan Glasner committed Apr 4, 2010
Showing with 17 additions and 19 deletions.
  1. +17 −19 lib/nimble_nodes.rb
View
@@ -1,36 +1,34 @@
+require 'json'
+
module NimbleNodes
- # returns array of files
- def self.files
- files = %w(dynos report server)
- files.push NimbleNodes.legacy? ? 'filter' : 'middleware'
- files
- end
-
+ #= Check Rails version
# returns true if gem is loaded in a pre 2.3 version of rails
def self.legacy?
defined?(RAILS_GEM_VERSION) and RAILS_GEM_VERSION.slice(0..2).to_f < 2.3
- end
+ end
- #= Monitoring
- # pass over the hash containing Rack env variables
- # a Report will be created and posted if neccessary
- def self.monitor(env)
- report = NimbleNodes::Report.new(env)
- report.post if report.post?
+ #= App status inspectors
+ def self.active?
+ NimbleNodes::App.token? and !NimbleNodes.paused?
end
- def self.installed?
- not ENV['NN_SERVER_DOMAIN'].nil?
+ def self.paused?
+ not NimbleNodes::Settings[:paused_at].nil?
end
- def self.paused?
- not ENV['NN_APP_PAUSED_AT'].nil?
+
+
+ def self.lib_path(path='')
+ File.dirname(__FILE__) + '/nimble_nodes' + path
end
end
-NimbleNodes.files.each { |file| require File.dirname(__FILE__) + "/nimble_nodes/#{file}" }
+files = %w(app settings dynos workers report server)
+files.each { |file| require NimbleNodes.lib_path('/' + file) }
+
+require NimbleNodes::App.reporter

0 comments on commit 70b0cbc

Please sign in to comment.