Permalink
Browse files

Refactored PrefPanePassenger specs.

  • Loading branch information...
1 parent bfd9958 commit 6ad0ad3aab6de453977c1d4c4395dfe785deb03b @alloy alloy committed Jun 24, 2008
Showing with 244 additions and 178 deletions.
  1. +26 −23 PassengerPref.rb
  2. +218 −155 test/pref_pane_passenger_test.rb
View
@@ -15,35 +15,19 @@ class << self
include SharedPassengerBehaviour
ib_outlet :installPassengerWarning
-
ib_outlet :authorizationView
-
ib_outlet :applicationsTableView
ib_outlet :applicationsController
kvc_accessor :applications, :authorized, :dirty_apps
def mainViewDidLoad
self.class.sharedInstance = self
-
@authorized = @dropping_directories = @dirty_apps = false
showPassengerWarning unless passenger_installed?
-
- @authorizationView.string = OSX::KAuthorizationRightExecute
- @authorizationView.delegate = self
- @authorizationView.updateStatus self
- @authorizationView.autoupdate = true
-
- @applications = [].to_ns
- @applicationsTableView.dataSource = self
- @applicationsTableView.registerForDraggedTypes [OSX::NSFilenamesPboardType]
- @applicationsTableView.setDraggingSourceOperationMask_forLocal(OSX::NSDragOperationGeneric, false)
-
- unless (existing_apps = PassengerApplication.existingApplications).empty?
- @applicationsController.addObjects existing_apps
- @applicationsController.selectedObjects = [existing_apps.last]
- end
+ setup_authorization_view!
+ setup_applications!
end
def applicationMarkedDirty(app)
@@ -74,17 +58,17 @@ def remove(sender = nil)
@applicationsController.removeObjects apps
end
+ def rbSetValue_forKey(value, key)
+ super
+ browse if !@dropping_directories and key == 'applications' and !value.empty? and value.last.new_app?
+ end
+
def showPassengerHelp(sender)
OSX::HelpHelper.openHelpPage File.expand_path('../English.lproj/PassengerPaneHelp/PassengerPaneHelp.html', __FILE__)
end
# Select application directory panel
- def rbSetValue_forKey(value, key)
- super
- browse if !@dropping_directories and key == 'applications' and !value.empty? and value.last.new_app?
- end
-
def browse(sender = nil)
panel = NSOpenPanel.openPanel
panel.canChooseDirectories = true
@@ -191,6 +175,25 @@ def unsavedChangesAlertDidEnd_returnCode_contextInfo(alert, returnCode, contextI
private
+ def setup_authorization_view!
+ @authorizationView.string = OSX::KAuthorizationRightExecute
+ @authorizationView.delegate = self
+ @authorizationView.updateStatus self
+ @authorizationView.autoupdate = true
+ end
+
+ def setup_applications!
+ @applications = [].to_ns
+ @applicationsTableView.dataSource = self
+ @applicationsTableView.registerForDraggedTypes [OSX::NSFilenamesPboardType]
+ @applicationsTableView.setDraggingSourceOperationMask_forLocal(OSX::NSDragOperationGeneric, false)
+
+ unless (existing_apps = PassengerApplication.existingApplications).empty?
+ @applicationsController.addObjects existing_apps
+ @applicationsController.selectedObjects = [existing_apps.last]
+ end
+ end
+
def passenger_installed?
`/usr/sbin/httpd -t -D DUMP_MODULES 2>&1`.include? 'passenger_module'
end
Oops, something went wrong.

0 comments on commit 6ad0ad3

Please sign in to comment.