repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/initializers/config.rb | config/initializers/config.rb | # frozen_string_literal: true
Config.setup do |config|
# Name of the constant exposing loaded settings
config.const_name = "Settings"
# Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'.
#
# config.knockout_prefix = nil
# Overwrite an existing value when... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/initializers/assets.rb | config/initializers/assets.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
Rails.application.config.assets.paths << Rails.root.jo... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/initializers/1_settings.rb | config/initializers/1_settings.rb | # frozen_string_literal: true
# rubocop:disable Layout/LineLength
def load_legacy_environment_variables
# Check for Legacy Environment Variables (to be deprecated)
deprecations_detected = false
legacy_options = %i[]
legacy_options.each do |option|
next if Settings.send(option).nil?
Rails.logger.warn... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/initializers/rack_attack.rb | config/initializers/rack_attack.rb | if defined? Rack::Attack
class Rack::Attack
# rack-attack helps you protect your Rails application from bad clients.
# You can use it to allow, block, and throttle requests.
# See https://github.com/rack/rack-attack for more details
# By default, rack-attack is enabled for all environments
# Rack... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/initializers/cors.rb | config/initializers/cors.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin Ajax requests.
# Read more: https://github.com/cyu/rack-cors
# Rails.application.confi... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/redirects.rb | config/routes/redirects.rb | # Redirect pwpx token path to OSS token path
get "/api_tokens", to: redirect("/users/token", status: 301)
| ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/public_pushes.rb | config/routes/public_pushes.rb | # File pushes redirects - with query string preservation
get "/f/:url_token", to: redirect(path: "/p/%{url_token}", status: 301)
get "/f/:url_token/r", to: redirect(path: "/p/%{url_token}/r", status: 301)
get "/f/:url_token/passphrase", to: redirect(path: "/p/%{url_token}/passphrase", status: 301)
# URL pushes redirec... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/users.rb | config/routes/users.rb | allowed_reg_routes = if Settings.disable_signups
%i[edit update destroy]
else
%i[new create edit update destroy]
end
devise_for :users, skip: :registrations, controllers: {
sessions: "users/sessions",
passwords: "users/passwords",
unlocks: "users/unlocks",
confirmations: "users/confirmations",
registrati... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/legacy_devise.rb | config/routes/legacy_devise.rb | # /users/sign_in
get CGI.unescape("/ca/usuaris/sign_in(.:format)"), to: redirect("/users/sign_in?locale=ca", status: 301)
get CGI.unescape("/cs/u%C5%BEivatel%C5%AF/sign_in(.:format)"), to: redirect("/users/sign_in?locale=cs", status: 301)
get CGI.unescape("/da/brugere/sign_in(.:format)"), to: redirect("/users/sign_in?l... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | true |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/legacy_pages.rb | config/routes/legacy_pages.rb | # Redirects for High Voltage Pages
get CGI.unescape("/ca/p%C3%A0gines/:id"), to: redirect("/pages/%{id}?locale=ca", status: 301)
get CGI.unescape("/cs/str%C3%A1nky/:id"), to: redirect("/pages/%{id}?locale=cs", status: 301)
get CGI.unescape("/da/sider/:id"), to: redirect("/pages/%{id}?locale=da", status: 301)
get CGI.un... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/pushes.rb | config/routes/pushes.rb | constraints(format: :html) do
# File pushes redirects - with query string preservation
get "/f/:url_token", to: redirect(path: "/p/%{url_token}", status: 301)
get "/f/:url_token/r", to: redirect(path: "/p/%{url_token}/r", status: 301)
get "/f/:url_token/passphrase", to: redirect(path: "/p/%{url_token}/passphras... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/public_users.rb | config/routes/public_users.rb | # devise_for :users, skip: :registrations, controllers: {
devise_for :users, only: :sessions, controllers: {
sessions: "users/sessions"
}
# allowed_reg_routes = if Settings.disable_signups
# %i[edit update]
# else
# %i[new create edit update]
# end
devise_scope :user do
resource :registration, only: [], path:... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/pwp_api.rb | config/routes/pwp_api.rb | constraints(format: :json) do
namespace :api do
namespace :v1 do
get :version, to: "version#show"
end
end
resources :p, controller: "api/v1/pushes", as: :passwords, except: %i[new index edit update] do
get "preview", on: :member
get "audit", on: :member
get "active", on: :collection
... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/madmin.rb | config/routes/madmin.rb | authenticated :user, lambda { |u| u.admin? } do
namespace :madmin, path: "admin/dbexplore" do
namespace :active_storage do
resources :attachments
resources :blobs
resources :variant_records
end
resources :audit_logs
resources :pushes
resources :users, except: [:edit, :update]
... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/legacy_pushes.rb | config/routes/legacy_pushes.rb | # Redirects for Pushes#new
["p", "f", "r"].each do |resource|
# example of a lambda
# get "/ca/#{resource}/nou(.:format)"), to: redirect { |c| c.key?(:format) ? "/#{resource}/new.#{c[:format]}?locale=ca" : "/#{resource}/new?locale=ca" }
get CGI.unescape("/ca/#{resource}/nou(.:format)"), to: redirect("/#{resource}... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/routes/admin.rb | config/routes/admin.rb | if Settings.enable_logins
authenticated :user, lambda { |u| u.admin? } do
get "/admin", to: "admin#index", as: :admin_root
namespace :admin do
resources :users, only: [:index] do
member do
patch :promote
patch :revoke
end
end
end
mount MissionControl::... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test r... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/environments/development.rb | config/environments/development.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response ti... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
pglombardo/PasswordPusher | https://github.com/pglombardo/PasswordPusher/blob/9869098cf38d89c76abc2d6bfee2438cce61ce1c/config/environments/production.rb | config/environments/production.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot. This eager loads... | ruby | Apache-2.0 | 9869098cf38d89c76abc2d6bfee2438cce61ce1c | 2026-01-04T15:53:03.627788Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_airbrake.rb | test/test_airbrake.rb | #!/usr/bin/env ruby
require File.dirname(__FILE__) + '/helper'
class TestAirbrake < Minitest::Test
def test_notify
airbrake = God::Contacts::Airbrake.new
airbrake.apikey = "put_your_apikey_here"
airbrake.name = "Airbrake"
Airbrake.expects(:notify).returns "123"
airbrake.notify("Test message for... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_conditions_socket_responding.rb | test/test_conditions_socket_responding.rb | require File.dirname(__FILE__) + '/helper'
class TestConditionsSocketResponding < Minitest::Test
# valid?
def test_valid_should_return_false_if_no_options_set
c = Conditions::SocketResponding.new
c.watch = stub(:name => 'foo')
assert_equal false, c.valid?
end
def test_valid_should_return_true_if... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_timeline.rb | test/test_timeline.rb | require File.dirname(__FILE__) + '/helper'
class TestTimeline < Minitest::Test
def setup
@timeline = Timeline.new(5)
end
def test_new_should_be_empty
assert_equal 0, @timeline.size
end
def test_should_not_grow_to_more_than_size
(1..10).each do |i|
@timeline.push(i)
end
assert_equ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_god_system.rb | test/test_god_system.rb | require File.dirname(__FILE__) + '/helper'
class TestGodSystem < MiniTest::Test
def assert_watch_running(watch_name)
assert_equal true, God.watches[watch_name].alive?
end
def with_god_cleanup
old_terminate = God.method(:terminate)
# necessary cuz actual god terminate will do exit(0) will stops tests... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_slack.rb | test/test_slack.rb | require File.dirname(__FILE__) + '/helper'
class TestSlack < Minitest::Test
def setup
@slack = God::Contacts::Slack.new
# new slack webhook url contains three random 'tokens' with length of 9, 9 and 24 characters
@slack.url = "https://hooks.slack.com/services/ABCABCABC/DEFDEFDEF/ABCDEFABCDEFABCDEFABCDEF... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_conditions_disk_usage.rb | test/test_conditions_disk_usage.rb | require File.dirname(__FILE__) + '/helper'
class TestConditionsDiskUsage < Minitest::Test
# valid?
def test_valid_should_return_false_if_no_above_given
c = Conditions::DiskUsage.new
c.mount_point = '/'
c.watch = stub(:name => 'foo')
assert_equal false, c.valid?
end
def test_valid_should_retur... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_jabber.rb | test/test_jabber.rb | #!/usr/bin/env ruby
require File.dirname(__FILE__) + '/helper'
class TestJabber < Minitest::Test
def setup
@jabber = God::Contacts::Jabber.new
end
def test_notify
@jabber.host = 'talk.google.com'
@jabber.from_jid = 'god@jabber.org'
@jabber.password = 'secret'
@jabber.to_jid = 'dev@jabber.or... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_god.rb | test/test_god.rb | require File.dirname(__FILE__) + '/helper'
class TestGod < MiniTest::Test
def setup
God::Socket.stubs(:new).returns(true)
God.stubs(:setup).returns(true)
God.stubs(:validater).returns(true)
God.reset
God.pid_file_directory = '/var/run/god'
end
def teardown
God.main && God.main.kill
if... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_conditions_tries.rb | test/test_conditions_tries.rb | require File.dirname(__FILE__) + '/helper'
class TestConditionsTries < Minitest::Test
# valid?
def test_valid_should_return_false_if_times_not_set
c = Conditions::Tries.new
c.watch = stub(:name => 'foo')
assert !c.valid?
end
end
class TestConditionsTries < Minitest::Test
def setup
@c = Condi... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_registry.rb | test/test_registry.rb | require File.dirname(__FILE__) + '/helper'
class TestRegistry < Minitest::Test
def setup
God.registry.reset
end
def test_add
foo = God::Process.new
foo.name = 'foo'
God.registry.add(foo)
assert_equal 1, God.registry.size
assert_equal foo, God.registry['foo']
end
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_handlers_kqueue_handler.rb | test/test_handlers_kqueue_handler.rb | require File.dirname(__FILE__) + '/helper'
if God::EventHandler.event_system == "kqueue"
class TestHandlersKqueueHandler < Minitest::Test
def test_register_process
KQueueHandler.expects(:monitor_process).with(1234, 2147483648)
KQueueHandler.register_process(1234, [:proc_exit])
end
def test_... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_system_portable_poller.rb | test/test_system_portable_poller.rb | require File.dirname(__FILE__) + '/helper'
class TestSystemPortablePoller < Minitest::Test
def setup
pid = Process.pid
@process = System::PortablePoller.new(pid)
end
def test_time_string_to_seconds
assert_equal 0, @process.bypass.time_string_to_seconds('0:00:00')
assert_equal 0, @process.bypass.... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_trigger.rb | test/test_trigger.rb | require File.dirname(__FILE__) + '/helper'
class TestTrigger < Minitest::Test
def setup
Trigger.reset
end
def teardown
Trigger.reset
end
# base case
def test_should_have_empty_triggers
assert_equal({}, Trigger.triggers)
end
# register
def test_register_should_add_condition_to_trigger... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_statsd.rb | test/test_statsd.rb | require File.dirname(__FILE__) + '/helper'
class TestStatsd < Minitest::Test
def setup
@statsd = God::Contacts::Statsd.new
end
def test_exists
God::Contacts::Statsd
end
def test_notify
[
'cpu out of bounds',
'memory out of bounds',
'process is flapping'
].each do |ev... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_process.rb | test/test_process.rb | require File.dirname(__FILE__) + '/helper'
module God
class Process
# def fork
# raise "You forgot to stub fork"
# end
def exec(*args)
raise "You forgot to stub exec"
end
end
end
class TestProcessChild < Minitest::Test
def setup
God.internal_init
@p = God::Process.new
@p... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_prowl.rb | test/test_prowl.rb | #!/usr/bin/env ruby
require File.dirname(__FILE__) + '/helper'
class TestProwl < Minitest::Test
def test_live_notify
prowl = God::Contacts::Prowl.new
prowl.name = "Prowly"
prowl.apikey = 'put_your_apikey_here'
Prowly.expects(:notify).returns(mock(:succeeded? => true))
prowl.notify("Test", Time.... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_condition.rb | test/test_condition.rb | require File.dirname(__FILE__) + '/helper'
class BadlyImplementedCondition < PollCondition
end
class TestCondition < Minitest::Test
# generate
def test_generate_should_return_an_object_corresponding_to_the_given_type
assert_equal Conditions::ProcessRunning, Condition.generate(:process_running, nil).class
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_conditions_process_running.rb | test/test_conditions_process_running.rb | require File.dirname(__FILE__) + '/helper'
class TestConditionsProcessRunning < Minitest::Test
def test_missing_pid_file_returns_opposite
[true, false].each do |r|
c = Conditions::ProcessRunning.new
c.running = r
c.stubs(:watch).returns(stub(:pid => 99999999, :name => 'foo'))
assert_equal... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_sugar.rb | test/test_sugar.rb | require File.dirname(__FILE__) + '/helper'
class TestSugar < Minitest::Test
def test_seconds
assert_equal 1, 1.seconds
assert_equal 1, 1.second
end
def test_minutes
assert_equal 60, 1.minutes
assert_equal 60, 1.minute
end
def test_hours
assert_equal 3600, 1.hours
assert_equal 3600, ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_task.rb | test/test_task.rb | require File.dirname(__FILE__) + '/helper'
class TestTask < Minitest::Test
def setup
God.internal_init
@task = Task.new
@task.name = 'foo'
@task.valid_states = [:foo, :bar]
@task.initial_state = :foo
@task.interval = 5
@task.prepare
end
# valid?
def test_valid_should_return_false_... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_driver.rb | test/test_driver.rb | require File.dirname(__FILE__) + '/helper'
class TestDriver < Minitest::Test
def setup
end
def test_push_pop_wait
eq = God::DriverEventQueue.new
cond = eq.instance_variable_get(:@resource)
cond.expects(:wait).times(1)
eq.push(God::TimedEvent.new(0))
eq.push(God::TimedEvent.new(0.1))
t... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_campfire.rb | test/test_campfire.rb | require File.dirname(__FILE__) + '/helper'
class TestCampfire < Minitest::Test
def setup
@campfire = God::Contacts::Campfire.new
end
def test_exists
God::Contacts::Campfire
end
def test_notify
@campfire.subdomain = 'github'
@campfire.token = 'abc'
@campfire.room = 'danger'
time = T... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_metric.rb | test/test_metric.rb | require File.dirname(__FILE__) + '/helper'
class TestMetric < Minitest::Test
def setup
@metric = Metric.new(stub(:interval => 10), nil)
end
# watch
def test_watch
w = stub()
m = Metric.new(w, nil)
assert_equal w, m.watch
end
# destination
def test_destination
d = stub()
m = Me... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/helper.rb | test/helper.rb | $:.unshift File.expand_path('../../lib', __FILE__) # For use/testing when no gem is installed
# Use this flag to actually load all of the god infrastructure
$load_god = true
require File.join(File.dirname(__FILE__), *%w[.. lib god sys_logger])
require File.join(File.dirname(__FILE__), *%w[.. lib god])
God::EventHandl... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_watch.rb | test/test_watch.rb | require File.dirname(__FILE__) + '/helper'
class TestWatch < Minitest::Test
def setup
God.internal_init
@watch = Watch.new
@watch.name = 'foo'
@watch.start = lambda { }
@watch.stop = lambda { }
@watch.prepare
end
# new
def test_new_should_have_no_behaviors
assert_equal [], @watch.... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_behavior.rb | test/test_behavior.rb | require File.dirname(__FILE__) + '/helper'
class TestBehavior < Minitest::Test
def test_generate_should_return_an_object_corresponding_to_the_given_type
assert_equal Behaviors::FakeBehavior, Behavior.generate(:fake_behavior, nil).class
end
def test_generate_should_raise_on_invalid_type
assert_raises NoS... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_socket.rb | test/test_socket.rb | require File.dirname(__FILE__) + '/helper'
class TestSocket < Minitest::Test
def setup
silence_warnings do
Object.const_set(:DRb, stub_everything)
end
end
def test_should_start_a_drb_server
DRb.expects(:start_service)
God::Socket.new
end
def test_should_use_supplied_port_and_host
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_conditions_http_response_code.rb | test/test_conditions_http_response_code.rb | require File.dirname(__FILE__) + '/helper'
class TestHttpResponseCode < Minitest::Test
def valid_condition
c = Conditions::HttpResponseCode.new()
c.watch = stub(:name => 'foo')
c.host = 'localhost'
c.port = 8080
c.path = '/'
c.timeout = 10
c.code_is = 200
c.times = 1
yield(c) if b... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_contact.rb | test/test_contact.rb | require File.dirname(__FILE__) + '/helper'
class TestContact < Minitest::Test
def test_exists
God::Contact
end
# generate
def test_generate_should_raise_on_invalid_kind
assert_raises(NoSuchContactError) do
Contact.generate(:invalid)
end
end
def test_generate_should_abort_on_invalid_con... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_email.rb | test/test_email.rb | require File.dirname(__FILE__) + '/helper'
class TestEmail < Minitest::Test
def setup
God::Contacts::Email.to_email = 'dev@example.com'
God::Contacts::Email.from_email = 'god@example.com'
@email = God::Contacts::Email.new
end
def test_validity_delivery
@email.delivery_method = :brainwaves
as... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_system_process.rb | test/test_system_process.rb | require File.dirname(__FILE__) + '/helper'
class TestSystemProcess < Minitest::Test
def setup
pid = Process.pid
@process = System::Process.new(pid)
end
def test_exists_should_return_true_for_running_process
assert_equal true, @process.exists?
end
def test_exists_should_return_false_for_non_exis... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_webhook.rb | test/test_webhook.rb | require File.dirname(__FILE__) + '/helper'
class TestWebhook < Minitest::Test
def setup
@webhook = God::Contacts::Webhook.new
end
def test_notify
@webhook.url = 'http://example.com/switch'
Net::HTTP.any_instance.expects(:request).returns(Net::HTTPSuccess.new('a', 'b', 'c'))
@webhook.notify('msg... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_event_handler.rb | test/test_event_handler.rb | require File.dirname(__FILE__) + '/helper'
module God
class EventHandler
def self.actions=(value)
@@actions = value
end
def self.actions
@@actions
end
def self.handler=(value)
@@handler = value
end
end
end
class TestEventHandler < Minitest::Test
def setup
@h = Go... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/suite.rb | test/suite.rb | require 'test/unit'
tests = Dir["#{File.dirname(__FILE__)}/test_*.rb"]
tests.each do |file|
require file
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_sensu.rb | test/test_sensu.rb | require File.dirname(__FILE__) + '/helper'
class TestSensu < Minitest::Test
def test_sensu_notify
sensu = God::Contacts::Sensu.new
sensu.check_name = "TestSensuContact"
UDPSocket.any_instance.expects(:send)
sensu.notify("Test", Time.now, "Test", "Test", "")
end
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_logger.rb | test/test_logger.rb | require File.dirname(__FILE__) + '/helper'
class TestLogger < Minitest::Test
def setup
@log = God::Logger.new(StringIO.new('/dev/null'))
end
# log
def test_log_should_keep_logs_when_wanted
@log.watch_log_since('foo', Time.now)
@log.expects(:info).with("qux")
@log.log(stub(:name => 'foo'), :i... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/test_hipchat.rb | test/test_hipchat.rb | require File.dirname(__FILE__) + '/helper'
class TestHipchat < Minitest::Test
def setup
@hipchat = God::Contacts::Hipchat.new
end
def test_exists
God::Contacts::Hipchat
end
def test_notify
@hipchat.token = 'ee64d6e2337310af'
@hipchat.ssl = 'true'
@hipchat.room = 'testroom'
@hipchat.... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/test.rb | test/configs/test.rb | ENV['GOD_TEST_RAILS_ROOT'] || abort("Set a rails root for testing in an environment variable called GOD_TEST_RAILS_ROOT")
RAILS_ROOT = ENV['GOD_TEST_RAILS_ROOT']
port = 5000
God.watch do |w|
w.name = "local-#{port}"
w.interval = 5.seconds
w.start = "mongrel_rails start -P ./log/mongrel.pid -c #{RAILS_ROOT} -p ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/usr1_trapper.rb | test/configs/usr1_trapper.rb | #! /usr/bin/env ruby
Signal.trap 'USR1' do
puts "can't stop won't stop"
end
loop do
puts 'server'
sleep 1
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/real.rb | test/configs/real.rb | if $0 == __FILE__
require File.join(File.dirname(__FILE__), *%w[.. .. lib god])
end
RAILS_ROOT = "/Users/tom/dev/git/helloworld"
God.watch do |w|
w.name = "local-3000"
w.interval = 5 # seconds
w.start = "mongrel_rails start -P ./log/mongrel.pid -c #{RAILS_ROOT} -d"
w.stop = "mongrel_rails stop -P ./log/mong... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/degrading_lambda/tcp_server.rb | test/configs/degrading_lambda/tcp_server.rb | #! /usr/bin/env ruby
require 'socket'
server = TCPServer.new('127.0.0.1', 9090)
while (session = server.accept)
puts "Found a session"
request = session.gets
puts "Request: #{request}"
time = request.to_i
puts "Sleeping for #{time}"
sleep time
session.print "Slept for #{time} seconds"
session.close
p... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/daemon_events/simple_server.rb | test/configs/daemon_events/simple_server.rb | require 'rubygems'
require 'daemons'
puts 'simple server ahoy!'
Daemons.run_proc('daemon-events', {:dir_mode => :system}) do
loop { puts 'server'; sleep 1 }
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/daemon_events/simple_server_stop.rb | test/configs/daemon_events/simple_server_stop.rb | # exit!(2)
3.times do
puts 'waiting'
sleep 1
end
p ENV
command = '/usr/local/bin/ruby ' + File.join(File.dirname(__FILE__), *%w[simple_server.rb]) + ' stop'
system(command)
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/child_polls/simple_server.rb | test/configs/child_polls/simple_server.rb | #! /usr/bin/env ruby
data = ''
loop do
STDOUT.puts('server');
STDOUT.flush;
100000.times { data << 'x' }
sleep 10
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/daemon_polls/simple_server.rb | test/configs/daemon_polls/simple_server.rb | require 'rubygems'
require 'daemons'
Daemons.run_proc('daemon-polls', {:dir_mode => :system}) do
loop { STDOUT.puts('server'); STDOUT.flush; sleep 1 }
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/keepalive/keepalive.rb | test/configs/keepalive/keepalive.rb | #! /usr/bin/env ruby
data = ''
loop do
STDOUT.puts('server');
STDOUT.flush;
100000.times { data << 'x' }
# sleep 10
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/stress/simple_server.rb | test/configs/stress/simple_server.rb | #! /usr/bin/env ruby
loop { puts 'server'; sleep 1 }
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/complex/simple_server.rb | test/configs/complex/simple_server.rb | #! /usr/bin/env ruby
loop { puts 'server'; sleep 1 }
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/child_events/simple_server.rb | test/configs/child_events/simple_server.rb | #! /usr/bin/env ruby
loop { puts 'server'; sleep 1 }
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/stop_options/simple_server.rb | test/configs/stop_options/simple_server.rb | #! /usr/bin/env ruby
trap :USR1 do
end
loop do
STDOUT.puts('server');
STDOUT.flush;
sleep 10
end
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/test/configs/contact/simple_server.rb | test/configs/contact/simple_server.rb | #! /usr/bin/env ruby
loop { puts 'server'; sleep 1 }
| ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/ext/god/extconf.rb | ext/god/extconf.rb | require 'mkmf'
fail = false
def create_dummy_makefile
File.open("Makefile", 'w') do |f|
f.puts "all:"
f.puts "install:"
end
end
have_func('rb_wait_for_single_fd')
case RUBY_PLATFORM
when /bsd/i, /darwin/i
unless have_header('sys/event.h')
puts
puts "Missing 'sys/event.h' header"
fail = true... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god.rb | lib/god.rb | # Bail out before loading anything unless this flag is set.
#
# We are doing this to guard against bundler autoloading because there is
# no value in loading god in most processes.
if $load_god
# core
require 'stringio'
require 'fileutils'
begin
require 'fastthread'
rescue LoadError
ensure
require 'thread'
end
#... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/trigger.rb | lib/god/trigger.rb | module God
class Trigger
class << self
attr_accessor :triggers # {task.name => condition}
end
# init
self.triggers = {}
@mutex = Mutex.new
def self.register(condition)
@mutex.synchronize do
self.triggers[condition.watch.name] ||= []
self.triggers[condition.watch... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/task.rb | lib/god/task.rb | module God
class Task
# Public: Gets/Sets the String name of the task.
attr_accessor :name
# Public: Gets/Sets the Numeric default interval to be used between poll
# events.
attr_accessor :interval
# Public: Gets/Sets the String group name of the task.
attr_accessor :group
# Public... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/logger.rb | lib/god/logger.rb | module God
class Logger < SimpleLogger
attr_accessor :logs
class << self
attr_accessor :syslog
end
self.syslog = defined?(Syslog)
# Instantiate a new Logger object
def initialize(io = $stdout)
super(io)
self.logs = {}
@mutex = Mutex.new
@capture = nil
@... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/errors.rb | lib/god/errors.rb | module God
class AbstractMethodNotOverriddenError < StandardError
end
class NoSuchWatchError < StandardError
end
class NoSuchConditionError < StandardError
end
class NoSuchBehaviorError < StandardError
end
class NoSuchContactError < StandardError
end
class InvalidCommandError < StandardError... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/sugar.rb | lib/god/sugar.rb | class Numeric
# Public: Units of seconds.
def seconds
self
end
# Public: Units of seconds.
alias :second :seconds
# Public: Units of minutes (60 seconds).
def minutes
self * 60
end
# Public: Units of minutes (60 seconds).
alias :minute :minutes
# Public: Units of hours (3600 seconds).
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/driver.rb | lib/god/driver.rb | require 'monitor'
# Ruby 1.9.1 specific fixes.
if RUBY_VERSION.between?('1.9', '1.9.1')
require 'god/compat19'
end
module God
# The TimedEvent class represents an event in the future. This class is used
# by the drivers to schedule upcoming conditional tests and other scheduled
# events.
class TimedEvent
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/event_handler.rb | lib/god/event_handler.rb | module God
class EventHandler
@@actions = {}
@@handler = nil
@@loaded = false
def self.loaded?
@@loaded
end
def self.event_system
@@handler::EVENT_SYSTEM
end
def self.load
begin
case RUBY_PLATFORM
when /darwin/i, /bsd/i
require 'god/event_... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/socket.rb | lib/god/socket.rb | require 'drb'
module God
# The God::Server oversees the DRb server which dishes out info on this God daemon.
class Socket
attr_reader :port
# The location of the socket for a given port
# +port+ is the port number
#
# Returns String (file location)
def self.socket_file(port)
"/tmp... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/registry.rb | lib/god/registry.rb | module God
def self.registry
@registry ||= Registry.new
end
class Registry
def initialize
@storage = {}
end
def add(item)
# raise TypeError unless item.is_a? God::Process
@storage[item.name] = item
end
def remove(item)
@storage.delete(item.name)
end
def ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/simple_logger.rb | lib/god/simple_logger.rb | module God
class SimpleLogger
DEBUG = 2
INFO = 4
WARN = 8
ERROR = 16
FATAL = 32
SEV_LABEL = {DEBUG => 'DEBUG',
INFO => 'INFO',
WARN => 'WARN',
ERROR => 'ERROR',
FATAL => 'FATAL'}
CONSTANT_TO_SYMBOL = { DEBUG => :debug,
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/watch.rb | lib/god/watch.rb | require 'etc'
require 'forwardable'
module God
# The Watch class is a specialized Task that handles standard process
# workflows. It has four states: init, up, start, and restart.
class Watch < Task
# The Array of Symbol valid task states.
VALID_STATES = [:init, :up, :start, :restart]
# The Sybmol i... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/process.rb | lib/god/process.rb | module God
class Process
WRITES_PID = [:start, :restart]
attr_accessor :name, :uid, :gid, :log, :log_cmd, :err_log, :err_log_cmd,
:start, :stop, :restart, :unix_socket, :chroot, :env, :dir,
:stop_timeout, :stop_signal, :umask
def initialize
self.log = '/dev/null... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/timeline.rb | lib/god/timeline.rb | module God
class Timeline < Array
# Instantiate a new Timeline
# +max_size+ is the maximum size to which the timeline should grow
#
# Returns Timeline
def initialize(max_size)
super()
@max_size = max_size
end
# Push a value onto the Timeline
# +val+ is the value to pu... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/sys_logger.rb | lib/god/sys_logger.rb | begin
require 'syslog'
# Ensure that Syslog is open
begin
Syslog.open('god')
rescue RuntimeError
Syslog.reopen('god')
end
Syslog.info("Syslog enabled.")
module God
class SysLogger
SYMBOL_EQUIVALENTS = { :fatal => Syslog::LOG_CRIT,
:error => Syslog::LOG_ER... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/behavior.rb | lib/god/behavior.rb | module God
class Behavior
include Configurable
attr_accessor :watch
# Generate a Behavior of the given kind. The proper class is found by camel casing the
# kind (which is given as an underscored symbol).
# +kind+ is the underscored symbol representing the class (e.g. foo_bar for God::Behavio... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/contact.rb | lib/god/contact.rb | module God
class Contact
include Configurable
attr_accessor :name, :group, :info
def self.generate(kind)
sym = kind.to_s.capitalize.gsub(/_(.)/){$1.upcase}.intern
c = God::Contacts.const_get(sym).new
unless c.kind_of?(Contact)
abort "Contact '#{c.class.name}' must subclass Go... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/configurable.rb | lib/god/configurable.rb | module God
module Configurable
# Override this method in your Configurable (optional)
#
# Called once after the Configurable has been sent to the block and attributes have been
# set. Do any post-processing on attributes here
def prepare
end
def reset
end
# Override this metho... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/metric.rb | lib/god/metric.rb | module God
# Metrics are responsible for holding watch conditions. An instance of
# Metric is yielded to blocks in the start_if, restart_if, stop_if, and
# transition methods.
class Metric
# The Watch.
attr_accessor :watch
# The destination Hash in canonical hash form. Example:
# { true => :up,... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/compat19.rb | lib/god/compat19.rb | require 'monitor'
# Taken from http://redmine.ruby-lang.org/repositories/entry/ruby-19/lib/monitor.rb
module MonitorMixin
class ConditionVariable
def wait(timeout = nil)
@monitor.__send__(:mon_check_owner)
count = @monitor.__send__(:mon_exit_for_cond)
begin
@cond.wait(@monitor.instance... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/condition.rb | lib/god/condition.rb | module God
class Condition < Behavior
attr_accessor :transition, :notify, :info, :phase
# Generate a Condition of the given kind. The proper class if found by camel casing the
# kind (which is given as an underscored symbol).
# +kind+ is the underscored symbol representing the class (e.g. :foo_bar... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/system/portable_poller.rb | lib/god/system/portable_poller.rb | module God
module System
class PortablePoller
def initialize(pid)
@pid = pid
end
# Memory usage in kilobytes (resident set size)
def memory
ps_int('rss')
end
# Percentage memory usage
def percent_memory
ps_float('%mem')
end
# Percenta... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/system/slash_proc_poller.rb | lib/god/system/slash_proc_poller.rb | module God
module System
class SlashProcPoller < PortablePoller
@@kb_per_page = 4 # TODO: Need to make this portable
@@hertz = 100
@@total_mem = nil
MeminfoPath = '/proc/meminfo'
UptimePath = '/proc/uptime'
RequiredPaths = [MeminfoPath, UptimePath]
# FreeBSD has /proc ... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/system/process.rb | lib/god/system/process.rb | module God
module System
class Process
def self.fetch_system_poller
@@poller ||= if SlashProcPoller.usable?
SlashProcPoller
else
PortablePoller
end
end
def initialize(pid)
@pid = pid.to_i
@poller = self.class.fetch_system_poller.new(@pid)... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/behaviors/notify_when_flapping.rb | lib/god/behaviors/notify_when_flapping.rb | module God
module Behaviors
class NotifyWhenFlapping < Behavior
attr_accessor :failures # number of failures
attr_accessor :seconds # number of seconds
attr_accessor :notifier # class to notify with
def initialize
super
@startup_times = []
end
def valid?
... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/behaviors/clean_pid_file.rb | lib/god/behaviors/clean_pid_file.rb | module God
module Behaviors
class CleanPidFile < Behavior
def valid?
valid = true
valid &= complain("Attribute 'pid_file' must be specified", self) if self.watch.pid_file.nil?
valid
end
def before_start
File.delete(self.watch.pid_file)
"deleted pid file... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
mojombo/god | https://github.com/mojombo/god/blob/92c06aa5f6293cf26498a306e9bb7ac856d7dca0/lib/god/behaviors/clean_unix_socket.rb | lib/god/behaviors/clean_unix_socket.rb | module God
module Behaviors
class CleanUnixSocket < Behavior
def valid?
valid = true
valid &= complain("Attribute 'unix_socket' must be specified", self) if self.watch.unix_socket.nil?
valid
end
def before_start
File.delete(self.watch.unix_socket)
"dele... | ruby | MIT | 92c06aa5f6293cf26498a306e9bb7ac856d7dca0 | 2026-01-04T15:57:05.100891Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.