Sha256: ab288491fb5b18ba85431bb8ff35e5d62a49f99e0f5d24eefce01e596e70d6a8
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'highline' module Sct class Setup attr_accessor :sctfile_content def self.start require "sct/sct_folder" if Sct::SctFolder.setup? puts "Already setup at path `#{Sct::SctFolder.path}`" return end Sct::SctFolder.create_folder! setup = self.new setup.write_sctfile end def write_sctfile sctfile_file_name = "Sctfile" cli = HighLine.new email = cli.ask("What is your email address?") { |q| q.validate = URI::MailTo::EMAIL_REGEXP } cloud_proxy = cli.ask("What is the path of your cloud proxy json credentials?") { |q| q.default = "/.config/gcloud/application_default_credentials.json" } host_path = cli.choose do |menu| menu.prompt = "What is the path of your hostfile?" menu.choice(:unix) { "/etc/hosts" } menu.choices(:windows) { "/mnt/c/Windows/System32/drivers/etc/hosts" } menu.default = :unix end self.sctfile_content = "" self.sctfile_content << "#{email} \n" self.sctfile_content << "cloud-proxy-path=#{cloud_proxy} \n" self.sctfile_content << "hostpath=#{host_path} \n" sctfile_path = File.join(Sct::SctFolder.path, sctfile_file_name) File.write(sctfile_path, self.sctfile_content) puts "Generated Sctfile at #{sctfile_path}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sct-0.1.2 | lib/sct/setup/setup.rb |
sct-0.1.1 | lib/sct/setup/setup.rb |