p4ruby 2021.1.2156749 → 2021.1.2196401

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: caea2db119dc72c9cbcdbb6d3218e0a548f75eb47c7e6471c66db6dd7d5bdb36
4
- data.tar.gz: 3eb17c7df1baa55c73b3c195de8fa0e31bd86a5dd688970d831f5f4e205e3bf6
3
+ metadata.gz: e9bc10481728903ef23ab0a23d26a8a8625aa77ae932b03013c2e64b77dc68ef
4
+ data.tar.gz: b92883da18bfbd61f0472ea75285b29839ba424fe17ff33fff31bcbcd2aecdb7
5
5
  SHA512:
6
- metadata.gz: 9f43e94cc99bc92157512f438138610364959eeb8ccb57f313027f01e8767b699b03615ed01dac042315a6b4a5a7775c7e5cd09469733d9a73d7bbc1808624c9
7
- data.tar.gz: f492d5051540489a0f62bd07b5d994148e02181f969523c633e5857d62253e2c983d83b9c90e7bab83b44efe2ef33770dfa025086badd89c99fbff0137e3a58d
6
+ metadata.gz: '081fb099b2bf35733bd3d1d442acbc8c7cd1b2ee239bc8d3e02f08c7dc1151d7bfc8f2247e5e496c53ea5bedea012c463530cb43cf97a052ee147767a39afa61'
7
+ data.tar.gz: 35f10620209159f2ac682f47d2aa603ad661037b43143d897c78328d615cf7d9cb5851927fbe5f03a5be5df6be24175672e0742e99ec4b9e2d87d253dc5ef495
data/README.md CHANGED
@@ -1,4 +1,17 @@
1
1
  [![Support](https://img.shields.io/badge/Support-Official-green.svg)](mailto:support@perforce.com)
2
2
 
3
- # p4ruby
3
+ # P4Ruby
4
4
  P4Ruby is a wrapper for the P4 C++ API in Ruby.
5
+
6
+ P4Ruby is a Ruby module that provides an object-oriented API to Helix Core server. Using P4Ruby is faster than using the command-line interface in scripts, because multiple command can be executed on a single connection, and because it returns Helix server responses as Ruby hashes and arrays.
7
+
8
+ ## Requirements
9
+ For P4Ruby requirements see "Compatibility Statements" in [RELNOTES](https://github.com/perforce/p4ruby/blob/master/RELNOTES.txt#L99)
10
+
11
+ ## Documentation
12
+ Official documentation is located on the [Perforce website](https://www.perforce.com/manuals/p4ruby/Content/P4Ruby/Home-p4ruby.html)
13
+
14
+ ## Support
15
+ P4Ruby is officially supported by Perforce.
16
+ Pull requests will be managed by Perforce's engineering teams. We will do our best to acknowledge these in a timely manner based on available capacity.
17
+ Issues will not be managed on GitHub. All issues should be recorded via [Perforce's standard support process](https://www.perforce.com/support/request-support).
@@ -66,6 +66,19 @@ static const int CANCEL = 2;
66
66
  * server, and converts the data to Ruby form for returning to the caller.
67
67
  ******************************************************************************/
68
68
 
69
+ class SSOShim : public ClientSSO {
70
+ public:
71
+ SSOShim(ClientUserRuby *ui) : ui(ui) {}
72
+ virtual ClientSSOStatus Authorize( StrDict &vars,
73
+ int maxLength,
74
+ StrBuf &result )
75
+ {
76
+ return ui->Authorize(vars, maxLength, result);
77
+ }
78
+ private:
79
+ ClientUserRuby *ui;
80
+ } ;
81
+
69
82
  ClientUserRuby::ClientUserRuby(SpecMgr *s) {
70
83
  specMgr = s;
71
84
  debug = 0;
@@ -78,15 +91,22 @@ ClientUserRuby::ClientUserRuby(SpecMgr *s) {
78
91
  rubyExcept = 0;
79
92
  alive = 1;
80
93
  track = false;
81
- SetSSOHandler( ssoHandler = new P4ClientSSO( s ) );
94
+ SetSSOHandler( new SSOShim( this ) );
95
+
96
+ ssoEnabled = 0;
97
+ ssoResultSet = 0;
98
+ ssoResult = Qnil;
99
+ ssoHandler = Qnil;
82
100
 
83
101
  ID idP4 = rb_intern("P4");
84
102
  ID idP4OH = rb_intern("OutputHandler");
85
103
  ID idP4Progress = rb_intern("Progress");
104
+ ID idP4SSO = rb_intern("SSOHandler");
86
105
 
87
106
  VALUE cP4 = rb_const_get_at(rb_cObject, idP4);
88
107
  cOutputHandler = rb_const_get_at(cP4, idP4OH);
89
108
  cProgress = rb_const_get_at(cP4, idP4Progress );
109
+ cSSOHandler = rb_const_get_at(cP4, idP4SSO);
90
110
  }
91
111
 
92
112
  void ClientUserRuby::Reset() {
@@ -721,47 +741,130 @@ void ClientUserRuby::GCMark() {
721
741
  if (mergeResult != Qnil) rb_gc_mark( mergeResult);
722
742
  if (handler != Qnil) rb_gc_mark( handler);
723
743
  if (progress != Qnil) rb_gc_mark( progress );
724
- rb_gc_mark( cOutputHandler);
744
+ if (ssoResult != Qnil) rb_gc_mark( ssoResult );
745
+ if (ssoHandler != Qnil) rb_gc_mark( ssoHandler );
746
+ rb_gc_mark( cOutputHandler );
725
747
  rb_gc_mark( cProgress );
748
+ rb_gc_mark( cSSOHandler );
726
749
 
727
750
  results.GCMark();
728
- ssoHandler->GCMark();
729
751
  }
730
752
 
731
- //
732
- // SSO handler
733
- //
734
753
 
735
- P4ClientSSO::P4ClientSSO( SpecMgr *s )
736
- {
737
- specMgr = s;
738
- resultSet = 0;
739
- ssoEnabled = 0;
740
- result = Qnil;
754
+ /*
755
+ * Set the Handler object. Double-check that it is either nil or
756
+ * an instance of OutputHandler to avoid future problems
757
+ */
758
+
759
+ VALUE
760
+ ClientUserRuby::SetRubySSOHandler(VALUE h) {
761
+ if (P4RDB_CALLS) fprintf(stderr, "[P4] SetSSOHandler()\n");
762
+
763
+ if (Qnil != h && Qfalse == rb_obj_is_kind_of(h, cSSOHandler)) {
764
+ rb_raise(eP4, "Handler needs to be an instance of P4::SSOHandler");
765
+ return Qfalse;
766
+ }
767
+
768
+ ssoHandler = h;
769
+ alive = 1; // ensure that we don't drop out after the next call
770
+
771
+ return Qtrue;
772
+ }
773
+
774
+
775
+ // returns true if output should be reported
776
+ // false if the output is handled and should be ignored
777
+ static VALUE CallMethodSSO(VALUE data) {
778
+ VALUE *args = reinterpret_cast<VALUE *>(data);
779
+ return rb_funcall(args[0], (ID) rb_intern("authorize"), 2, args[1], args[2]);
741
780
  }
742
781
 
743
782
  ClientSSOStatus
744
- P4ClientSSO::Authorize( StrDict &vars, int maxLength, StrBuf &strbuf )
783
+ ClientUserRuby::CallSSOMethod(VALUE vars, int maxLength, StrBuf &result) {
784
+ ClientSSOStatus answer = CSS_SKIP;
785
+ int excepted = 0;
786
+ result.Clear();
787
+
788
+ if (P4RDB_COMMANDS) fprintf(stderr, "[P4] CallSSOMethod\n");
789
+
790
+ // some wild hacks to satisfy the rb_protect method
791
+
792
+ VALUE args[3] = { ssoHandler, vars, INT2NUM( maxLength ) };
793
+
794
+ VALUE res = rb_protect(CallMethodSSO, (VALUE) args, &excepted);
795
+
796
+ if (excepted) { // exception thrown
797
+ alive = 0;
798
+ rb_jump_tag(excepted);
799
+ } else if( FIXNUM_P( res ) ) {
800
+ int a = NUM2INT(res);
801
+ if (P4RDB_COMMANDS)
802
+ fprintf(stderr, "[P4] CallSSOMethod returned %d\n", a);
803
+
804
+ if( a < CSS_PASS || a > CSS_SKIP )
805
+ rb_raise(eP4, "P4::SSOHandler::authorize returned out of range response");
806
+ answer = (ClientSSOStatus) a;
807
+ } else if( Qtrue == rb_obj_is_kind_of(res, rb_cArray) ) {
808
+ VALUE resval1 = rb_ary_shift(res);
809
+ Check_Type( resval1, T_FIXNUM );
810
+ int a = NUM2INT(resval1);
811
+ if( a < CSS_PASS || a > CSS_SKIP )
812
+ rb_raise(eP4, "P4::SSOHandler::authorize returned out of range response");
813
+ answer = (ClientSSOStatus) a;
814
+
815
+ VALUE resval2 = rb_ary_shift(res);
816
+ if( resval2 != Qnil )
817
+ {
818
+ Check_Type( resval2, T_STRING );
819
+ result.Set(StringValuePtr(resval2));
820
+ if (P4RDB_COMMANDS)
821
+ fprintf(stderr, "[P4] CallSSOMethod returned %d, %s\n", a, result.Text());
822
+ }
823
+
824
+ } else {
825
+ Check_Type( res, T_STRING );
826
+ answer = CSS_PASS;
827
+
828
+ result.Set(StringValuePtr(res));
829
+ if (P4RDB_COMMANDS)
830
+ fprintf(stderr, "[P4] CallSSOMethod returned %s\n", result.Text());
831
+
832
+ }
833
+
834
+ return answer;
835
+ }
836
+
837
+ ClientSSOStatus
838
+ ClientUserRuby::Authorize( StrDict &vars, int maxLength, StrBuf &strbuf )
745
839
  {
746
- ssoVars.Clear();
840
+ ssoVars.Clear();
841
+
842
+ if( ssoHandler != Qnil )
843
+ {
844
+ ClientSSOStatus res = CallSSOMethod( specMgr->StrDictToHash(&vars), maxLength, strbuf );
845
+ if( res != CSS_SKIP )
846
+ return res;
847
+ if (P4RDB_COMMANDS)
848
+ fprintf(stderr, "[P4] Authorize skipped result from SSO Handler\n" );
849
+ }
747
850
 
748
- if( !ssoEnabled )
749
- return CSS_SKIP;
851
+ if( !ssoEnabled )
852
+ return CSS_SKIP;
750
853
 
751
- if( ssoEnabled < 0 )
752
- return CSS_UNSET;
854
+ if( ssoEnabled < 0 )
855
+ return CSS_UNSET;
753
856
 
754
- if( resultSet )
755
- {
756
- strbuf.Clear();
757
- VALUE resval = result;
857
+ if( ssoResultSet )
858
+ {
859
+ strbuf.Clear();
860
+ VALUE resval = ssoResult;
758
861
 
759
- //if( P4RDB_CALLS )
760
- // std::cerr << "[P4] ClientSSO::Authorize(). Using supplied input"
761
- // << std::endl;
862
+ //if( P4RDB_CALLS )
863
+ // std::cerr << "[P4] ClientSSO::Authorize(). Using supplied input"
864
+ // << std::endl;
762
865
 
763
- if (Qtrue == rb_obj_is_kind_of(result, rb_cArray)) {
764
- resval = rb_ary_shift(result);
866
+ if (Qtrue == rb_obj_is_kind_of(ssoResult, rb_cArray)) {
867
+ resval = rb_ary_shift(ssoResult);
765
868
  }
766
869
 
767
870
  if( resval != Qnil ) {
@@ -771,111 +874,106 @@ P4ClientSSO::Authorize( StrDict &vars, int maxLength, StrBuf &strbuf )
771
874
  strbuf.Set(StringValuePtr(str));
772
875
  }
773
876
 
774
- return resultSet == 2 ? CSS_FAIL
775
- : CSS_PASS;
776
- }
877
+ return ssoResultSet == 2 ? CSS_FAIL
878
+ : CSS_PASS;
879
+ }
777
880
 
778
- ssoVars.CopyVars( vars );
779
- return CSS_EXIT;
881
+ ssoVars.CopyVars( vars );
882
+ return CSS_EXIT;
780
883
  }
781
884
 
782
885
  VALUE
783
- P4ClientSSO::EnableSSO( VALUE e )
886
+ ClientUserRuby::EnableSSO( VALUE e )
784
887
  {
785
- if( e == Qnil )
786
- {
787
- ssoEnabled = 0;
788
- return Qtrue;
789
- }
790
-
791
- if( e == Qtrue )
792
- {
793
- ssoEnabled = 1;
794
- return Qtrue;
795
- }
796
-
797
- if( e == Qfalse )
798
- {
799
- ssoEnabled = -1;
800
- return Qtrue;
801
- }
888
+ if( e == Qnil )
889
+ {
890
+ ssoEnabled = 0;
891
+ return Qtrue;
892
+ }
893
+
894
+ if( e == Qtrue )
895
+ {
896
+ ssoEnabled = 1;
897
+ return Qtrue;
898
+ }
899
+
900
+ if( e == Qfalse )
901
+ {
902
+ ssoEnabled = -1;
903
+ return Qtrue;
904
+ }
802
905
 
803
906
  return Qfalse;
804
907
  }
805
908
 
806
909
  VALUE
807
- P4ClientSSO::SSOEnabled()
910
+ ClientUserRuby::SSOEnabled()
808
911
  {
809
- if( ssoEnabled == 1 )
810
- {
811
- return Qtrue;
812
- }
813
- else if( ssoEnabled == -1 )
814
- {
815
- return Qfalse;
816
- }
817
- else
818
- {
819
- return Qnil;
820
- }
912
+ if( ssoEnabled == 1 )
913
+ {
914
+ return Qtrue;
915
+ }
916
+ else if( ssoEnabled == -1 )
917
+ {
918
+ return Qfalse;
919
+ }
920
+ else
921
+ {
922
+ return Qnil;
923
+ }
821
924
  }
822
925
 
823
926
  VALUE
824
- P4ClientSSO::SetPassResult( VALUE i )
927
+ ClientUserRuby::SetSSOPassResult( VALUE i )
825
928
  {
826
- resultSet = 1;
827
- return SetResult( i );
929
+ ssoResultSet = 1;
930
+ return SetSSOResult( i );
828
931
  }
829
932
 
830
933
  VALUE
831
- P4ClientSSO::GetPassResult()
934
+ ClientUserRuby::GetSSOPassResult()
832
935
  {
833
- if( resultSet == 1 )
834
- {
835
- return result;
836
- }
837
- else
838
- {
839
- return Qnil;
840
- }
936
+ if( ssoResultSet == 1 )
937
+ {
938
+ return ssoResult;
939
+ }
940
+ else
941
+ {
942
+ return Qnil;
943
+ }
841
944
  }
842
945
 
843
946
  VALUE
844
- P4ClientSSO::SetFailResult( VALUE i )
947
+ ClientUserRuby::SetSSOFailResult( VALUE i )
845
948
  {
846
- resultSet = 2;
847
- return SetResult( i );
949
+ ssoResultSet = 2;
950
+ return SetSSOResult( i );
848
951
  }
849
952
 
850
953
  VALUE
851
- P4ClientSSO::GetFailResult()
954
+ ClientUserRuby::GetSSOFailResult()
852
955
  {
853
- if( resultSet == 2 )
854
- {
855
- return result;
856
- }
857
- else
858
- {
859
- return Qnil;
860
- }
956
+ if( ssoResultSet == 2 )
957
+ {
958
+ return ssoResult;
959
+ }
960
+ else
961
+ {
962
+ return Qnil;
963
+ }
861
964
  }
862
965
 
863
966
  VALUE
864
- P4ClientSSO::SetResult( VALUE i )
967
+ ClientUserRuby::SetSSOResult( VALUE i )
865
968
  {
866
- //if (P4RDB_CALLS) fprintf(stderr, "[P4] P4ClientSSO::SetResult()\n");
969
+ if (P4RDB_CALLS) fprintf(stderr, "[P4] P4ClientSSO::SetResult()\n");
867
970
 
868
- result = i;
971
+ ssoResult = i;
869
972
  return Qtrue;
870
973
  }
871
974
 
872
975
  VALUE
873
- P4ClientSSO::GetSSOVars()
976
+ ClientUserRuby::GetSSOVars()
874
977
  {
875
- return specMgr->StrDictToHash( &ssoVars );
876
- }
877
-
878
- void
879
- P4ClientSSO::GCMark() {
880
- if (result != Qnil) rb_gc_mark( result );
978
+ return specMgr->StrDictToHash( &ssoVars );
881
979
  }
@@ -42,40 +42,7 @@
42
42
  class SpecMgr;
43
43
  class ClientProgress;
44
44
 
45
- class P4ClientSSO : public ClientSSO
46
- {
47
- public:
48
- P4ClientSSO( SpecMgr *s );
49
-
50
- // Client SSO methods overridden here
51
- virtual ClientSSOStatus Authorize( StrDict &vars, int maxLength,
52
- StrBuf &result );
53
-
54
- // Local methods
55
- VALUE EnableSSO( VALUE e );
56
- VALUE SSOEnabled();
57
- VALUE SetPassResult( VALUE i );
58
- VALUE GetPassResult();
59
- VALUE SetFailResult( VALUE i );
60
- VALUE GetFailResult();
61
- VALUE GetSSOVars();
62
-
63
- void GCMark();
64
-
65
- private:
66
-
67
- VALUE SetResult( VALUE i );
68
-
69
- int ssoEnabled;
70
- int resultSet;
71
-
72
- StrBufDict ssoVars;
73
- SpecMgr * specMgr;
74
-
75
- VALUE result;
76
- };
77
-
78
- class ClientUserRuby: public ClientUser, public KeepAlive {
45
+ class ClientUserRuby: public ClientUser, public ClientSSO, public KeepAlive {
79
46
  public:
80
47
  ClientUserRuby(SpecMgr *s);
81
48
 
@@ -136,13 +103,18 @@ public:
136
103
 
137
104
  // SSO handler support
138
105
 
139
- VALUE EnableSSO( VALUE e ) { return ssoHandler->EnableSSO( e ); }
140
- VALUE SSOEnabled() { return ssoHandler->SSOEnabled(); }
141
- VALUE SetSSOPassResult( VALUE i ) { return ssoHandler->SetPassResult( i ); }
142
- VALUE GetSSOPassResult(){ return ssoHandler->GetPassResult();}
143
- VALUE SetSSOFailResult( VALUE i ) { return ssoHandler->SetFailResult( i ); }
144
- VALUE GetSSOFailResult(){ return ssoHandler->GetFailResult();}
145
- VALUE GetSSOVars() { return ssoHandler->GetSSOVars(); }
106
+ virtual ClientSSOStatus Authorize( StrDict &vars, int maxLength, StrBuf &result );
107
+ VALUE EnableSSO( VALUE e );
108
+ VALUE SSOEnabled();
109
+ VALUE SetSSOPassResult( VALUE i );
110
+ VALUE GetSSOPassResult();
111
+ VALUE SetSSOFailResult( VALUE i );
112
+ VALUE GetSSOFailResult();
113
+ VALUE GetSSOVars();
114
+ VALUE SetRubySSOHandler( VALUE handler );
115
+ VALUE GetRubySSOHandler() {
116
+ return ssoHandler;
117
+ }
146
118
 
147
119
  // override from KeepAlive
148
120
  virtual int IsAlive() {
@@ -155,6 +127,8 @@ private:
155
127
  void ProcessOutput(const char * method, VALUE data);
156
128
  void ProcessMessage(Error * e);
157
129
  bool CallOutputMethod(const char * method, VALUE data);
130
+ VALUE SetSSOResult( VALUE i );
131
+ ClientSSOStatus CallSSOMethod(VALUE vars, int maxLength, StrBuf &result);
158
132
 
159
133
  private:
160
134
  StrBuf cmd;
@@ -167,11 +141,18 @@ private:
167
141
  VALUE cOutputHandler;
168
142
  VALUE progress;
169
143
  VALUE cProgress;
144
+ VALUE cSSOHandler;
170
145
  int debug;
171
146
  int apiLevel;
172
147
  int alive;
173
148
  int rubyExcept;
174
149
  bool track;
175
- P4ClientSSO * ssoHandler;
150
+
151
+ // SSO handler support
152
+ int ssoEnabled;
153
+ int ssoResultSet;
154
+ StrBufDict ssoVars;
155
+ VALUE ssoResult;
156
+ VALUE ssoHandler;
176
157
  };
177
158
 
data/ext/P4/extconf.rb CHANGED
@@ -444,15 +444,11 @@ end
444
444
  # directory name where we can download files from.
445
445
  def p4_platform_label
446
446
  case RbConfig::CONFIG["target_os"].downcase
447
- when /nt|mswin|mingw/
447
+ when /nt|mswin|mingw|cygwin|msys/
448
448
  # Ruby on windows is only MinGW via Rubyinstaller.org, though this may
449
449
  # not work on all rubies.
450
- if RbConfig::CONFIG['MAJOR'].to_i >= 2
451
- # Note that x64 or x86 needs to be suffixed to this
452
- 'mingw64'
453
- else
454
- 'mingwx86'
455
- end
450
+ # There are too many permutations of Windows p4api, to automate.
451
+ raise 'Automatic fetching of p4api from perforce FTP is not supported on Windows'
456
452
  when /darwin19|darwin[2-9][0-9]/
457
453
  "macosx1015#{p4_cpu(:darwin)}"
458
454
  when /darwin/
@@ -460,9 +456,7 @@ def p4_platform_label
460
456
  when /solaris/
461
457
  "solaris10#{p4_cpu(:solaris)}"
462
458
  when /linux/
463
- "linux26#{p4_cpu(:linux)}"
464
- when /cygwin/
465
- raise 'cygwin is not supported for the --download-p4api option'
459
+ "linux26#{p4_cpu(:linux)}"
466
460
  end
467
461
  end
468
462
 
data/ext/P4/p4.cpp CHANGED
@@ -878,6 +878,20 @@ static VALUE p4_set_sso_failresult( VALUE self, VALUE result )
878
878
  Data_Get_Struct( self, P4ClientApi, p4 );
879
879
  return p4->SetSSOFailResult( result );
880
880
  }
881
+ static VALUE p4_get_ssohandler( VALUE self )
882
+ {
883
+ P4ClientApi *p4;
884
+ Data_Get_Struct( self, P4ClientApi, p4 );
885
+ return p4->GetSSOHandler();
886
+ }
887
+
888
+ static VALUE p4_set_ssohandler( VALUE self, VALUE handler )
889
+ {
890
+ P4ClientApi *p4;
891
+ Data_Get_Struct( self, P4ClientApi, p4 );
892
+ p4->SetSSOHandler( handler );
893
+ return Qtrue;
894
+ }
881
895
 
882
896
  /*******************************************************************************
883
897
  * P4::MergeData methods. Construction/destruction defined elsewhere
@@ -1416,6 +1430,8 @@ void Init_P4()
1416
1430
  rb_define_method( cP4, "ssopassresult=", RUBY_METHOD_FUNC(p4_set_sso_passresult), 1);
1417
1431
  rb_define_method( cP4, "ssofailresult", RUBY_METHOD_FUNC(p4_get_sso_failresult), 0);
1418
1432
  rb_define_method( cP4, "ssofailresult=", RUBY_METHOD_FUNC(p4_set_sso_failresult), 1);
1433
+ rb_define_method( cP4, "ssohandler", RUBY_METHOD_FUNC(p4_get_ssohandler), 0);
1434
+ rb_define_method( cP4, "ssohandler=", RUBY_METHOD_FUNC(p4_set_ssohandler), 1);
1419
1435
 
1420
1436
 
1421
1437
  // P4::MergeData class
@@ -715,6 +715,17 @@ P4ClientApi::SetProgress( VALUE progress ) {
715
715
  return ui.SetProgress( progress );
716
716
  }
717
717
 
718
+ VALUE
719
+ P4ClientApi::SetSSOHandler( VALUE h )
720
+ {
721
+ if ( P4RDB_COMMANDS )
722
+ fprintf( stderr, "[P4] Received SSO handler object\n" );
723
+
724
+ ui.SetRubySSOHandler( h );
725
+
726
+ return Qtrue;
727
+ }
728
+
718
729
 
719
730
  void
720
731
  P4ClientApi::GCMark()
data/ext/P4/p4clientapi.h CHANGED
@@ -179,6 +179,8 @@ public:
179
179
  VALUE GetSSOPassResult();
180
180
  VALUE SetSSOFailResult( VALUE r );
181
181
  VALUE GetSSOFailResult();
182
+ VALUE SetSSOHandler( VALUE handler );
183
+ VALUE GetSSOHandler() { return ui.GetRubySSOHandler(); }
182
184
 
183
185
  // Ruby garbage collection
184
186
  void GCMark();
data/lib/P4/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class P4
2
- Version = VERSION = '2021.1.2156749'
2
+ Version = VERSION = '2021.1.2196401'
3
3
  end
data/lib/P4.rb CHANGED
@@ -118,6 +118,13 @@ class P4
118
118
  PROG_FAILDONE = 2
119
119
  PROG_FLUSH = 3
120
120
 
121
+ # SSO Handler return values constants
122
+ SSO_PASS = 0 # SSO succeeded (result is an authentication token)
123
+ SSO_FAIL = 1 # SSO failed (result will be logged as error message)
124
+ SSO_UNSET = 2 # Client has no SSO support
125
+ SSO_EXIT = 3 # Stop login process
126
+ SSO_SKIP = 4 # Fall back to default P4API behavior
127
+
121
128
  # Mappings for P4#each_<spec>
122
129
  # Hash of type vs. key
123
130
  SpecTypes = {
@@ -669,4 +676,13 @@ class P4
669
676
  HANDLED
670
677
  end
671
678
  end
679
+
680
+ #*****************************************************************************
681
+ # P4::SSOHandler class.
682
+ #*****************************************************************************
683
+ class SSOHandler
684
+ def authorize(vars, maxLength)
685
+ [ SSO_SKIP, "" ]
686
+ end
687
+ end
672
688
  end # class P4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: p4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2021.1.2156749
4
+ version: 2021.1.2196401
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perforce Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-14 00:00:00.000000000 Z
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby extensions to the C++ Perforce API.
14
14
  email: support@perforce.com