Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a simple way to prevent bundler auto-loading #97

Merged
merged 2 commits into from
Sep 18, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/god
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ STDOUT.sync = true

$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])

require 'rubygems'
require 'optparse'
require 'drb'
require 'yaml'
Expand Down Expand Up @@ -105,6 +104,9 @@ begin
abort("Invalid log level '#{options[:log_level]}'")
end

# Use this flag to actually load all of the god infrastructure
$load_god = true

# dispatch
if !options[:config] && options[:version]
require 'god'
Expand Down
10 changes: 8 additions & 2 deletions lib/god.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
# 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'
Expand Down Expand Up @@ -726,7 +730,7 @@ def self.at_exit
# private

# Match a shortened pattern against a list of String candidates.
# The pattern is expanded into a regular expression by
# The pattern is expanded into a regular expression by
# inserting .* between each character.
#
# pattern - The String containing the abbreviation.
Expand Down Expand Up @@ -756,3 +760,5 @@ def self.pattern_match(pattern, list)
at_exit do
God.at_exit if $run
end

end
6 changes: 5 additions & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
require 'rubygems'
$:.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::EventHandler.load
Expand Down