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 | |
---|---|---|---|---|---|
#3 | 15828 | tjuricek |
Remove 'service object' abstraction for helix sync, revise to module code. This begins removing an unnecessary level of indirection. As it turns out, the Helix Sync logic will remain largely untouched between different systems. If we need very specific logic, we'll have to adjust each method, likely with configuration. Which will of course need some testing, or just outright replacement, which *should* be easier with module includes. |
||
#2 | 15757 | tjuricek |
Add resolve implementation for submitting from shelves for Helix Sync Includes additional concepts for creating a "helix sync shelf client" vs a "helix sync device client". It's expected that there's basically one shelf client per user per project. The "device" client is an additional client per user per project per machine. The HWS services will submit via the "shelf client". The resolve implementation remains untested at the moment in order to get the client changes in the hands of Helix Sync developers. |
||
#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. |