Class: PassengerPane::Configuration
- Inherits:
-
Object
- Object
- PassengerPane::Configuration
- Defined in:
- lib/passenger_pane/configuration.rb
Constant Summary collapse
- CONFIG_FILENAME =
'~/.passenger_pane.yml'- APACHE_DIRECTORY =
'/private/etc/apache2'
Class Method Summary collapse
Instance Method Summary collapse
- #applications ⇒ Object
- #httpd ⇒ Object
-
#initialize(apache_directory = APACHE_DIRECTORY) ⇒ Configuration
constructor
A new instance of Configuration.
- #set(options) ⇒ Object
Constructor Details
#initialize(apache_directory = APACHE_DIRECTORY) ⇒ Configuration
Returns a new instance of Configuration.
31 32 33 34 |
# File 'lib/passenger_pane/configuration.rb', line 31 def initialize(apache_directory=APACHE_DIRECTORY) self.apache_directory = apache_directory set(self.class.defaults) end |
Class Method Details
.auto ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/passenger_pane/configuration.rb', line 21 def self.auto configuration = new if File.exist?(config_filename) configuration.set(YAML.load_file(config_filename)) end configuration end |
.config_filename ⇒ Object
17 18 19 |
# File 'lib/passenger_pane/configuration.rb', line 17 def self.config_filename File.(CONFIG_FILENAME) end |
.defaults ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/passenger_pane/configuration.rb', line 6 def self.defaults { :ruby_binary => "/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby", :httpd_binary => "/usr/sbin/httpd", :httpd_conf => "httpd.conf", :passenger_vhosts => "passenger_pane_vhosts", :passenger_vhosts_ext => "vhost.conf", :apache_restart_command => "/bin/launchctl stop org.apache.httpd" } end |
Instance Method Details
#applications ⇒ Object
50 51 52 |
# File 'lib/passenger_pane/configuration.rb', line 50 def applications PassengerPane::Application.all(self) end |
#httpd ⇒ Object
46 47 48 |
# File 'lib/passenger_pane/configuration.rb', line 46 def httpd @httpd ||= PassengerPane::HttpdConf.new(self) end |
#set(options) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/passenger_pane/configuration.rb', line 36 def set() .each do |key, value| begin send("#{key}=", value) rescue NoMethodError raise ArgumentError, "There is no configuration named `#{key}', valid options are: #{self.class.defaults.keys.join(', ')} and apache_directory." end end end |