sct 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +3 -2
- data/bin/sct +4 -4
- data/lib/.DS_Store +0 -0
- data/lib/sct/commands/init.rb +1 -1
- data/lib/sct/sct_folder.rb +1 -1
- data/lib/sct/setup/helpers.rb +1 -1
- data/lib/sct/setup/setup.rb +31 -10
- data/lib/sct/version.rb +1 -1
- data/lib/sct.rb +14 -8
- data/sct.gemspec +2 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bacd93ef13d52b6b218f43b7d5f6b522f4572806506af40d6baf7bd01829d96
|
4
|
+
data.tar.gz: feedea275908afa26178138c3433409878a7fc3580d12d8e720245781fa3a2b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5ee00860cd8f572bf22cd36145756284401be05f613f80776243989d3181ca236cda7a04f64e2b2002783009193b149b2770d3854c48df1536e4b9ee1dc3d10
|
7
|
+
data.tar.gz: 9e067e4768dd9885f2eb294c6be1f8243420b9bc7dea65f24c84129353944e1d9e532390d9647e778784735c2602bcc7be5ba44747a801ba0d11214de7e93c9d
|
data/.DS_Store
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
data/bin/sct
CHANGED
@@ -4,7 +4,7 @@ require 'commander/import'
|
|
4
4
|
require 'sct'
|
5
5
|
|
6
6
|
if RUBY_VERSION < '2.0.0'
|
7
|
-
abort("
|
7
|
+
abort("sct requires Ruby 2.0.0 or higher")
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.windows?
|
@@ -12,10 +12,10 @@ def self.windows?
|
|
12
12
|
end
|
13
13
|
|
14
14
|
if ARGV.include?('-v') || ARGV.include?('--version')
|
15
|
-
# This will print out the
|
15
|
+
# This will print out the sct binary path right above the
|
16
16
|
# version number. Very often, users are not aware they have
|
17
|
-
# e.g. bundled
|
18
|
-
puts("
|
17
|
+
# e.g. bundled sct installed
|
18
|
+
puts("sct installation at path:")
|
19
19
|
puts(File.expand_path(__FILE__))
|
20
20
|
puts("-----------------------------")
|
21
21
|
end
|
data/lib/.DS_Store
CHANGED
Binary file
|
data/lib/sct/commands/init.rb
CHANGED
data/lib/sct/sct_folder.rb
CHANGED
data/lib/sct/setup/helpers.rb
CHANGED
data/lib/sct/setup/setup.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
require 'highline'
|
2
|
+
|
1
3
|
module Sct
|
2
4
|
class Setup
|
3
5
|
|
4
|
-
attr_accessor :
|
6
|
+
attr_accessor :sctfile_content
|
5
7
|
|
6
8
|
def self.start
|
7
9
|
|
8
|
-
require "
|
10
|
+
require "sct/sct_folder"
|
9
11
|
|
10
12
|
if Sct::SctFolder.setup?
|
11
13
|
puts "Already setup at path `#{Sct::SctFolder.path}`"
|
@@ -15,22 +17,41 @@ module Sct
|
|
15
17
|
Sct::SctFolder.create_folder!
|
16
18
|
|
17
19
|
setup = self.new
|
18
|
-
setup.
|
20
|
+
setup.write_sctfile
|
19
21
|
|
20
22
|
end
|
21
23
|
|
22
|
-
def
|
24
|
+
def write_sctfile
|
25
|
+
|
26
|
+
sctfile_file_name = "Sctfile"
|
27
|
+
|
28
|
+
cli = HighLine.new
|
23
29
|
|
24
|
-
|
30
|
+
email = cli.ask("What is your email address?") { |q|
|
31
|
+
q.validate = URI::MailTo::EMAIL_REGEXP
|
32
|
+
}
|
33
|
+
|
34
|
+
cloud_proxy = cli.ask("What is the path of your cloud proxy json credentials?") { |q|
|
35
|
+
q.default = "/.config/gcloud/application_default_credentials.json"
|
36
|
+
}
|
37
|
+
|
38
|
+
host_path = cli.choose do |menu|
|
39
|
+
menu.prompt = "What is the path of your hostfile?"
|
40
|
+
menu.choice(:unix) { "/etc/hosts" }
|
41
|
+
menu.choices(:windows) { "/mnt/c/Windows/System32/drivers/etc/hosts" }
|
42
|
+
menu.default = :unix
|
43
|
+
end
|
25
44
|
|
26
|
-
self.
|
27
|
-
self.
|
45
|
+
self.sctfile_content = ""
|
46
|
+
self.sctfile_content << "#{email} \n"
|
47
|
+
self.sctfile_content << "cloud-proxy-path=#{cloud_proxy} \n"
|
48
|
+
self.sctfile_content << "hostpath=#{host_path} \n"
|
28
49
|
|
29
|
-
|
50
|
+
sctfile_path = File.join(Sct::SctFolder.path, sctfile_file_name)
|
30
51
|
|
31
|
-
File.write(
|
52
|
+
File.write(sctfile_path, self.sctfile_content)
|
32
53
|
|
33
|
-
puts "Generated Sctfile at #{
|
54
|
+
puts "Generated Sctfile at #{sctfile_path}"
|
34
55
|
|
35
56
|
end
|
36
57
|
end
|
data/lib/sct/version.rb
CHANGED
data/lib/sct.rb
CHANGED
@@ -1,20 +1,27 @@
|
|
1
|
+
require 'sct'
|
2
|
+
require 'sct/command'
|
1
3
|
require "sct/version"
|
2
|
-
require "
|
4
|
+
require "sct/sct_folder"
|
5
|
+
require 'colored'
|
6
|
+
require 'commander'
|
3
7
|
|
4
8
|
module Sct
|
5
|
-
class Error < StandardError; end
|
6
|
-
|
7
9
|
class SctCore
|
8
10
|
|
9
|
-
|
10
|
-
program :name, 'Sct'
|
11
|
+
program :name, 'sct'
|
11
12
|
program :version, Sct::VERSION
|
12
|
-
program :summary, 'CLI helper tool for local
|
13
|
-
program :description, '
|
13
|
+
program :summary, 'CLI helper tool for local SCT development'
|
14
|
+
program :description, 'SCT is a CLI tool for developers using the Visma Continuous Deployment Model in conjunction with the Google Cloud Platform (GCP). It provides multiple command to set up and maintain a kubernetes cluster on a machine for local development'
|
14
15
|
|
16
|
+
def self.take_off(cmds)
|
17
|
+
self.new.run
|
15
18
|
cmds.each { |cmd| registerCommand(cmd) }
|
16
19
|
end
|
17
20
|
|
21
|
+
def run
|
22
|
+
|
23
|
+
end
|
24
|
+
|
18
25
|
def self.registerCommand(cmd)
|
19
26
|
# validate Command Class
|
20
27
|
if cmd.class != Class ||
|
@@ -51,5 +58,4 @@ module Sct
|
|
51
58
|
end
|
52
59
|
|
53
60
|
end
|
54
|
-
|
55
61
|
end
|
data/sct.gemspec
CHANGED
@@ -28,10 +28,11 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = ["sct"]
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_dependency "class_interface"
|
31
|
+
spec.add_dependency "class_interface", "~> 0.1.1"
|
32
32
|
spec.add_dependency "colored", "~> 1.2"
|
33
33
|
spec.add_dependency "hosts", "~> 0.1.1"
|
34
34
|
spec.add_dependency "commander", "~> 4.4.7"
|
35
|
+
spec.add_dependency "highline", ">= 1.7.2"
|
35
36
|
|
36
37
|
spec.add_development_dependency "bundler", "~> 2.0"
|
37
38
|
spec.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reshad Farid
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: class_interface
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colored
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 4.4.7
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: highline
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.7.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.7.2
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|