byld-cli 0.0.6 → 0.0.7
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/byld-cli.gemspec +1 -1
- data/lib/blocks/connect.rb +3 -3
- data/lib/blocks/create_block.rb +5 -5
- data/lib/blocks/run_migration.rb +1 -1
- data/lib/common/access_console.rb +1 -1
- data/lib/common/access_logs.rb +1 -1
- data/lib/common/create_project.rb +2 -3
- data/lib/common/deploy.rb +3 -3
- data/lib/common/login_user.rb +1 -1
- data/lib/common/status.rb +2 -12
- data/lib/gates/create_gate.rb +6 -6
- data/lib/gates/expose.rb +5 -5
- data/lib/helpers/config_helper.rb +28 -5
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9921ce939ed12c148d831a6f945df7f7a4ad59e4f7192a00a1012a32b94b946d
|
4
|
+
data.tar.gz: d52d9affbe3a25ebc20fd6df327d03f12e3bed95443f647a48381d272a058412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044136c15876ced63c09474f23b939786a6fc3ae2980bd6f1865ce397b6dd41c727f1ac0e46aae2d29814d8c4f40e825997479682dd9d19bde36683d17596097
|
7
|
+
data.tar.gz: 919d5255bea0eb5880154b080042d48d9d0db84c43db46ab65585ffbfda08975c165600d8179495312a229d6ed2de076d0480e7966fe2adb28eb31c8f14f20c4
|
data/byld-cli.gemspec
CHANGED
data/lib/blocks/connect.rb
CHANGED
@@ -11,15 +11,15 @@ class Connect < Thor::Group
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_client
|
14
|
+
namespace_id, project_id = ConfigHelper.get_namespace_and_project
|
14
15
|
puts "☝️ Connecting #{name}..."
|
15
|
-
project_config = Config.load(".byld/config.yml")
|
16
16
|
|
17
|
-
success, res = Infra.generate_client(name,
|
17
|
+
success, res = Infra.generate_client(name, namespace_id)
|
18
18
|
if success
|
19
19
|
create_file ".byld/gen/#{name.underscore}.rb", res.first['content']
|
20
20
|
puts "🔗 #{name} connected successfully!"
|
21
21
|
else
|
22
|
-
say "⚠️ Error connecting block. Reason: #{res}" unless success
|
22
|
+
say "⚠️ Error connecting block. Reason: #{res['error']}" unless success
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
data/lib/blocks/create_block.rb
CHANGED
@@ -13,15 +13,15 @@ class CreateBlock < Thor::Group
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def create_infra
|
16
|
-
|
17
|
-
success, res = Infra.create_project(
|
16
|
+
namespace_id = ConfigHelper.get_namespace_id
|
17
|
+
success, res = Infra.create_project(namespace_id, name, 'domain')
|
18
18
|
|
19
19
|
if success
|
20
|
-
|
21
|
-
|
20
|
+
ConfigHelper.save_config(name, res)
|
21
|
+
|
22
22
|
say "👍 Block created successfully!"
|
23
23
|
else
|
24
|
-
say "⚠️ Error creating block. Reason: #{res}" unless success
|
24
|
+
say "⚠️ Error creating block. Reason: #{res['error']}" unless success
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/lib/blocks/run_migration.rb
CHANGED
@@ -7,7 +7,7 @@ class RunMigration < Thor::Group
|
|
7
7
|
class_option :env, :default => 'dev'
|
8
8
|
|
9
9
|
def run_migrations
|
10
|
-
db_config =
|
10
|
+
db_config = Config.load(".byld/config.yml")['storage']
|
11
11
|
ActiveRecord::Base.establish_connection(db_config)
|
12
12
|
ActiveRecord::MigrationContext.new(".byld/migrations/").migrate
|
13
13
|
end
|
data/lib/common/access_logs.rb
CHANGED
@@ -26,7 +26,7 @@ class AccessLogs < Thor::Group
|
|
26
26
|
last_since_time = has_new_logs ? since_time : last_since_time
|
27
27
|
say res['logs'] if has_new_logs
|
28
28
|
else
|
29
|
-
say "⚠️ Error getting logs. Reason: #{res}" unless success
|
29
|
+
say "⚠️ Error getting logs. Reason: #{res['error']}" unless success
|
30
30
|
end
|
31
31
|
sleep 2
|
32
32
|
end
|
@@ -17,12 +17,11 @@ class CreateProject < Thor::Group
|
|
17
17
|
success, res = Infra.create_namespace(Config.instance['id'], name)
|
18
18
|
|
19
19
|
if success
|
20
|
-
|
21
|
-
namespace_config.merge!(namespace: res)
|
20
|
+
ConfigHelper.save_config(name, res)
|
22
21
|
|
23
22
|
say "👍 Project created successfully!"
|
24
23
|
else
|
25
|
-
say "⚠️ Error creating project. Reason: #{res}" unless success
|
24
|
+
say "⚠️ Error creating project. Reason: #{res['error']}" unless success
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
data/lib/common/deploy.rb
CHANGED
@@ -7,14 +7,14 @@ class Deploy < Thor::Group
|
|
7
7
|
|
8
8
|
def deploy
|
9
9
|
name = File.basename(Dir.getwd)
|
10
|
-
|
10
|
+
_, project_id = ConfigHelper.get_namespace_and_project
|
11
11
|
|
12
12
|
say "☝️ Deploying #{name}..."
|
13
|
-
success, res = Infra.deploy(
|
13
|
+
success, res = Infra.deploy(project_id)
|
14
14
|
if success
|
15
15
|
say "👌 Deployment triggered!"
|
16
16
|
else
|
17
|
-
say "⚠️ Error deploying block or gate. Reason: #{res}" unless success
|
17
|
+
say "⚠️ Error deploying block or gate. Reason: #{res['error']}" unless success
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
data/lib/common/login_user.rb
CHANGED
data/lib/common/status.rb
CHANGED
@@ -8,9 +8,9 @@ class Status < Thor::Group
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def print_status
|
11
|
-
success, res = Infra.get_namespace(
|
11
|
+
success, res = Infra.get_namespace(ConfigHelper.get_namespace_id)
|
12
12
|
|
13
|
-
say "⚠️ Error fetching project status. Reason: #{res}" unless success
|
13
|
+
say "⚠️ Error fetching project status. Reason: #{res['error']}" and return unless success
|
14
14
|
|
15
15
|
say set_color("\n#{res['name']}\n", :bold)
|
16
16
|
say set_color("gate\n", :bold)
|
@@ -29,14 +29,4 @@ class Status < Thor::Group
|
|
29
29
|
say Terminal::Table.new headings: ['name', 'status'], rows: blocks
|
30
30
|
end
|
31
31
|
|
32
|
-
def namespace_id
|
33
|
-
config = Config.load(".byld/config.yml")
|
34
|
-
|
35
|
-
if config['namespace'].present?
|
36
|
-
config['namespace']['id']
|
37
|
-
elsif config['project'].present?
|
38
|
-
config['project']['namespaceId']
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
32
|
end
|
data/lib/gates/create_gate.rb
CHANGED
@@ -12,15 +12,15 @@ class CreateGate < Thor::Group
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def create_infra
|
15
|
-
|
16
|
-
sucess, res = Infra.create_project(
|
15
|
+
namespace_id = ConfigHelper.get_namespace_id
|
16
|
+
sucess, res = Infra.create_project(namespace_id, 'gate', 'graph')
|
17
17
|
|
18
18
|
if sucess
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
ConfigHelper.save_config('gate', res)
|
20
|
+
|
21
|
+
say "👍 Gate created successfully!"
|
22
22
|
else
|
23
|
-
say "⚠️ Error creating gate. Reason: #{res}"
|
23
|
+
say "⚠️ Error creating gate. Reason: #{res['error']}"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
data/lib/gates/expose.rb
CHANGED
@@ -12,20 +12,20 @@ class Expose < Thor::Group
|
|
12
12
|
def create_client
|
13
13
|
puts "☝️ Connecting #{name}..."
|
14
14
|
|
15
|
-
|
16
|
-
success, res = Infra.generate_client(name,
|
15
|
+
namespace_id, gate_id = ConfigHelper.get_namespace_and_project
|
16
|
+
success, res = Infra.generate_client(name, namespace_id)
|
17
17
|
if success
|
18
18
|
create_file ".byld/gen/#{name.underscore}.rb", res.first['content']
|
19
19
|
puts "🔗 #{name} connected successfully!"
|
20
20
|
else
|
21
|
-
puts "⚠️ Error connecting block. Reason: #{res}"
|
21
|
+
puts "⚠️ Error connecting block. Reason: #{res['error']}"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_edge
|
26
26
|
puts "☝️ Exposing #{name}..."
|
27
|
-
|
28
|
-
success, res = Infra.generate_edges(name,
|
27
|
+
namespace_id, gate_id = ConfigHelper.get_namespace_and_project
|
28
|
+
success, res = Infra.generate_edges(name, namespace_id)
|
29
29
|
if success
|
30
30
|
res.each do |edge|
|
31
31
|
create_file "./edges/#{edge['name']}", edge['content']
|
@@ -1,13 +1,19 @@
|
|
1
1
|
module ConfigHelper
|
2
|
+
|
3
|
+
def self.save_config(dir, config)
|
4
|
+
block_config = Config.load("#{dir}/.byld/config.yml")
|
5
|
+
block_config.merge!(project: config)
|
6
|
+
end
|
7
|
+
|
2
8
|
def self.get_namespace_and_project
|
3
|
-
namespace_path =
|
4
|
-
project_path =
|
9
|
+
namespace_path = '../.byld/config.yml'
|
10
|
+
project_path = '.byld/config.yml'
|
5
11
|
|
6
|
-
namespace_config = Config.load(
|
7
|
-
project_config = Config.load(
|
12
|
+
namespace_config = Config.load(namespace_path) if File.exist?(namespace_path)
|
13
|
+
project_config = Config.load(project_path) if File.exist?(project_path)
|
8
14
|
|
9
15
|
if namespace_config.nil? or project_config.nil?
|
10
|
-
puts "\n
|
16
|
+
puts "\n🚫 Config is missing! Note: This command is valid only within block or gate directory \n\n"
|
11
17
|
exit
|
12
18
|
end
|
13
19
|
|
@@ -16,4 +22,21 @@ module ConfigHelper
|
|
16
22
|
|
17
23
|
[namespace_id, project_id]
|
18
24
|
end
|
25
|
+
|
26
|
+
def self.get_namespace_id
|
27
|
+
config_path = '.byld/config.yml'
|
28
|
+
config = Config.load(config_path) if File.exist?(config_path)
|
29
|
+
|
30
|
+
if config.nil?
|
31
|
+
puts "\n🚫 Config is missing! Note: This command is valid only within block or gate or project directory \n\n"
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
35
|
+
if config['namespace'].present?
|
36
|
+
config['namespace']['id']
|
37
|
+
elsif config['project'].present?
|
38
|
+
config['project']['namespaceId']
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
19
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: byld-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- the fellowhip co
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 5.2.3
|
111
111
|
description: cli for byld
|
112
|
-
email:
|
112
|
+
email:
|
113
113
|
executables:
|
114
114
|
- byld
|
115
115
|
extensions: []
|
@@ -162,10 +162,10 @@ files:
|
|
162
162
|
- lib/templates/gate/.byld/config.yml.tt
|
163
163
|
- lib/templates/gate/Gemfile
|
164
164
|
- lib/templates/gate/edges/.empty_directory
|
165
|
-
homepage:
|
165
|
+
homepage:
|
166
166
|
licenses: []
|
167
167
|
metadata: {}
|
168
|
-
post_install_message:
|
168
|
+
post_install_message:
|
169
169
|
rdoc_options: []
|
170
170
|
require_paths:
|
171
171
|
- lib
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubygems_version: 3.0.3
|
184
|
-
signing_key:
|
184
|
+
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: cli for byld
|
187
187
|
test_files: []
|