sct 0.1.6 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f100b62e8d0d2bd70af3f5537b6c2c718c7296bc56e404b8cae56cabd287e481
4
- data.tar.gz: 168407ad244468a1bf770043dd083cad1804129bc24185c7e60408a9ef74b3ca
3
+ metadata.gz: 7da46c8483060b85fda39a7ee5a274be457f7f8a08aeddaa62d508e38f8aff92
4
+ data.tar.gz: 7185c99600e9fb1e382c4d70915e133e07d2a3bf9bbfa9302705a0e0f57b03d9
5
5
  SHA512:
6
- metadata.gz: 014d32a3773100dd29a7221551be2f5c999b85a4f212aef5d1970606aceb1127da8143ab1c21a7f934b9540bf165272584f626c091d53d75b759de9ee7ae4d14
7
- data.tar.gz: 6113574bffe433da86ad29a0aa48470e84d4a070f9405b7a13da632abea463d5619d45a60d326edc581f84189a67c8478574d9b05cc60f2973277cc03c4b7f55
6
+ metadata.gz: 4ee29b0cf5bbb7d1aa1f0b588783846709b56529b39663a7c864819de4a0e54e280a55f1f41ef6437ecc947ed99599ad9fc4358d1daa7e54f705a9274e295818
7
+ data.tar.gz: 75c5939844adba62b837ed12ac8abe949b4f17a412d750eb1f28f12ba1b951ce6efaffbdcb26232e1ba47625e6a7309e74f612ba492f04d6a0bd86abc0374aeb
@@ -25,10 +25,10 @@ module Sct
25
25
  case args[0]
26
26
  when "up"
27
27
  system("#{minikube} start")
28
- system("sudo sct hostfile")
29
28
  system("#{minikube} ssh -- 'sudo su -c \"echo 10048576 > /proc/sys/fs/inotify/max_user_watches\"'")
30
29
  system("kubectl config use-context minikube")
31
30
  system("kubectl delete pod -n kube-system $(kubectl get pods -n kube-system | grep registry-creds | awk '{print $1}')")
31
+ system("sudo sct hostfile")
32
32
  puts "\n✔️ You can now visit your environment at 👉 https://spend-cloud.spend.cloud.local 👌"
33
33
  when "down"
34
34
  system("#{minikube} stop")
@@ -31,11 +31,9 @@ module Sct
31
31
  q.default = "~/.config/gcloud/application_default_credentials.json"
32
32
  }
33
33
 
34
- host_path = cli.choose do |menu|
35
- menu.prompt = "What is the path of your hostfile?"
36
- menu.choice(:unix) { "/etc/hosts" }
37
- menu.choices(:windows) { "/mnt/c/Windows/System32/drivers/etc/hosts" }
38
- menu.default = :unix
34
+ host_path = "/etc/hosts"
35
+ if Sct::Config.operatingSystem == Sct::Config::WINDOWS
36
+ host_path = "/mnt/c/Windows/System32/drivers/etc/hosts"
39
37
  end
40
38
 
41
39
  contents = ""
data/lib/sct/config.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  module Sct
2
2
  class Config
3
3
 
4
+ WINDOWS = "Windows"
5
+ MAC_OS = "MacOS"
6
+ UBUNTU = "Ubuntu"
7
+
4
8
  def self.dir
5
9
  user = ENV["SUDO_USER"] || ENV["USER"]
6
10
 
@@ -40,5 +44,20 @@ module Sct
40
44
 
41
45
  return Sct::Helpers.to_hash(contents)
42
46
  end
47
+
48
+ def self.operatingSystem
49
+ proc = `uname -a`
50
+
51
+ case proc
52
+ when /Microsoft/
53
+ os = WINDOWS
54
+ when /Darwin/
55
+ os = MAC_OS
56
+ else
57
+ os = UBUNTU
58
+ end
59
+
60
+ return os
61
+ end
43
62
  end
44
63
  end
@@ -60,7 +60,7 @@ module Sct
60
60
  def self.setPwdAsVolume(volume_path)
61
61
  pwd = `pwd -P`
62
62
 
63
- if self.operatingSystem() == "Windows"
63
+ if Sct::Config.operatingSystem == Sct::Config::WINDOWS
64
64
  pwd=self.convertPath(pwd)
65
65
  end
66
66
 
@@ -199,30 +199,12 @@ module Sct
199
199
  return command_string + append.gsub(/\r?\n/, "") + " "
200
200
  end
201
201
 
202
- ###
203
- # Check the operating system on which this command is being run
204
- ###
205
- def self.operatingSystem()
206
- proc = `uname -a`
207
-
208
- case proc
209
- when /Microsoft/
210
- os = "Windows"
211
- when /Darwin/
212
- os = "MacOS"
213
- else
214
- os = "Ubuntu"
215
- end
216
-
217
- return os
218
- end
219
-
220
202
  ###
221
203
  # Get the actual home path of the user. This may be different depending on the operating system
222
204
  ###
223
205
  def self.getTrueHomePath
224
206
  home_path = `echo ~`
225
- if self.operatingSystem() == "Windows"
207
+ if Sct::Config.operatingSystem == Sct::Config::WINDOWS
226
208
  home_path = self.convertPath(`cmd.exe /c echo %userprofile%`, false)
227
209
  end
228
210
 
@@ -233,7 +215,7 @@ module Sct
233
215
  # Convert the unix paths to Windows paths for Windows systems
234
216
  ###
235
217
  def self.convertPath(path, to_native=true)
236
- if self.operatingSystem() == "Windows" && to_native
218
+ if Sct::Config.operatingSystem == Sct::Config::WINDOWS && to_native
237
219
  return path.gsub(/\/mnt\/c/, 'C:/').gsub(/\/\//, '/').gsub(/\\\\/, "/").gsub(/\r\n?/, '')
238
220
  else
239
221
  return path.gsub(/C:\\/, '/mnt/c').gsub(/\\\\/, "/").gsub(/\\/, '/').gsub(/\r\n?/, '')
data/lib/sct/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sct
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
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-30 00:00:00.000000000 Z
11
+ date: 2020-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: class_interface