module HelixSync # Provides a mechanism for managing client workspaces for projects. class ClientService # Rack environment attr_accessor :env def initialize(env: nil) @env = env end @@handle_create_client = [] # Callback methods that can implement client workspace creation based on # projects. # # Each callback should take 4 parameters: # # - `project` [String] The project ID. # # - `device` [String] A device ID (like a hostname or MAC address) that # we'll associate with the client. # # - `root` [String] The Root field of the client, the base directory for # the new setting. # # - `env` [Hash] The rack environment # # Your callback should return the new client name if it's been handled. # # It's assumed that your implementation will handle other defaults # responsibly. # # Example: # # HelixSync::ClientService.handle_create_client << lambda do |project, device, root, env| # client_name = go_make_client() # return client_name if client_name # Just return nil if you can't handle it # end def self.handle_create_client @@handle_create_client end # Create a client for the project. # # Returns the new client name if successful, nil otherwise. def create_client(project, device, root) client_id = nil @@handle_create_client.find do |handler| id = handler.call(project, device, root, env) client_id = id if id id end client_id end def p4 env['p4'] end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15741 | ptomiak | Branch HWS for my use. | ||
//guest/perforce_software/helix-web-services/main/source/helix_web_services/lib/helix_sync/client_service.rb | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services/lib/helix_sync/client_service.rb | |||||
#2 | 15487 | tjuricek | Add basic ability to create pending changelists for helix sync projects. | ||
#1 | 15479 | tjuricek | Added a basic "HVE project" implementation for creating clients. |