phoseum-cli 0.0.13 → 0.0.18

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: 052beefab210d213c09986b11dfe93e499d328f6523f7f3cba71ecb2502ead53
4
- data.tar.gz: 75fd5b65b74758d1517c61e65f69295ca445e70ba37e32ae57863da0ddb825d9
3
+ metadata.gz: 2ae7c5b87f964e094e8e1e6ef6f1a147e5870aead7c9e8d8fbc1f301f9801f4b
4
+ data.tar.gz: d495df08338bfb6a067fdc2643e0a12042a310ba4b83d4b5476bf900123c4949
5
5
  SHA512:
6
- metadata.gz: 44173a8f4ed5893c0fdd6b5a9ef2b4ab463b091ed4c35f237be7f3ad369044a281d9067edbf7bd9d72670c45973827d9428fc015a6071f4eff5e1ff1ffd55c5f
7
- data.tar.gz: 68c50ae1d3cc2c35e4d369bc02bbba99236a07a1a3f3e314f73ff411bab7e3ee27965507afbb22b44220df36a411ee10a84586ad5109be62e4e2bf974cba7f95
6
+ metadata.gz: 40c22cc7fff4bfec7b5479856b5ec2b6ea95089f538f4bce1dcc5f394bf0f90c61245ac5249f103183bf283d97772a856f99bddb669fef3ba9a00db1541a4b11
7
+ data.tar.gz: 220f37e7d4efaf40014a025a4cd4250726d5e0d9752994a35636dfab51be8ecca3acccc1758471ec43c7eb7774ff88b261b2a86dc0722c40cd239a61bc3c1cd0
@@ -277,6 +277,15 @@ def user_mgmt(action,user,pass='',role='')
277
277
  end
278
278
 
279
279
  def user_login(puser='',ppass='')
280
+
281
+ server_value = cross_versions()
282
+ if server_value['version'] != VERSION_SIGN
283
+ puts "Server and Client version won't match, please make them match to continue.".red
284
+ puts "Remote version: #{server_value['version']}"
285
+ puts "Local version: #{VERSION_SIGN}"
286
+ exit 1
287
+ end
288
+
280
289
  post_body={}
281
290
  user= !puser ? '' : puser
282
291
  pass= !ppass ? '' : ppass
@@ -504,6 +513,14 @@ case options
504
513
  else
505
514
  puts "Login failed".red
506
515
  end
516
+ when -> (vs) { vs[:version] }
517
+ local_version
518
+ exit 0
519
+ when -> (x) { x[:crossv] }
520
+ server_value = cross_versions()
521
+ puts "Remote version: #{server_value['version']}"
522
+ puts "Local version: #{VERSION_SIGN}"
523
+ exit 0
507
524
  when -> (t) { t[:test] }
508
525
  puts "Making local analysis of files on directory".green if !$QUIET
509
526
  test
@@ -48,6 +48,14 @@ def option_parser(opts)
48
48
  options[:verbose] = v
49
49
  end
50
50
 
51
+ opts.on("-V", "--version", "What version we are") do |vs|
52
+ options[:version] = vs
53
+ end
54
+
55
+ opts.on("-x", "--cross-versions", "Check version match between Client and API") do |x|
56
+ options[:crossv] = x
57
+ end
58
+
51
59
  opts.on("-r", "--role ROLE", "Role for user: [User, Super]. Use with 'create-user'") do |r|
52
60
  options[:role] = r
53
61
  end
@@ -253,6 +261,37 @@ def validate_token(token)
253
261
  end
254
262
  end
255
263
 
264
+ def cross_versions
265
+ headers = {}
266
+ base = URI.parse("#{$config['SERVERURL']}")
267
+ request = Net::HTTP::Post.new(base,headers)
268
+ request.basic_auth("cli", "loginNOauth")
269
+ request.body = JSON.generate({"action" => "version-check" })
270
+ response = Net::HTTP.start(base.hostname, $config['PORT'],
271
+ :timeout => $config['CALL_TIMEOUT'],
272
+ :use_ssl => base.scheme == "https",
273
+ :verify_mode => OpenSSL::SSL::VERIFY_PEER,
274
+ :ca_file => $config['CA_TRUST']
275
+ ) do |http|
276
+ http.request(request)
277
+ end
278
+ begin
279
+ list = JSON.parse(response.body)
280
+ return list
281
+ # if list['error']
282
+ # return false
283
+ # end
284
+ # if list['success']
285
+ # return true
286
+ # end
287
+ rescue
288
+ puts "\nThe server sent out an Error:".red
289
+ puts clean_html(response.body)
290
+ exit 1
291
+ end
292
+ end
293
+
294
+
256
295
  def delete_user(username)
257
296
  headers = {}
258
297
  if $config['TOKEN']
@@ -285,3 +324,10 @@ def delete_user(username)
285
324
  exit 1
286
325
  end
287
326
  end
327
+
328
+ def local_version
329
+ puts "This CLI library is running version: #{VERSION_SIGN}"
330
+ return
331
+ end
332
+
333
+ VERSION_SIGN="0.0.18"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoseum-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julio C Hegedus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-01 00:00:00.000000000 Z
11
+ date: 2020-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml