pinokiod 3.3.53 → 3.4.0

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.
@@ -20,48 +20,61 @@ class Brew {
20
20
 
21
21
  if (this.kernel.platform === "darwin") {
22
22
  // command line tools
23
- let e4;
24
- let result = await this.kernel.bin.exec({ message: "xcode-select --version" }, (stream) => { })
25
- if (result && result.stdout) {
26
- e4 = /xcode-select version ([0-9]+)/gi.exec(result.stdout)
27
- if (e4.length > 1) {
28
- let version = Number(e4[1])
29
- console.log("xcode-select version", version)
30
- if (version >= 2349) {
31
- e4 = true
23
+
24
+ // try to get the contents
25
+ let result = await this.kernel.bin.exec({ message: "ls -m $(xcode-select -p)" }, (stream) => {
26
+ ondata(stream)
27
+ })
28
+ let e5 = result && result.stdout && /.*Library.*/g.test(result.stdout) && /.*SDKs.*/g.test(result.stdout) && /.*usr.*/g.test(result.stdout)
29
+ if (e5) {
30
+ const msg = "> xcode-select command line tools is installed. checking the version...\r\n"
31
+ console.log(msg)
32
+ ondata({ raw: msg })
33
+ // check the version.
34
+ // if it's not valid, install the latest
35
+ // if it's valid, skip
36
+ let e4;
37
+ let result = await this.kernel.bin.exec({ message: "xcode-select --version" }, (stream) => {
38
+ ondata(stream)
39
+ })
40
+ if (result && result.stdout) {
41
+ e4 = /xcode-select version ([0-9]+)/gi.exec(result.stdout)
42
+ if (e4.length > 1) {
43
+ let version = Number(e4[1])
44
+ console.log("xcode-select version", version)
45
+ if (version >= 2349) {
46
+ e4 = true
47
+ } else {
48
+ e4 = false
49
+ }
32
50
  } else {
33
51
  e4 = false
34
52
  }
35
53
  } else {
36
54
  e4 = false
37
55
  }
38
- } else {
39
- e4 = false
40
- }
41
-
42
- console.log("> e4", e4)
43
-
44
- if (!e4) {
45
- console.log("install the latest xcode build tools")
46
- // not installed or not installed properly
47
- // install xcode build tools
48
- await this.kernel.bin.exec({ sudo: true, conda: { skip: true }, message: "rm -rf /Library/Developer/CommandLineTools" }, (stream) => { ondata(stream) })
49
- let sh_path = path.resolve(this.kernel.homedir, "xcode.sh")
50
- let src_path = path.resolve(__dirname, "xcode.sh")
51
- console.log({ sh_path, src_path })
52
- let sh = await fs.promises.readFile(src_path, "utf8")
53
- console.log({ sh })
54
- await fs.promises.writeFile(sh_path, sh)
55
- await this.kernel.bin.exec({ message: "bash ./xcode.sh", path: this.kernel.homedir, conda: { skip: true }}, (stream) => { ondata(stream) })
56
+ console.log("> e4", e4)
56
57
 
57
- ondata({ raw: "installing xcode-select. please approve the xcode-select install dialog and install before proceeding...\r\n" })
58
- await this.kernel.bin.exec({ message: "xcode-select --install", conda: { skip: true } }, (stream) => { ondata(stream) })
59
58
 
59
+ // valid version installed => skip
60
+ if (e4) {
61
+ const msg = "> a valid version command line tools already installed. skipping...\r\n"
62
+ console.log(msg)
63
+ ondata({ raw: msg })
64
+ } else {
65
+ const msg = "> valid version command line tools NOT installed.\r\n"
66
+ console.log(msg)
67
+ ondata({ raw: msg })
68
+ await this._install(req, ondata)
69
+ }
60
70
  } else {
61
- console.log("no need to install xcode build tools")
71
+ // not installed. install
72
+ const msg = "> command line tools not installed yet. install the latest xcode build tools...\r\n"
73
+ console.log(msg)
74
+ ondata({ raw: msg })
75
+ await this._install(req, ondata)
62
76
  }
63
77
 
64
-
65
78
  //ondata({ raw: "Setting CommandLineTools path...\r\n" })
66
79
  //await this.kernel.bin.exec({ sudo: true, message: "xcode-select -switch /Library/Developer/CommandLineTools" }, (stream) => { ondata(stream) })
67
80
  }
@@ -71,6 +84,25 @@ class Brew {
71
84
  //
72
85
  ondata({ raw: `Install finished\r\n` })
73
86
  }
87
+ async _install(req, ondata) {
88
+ // command line tools installed
89
+ const msg = "> installing the latest xcode build tools...\r\n"
90
+ console.log(msg)
91
+ ondata({ raw: msg })
92
+ // not installed or not installed properly
93
+ // install xcode build tools
94
+ await this.kernel.bin.exec({ sudo: true, conda: { skip: true }, message: "rm -rf /Library/Developer/CommandLineTools" }, (stream) => { ondata(stream) })
95
+ let sh_path = path.resolve(this.kernel.homedir, "xcode.sh")
96
+ let src_path = path.resolve(__dirname, "xcode.sh")
97
+ console.log({ sh_path, src_path })
98
+ let sh = await fs.promises.readFile(src_path, "utf8")
99
+ console.log({ sh })
100
+ await fs.promises.writeFile(sh_path, sh)
101
+ await this.kernel.bin.exec({ message: "bash ./xcode.sh", path: this.kernel.homedir, conda: { skip: true }}, (stream) => { ondata(stream) })
102
+
103
+ ondata({ raw: "> installing xcode-select. please approve the xcode-select install dialog and install before proceeding...\r\n" })
104
+ await this.kernel.bin.exec({ message: "xcode-select --install", conda: { skip: true } }, (stream) => { ondata(stream) })
105
+ }
74
106
 
75
107
  async installed() {
76
108
  return this.kernel.bin.brew_installed
package/kernel/index.js CHANGED
@@ -39,7 +39,7 @@ class Kernel {
39
39
  //schema = ">=1.0.0"
40
40
  //schema = "<=2.1.0"
41
41
  //schema = "<=3.2.0"
42
- schema = "<=3.3.20"
42
+ schema = "<=3.4.0"
43
43
  constructor(store) {
44
44
  this.fetch = fetch
45
45
  this.store = store
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.3.53",
3
+ "version": "3.4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {