blufin-lib 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/blufin-lib.rb +1 -0
- data/lib/core/files.rb +0 -1
- data/lib/core/projects.rb +82 -77
- data/lib/core/scrape.rb +16 -0
- data/lib/core/strings.rb +1 -1
- data/lib/core/terminal.rb +5 -4
- data/lib/scan/scanner_error.rb +3 -1
- data/lib/scan/scanner_js.rb +3 -0
- data/lib/version.rb +1 -1
- data/opt/schema/codegen.yml +5 -14
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b9d45f82bc9778ae3281cdcc7543d0a2a753a39e990f3f158f3d18a2a2e26408
|
4
|
+
data.tar.gz: 01fe028ff635264cc0367b7f207d35d9d45735fe01d85a44af5a8f31ce07f6f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d62b0fa6f777a9d2624629907346180502668e5f7d736324866e43fa11094523994d475fe3c14c25001d7c05ca1b1d62b00a1a15e96496fa1380eb7d8a8b99a3
|
7
|
+
data.tar.gz: 8498ab7b2a37089bee47ad64834d89682b0430e21f78efcc0039f37568eb2afd5d6e5de0c754763af27f1f6c839bd77ada3539abc83aa427964c28af74d94f1a
|
data/lib/blufin-lib.rb
CHANGED
@@ -13,6 +13,7 @@ module Blufin
|
|
13
13
|
autoload :Numbers, 'core/numbers'
|
14
14
|
autoload :Projects, 'core/projects'
|
15
15
|
autoload :Routes, 'core/routes'
|
16
|
+
autoload :Scrape, 'core/scrape'
|
16
17
|
autoload :ScannerError, 'scan/scanner_error'
|
17
18
|
autoload :ScannerJava, 'scan/scanner_java'
|
18
19
|
autoload :ScannerJs, 'scan/scanner_js'
|
data/lib/core/files.rb
CHANGED
data/lib/core/projects.rb
CHANGED
@@ -2,67 +2,65 @@ module Blufin
|
|
2
2
|
|
3
3
|
class Projects
|
4
4
|
|
5
|
-
SCHEMA_FILE
|
6
|
-
SCHEMA_FILE_CODEGEN
|
7
|
-
SCRIPT_RUN
|
8
|
-
SCRIPT_TEST
|
9
|
-
SCRIPT_BUILD
|
10
|
-
SCRIPT_DEPLOY
|
11
|
-
RUN_SCRIPTS
|
12
|
-
TEST_SCRIPTS
|
13
|
-
BUILD_SCRIPTS
|
14
|
-
ID
|
15
|
-
PROJECT_ID
|
16
|
-
PROJECT
|
17
|
-
PROJECT_ROOT
|
18
|
-
TYPE
|
19
|
-
REPOSITORY
|
20
|
-
UPSTREAM
|
21
|
-
DOWNSTREAM
|
22
|
-
LOCAL
|
23
|
-
REMOTE
|
24
|
-
FILE
|
25
|
-
DEPLOYMENT
|
26
|
-
DEPLOYMENT_BUCKET
|
27
|
-
DEPLOYMENT_FILES
|
28
|
-
RUN
|
29
|
-
TEST
|
30
|
-
BUILD
|
31
|
-
COMMANDS
|
32
|
-
API
|
33
|
-
SCHEDULER
|
34
|
-
WORKER
|
35
|
-
LAMBDA
|
36
|
-
UI
|
37
|
-
TRANSIENT_DATA
|
38
|
-
CODEGEN
|
39
|
-
CG_API_SIMPLE
|
40
|
-
CG_QUASAR
|
41
|
-
CG_QUASAR_ROOT
|
42
|
-
CG_QUASAR_PAGES
|
43
|
-
CG_QUASAR_PAGES_IGNORE
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
TYPE_UI = 'ui' # TODO - Probably need to extend this to every type of UI.
|
65
|
-
VALID_TYPES = [
|
5
|
+
SCHEMA_FILE = "#{Blufin::Base::get_base_path}#{Blufin::Base::OPT_PATH}/schema/projects.yml"
|
6
|
+
SCHEMA_FILE_CODEGEN = "#{Blufin::Base::get_base_path}#{Blufin::Base::OPT_PATH}/schema/codegen.yml"
|
7
|
+
SCRIPT_RUN = 'run'
|
8
|
+
SCRIPT_TEST = 'test'
|
9
|
+
SCRIPT_BUILD = 'build'
|
10
|
+
SCRIPT_DEPLOY = 'deploy'
|
11
|
+
RUN_SCRIPTS = 'RunScripts'
|
12
|
+
TEST_SCRIPTS = 'TestScripts'
|
13
|
+
BUILD_SCRIPTS = 'BuildScripts'
|
14
|
+
ID = 'Id'
|
15
|
+
PROJECT_ID = 'ProjectId'
|
16
|
+
PROJECT = 'Project'
|
17
|
+
PROJECT_ROOT = 'ProjectRoot'
|
18
|
+
TYPE = 'Type'
|
19
|
+
REPOSITORY = 'Repository'
|
20
|
+
UPSTREAM = 'Upstream'
|
21
|
+
DOWNSTREAM = 'Downstream'
|
22
|
+
LOCAL = 'Local'
|
23
|
+
REMOTE = 'Remote'
|
24
|
+
FILE = 'File'
|
25
|
+
DEPLOYMENT = 'Deployment'
|
26
|
+
DEPLOYMENT_BUCKET = 'Bucket'
|
27
|
+
DEPLOYMENT_FILES = 'Files'
|
28
|
+
RUN = 'Run'
|
29
|
+
TEST = 'Test'
|
30
|
+
BUILD = 'Build'
|
31
|
+
COMMANDS = 'Commands'
|
32
|
+
API = 'API'
|
33
|
+
SCHEDULER = 'Scheduler'
|
34
|
+
WORKER = 'Worker'
|
35
|
+
LAMBDA = 'Lambda'
|
36
|
+
UI = 'UI' # TODO - Probably need to extend this to every type of UI.
|
37
|
+
TRANSIENT_DATA = 'TransientData'
|
38
|
+
CODEGEN = 'codegen'
|
39
|
+
CG_API_SIMPLE = 'ApiSimple'
|
40
|
+
CG_QUASAR = 'Quasar'
|
41
|
+
CG_QUASAR_ROOT = 'Root'
|
42
|
+
CG_QUASAR_PAGES = 'PathPages'
|
43
|
+
CG_QUASAR_PAGES_IGNORE = 'PathPagesIgnore'
|
44
|
+
CG_QUASAR_ROUTES_FILE = 'RoutesFile'
|
45
|
+
CG_QUASAR_ROUTER_VIEW_LAYOUT = 'RouterViewLayout'
|
46
|
+
TITLE = 'Title'
|
47
|
+
ALIAS = 'Alias'
|
48
|
+
DOMAIN = 'Domain'
|
49
|
+
PROJECT_NAME_PASCAL_CASE = 'ProjectNamePascalCase'
|
50
|
+
PROJECT_NAME = 'ProjectName'
|
51
|
+
PORT = 'Port'
|
52
|
+
PORTS = 'Ports'
|
53
|
+
STAGES = 'Stages'
|
54
|
+
TYPE_ALEXA = 'alexa'
|
55
|
+
TYPE_API = 'api'
|
56
|
+
TYPE_API_SIMPLE = 'api-simple'
|
57
|
+
TYPE_LAMBDA = 'lambda'
|
58
|
+
TYPE_MVN_LIB = 'mvn-lib'
|
59
|
+
TYPE_NPM_LIB = 'npm-lib'
|
60
|
+
TYPE_MOBILE = 'mobile'
|
61
|
+
TYPE_QUASAR = 'quasar'
|
62
|
+
TYPE_UI = 'ui' # TODO - Probably need to extend this to every type of UI.
|
63
|
+
VALID_TYPES = [
|
66
64
|
TYPE_ALEXA,
|
67
65
|
TYPE_API,
|
68
66
|
TYPE_API_SIMPLE,
|
@@ -295,7 +293,7 @@ module Blufin
|
|
295
293
|
Blufin::Terminal::error('No projects found.') unless array_of_projects.any?
|
296
294
|
return array_of_projects[0] if array_of_projects.length == 1
|
297
295
|
projects = []
|
298
|
-
array_of_projects.each { |project| projects << {
|
296
|
+
array_of_projects.each { |project| projects << {:text => project[PROJECT_ID], :value => project} }
|
299
297
|
Blufin::Terminal::prompt_select('Select project:', projects)
|
300
298
|
end
|
301
299
|
|
@@ -335,6 +333,8 @@ module Blufin
|
|
335
333
|
end
|
336
334
|
end
|
337
335
|
|
336
|
+
# TODO - This file is very broken: 06/01/20 -- Need to remove all the API SIMPLE + QUASAR STUFF!
|
337
|
+
|
338
338
|
# Buffer/validate project(s) stuff.
|
339
339
|
projects_yml['Projects'].each do |project|
|
340
340
|
project_id = project[PROJECT_ID]
|
@@ -387,12 +387,15 @@ module Blufin
|
|
387
387
|
@codegen_file = "#{Blufin::Projects::get_project_path(project_id, project: project)}/.#{CODEGEN}/#{CODEGEN}.yml"
|
388
388
|
|
389
389
|
if [TYPE_API_SIMPLE, TYPE_QUASAR].include?(project_type)
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
390
|
+
|
391
|
+
# TODO - REMOVE THIS?
|
392
|
+
|
393
|
+
# # Validate (and parse) .codegen/codegen.yml.
|
394
|
+
# Blufin::Terminal::error("#{Blufin::Terminal::format_highlight(project_id)} \xe2\x80\x94 Missing file: #{Blufin::Terminal::format_directory(@codegen_file)}", 'This file needs to exist.', true) unless Blufin::Files::file_exists(@codegen_file)
|
395
|
+
# # Parse .codegen/codegen.yml
|
396
|
+
# document, errors = Blufin::Config::validate_file(@codegen_file, SCHEMA_FILE_CODEGEN)
|
397
|
+
# display_parse_errors_if_any(errors, @codegen_file)
|
398
|
+
# @codegen_yml = parse_yml(@codegen_file)
|
396
399
|
end
|
397
400
|
|
398
401
|
# Validate Script(s).
|
@@ -403,7 +406,7 @@ module Blufin
|
|
403
406
|
if project[script_type].is_a?(Hash)
|
404
407
|
script_key = script_key_mapper(script_type)
|
405
408
|
valid_scripts = []
|
406
|
-
valid_scripts = @@scripts[script_key].keys if @@scripts.has_key?(script_key)
|
409
|
+
valid_scripts = @@scripts[script_key].keys if @@scripts.is_a?(Hash) && @@scripts.has_key?(script_key)
|
407
410
|
script = project[script_type]
|
408
411
|
script_name = script['Script']
|
409
412
|
unless valid_scripts.include?(script_name)
|
@@ -464,11 +467,12 @@ module Blufin
|
|
464
467
|
Blufin::Terminal::error("#{Blufin::Terminal::format_highlight(project_id)} \xe2\x80\x94 Property not supported: #{Blufin::Terminal::format_invalid(API)}", "This property is only allowed for project(s) with type: #{API}", true) if project.has_key?(API)
|
465
468
|
end
|
466
469
|
|
470
|
+
# TODO - REMOVE?
|
467
471
|
# Validate ApiSimple property.
|
468
|
-
if project_type == TYPE_API_SIMPLE
|
469
|
-
|
470
|
-
|
471
|
-
end
|
472
|
+
# if project_type == TYPE_API_SIMPLE
|
473
|
+
# Blufin::Terminal::error("#{Blufin::Terminal::format_highlight(project_id)} \xe2\x80\x94 Missing property #{Blufin::Terminal::format_highlight(CG_API_SIMPLE)} in: #{Blufin::Terminal::format_directory(@codegen_file)}", "This property is required for project(s) with type: #{TYPE_API_SIMPLE}", true) unless @codegen_yml.has_key?(CG_API_SIMPLE)
|
474
|
+
# project[TRANSIENT_DATA] = @codegen_yml[CG_API_SIMPLE]
|
475
|
+
# end
|
472
476
|
|
473
477
|
# Validate Lambda property.
|
474
478
|
if project_type == TYPE_LAMBDA
|
@@ -493,11 +497,12 @@ module Blufin
|
|
493
497
|
Blufin::Terminal::error("#{Blufin::Terminal::format_highlight(project_id)} \xe2\x80\x94 Property not supported: #{Blufin::Terminal::format_invalid(LAMBDA)}", "This property is only allowed for project(s) with type: #{TYPE_LAMBDA}", true) if project.has_key?(LAMBDA)
|
494
498
|
end
|
495
499
|
|
500
|
+
# TODO - REMOVE?
|
496
501
|
# Validate Quasar property.
|
497
|
-
if project_type == TYPE_QUASAR
|
498
|
-
|
499
|
-
|
500
|
-
end
|
502
|
+
# if project_type == TYPE_QUASAR
|
503
|
+
# Blufin::Terminal::error("#{Blufin::Terminal::format_highlight(project_id)} \xe2\x80\x94 Missing property #{Blufin::Terminal::format_highlight(CG_QUASAR)} in: #{Blufin::Terminal::format_directory(@codegen_file)}", "This property is required for project(s) with type: #{TYPE_QUASAR}", true) unless @codegen_yml.has_key?(CG_QUASAR)
|
504
|
+
# project[TRANSIENT_DATA] = @codegen_yml[CG_QUASAR]
|
505
|
+
# end
|
501
506
|
|
502
507
|
# Validate upstream/downstream Libs(s).
|
503
508
|
[UPSTREAM, DOWNSTREAM].each do |stream|
|
data/lib/core/scrape.rb
ADDED
data/lib/core/strings.rb
CHANGED
@@ -35,7 +35,7 @@ module Blufin
|
|
35
35
|
# @param String - The string to be trimmed (and returned).
|
36
36
|
# @return String
|
37
37
|
def self.remove_surrounding_slashes(string)
|
38
|
-
raise RuntimeError, "Expected String, instead got
|
38
|
+
raise RuntimeError, "Expected String, instead got: #{string.class} (#{string.inspect})" unless string.is_a?(String)
|
39
39
|
string = string.strip
|
40
40
|
validate_string(string)
|
41
41
|
string = string.gsub(/\A\/+/, '')
|
data/lib/core/terminal.rb
CHANGED
@@ -115,13 +115,13 @@ module Blufin
|
|
115
115
|
|
116
116
|
# Same as above but with a proc/lambda instead of a terminal command.
|
117
117
|
# @return void
|
118
|
-
def self.execute_proc(title, proc, verbose: true)
|
118
|
+
def self.execute_proc(title, proc, verbose: true, hide_progress: false)
|
119
119
|
raise RuntimeError, "Expected String, instead got:#{title.class}" unless title.is_a?(String)
|
120
120
|
raise RuntimeError, "Expected proc to be an instance of Proc, instead got: #{proc.class}" unless proc.is_a?(Proc)
|
121
121
|
t1 = Time.now
|
122
122
|
spinner = nil
|
123
123
|
spinner = TTY::Spinner.new("[:spinner] \x1B[38;5;208m#{title}\x1B[0m", format: :dots) if verbose
|
124
|
-
spinner.auto_spin if verbose
|
124
|
+
spinner.auto_spin if verbose && !hide_progress
|
125
125
|
res = proc.call
|
126
126
|
t2 = Time.now
|
127
127
|
delta = "#{'%.3f' % (t2 - t1).abs}s"
|
@@ -147,9 +147,9 @@ module Blufin
|
|
147
147
|
when MSG_TODO
|
148
148
|
puts "\x1B[38;5;231m\x1B[48;5;199m @TODO \x1B[0m \x1B[0m\xe2\x86\x92\x1B[0m \x1B[0m#{message}\x1B[0m\n"
|
149
149
|
when MSG_AUTOMATIC
|
150
|
-
puts "\x1B[38;5;231m\x1B[48;5;
|
150
|
+
puts "\x1B[38;5;231m\x1B[48;5;92m Automatic \x1B[0m \x1B[0m\xe2\x86\x92\x1B[0m \x1B[0m#{message}\x1B[0m\n"
|
151
151
|
when MSG_GENERATED
|
152
|
-
puts "\x1B[38;5;231m\x1B[48;5;
|
152
|
+
puts "\x1B[38;5;231m\x1B[48;5;89m Generated \x1B[0m \x1B[0m\xe2\x86\x92\x1B[0m \x1B[0m#{message}\x1B[0m\n"
|
153
153
|
when MSG_PROCESSED
|
154
154
|
puts "\x1B[38;5;231m\x1B[48;5;238m Processed \x1B[0m \x1B[0m\xe2\x86\x92\x1B[0m \x1B[0m#{message}\x1B[0m\n"
|
155
155
|
when MSG_PROGRESS
|
@@ -661,4 +661,5 @@ module Blufin
|
|
661
661
|
end
|
662
662
|
|
663
663
|
end
|
664
|
+
|
664
665
|
end
|
data/lib/scan/scanner_error.rb
CHANGED
@@ -70,7 +70,9 @@ module Blufin
|
|
70
70
|
raise RuntimeError, "Expected String, instead got: #{file.class}" unless file.is_a?(String)
|
71
71
|
fs = file.split('/')
|
72
72
|
fl = fs.pop
|
73
|
-
|
73
|
+
is_file = fl =~ /\./
|
74
|
+
color = is_file ? 202 : 75
|
75
|
+
"\x1B[48;5;233m \x1B[38;5;240m#{fs.join('/')}/\x1B[38;5;#{color}m#{fl} \x1B[0m#{is_file ? nil : '(path)'}"
|
74
76
|
end
|
75
77
|
|
76
78
|
# Add an error.
|
data/lib/scan/scanner_js.rb
CHANGED
data/lib/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
BLUFIN_LIB_VERSION = '2.3.
|
1
|
+
BLUFIN_LIB_VERSION = '2.3.1'
|
data/opt/schema/codegen.yml
CHANGED
@@ -9,7 +9,7 @@ mapping:
|
|
9
9
|
ControllerPath:
|
10
10
|
required: true
|
11
11
|
pattern: /^[a-z0-9\-\/]+$/
|
12
|
-
|
12
|
+
ModulePath:
|
13
13
|
required: true
|
14
14
|
pattern: /^[a-z0-9\-\/]+$/
|
15
15
|
Lambda:
|
@@ -30,18 +30,9 @@ mapping:
|
|
30
30
|
type: seq
|
31
31
|
sequence:
|
32
32
|
- type: str
|
33
|
-
ApiDocsFile:
|
34
|
-
required: true
|
35
|
-
pattern: /^[a-z0-9\-\.\/]+$/
|
36
|
-
JsDocsFile:
|
37
|
-
required: true
|
38
|
-
pattern: /^[a-z0-9\-\.\/]+$/
|
39
|
-
JsPath:
|
40
|
-
required: true
|
41
|
-
pattern: /^[a-z0-9\-\/]+$/
|
42
|
-
JsPathTests:
|
43
|
-
required: true
|
44
|
-
pattern: /^[a-z0-9\-\/]+$/
|
45
33
|
RoutesFile:
|
46
34
|
required: true
|
47
|
-
pattern: /^[a-z0-9
|
35
|
+
pattern: /^[a-z0-9\-\/]+\.js$/
|
36
|
+
RouterViewLayout:
|
37
|
+
required: true
|
38
|
+
pattern: /^[a-z0-9\-\/]+\.vue$/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blufin-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert Rannetsperger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01
|
11
|
+
date: 2020-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: kwalify
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.21.0
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.21.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: tty-spinner
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/core/numbers.rb
|
143
143
|
- lib/core/projects.rb
|
144
144
|
- lib/core/routes.rb
|
145
|
+
- lib/core/scrape.rb
|
145
146
|
- lib/core/strings.rb
|
146
147
|
- lib/core/terminal.rb
|
147
148
|
- lib/core/tools.rb
|
@@ -177,8 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
178
|
- !ruby/object:Gem::Version
|
178
179
|
version: '0'
|
179
180
|
requirements: []
|
180
|
-
|
181
|
-
rubygems_version: 2.5.2.3
|
181
|
+
rubygems_version: 3.1.2
|
182
182
|
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Blufin Lib
|