bld 0.1.11 → 0.1.12
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/bin/bld +1 -1
- data/bin/build +1 -1
- data/lib/commands.rb +50 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c960f6dd300e86772b724b30cc9c871e463e2a90126f81c11002be45a267551
|
4
|
+
data.tar.gz: ed13da023c4c920edbb9ea4df7ecab26d1fac2fb12f9483d1b1b3262666f9807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d7ec6e425b8851d51ecff706277d47892d2df5188411e7920e75cbe2ad3dfbe4cdd4907578302835e45c82f11c72b1da5f854fb68ea65a09413d1205d3a2e24
|
7
|
+
data.tar.gz: 7f47e83c9a815ceb768e1178045ef9fe07168dfa3ba917f47292054dfc03909846e8e9377f570ce7a3ed63575d5a2604837eba64bed00ab4fa69ecaf22f7908a
|
data/bin/bld
CHANGED
data/bin/build
CHANGED
data/lib/commands.rb
CHANGED
@@ -13,8 +13,7 @@ class BuildCLICommands
|
|
13
13
|
puts(CLI::UI.fmt("{{red:›}} See more help with --help"))
|
14
14
|
exit(1)
|
15
15
|
end
|
16
|
-
|
17
|
-
user_token = user_netrc.[]("build.io")&.password
|
16
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
18
17
|
if user_token.nil?
|
19
18
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
20
19
|
exit(1)
|
@@ -91,8 +90,7 @@ class BuildCLICommands
|
|
91
90
|
exit(1)
|
92
91
|
end
|
93
92
|
process = args.first
|
94
|
-
|
95
|
-
user_token = user_netrc.[]("build.io")&.password
|
93
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
96
94
|
if user_token.nil?
|
97
95
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
98
96
|
exit(1)
|
@@ -132,8 +130,7 @@ class BuildCLICommands
|
|
132
130
|
puts(CLI::UI.fmt("{{red:›}} See more help with --help"))
|
133
131
|
exit(1)
|
134
132
|
end
|
135
|
-
|
136
|
-
user_token = user_netrc.[]("build.io")&.password
|
133
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
137
134
|
if user_token.nil?
|
138
135
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
139
136
|
exit(1)
|
@@ -175,8 +172,7 @@ class BuildCLICommands
|
|
175
172
|
puts(CLI::UI.fmt("{{red:›}} See more help with --help"))
|
176
173
|
exit(1)
|
177
174
|
end
|
178
|
-
|
179
|
-
user_token = user_netrc.[]("build.io")&.password
|
175
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
180
176
|
if user_token.nil?
|
181
177
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
182
178
|
exit(1)
|
@@ -219,8 +215,7 @@ class BuildCLICommands
|
|
219
215
|
puts(CLI::UI.fmt("{{red:›}} See more help with --help"))
|
220
216
|
exit(1)
|
221
217
|
end
|
222
|
-
|
223
|
-
user_token = user_netrc.[]("build.io")&.password
|
218
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
224
219
|
if user_token.nil?
|
225
220
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
226
221
|
exit(1)
|
@@ -261,8 +256,7 @@ class BuildCLICommands
|
|
261
256
|
puts(CLI::UI.fmt("{{red:›}} See more help with --help"))
|
262
257
|
exit(1)
|
263
258
|
end
|
264
|
-
|
265
|
-
user_token = user_netrc.[]("build.io")&.password
|
259
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
266
260
|
if user_token.nil?
|
267
261
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
268
262
|
exit(1)
|
@@ -289,8 +283,7 @@ class BuildCLICommands
|
|
289
283
|
cli_details: { :syntax => "apps:create [options] -a <app>", :description => "Create a new app",
|
290
284
|
:options => [["-t", "--team=<value>", String, "team to use"], ["-r", "--region=<value>", String, "specify region for the app to run in"], ["-s", "--stack=<value>", String, "the stack to create the app on"], ["-a", "--app=<value>", String, "(required) the name of the app to create"]] },
|
291
285
|
cli_perform: Proc.new { |args, options|
|
292
|
-
|
293
|
-
user_token = user_netrc.[]("build.io")&.password
|
286
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
294
287
|
if user_token.nil?
|
295
288
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
296
289
|
exit(1)
|
@@ -315,11 +308,12 @@ class BuildCLICommands
|
|
315
308
|
query_string = URI.encode_www_form(query_params)
|
316
309
|
res = HTTParty.get("#{ANTIMONY_HOST}/api/cli/command/apps/create?#{query_string}",
|
317
310
|
{ headers: { "Authorization" => auth } })
|
318
|
-
if res.
|
319
|
-
puts(CLI::UI.fmt("{{red:›}} Error:
|
311
|
+
if !res.success?
|
312
|
+
puts(CLI::UI.fmt("{{red:›}} Error: #{res.body}"))
|
320
313
|
exit(1)
|
321
314
|
end
|
322
315
|
app_name = JSON.parse(res.body).[]("name")
|
316
|
+
region = options.region || "us-east-1"
|
323
317
|
puts("https://#{app_name}.#{region}.antimony.io | #{app_name}")
|
324
318
|
},
|
325
319
|
},
|
@@ -378,8 +372,7 @@ class BuildCLICommands
|
|
378
372
|
puts(CLI::UI.fmt("{{red:›}} See more help with --help"))
|
379
373
|
exit(1)
|
380
374
|
end
|
381
|
-
|
382
|
-
user_token = user_netrc.[]("build.io")&.password
|
375
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
383
376
|
if user_token.nil?
|
384
377
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
385
378
|
exit(1)
|
@@ -430,8 +423,7 @@ class BuildCLICommands
|
|
430
423
|
cli_details: { :syntax => "build whoami", :description => "Display the current logged in user",
|
431
424
|
:options => [] },
|
432
425
|
cli_perform: Proc.new { |args, options|
|
433
|
-
|
434
|
-
user_token = user_netrc.[]("build.io")&.password
|
426
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
435
427
|
if user_token.nil?
|
436
428
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
437
429
|
exit(1)
|
@@ -454,8 +446,7 @@ class BuildCLICommands
|
|
454
446
|
puts(CLI::UI.fmt("{{red:›}} Error: no command provided"))
|
455
447
|
exit(1)
|
456
448
|
end
|
457
|
-
|
458
|
-
user_token = user_netrc.[]("build.io")&.password
|
449
|
+
user_token = ENV.[]("BUILD_API_KEY") || Netrc.read.[]("build.io")&.password
|
459
450
|
if user_token.nil?
|
460
451
|
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
461
452
|
exit(1)
|
@@ -477,10 +468,45 @@ class BuildCLICommands
|
|
477
468
|
exit(1)
|
478
469
|
end
|
479
470
|
ruby = JSON.parse(res.body).[]("ruby")
|
480
|
-
require("shellwords")
|
481
|
-
command = "/cnb/lifecycle/launcher #{Shellwords.join(args)}"
|
482
471
|
eval(ruby)
|
483
472
|
},
|
473
|
+
},
|
474
|
+
"oidc-login": {
|
475
|
+
cli_details: { :syntax => "build oidc-login", :description => "Login to your Build cluster",
|
476
|
+
:options => [["-r", "--region REGION", String, "(required) The region of the cluster to access"]] },
|
477
|
+
cli_perform: Proc.new { |args, options|
|
478
|
+
region = options.region
|
479
|
+
if region.nil? || region.strip == ""
|
480
|
+
puts(CLI::UI.fmt("{{red:›}} Error: The following error occurred:"))
|
481
|
+
puts(CLI::UI.fmt("{{red:›}} {{gray:Missing required flag region}}"))
|
482
|
+
puts(CLI::UI.fmt("{{red:›}} See more help with --help"))
|
483
|
+
exit(1)
|
484
|
+
end
|
485
|
+
user_token = ENV.[]("BUILD_API_KEY")
|
486
|
+
if user_token.nil?
|
487
|
+
user_netrc = Netrc.read
|
488
|
+
user_token = user_netrc.[]("build.io")&.password
|
489
|
+
end
|
490
|
+
if user_token.nil?
|
491
|
+
puts(CLI::UI.fmt("{{red:›}} Error: not logged in"))
|
492
|
+
exit(1)
|
493
|
+
end
|
494
|
+
auth = "Bearer #{user_token}"
|
495
|
+
query_params = {}
|
496
|
+
query_params.[]=(:region, region)
|
497
|
+
query_string = URI.encode_www_form(query_params)
|
498
|
+
res = HTTParty.get("#{ANTIMONY_HOST}/api/cli/command/oidc-login?#{query_string}",
|
499
|
+
{ headers: { "Authorization" => auth } })
|
500
|
+
if res.code != 200
|
501
|
+
if res.body && res.body != "" && JSON.parse(res.body)&.key?("error")
|
502
|
+
puts(CLI::UI.fmt("{{red:›}} Error: #{JSON.parse(res.body).[]("error")}"))
|
503
|
+
else
|
504
|
+
puts(CLI::UI.fmt("{{red:›}} Error: An unknown error occurred"))
|
505
|
+
end
|
506
|
+
exit(1)
|
507
|
+
end
|
508
|
+
puts(res.body)
|
509
|
+
},
|
484
510
|
}
|
485
511
|
}
|
486
512
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- usiegl00
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abbrev
|