adminix 0.1.18 → 0.1.19

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: '098faef5106b7eec94da11777d482614f3f4b6b7'
4
- data.tar.gz: d2250cdb502b8e7d02860469a7acfbcaed6917d5
3
+ metadata.gz: 9618c1c55b36600d0e1a0f343b82ec8339debca4
4
+ data.tar.gz: b76246588879ea4227e86440aed83c8f203ab42e
5
5
  SHA512:
6
- metadata.gz: ddb363ea10e351f81bed935ddd699ea4c5b7b7caf4a8f18d9fd294fd9e76fe4cc6b5c22b88fe5fb4d24ce6e00f621a9ce3256e02a497a5cf89b1b28650b5a778
7
- data.tar.gz: '08aa9659933b35a968dac35def0b4a0e4edd156f747cd40c3162ba30b6fe008ff6e8928f121da59b9ce38022f6859c6e478bb3675c082ab8cb0bc12ca27ca43e'
6
+ metadata.gz: 24ce033ce8da30a13c1aaf8a864f1d09a5a595ec69b8a3abf2c3f06ae537e367b2943358182aad726eccb323231ad36b6dbdf715d7390fe2381610b5efd424b2
7
+ data.tar.gz: c3d654188bf001755b0ef712d5609336178049c97faf1efac70adb6fcd8d4299070848157964591dd38878cfd27723e13e0c21af5b87d9f12f56eb03ce524674
@@ -38,6 +38,28 @@ module Adminix
38
38
  end
39
39
 
40
40
  def options_to_envs
41
+ data = fetch_options
42
+
43
+ data['result'].each do |o|
44
+ puts "export #{o['key'].upcase}=#{o['value']}"
45
+ end
46
+
47
+ puts "# Run this command to configure your shell:\n" +
48
+ "# eval $(adminix env)"
49
+ end
50
+
51
+ def options_to_envs_inline
52
+ data = fetch_options
53
+ str = 'export '
54
+
55
+ data['result'].each do |o|
56
+ str << " #{o['key'].upcase}=#{o['value']}"
57
+ end
58
+
59
+ str
60
+ end
61
+
62
+ def fetch_options
41
63
  uri = URI.parse("#{config.host}/v1/services/#{id}/options")
42
64
  request = Net::HTTP::Get.new(uri)
43
65
  request["Authorization"] = "Bearer #{config.secret_key}"
@@ -46,13 +68,7 @@ module Adminix
46
68
  http.request(request)
47
69
  end
48
70
 
49
- data = JSON.parse(response.body)
50
- data['result'].each do |o|
51
- puts "export #{o['key'].upcase}=#{o['value']}"
52
- end
53
-
54
- puts "# Run this command to configure your shell:\n" +
55
- "# eval $(adminix env)"
71
+ JSON.parse(response.body)
56
72
  end
57
73
 
58
74
  def restart!
@@ -81,8 +97,18 @@ module Adminix
81
97
  # TODO frontend fix attribute args
82
98
  args.each { |hs| script.gsub!("%{#{hs[0]}}", hs[1]) }
83
99
 
100
+ export_envs = options_to_envs_inline
101
+ script = "#{export_envs} && #{script}"
102
+
103
+ system.log "Executing command: "
104
+ system.log "-----------------------------------"
105
+ system.log script
106
+ system.log "-----------------------------------"
107
+
84
108
  output = system.eval(script)
109
+
85
110
  system.log "Command execution output: "
111
+ system.log "-----------------------------------"
86
112
  system.log output
87
113
  system.log "-----------------------------------"
88
114
 
@@ -1,3 +1,3 @@
1
1
  module Adminix
2
- VERSION = "0.1.18"
2
+ VERSION = "0.1.19"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Dyl
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-19 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine