byld-cli 0.0.7 → 0.0.9

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: 9921ce939ed12c148d831a6f945df7f7a4ad59e4f7192a00a1012a32b94b946d
4
- data.tar.gz: d52d9affbe3a25ebc20fd6df327d03f12e3bed95443f647a48381d272a058412
3
+ metadata.gz: 0d850ce35811255d939c37b62814d57d6178ca0cf9853e5f565160602fe2e325
4
+ data.tar.gz: 4b3029fcb988bb369161ffe3499801699d12e3c90b0f5fe7ff3e8821495cb039
5
5
  SHA512:
6
- metadata.gz: 044136c15876ced63c09474f23b939786a6fc3ae2980bd6f1865ce397b6dd41c727f1ac0e46aae2d29814d8c4f40e825997479682dd9d19bde36683d17596097
7
- data.tar.gz: 919d5255bea0eb5880154b080042d48d9d0db84c43db46ab65585ffbfda08975c165600d8179495312a229d6ed2de076d0480e7966fe2adb28eb31c8f14f20c4
6
+ metadata.gz: 6a949f660056c52fc4892de02cfb748127340bdad3c54ca862f4c61958137f082c22b11297bc7cd3b0413415b5ce88c902fb544767e2af504f2221c04eb732ea
7
+ data.tar.gz: 1c4fcf318a0896e369b21ce45d06028e49e263ac9cd1b08c1ddd5eba166e5536a56010dbf2415237e0ec344e663c6b34138c6305f401d61136e7d974cb328c0a
@@ -1,9 +1,10 @@
1
+ require_relative ('./lib/constants')
1
2
  lib = File.expand_path("../lib", __FILE__)
2
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
4
 
4
5
  Gem::Specification.new do |spec|
5
6
  spec.name = 'byld-cli'
6
- spec.version = '0.0.7'
7
+ spec.version = BYLD_VERSION
7
8
 
8
9
  spec.authors = ['the fellowhip co']
9
10
  spec.summary = 'cli for byld'
@@ -7,17 +7,14 @@ class CreateBlock < Thor::Group
7
7
  File.dirname(__FILE__)
8
8
  end
9
9
 
10
- def create_directory
10
+ def create_infra
11
11
  say "✍️ Setting up #{name}..."
12
- directory '../templates/block', name
13
- end
14
-
15
- def create_infra
16
12
  namespace_id = ConfigHelper.get_namespace_id
17
13
  success, res = Infra.create_project(namespace_id, name, 'domain')
18
-
14
+
19
15
  if success
20
- ConfigHelper.save_config(name, res)
16
+ directory '../templates/block', name
17
+ ConfigHelper.save_config('project', name, res)
21
18
 
22
19
  say "👍 Block created successfully!"
23
20
  else
@@ -22,6 +22,8 @@ require_relative 'gates/gate'
22
22
  require_relative 'gates/expose'
23
23
 
24
24
  class ByldCli < Thor
25
+ map %w[--version -v] => :__print_version
26
+
25
27
  register(LoginUser, 'login', 'login', 'Logins into your account')
26
28
  register(CreateProject, 'new', 'new [NAME]', 'Creates a new project')
27
29
  register(Deploy, 'deploy', 'deploy', 'Deploys the current block or gate')
@@ -37,5 +39,11 @@ class ByldCli < Thor
37
39
 
38
40
  desc 'gate [COMMAND]', 'Gate commands'
39
41
  subcommand 'gate', Gate
42
+
43
+ desc "--version, -v", "Display the version"
44
+ def __print_version
45
+ puts BYLD_VERSION
46
+ end
47
+
40
48
  end
41
49
 
@@ -32,13 +32,16 @@ class AccessConsole < Thor::Group
32
32
  ws = Faye::WebSocket::Client.new("ws://#{BIFROST_HOST}?namespace=#{res['namespace_name']}&pod=#{res['pod_name']}")
33
33
 
34
34
  ws.on :open do |event|
35
- puts "🟢 Connected!"
35
+ puts "🌐 Connecting to IRB Console..."
36
36
  end
37
37
 
38
38
  command = ""
39
+ connected = false
39
40
  ws.on :message do |event|
40
41
  data = Base64.strict_decode64(event.data)
41
42
  if (data.strip.end_with?("#"))
43
+ puts "🟢 Connected!" unless connected
44
+ connected = true
42
45
  command = ask(data)
43
46
  ws.send(command)
44
47
  else
@@ -49,8 +52,9 @@ class AccessConsole < Thor::Group
49
52
  end
50
53
 
51
54
  ws.on :close do |event|
52
- # p [:close, event.code, event.reason]
53
55
  ws = nil
56
+ say "⚠️ Connection lost: #{event.code}: #{event.reason}"
57
+ exit
54
58
  end
55
59
  }
56
60
  else
@@ -7,17 +7,14 @@ class CreateProject < Thor::Group
7
7
  File.dirname(__FILE__)
8
8
  end
9
9
 
10
- def create_directory
10
+ def create_project
11
11
  say "✍️ Setting up your project..."
12
- empty_directory name
13
- create_file "#{name}/.byld/config.yml"
14
- end
15
-
16
- def create_project
17
12
  success, res = Infra.create_namespace(Config.instance['id'], name)
18
-
13
+
19
14
  if success
20
- ConfigHelper.save_config(name, res)
15
+ empty_directory name
16
+ create_file "#{name}/.byld/config.yml"
17
+ ConfigHelper.save_config('namespace', name, res)
21
18
 
22
19
  say "👍 Project created successfully!"
23
20
  else
@@ -1,3 +1,4 @@
1
1
  BYLD_CONF = "#{Dir.home}/.byld.yaml"
2
2
  BYLD_HOST = ENV['BYLD_HOST'] || 'api.letsbyld.com'
3
3
  BIFROST_HOST = ENV['BIFROST_HOST'] || 'sockets.letsbyld.com'
4
+ BYLD_VERSION = '0.0.9'
@@ -5,18 +5,15 @@ class CreateGate < Thor::Group
5
5
  File.dirname(__FILE__)
6
6
  end
7
7
 
8
- def create_directory
8
+ def create_infra
9
9
  say "✍️ Setting up your gate..."
10
-
11
- directory "../templates/gate", 'gate'
12
- end
13
10
 
14
- def create_infra
15
11
  namespace_id = ConfigHelper.get_namespace_id
16
12
  sucess, res = Infra.create_project(namespace_id, 'gate', 'graph')
17
-
13
+
18
14
  if sucess
19
- ConfigHelper.save_config('gate', res)
15
+ directory "../templates/gate", 'gate'
16
+ ConfigHelper.save_config('project', 'gate', res)
20
17
 
21
18
  say "👍 Gate created successfully!"
22
19
  else
@@ -1,8 +1,8 @@
1
1
  module ConfigHelper
2
2
 
3
- def self.save_config(dir, config)
3
+ def self.save_config(key, dir, config)
4
4
  block_config = Config.load("#{dir}/.byld/config.yml")
5
- block_config.merge!(project: config)
5
+ block_config.merge!(key => config)
6
6
  end
7
7
 
8
8
  def self.get_namespace_and_project
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byld-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - the fellowhip co