require 'helix_sync/methods' require 'sinatra/base' module HelixSync class App < Sinatra::Base include HelixSync::Methods # Fetch the latest changelist for a Helix Sync project # # Note: this will likely require the Helix Sync shelf client to exist. get '/helix-sync/v1/:project_id/last-change' do |project_id| require_p4 # In case you create a new project, you can still send in a default of 0, # just to avoid a 404. The shelf client should still exist though. default = params['default'] if params.key?('default') change = find_latest_change_for_project(project_id) change = default if !change and default halt 404 unless change {change: change}.to_json end # Get a pending changelist for the user to use for a project get '/helix-sync/v1/:project_id/pending' do |project_id| require_p4 default = params['default'] if params.key?('default') change = find_pending_change_for_project(project_id) change = default if !change and default halt 404 unless change {change: change}.to_json end # Removes the pending changelist for a particular project. # # The main use case here might be uninstallation. delete '/helix-sync/v1/:project_id/pending' do |project_id| require_p4 delete_pending_change_for_project(project_id) '' end # Get a pending changelist for the user to use for a project get '/helix-sync/v1/:project_id/preview' do |project_id| require_p4 plan = preview_pending_change(project_id) halt 404 unless plan plan.to_json end # Submit a pending changelist for a project post '/helix-sync/v1/:project/submit' do |project_id| require_p4 resolve_and_submit_shelf(project_id) '' end # Create/update the client for a Helix Sync project post '/helix-sync/v1/:project/clients/device' do |project_id| require_p4 device = params['device'] root = params['root'] client_name = create_device_client(project_id, device, root) halt 404 unless client_name {client: client_name}.to_json end # There shouldn't be any real changelists on this device client. Or you # will get a failure. delete '/helix-sync/v1/:project/clients/device/:device' do |project_id, device_id| require_p4 delete_device_client(project_id, device_id) '' end post '/helix-sync/v1/:project/clients/shelf' do |project_id| require_p4 client_name = create_shelf_client(project_id, '/dev/null') halt 404 unless client_name {client: client_name}.to_json end # Note: It is up to the user to ensure that no pending changes are used # on the client. (See DELETE /helix-sync/v1/:project_id/pending) delete '/helix-sync/v1/:project/clients/shelf' do |project_id| require_p4 delete_shelf_client(project_id) '' end end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 16196 | Doug Scheirer | Merge from main | ||
#4 | 16114 | Doug Scheirer | Merge from main | ||
#3 | 16014 | Doug Scheirer | Merge down from main | ||
#2 | 15845 | Doug Scheirer | Integ from main | ||
#1 | 15688 | Doug Scheirer |
Populate -o //guest/perforce_software/helix-web-services/... //guest/doug_scheirer/helix-web-services/.... |
||
//guest/perforce_software/helix-web-services/main/source/helix_web_services/lib/helix_sync/app.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/app.rb | |||||
#7 | 15517 | tjuricek | Do not require changelist ID for submitting Helix Sync pending changelists. | ||
#6 | 15499 | tjuricek | Naive implementation of helix sync project submit for "helix versioning engine projects". | ||
#5 | 15497 | tjuricek | Add support to fetch the latest change of a project. | ||
#4 | 15496 | tjuricek |
Revise GET /helix_sync/v1/changes/[project] to /helix_sync/v1/changes/[project]/pending The base method is really intended for the latest changelist number. Meh. |
||
#3 | 15487 | tjuricek | Add basic ability to create pending changelists for helix sync projects. | ||
#2 | 15479 | tjuricek | Added a basic "HVE project" implementation for creating clients. | ||
#1 | 15242 | tjuricek | Add Helix Sync stubs and documentation |