nex_client 0.4.0 → 0.5.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 +4 -4
- data/lib/nex_client/cli.rb +10 -0
- data/lib/nex_client/commands/apps.rb +35 -1
- data/lib/nex_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f9046a18cc9d234db63aaac5f80b8973da9ba1
|
4
|
+
data.tar.gz: 6421cce72b2e485bdfc84e6ed89af57bf0df14bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6a44eca9ff5dd925fcef3658159fad7fe4addf4e9a99630a8e63ffa679464a8896f8efd38ad80b2abb594d5a2b123c903c3b63207e5fb1f1e35cc7ac39cc697
|
7
|
+
data.tar.gz: ab60f6dca0752249b3d4953ac70734eb4ea597f4b7007292caa7e70fac9c4f00b3430c8b1b1426bd3e40f08f5dc7e457686c42572b3291f7559829a06a679fa5
|
data/lib/nex_client/cli.rb
CHANGED
@@ -163,6 +163,16 @@ module NexClient
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
+
command :'apps:transfer' do |c|
|
167
|
+
c.syntax = 'nex-cli apps:transfer APP_NAME OWNER_HANDLE [options]'
|
168
|
+
c.summary = 'Transfer app ownership'
|
169
|
+
c.description = 'Transfer an app to another organization or user'
|
170
|
+
c.example 'transfer myapp to doecorp', 'nex-cli apps:transfer myapp doecorp'
|
171
|
+
c.action do |args, options|
|
172
|
+
NexClient::Commands::Apps.transfer(args,options)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
166
176
|
command :'apps:up' do |c|
|
167
177
|
c.syntax = 'nex-cli apps:up APP_NAME [options]'
|
168
178
|
c.summary = 'Scale applications up'
|
@@ -112,7 +112,7 @@ module NexClient
|
|
112
112
|
error("Error! Could not find organization: #{opts.owner}")
|
113
113
|
return false
|
114
114
|
end
|
115
|
-
e.relationships.attributes = { owner: { data: { type:
|
115
|
+
e.relationships.attributes = { owner: { data: { type: o.type, id: o.id } } }
|
116
116
|
end
|
117
117
|
|
118
118
|
# Save the resource
|
@@ -149,6 +149,40 @@ module NexClient
|
|
149
149
|
success("Successfully destroyed app: #{name}")
|
150
150
|
end
|
151
151
|
|
152
|
+
def self.transfer(args,opts)
|
153
|
+
name = args.first
|
154
|
+
e = NexClient::App.find(name: name).first
|
155
|
+
|
156
|
+
# Display error
|
157
|
+
unless e
|
158
|
+
error("Error! Could not find app: #{name}")
|
159
|
+
return false
|
160
|
+
end
|
161
|
+
|
162
|
+
# Get owner
|
163
|
+
handle = args.last
|
164
|
+
o = NexClient::Organization.find(handle: handle).first ||
|
165
|
+
NexClient::User.find(handle: handle).first
|
166
|
+
|
167
|
+
# Display error if owner not found
|
168
|
+
unless o
|
169
|
+
error("Error! Could not find owner: #{handle}")
|
170
|
+
return false
|
171
|
+
end
|
172
|
+
|
173
|
+
# Update and save record
|
174
|
+
e.relationships.attributes = { owner: { data: { type: o.type, id: o.id } } }
|
175
|
+
e.save
|
176
|
+
|
177
|
+
# Display errors if any
|
178
|
+
if e.errors.any?
|
179
|
+
display_record_errors(e)
|
180
|
+
return false
|
181
|
+
end
|
182
|
+
|
183
|
+
success("Successfully transfered #{name} to #{handle}")
|
184
|
+
end
|
185
|
+
|
152
186
|
def self.restart(args,opts)
|
153
187
|
name = args.first
|
154
188
|
e = NexClient::App.find(name: name).first
|
data/lib/nex_client/version.rb
CHANGED