Skip to content

Instantly share code, notes, and snippets.

@ohadlevy
Created December 30, 2014 09:39
Show Gist options
  • Save ohadlevy/ab20dfcabe923a5113a4 to your computer and use it in GitHub Desktop.
Save ohadlevy/ab20dfcabe923a5113a4 to your computer and use it in GitHub Desktop.
diff --git a/lib/proxy/plugin.rb b/lib/proxy/plugin.rb
index 8bdabc3..1a598c0 100644
--- a/lib/proxy/plugin.rb
+++ b/lib/proxy/plugin.rb
@@ -71,7 +71,7 @@ class ::Proxy::Plugin
end
def http_rackup_path(path)
- @get_http_rackup_path = path if http_enabled?
+ @get_http_rackup_path = path
end
def https_enabled?
@@ -79,7 +79,7 @@ class ::Proxy::Plugin
end
def https_rackup_path(path)
- @get_https_rackup_path = path if https_enabled?
+ @get_https_rackup_path = path
end
def dependencies
@@ -97,6 +97,9 @@ class ::Proxy::Plugin
# relative to ::Proxy::SETTINGS.settings_directory
def settings_file(apath = nil)
if apath.nil?
+ if plugin_name.nil?
+ raise "invalid plugin name: #{self.to_s}"
+ end
@settings_file || "#{plugin_name}.yml"
else
@settings = nil
@@ -134,11 +137,19 @@ class ::Proxy::Plugin
end
def http_rackup
- self.class.get_http_rackup_path.nil? ? "" : File.read(self.class.get_http_rackup_path)
+ if self.class.http_enabled? && self.class.get_http_rackup_path
+ File.read(self.class.get_http_rackup_path)
+ else
+ ""
+ end
end
def https_rackup
- self.class.get_https_rackup_path.nil? ? "" : File.read(self.class.get_https_rackup_path)
+ if self.class.https_enabled? && self.class.get_https_rackup_path
+ File.read(self.class.get_https_rackup_path)
+ else
+ ""
+ end
end
def settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment