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 +4 -4
- data/byld-cli.gemspec +2 -1
- data/lib/blocks/create_block.rb +4 -7
- data/lib/byld_cli.rb +8 -0
- data/lib/common/access_console.rb +6 -2
- data/lib/common/create_project.rb +5 -8
- data/lib/constants.rb +1 -0
- data/lib/gates/create_gate.rb +4 -7
- data/lib/helpers/config_helper.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d850ce35811255d939c37b62814d57d6178ca0cf9853e5f565160602fe2e325
|
4
|
+
data.tar.gz: 4b3029fcb988bb369161ffe3499801699d12e3c90b0f5fe7ff3e8821495cb039
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a949f660056c52fc4892de02cfb748127340bdad3c54ca862f4c61958137f082c22b11297bc7cd3b0413415b5ce88c902fb544767e2af504f2221c04eb732ea
|
7
|
+
data.tar.gz: 1c4fcf318a0896e369b21ce45d06028e49e263ac9cd1b08c1ddd5eba166e5536a56010dbf2415237e0ec344e663c6b34138c6305f401d61136e7d974cb328c0a
|
data/byld-cli.gemspec
CHANGED
@@ -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 =
|
7
|
+
spec.version = BYLD_VERSION
|
7
8
|
|
8
9
|
spec.authors = ['the fellowhip co']
|
9
10
|
spec.summary = 'cli for byld'
|
data/lib/blocks/create_block.rb
CHANGED
@@ -7,17 +7,14 @@ class CreateBlock < Thor::Group
|
|
7
7
|
File.dirname(__FILE__)
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
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
|
-
|
16
|
+
directory '../templates/block', name
|
17
|
+
ConfigHelper.save_config('project', name, res)
|
21
18
|
|
22
19
|
say "👍 Block created successfully!"
|
23
20
|
else
|
data/lib/byld_cli.rb
CHANGED
@@ -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 "
|
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
|
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
|
-
|
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
|
data/lib/constants.rb
CHANGED
data/lib/gates/create_gate.rb
CHANGED
@@ -5,18 +5,15 @@ class CreateGate < Thor::Group
|
|
5
5
|
File.dirname(__FILE__)
|
6
6
|
end
|
7
7
|
|
8
|
-
def
|
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
|
-
|
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!(
|
5
|
+
block_config.merge!(key => config)
|
6
6
|
end
|
7
7
|
|
8
8
|
def self.get_namespace_and_project
|