p4ruby 2017.1.1653916 → 2017.1.1699426

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
  SHA1:
3
- metadata.gz: de7ef1db8588d07ebaaddf51952a2d10e66609ae
4
- data.tar.gz: 2aac13755ff1f38366dd07c0b897eebb6f936b00
3
+ metadata.gz: 6b823b2820c19f394899dcc7e5b853a0ea90003a
4
+ data.tar.gz: 13f0eed9d3d303728d198fdb7831fe940dae055e
5
5
  SHA512:
6
- metadata.gz: 16af3d80bf612148a7d36a1ef51be24f97c93dcc0eef4fed9457c2ae6b70db1497050a68bbddb531209a98741e68b51aed442e039333eecfd09d14cde60b908b
7
- data.tar.gz: af3387c0529cc2a800246dc380c7df337fed57badd7795664a527bbd0931cb0c4185eabc369b61ab8e3d634373f84937a31ea3b612d1530e1f98635f69d8a4cd
6
+ metadata.gz: 9026dd4c25121947241dc0b31c1d3f306153a8827f40d1b7e4348e2101655e0dd07fb808439141c0513d568f7a69320317f3e9a8267d10437536867e7920befb
7
+ data.tar.gz: 4783f0c749b9b4d54c0401169c1f4d7ebc008500ce3d4d0440ff396d990a0a5ed5faefe7d3a72c1d435bb82a85430e3acd66f4b0150d2bd6649a76e238c63452
data/README.md CHANGED
@@ -290,6 +290,9 @@ release up to the bug fix change level.
290
290
 
291
291
  New functionality in 2017.1
292
292
 
293
+ - (SIR#96305/ P4RUBY-214)
294
+ Add get/set trust file location to api
295
+
293
296
  - (SIR#93993 / P4RUBY-206)
294
297
 
295
298
  Add a reset() method for resetting p4 client data (messages, output, etc.)
data/ext/P4/p4.cpp CHANGED
@@ -489,6 +489,21 @@ static VALUE p4_set_ticket_file( VALUE self, VALUE path )
489
489
  return Qtrue;
490
490
  }
491
491
 
492
+ static VALUE p4_get_trust_file( VALUE self )
493
+ {
494
+ P4ClientApi *p4;
495
+ Data_Get_Struct( self, P4ClientApi, p4 );
496
+ return P4Utils::ruby_string( p4->GetTrustFile().Text() );
497
+ }
498
+
499
+ static VALUE p4_set_trust_file( VALUE self, VALUE path )
500
+ {
501
+ P4ClientApi *p4;
502
+ Data_Get_Struct( self, P4ClientApi, p4 );
503
+ p4->SetTrustFile( StringValuePtr( path ) );
504
+ return Qtrue;
505
+ }
506
+
492
507
  static VALUE p4_get_user( VALUE self )
493
508
  {
494
509
  P4ClientApi *p4;
@@ -1188,6 +1203,14 @@ static VALUE p4msg_get_text( VALUE self )
1188
1203
  return e->GetText();
1189
1204
  }
1190
1205
 
1206
+ static VALUE p4msg_get_dict( VALUE self )
1207
+ {
1208
+ P4Error * e = 0;
1209
+
1210
+ Data_Get_Struct( self, P4Error, e );
1211
+ return e->GetDict();
1212
+ }
1213
+
1191
1214
  static VALUE p4msg_get_id( VALUE self )
1192
1215
  {
1193
1216
  P4Error * e = 0;
@@ -1263,6 +1286,8 @@ void Init_P4()
1263
1286
  rb_define_method( cP4, "protocol", RUBY_METHOD_FUNC(p4_set_protocol), 2 );
1264
1287
  rb_define_method( cP4, "ticket_file", RUBY_METHOD_FUNC(p4_get_ticket_file), 0 );
1265
1288
  rb_define_method( cP4, "ticket_file=", RUBY_METHOD_FUNC(p4_set_ticket_file), 1 );
1289
+ rb_define_method( cP4, "trust_file", RUBY_METHOD_FUNC(p4_get_trust_file), 0 );
1290
+ rb_define_method( cP4, "trust_file=", RUBY_METHOD_FUNC(p4_set_trust_file), 1 );
1266
1291
  rb_define_method( cP4, "user", RUBY_METHOD_FUNC(p4_get_user) , 0 );
1267
1292
  rb_define_method( cP4, "user=", RUBY_METHOD_FUNC(p4_set_user) , 1 );
1268
1293
  rb_define_method( cP4, "version", RUBY_METHOD_FUNC(p4_get_version) , 0 );
@@ -1363,6 +1388,7 @@ void Init_P4()
1363
1388
  rb_define_method( cP4Msg, "msgid", RUBY_METHOD_FUNC(p4msg_get_id), 0);
1364
1389
  rb_define_method( cP4Msg, "severity", RUBY_METHOD_FUNC(p4msg_get_severity), 0);
1365
1390
  rb_define_method( cP4Msg, "generic", RUBY_METHOD_FUNC(p4msg_get_generic), 0);
1391
+ rb_define_method( cP4Msg, "dictionary", RUBY_METHOD_FUNC(p4msg_get_dict), 0);
1366
1392
  rb_define_method( cP4Msg, "to_s", RUBY_METHOD_FUNC(p4msg_get_text), 0);
1367
1393
 
1368
1394
  // P4::Progress class.
@@ -94,7 +94,17 @@ P4ClientApi::P4ClientApi() : ui( &specMgr )
94
94
  henv.GetTicketFile( ticketFile );
95
95
 
96
96
  if( (t = enviro->Get("P4TICKETS")) )
97
- ticketFile = t;
97
+ ticketFile = t;
98
+
99
+ //
100
+ // Load the current trust file. Start with the default, and then
101
+ // override it if P4TRUST is set.
102
+ //
103
+
104
+ henv.GetTrustFile( trustFile );
105
+
106
+ if( (t = enviro->Get("P4TICKETS")) )
107
+ trustFile = t;
98
108
 
99
109
  //
100
110
  // Load the current P4CHARSET if set.
@@ -192,6 +202,13 @@ P4ClientApi::SetTicketFile( const char *p )
192
202
  ticketFile = p;
193
203
  }
194
204
 
205
+ void
206
+ P4ClientApi::SetTrustFile( const char *p )
207
+ {
208
+ client.SetTrustFile( p );
209
+ trustFile = p;
210
+ }
211
+
195
212
  void
196
213
  P4ClientApi::SetDebug( int d )
197
214
  {
data/ext/P4/p4clientapi.h CHANGED
@@ -85,6 +85,7 @@ public:
85
85
  void SetProg( const char *p ) { prog = p; }
86
86
  void SetProtocol( const char *var, const char *val );
87
87
  void SetTicketFile( const char *p );
88
+ void SetTrustFile( const char *p );
88
89
  void SetUser( const char *u ) { client.SetUser( u ); }
89
90
  void SetVersion( const char *v ) { version = v; }
90
91
 
@@ -102,6 +103,7 @@ public:
102
103
  const StrPtr &GetPort() { return client.GetPort(); }
103
104
  const StrPtr &GetProg() { return prog; }
104
105
  const StrPtr &GetTicketFile() { return ticketFile; }
106
+ const StrPtr &GetTrustFile() { return trustFile; }
105
107
  const StrPtr &GetUser() { return client.GetUser(); }
106
108
  const StrPtr &GetVersion() { return version; }
107
109
 
@@ -235,6 +237,7 @@ private:
235
237
  StrBuf prog;
236
238
  StrBuf version;
237
239
  StrBuf ticketFile;
240
+ StrBuf trustFile;
238
241
  int depth;
239
242
  int debug;
240
243
  int exceptionLevel;
data/ext/P4/p4error.cpp CHANGED
@@ -88,6 +88,21 @@ P4Error::GetText()
88
88
  return P4Utils::ruby_string( t.Text(), t.Length() );
89
89
  }
90
90
 
91
+ VALUE
92
+ P4Error::GetDict()
93
+ {
94
+ VALUE dictHash = rb_hash_new();
95
+ StrDict* pDict = error.GetDict();
96
+ StrRef key, val;
97
+ // suppress -Wpointer-arith
98
+ for (int i=0;pDict->GetVar(i,key,val) != 0;i++) {
99
+ rb_hash_aset( dictHash,
100
+ P4Utils::ruby_string(key.Text(), key.Length()),
101
+ P4Utils::ruby_string(val.Text(), val.Length()));
102
+ }
103
+ return dictHash;
104
+ }
105
+
91
106
  VALUE
92
107
  P4Error::Inspect()
93
108
  {
data/ext/P4/p4error.h CHANGED
@@ -46,6 +46,7 @@ class P4Error
46
46
  VALUE GetGeneric();
47
47
  VALUE GetSeverity();
48
48
  VALUE GetText();
49
+ VALUE GetDict();
49
50
  VALUE Inspect();
50
51
 
51
52
  // Wrap as Ruby object of class pClass
data/lib/P4/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class P4
2
- Version = VERSION = '2017.1.1653916'
2
+ Version = VERSION = '2017.1.1699426'
3
3
  end
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: 2017.1.1653916
4
+ version: 2017.1.1699426
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: 2018-04-26 00:00:00.000000000 Z
11
+ date: 2018-09-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby extensions to the C++ Perforce API.
14
14
  email: support@perforce.com