Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

making it support both rack and rails

  • Loading branch information...
commit 061c48786a8fdb7eb43f27ab3d95495a51b6a818 1 parent 44b3afd
@jamster authored
View
7 Rakefile
@@ -12,7 +12,7 @@ namespace :prefpane do
# Make sure that the prefpane searches inside the bundle for the RubyCocoa framework.
#
# This task is invoked from the xcode project post build script.
- desc 'Adjusts the install name of the bundled RubyCocoa to point to the right place'
+ desc 'Adjusts the install name of the bundled rvm to point to the right place'
task :change_ruycocoa_framework_location do
current = `/usr/bin/otool -L #{BIN}`.match(/^\t(.+RubyCocoa).+$/)[1]
sh "/usr/bin/install_name_tool -change '#{current}' '@loader_path/../Frameworks/RubyCocoa.framework/Versions/A/RubyCocoa' '#{BIN}'"
@@ -32,8 +32,9 @@ end
desc 'Creates a release build and pkg'
task :release => [:clean, 'prefpane:build'] do
- require 'osx/cocoa'
- version = OSX::NSDictionary.dictionaryWithContentsOfFile('Info.plist')['CFBundleVersion'].to_s
+ # require 'osx/cocoa'
+ # version = OSX::NSDictionary.dictionaryWithContentsOfFile('Info.plist')['CFBundleVersion'].to_s
+ version = "NOTRUBYCOCOA"
name = "PassengerPane-#{version}"
pkg_dir = "pkg/#{name}"
View
12 app/models/passenger_application.rb
@@ -198,6 +198,8 @@ def to_hash
{
'app_type' => application_type,
+ 'is_rails' => is_rails?,
+ 'is_rack' => is_rack?,
'config_path' => config_path,
'host' => @host.to_s,
'aliases' => @aliases.to_s,
@@ -221,6 +223,16 @@ def check_application_type
(File.exist?(env_file) and File.read(env_file) =~ RAILS_APP_REGEXP) ? RAILS : RACK
end
+ def is_rack?
+ config_ru_file = File.join(@path, 'config.ru')
+ File.exist?(env_file)
+ end
+
+ def is_rails?
+ env_file = File.join(@path, 'config', 'environment.rb')
+ File.exist?(env_file) && File.read(env_file) =~ RAILS_APP_REGEXP
+ end
+
def load_data_from_vhost_file(file = config_path)
data = File.read(file).strip
View
3  app/scripts/config_installer.rb
@@ -64,7 +64,8 @@ def create_vhost_conf(index)
" ServerName #{app['host']}",
(" ServerAlias #{app['aliases']}" unless app['aliases'].empty?),
" DocumentRoot \"#{public_dir}\"",
- " #{app['app_type'].capitalize}Env #{app['environment']}",
+ (" RailsEnv #{app['environment']}" if app['is_rails']),
+ (" RackEnv #{app['environment']}" if app['is_rack']),
(app['user_defined_data'] unless app['user_defined_data'].empty?),
"</VirtualHost>"
].compact.join("\n")
Please sign in to comment.
Something went wrong with that request. Please try again.