nex_client 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bea397684b919daf609e59cba8da6003c876186
4
- data.tar.gz: 4eb230395b5f7a8b0fe41f5f4d9f9f45adc8d8bc
3
+ metadata.gz: b85a0da3bcdc2e97be481dea0a1d82c6734cfe55
4
+ data.tar.gz: 226353cfb77a81de88917aa5004bc599499afd2b
5
5
  SHA512:
6
- metadata.gz: 16aa93de97a9261ae2fa9e6ba2ebe15fc0f3194c14685258d1d98e3cc1616a665ce80ed31fe7199fc94d01c1a27d15fa68ae523b6229a41c935d2f0b03d87bca
7
- data.tar.gz: 2f7cfccadd6e26606426eed05f8c55ee32c3703d6358660b97013044afe7b871cec293fe6ecc5f988ac7b440288b33bbdf7e34f4260158802ec96054315b9688
6
+ metadata.gz: 0c97820ae8892d92b7dc605bf828998de377cb1b1dcf6c8f7e1c2ab0ddd6bc159d4d76821d58b74087e4b3e752909c18531b840303d8ec47896be036124853a7
7
+ data.tar.gz: 0b0164bbbb7683305afeb91f4db7f3a2c19bf33cace71c159d7a1f7c9d1fc9ead289d4be8826fa94793b48fa54c2373f372bab0485768782ef03b93aa743328d
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module NexClient
3
3
  class BaseResource < JsonApiClient::Resource
4
- API_HOST = {
4
+ HOST_MAPPING = {
5
5
  'development' => 'http://localhost:5000',
6
6
  'test' => 'http://nex-test.com',
7
7
  'uat' => 'https://api-nex-uat.maestrano.io',
@@ -9,8 +9,9 @@ module NexClient
9
9
  }
10
10
  API_ROOT_PATH = '/api/v1'
11
11
  ENVIRONMENT = ENV['NEX_ENV'] || 'uat' # should be eventually be changed to production
12
+ API_HOST = ENV['NEX_ENDPOINT'] || HOST_MAPPING[ENVIRONMENT]
12
13
 
13
- self.site = "#{API_HOST[ENVIRONMENT]}#{API_ROOT_PATH}"
14
+ self.site = "#{API_HOST}#{API_ROOT_PATH}"
14
15
  end
15
16
  end
16
17
 
@@ -288,6 +288,7 @@ module NexClient
288
288
  c.option '--delete MYVAR,MYVAR2,...', Array, 'comma separated list of env variables'
289
289
  c.option '--env-file FILE', String, 'newline separated list of env variables (MYVAR=1) or YAML file. Note that YAML parsing is recursive.'
290
290
  c.option '--env-prefix PREFIX', String, 'prefix all variables contained in the env file with the specified prefix (PREFIX_MYVAR)'
291
+ c.option '--raw', 'vars are returned in a environment file format (key=value)'
291
292
  c.action do |args, options|
292
293
  NexClient::Commands::Apps.manage_vars(args,options)
293
294
  end
@@ -57,7 +57,7 @@ module NexClient
57
57
  self.display_vars(e.all_vars)
58
58
 
59
59
  # Display options
60
- self.display_options(e.opts)
60
+ self.display_options(e.opts) if e.respond_to?(:opts)
61
61
 
62
62
  # Display App
63
63
  Apps.display_apps(e.app)
@@ -63,7 +63,7 @@ module NexClient
63
63
  self.display_vars(e.all_vars)
64
64
 
65
65
  # Display options
66
- self.display_options(e.opts)
66
+ self.display_options(e.opts) if e.respond_to?(:opts)
67
67
 
68
68
  # Display Source Control Management
69
69
  self.display_scm(e.scm)
@@ -340,7 +340,11 @@ module NexClient
340
340
  end
341
341
 
342
342
  # Display all vars
343
- self.display_vars(e.all_vars)
343
+ if opts.raw
344
+ self.display_raw_vars(e.all_vars)
345
+ else
346
+ self.display_vars(e.all_vars)
347
+ end
344
348
  end
345
349
 
346
350
  def self.manage_scm(args,opts)
@@ -392,6 +396,14 @@ module NexClient
392
396
  puts "\n"
393
397
  end
394
398
 
399
+ def self.display_raw_vars(list)
400
+ table = [list].flatten.compact.map do |e|
401
+ e.sort_by { |k, v| k }.map { |k,v| "#{k}=#{v}" }
402
+ end.flatten
403
+ puts table
404
+ puts "\n"
405
+ end
406
+
395
407
  def self.display_vars(list)
396
408
  table = Terminal::Table.new title: VARS_TITLE, headings: VARS_HEADERS do |t|
397
409
  [list].flatten.compact.each do |e|
@@ -1,3 +1,3 @@
1
1
  module NexClient
2
- VERSION ||= '0.13.0'
2
+ VERSION ||= '0.14.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nex_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Lachaume
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-01 00:00:00.000000000 Z
11
+ date: 2016-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_api_client