require 'helix_versioning_engine/util' module HelixVersioningEngine # Generic CRUD behavior for most of our spec types. class App < Sinatra::Base set(:is_spec) do |_x| condition do path_info = env['PATH_INFO'] matches = %r{^/helix_versioning_engine/v\d+/(?<spec_type>\w+)}.match(path_info) if matches spec_type = matches[:spec_type] return (spec_type == 'branches' || spec_type == 'clients' || spec_type == 'depots' || spec_type == 'groups' || spec_type == 'jobs' || spec_type == 'labels' || spec_type == 'servers' ) end false end end # Provide a generic collection accessor for each of the specs. get '/helix_versioning_engine/:api/:spec_type', is_spec: true do |_, spec_type| require_p4 results = env['p4'].run(spec_type) results.to_json end # Provide a generic output accessor for each spec get '/helix_versioning_engine/:api/:spec_type/:id', is_spec: true do |api, spec_type, id| require_p4 results = env['p4'].run(Util.singular(spec_type), '-o', id) results.first.to_json end # This is our generic "add" mechanism for each type. # # It's assumed that the client understands the requirements of each spec # type. post '/helix_versioning_engine/:api/:spec_type', is_spec: true do |api, spec_type| require_p4 method_name = "save_#{Util.singular(spec_type)}".to_sym results = env['p4'].send(method_name, params) results.to_json end # An 'update' mechanism for each spec type. patch '/helix_versioning_engine/:api/:spec_type/:id', is_spec: true do |_, spec_type, id| require_p4 p4 = env['p4'] singular = Util.singular(spec_type) spec = p4.run(singular, '-o', id)[0] spec = spec.merge(filter_params(params)) method_name = "save_#{singular}".to_sym p4.send(method_name, spec) spec.to_json end delete '/helix_versioning_engine/:api/:spec_type/:id', is_spec: true do |_, spec_type, id| require_p4 method_name = "delete_#{Util.singular(spec_type)}".to_sym env['p4'].send(method_name, id) '' 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_versioning_engine/app/specs.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_versioning_engine/app/specs.rb | |||||
#3 | 15240 | tjuricek |
Set api level via request path on all Helix Versioning Engine methods. This will allow migration of applications to different P4D versions. Our internal methods (like project API) should attempt to handle backward compatibility similarly. P4WEBAPI-118 |
||
#2 | 15073 | tjuricek | Update Auth::Middleware and add spec | ||
#1 | 15032 | tjuricek |
Starting config and doc revisions. System is now broken while revisions underway. Configuration of the p4d connection is now done via a single HWSSettings middleware object injected into the Rack env. The HWSP4Cleanup middleware now cleans up any p4 injected into the Rack env. The Auth::App class now mostly just contains one method to generate a p4 ticket. /auth/v1/login. Added yard documentation for the main project. Yard docs have been reconfigured to dump into build/ directories. This should probably be done with each release. Hm... The top level rake file contains a task, 'all:doc', to update our documentation. This should probably be run for each checkin. Hm... Specs are now using Rack::Test on top of a 'live' p4d. I'd suggest you still use the p4util mechanism, which now dumps to a /tmp folder, so we can safely add P4IGNORE rules back into your local .p4config file. Old 'perforce' application now called 'helix_versioning_engine'. Removing cache data. Helix Sync may be slow. It may also get axed. We'll see. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services/lib/perforce/app/specs.rb | |||||
#2 | 13839 | tjuricek |
Conversion of the p4_project_service microservice to new monolithic system. This may not have an HTTP front end in the monolithic system. Project services are really just about how the core object model is structured. It's likely that each application will add their own wrinkles and extensions to the system, so it's unlikely we'll need a generic "project model". Exactly how extensions are registered and used is still a bit TBD at the moment. Previously they were to be registered webhooks, that model may change. Does not include tests yet. |
||
#1 | 13799 | tjuricek |
Start with branch specs hosting in a new monolithic 'helix web services' project. Converting from a microservice to a monolithic architecture due to resource constraints at getting a deployable system running. Additionally, since it's not expected that people will upgrade often, the major benefit of microservices - being able to add services individually without affecting others - is not really a major benefit. The Ruby SDK will be consolidated into a single 'helix web services client' project. It may end up being distributed via Rubygems. This only runs branch specs at the moment. I want to get a CD pipeline setup for the monolithic server before revising more methods. |
||
//guest/perforce_software/helix-web-services/main/p4_web_api/p4_web_api/lib/p4_web_api/app/specs.rb | |||||
#3 | 13784 | tjuricek | Typo fix | ||
#2 | 13675 | tjuricek |
Add notification_services initialization Removing the 'online setup' mode in lieu of doing things during the salt process. Mostly this removes the trigger setup from the main web application. |
||
#1 | 13412 | tjuricek |
Initial version of the web-services mainline. This is a collection of several projects, that will likely often get released together, though many of them may not always be relevant. See the README for more information. |