Class: HelixVersioningEngine::SubmitService
- Inherits:
-
Object
- Object
- HelixVersioningEngine::SubmitService
- Defined in:
- lib/helix_versioning_engine/submit_service.rb
Instance Attribute Summary (collapse)
-
- (Object) env
Existing Rack environment.
-
- (Object) p4
Require the p4 connection decided by our middleware.
Instance Method Summary (collapse)
-
- (SubmitService) initialize(p4: nil, env: nil)
constructor
A new instance of SubmitService.
-
- (Object) stream_client_for(change)
Returns true if the changelist is associated with a Streams-based client.
-
- (Object) submit_shelf(change)
Perform a 'p4 submit -e change'.
Constructor Details
- (SubmitService) initialize(p4: nil, env: nil)
Returns a new instance of SubmitService
11 12 13 14 15 16 17 |
# File 'lib/helix_versioning_engine/submit_service.rb', line 11 def initialize(p4: nil, env: nil) @p4 = p4 @env = env # This is created by `submit_shelf` @p4_root = nil end |
Instance Attribute Details
- (Object) env
Existing Rack environment
9 10 11 |
# File 'lib/helix_versioning_engine/submit_service.rb', line 9 def env @env end |
- (Object) p4
Require the p4 connection decided by our middleware
6 7 8 |
# File 'lib/helix_versioning_engine/submit_service.rb', line 6 def p4 @p4 end |
Instance Method Details
- (Object) stream_client_for(change)
Returns true if the changelist is associated with a Streams-based client.
36 37 38 39 40 41 42 |
# File 'lib/helix_versioning_engine/submit_service.rb', line 36 def stream_client_for(change) change_spec = p4.fetch_change(change) client_spec = p4.fetch_client(change_spec._client) client_spec._stream.nil? ? nil : client_spec end |
- (Object) submit_shelf(change)
Perform a 'p4 submit -e change'
This will need to detect the correct kind of temporary client to create, create that, and then perform the submission.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/helix_versioning_engine/submit_service.rb', line 23 def submit_shelf(change) stream_client = stream_client_for(change) if stream_client @p4_root = P4Util.create_temp_stream_client_duplicate(p4, stream_client) env['p4_root'] = @p4_root else @p4_root = P4Util.create_temp_client(p4) env['p4_root'] = @p4_root end p4.run_submit('-e', change) end |