atk_toolbox 0.0.104 → 0.0.105

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: a0a6d59658071c79365f3123c13fea6f273b40e5bbed9c5f72043d6361a0a630
4
- data.tar.gz: 64064bdc88621871c55c26cfc9471de3234703c9d7111303b3464e9f79065c6c
3
+ metadata.gz: 2a0227d1d4c7c02fb3fd5b05488dc8427a00842510cc6aca8fd2334461db7992
4
+ data.tar.gz: 4f2d3a17a04671ba81034e58d039fe236d619bdcaaa30d075f55f4cad55630dd
5
5
  SHA512:
6
- metadata.gz: 769fdbdc25e60ca4cb623ee49e54b8c9f54da4947fb4ca74c635661488c3b7a72a161f85737e9893eec46cb1012417aba1d3230747532a0532ac96489a75449d
7
- data.tar.gz: e2acfbfeec69c4cfa3a38308b18908454486995f401526bb1605fdcf988226e685b3840411d8770f878f45d7bbe385bdf1bb3db1b7bc556f487a029679549de3
6
+ metadata.gz: 2b2026e33762fff5627d8cef175babdca7134a3d26cc190453db36209ab53cebaf15ed1f96b312a71939c9ad8f7dbb2b2dd6a74a41d99e6d901f466b484c0cac
7
+ data.tar.gz: 2dc8daf6aa386bd54c0bbb16b70d0012e717afd54afa9540611c40d8c328f1c38c3244bb7ecdf065bc6a77319cbed88170c2c7a44c086443bdaccb3dd943ba0c
@@ -2,29 +2,37 @@ require_relative './file_sys'
2
2
  require_relative './os'
3
3
  require_relative './atk_info'
4
4
 
5
- def set_command(name, code)
6
- if OS.is?("unix")
7
- exec_path = "/usr/local/bin/#{name}"
8
- local_place = ATK.temp_path(name)
9
- # add the hash bang
10
- hash_bang = "#!#{ATK.paths[:ruby]}\n"
11
- # create the file
12
- FS.write(hash_bang+code, to: local_place)
13
- # copy to command folder
14
- system("sudo", "cp", local_place, exec_path)
15
- system("sudo", "chmod", "ugo+x", exec_path)
16
- elsif OS.is?("windows")
17
- # check for invalid file paths, see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
18
- if name =~ /[><:"\/\\|?*]/
19
- puts "Sorry #{name} isn't a valid file path on windows"
20
- return ""
5
+ # the reason this isn't inside of the console.rb
6
+ # is because atk_info requires console
7
+ # and this requires atk_info
8
+ # which would cause a circular dependency
9
+
10
+ # add set_command to the Console
11
+ class TTY::Prompt
12
+ def set_command(name, code)
13
+ if OS.is?("unix")
14
+ exec_path = "/usr/local/bin/#{name}"
15
+ local_place = ATK.temp_path(name)
16
+ # add the hash bang
17
+ hash_bang = "#!#{ATK.paths[:ruby]}\n"
18
+ # create the file
19
+ FS.write(hash_bang+code, to: local_place)
20
+ # copy to command folder
21
+ system("sudo", "cp", local_place, exec_path)
22
+ system("sudo", "chmod", "ugo+x", exec_path)
23
+ elsif OS.is?("windows")
24
+ # check for invalid file paths, see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
25
+ if name =~ /[><:"\/\\|?*]/
26
+ puts "Sorry #{name} isn't a valid file path on windows"
27
+ return ""
28
+ end
29
+ username = FS.username
30
+ exec_path = "C:\\Users\\#{username}\\AppData\\local\\Microsoft\\WindowsApps\\#{name}"
31
+
32
+ # create the code
33
+ IO.write(exec_path+".rb", code)
34
+ # create an executable to call the code
35
+ IO.write(exec_path+".bat", "@echo off\nruby \"#{exec_path}.rb\" %*")
21
36
  end
22
- username = FS.username
23
- exec_path = "C:\\Users\\#{username}\\AppData\\local\\Microsoft\\WindowsApps\\#{name}"
24
-
25
- # create the code
26
- IO.write(exec_path+".rb", code)
27
- # create an executable to call the code
28
- IO.write(exec_path+".bat", "@echo off\nruby \"#{exec_path}.rb\" %*")
29
37
  end
30
38
  end
@@ -1,3 +1,3 @@
1
1
  module AtkToolbox
2
- VERSION = '0.0.104'
2
+ VERSION = '0.0.105'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atk_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.104
4
+ version: 0.0.105
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Hykin