atk_toolbox 0.0.84 → 0.0.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atk/file_sys.rb +65 -23
- data/lib/atk/yaml_info_parser.rb +8 -2
- data/lib/atk_toolbox/version.rb +1 -1
- data/test/info.yaml +37 -77
- data/test/main.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1be06eba95081b6c96474395cec11725013051340b97824f372f8a6c4db543e
|
4
|
+
data.tar.gz: 8278323e7bc9ccbd279d3e335d30f1a92c863b1487909d4c168da681dce52efe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e18239ef2c6c43890bbb7f63ecdea67d4be98690dff0bde533aac8f1d52219487f8724e1c82fd9cffc536b5e2ebaf9e15a653ef9d50dc4cffbd3f54e40872a9
|
7
|
+
data.tar.gz: 8f730ef8cc49c963992a1214e47e79d23cd8e0a34eb2f6101463177b4a9079e789b5a678c4f7bad78609627e616132eb5cfaf2d04ca84d2d8cc9861b3c614121
|
data/lib/atk/file_sys.rb
CHANGED
@@ -19,7 +19,10 @@ class String
|
|
19
19
|
# ex: "foldername"/"filename"
|
20
20
|
def /(next_string)
|
21
21
|
if OS.is?("windows")
|
22
|
-
|
22
|
+
next_string_without_leading_or_trailing_slashes = next_string.gsub(/(^\\|^\/|\\$|\/$)/,"")
|
23
|
+
output = self + "\\" + next_string
|
24
|
+
# replace all forward slashes with backslashes
|
25
|
+
output.gsub(/\//,"\\")
|
23
26
|
else
|
24
27
|
File.join(self, next_string)
|
25
28
|
end
|
@@ -170,26 +173,31 @@ class FileSys
|
|
170
173
|
def self.touch(*args)
|
171
174
|
return FileUtils.touch(*args)
|
172
175
|
end
|
176
|
+
singleton_class.send(:alias_method, :touch_file, :touch)
|
177
|
+
singleton_class.send(:alias_method, :new_file, :touch)
|
173
178
|
|
174
179
|
def self.touch_dir(path)
|
175
180
|
if not FileSys.directory?(path)
|
176
181
|
FileUtils.makedirs(path)
|
177
182
|
end
|
178
183
|
end
|
184
|
+
singleton_class.send(:alias_method, :new_folder, :touch_dir)
|
179
185
|
|
180
186
|
# Pathname aliases
|
181
187
|
def self.absolute_path?(path)
|
182
188
|
Pathname.new(path).absolute?
|
183
189
|
end
|
184
|
-
|
185
|
-
|
186
|
-
|
190
|
+
singleton_class.send(:alias_method, :is_absolute_path, :absolute_path?)
|
191
|
+
singleton_class.send(:alias_method, :abs?, :absolute_path?)
|
192
|
+
singleton_class.send(:alias_method, :is_abs, :abs?)
|
193
|
+
|
187
194
|
def self.relative_path?(path)
|
188
195
|
Pathname.new(path).relative?
|
189
196
|
end
|
190
|
-
|
191
|
-
|
192
|
-
|
197
|
+
singleton_class.send(:alias_method, :is_relative_path, :relative_path?)
|
198
|
+
singleton_class.send(:alias_method, :rel?, :relative_path?)
|
199
|
+
singleton_class.send(:alias_method, :is_rel, :rel?)
|
200
|
+
|
193
201
|
def self.path_pieces(path)
|
194
202
|
# use this function like this:
|
195
203
|
# *path, filename, extension = FS.path_peices('/Users/jeffhykin/Desktop/place1/file1.pdf')
|
@@ -244,20 +252,19 @@ class FileSys
|
|
244
252
|
end
|
245
253
|
def self.time_modified(*args)
|
246
254
|
end
|
247
|
-
|
248
|
-
File.directory?(*args)
|
249
|
-
end
|
250
|
-
def self.dir?(*args)
|
251
|
-
File.directory?(*args)
|
252
|
-
end
|
253
|
-
def self.exists?(*args)
|
254
|
-
File.exist?(*args)
|
255
|
-
end
|
255
|
+
|
256
256
|
def self.join(*args)
|
257
257
|
if OS.is?("windows")
|
258
|
-
|
258
|
+
folders_without_leading_or_trailing_slashes = args.map do |each|
|
259
|
+
# replace all forward slashes with backslashes
|
260
|
+
backslashed_only = each.gsub(/\//,"\\")
|
261
|
+
# remove leading/trailing backslashes
|
262
|
+
backslashed_only.gsub(/(^\\|^\/|\\$|\/$)/,"")
|
263
|
+
end
|
264
|
+
# join all of them with backslashes
|
265
|
+
folders_without_leading_or_trailing_slashes.join("\\")
|
259
266
|
else
|
260
|
-
File.join(
|
267
|
+
File.join(*args)
|
261
268
|
end
|
262
269
|
end
|
263
270
|
|
@@ -274,33 +281,56 @@ class FileSys
|
|
274
281
|
def self.extname(*args)
|
275
282
|
File.extname(*args)
|
276
283
|
end
|
277
|
-
def self.
|
284
|
+
def self.folder?(*args)
|
278
285
|
File.directory?(*args)
|
279
286
|
end
|
287
|
+
singleton_class.send(:alias_method, :is_folder, :folder?)
|
288
|
+
singleton_class.send(:alias_method, :dir?, :folder?)
|
289
|
+
singleton_class.send(:alias_method, :is_dir, :dir?)
|
290
|
+
singleton_class.send(:alias_method, :directory?, :folder?)
|
291
|
+
singleton_class.send(:alias_method, :is_directory, :directory?)
|
292
|
+
|
293
|
+
def self.exists?(*args)
|
294
|
+
File.exist?(*args)
|
295
|
+
end
|
296
|
+
singleton_class.send(:alias_method, :does_exist, :exists?)
|
297
|
+
singleton_class.send(:alias_method, :exist?, :exists?)
|
298
|
+
|
280
299
|
def self.file?(*args)
|
281
300
|
File.file?(*args)
|
282
301
|
end
|
302
|
+
singleton_class.send(:alias_method, :is_file, :file?)
|
303
|
+
|
283
304
|
def self.empty?(*args)
|
284
305
|
File.empty?(*args)
|
285
306
|
end
|
286
|
-
|
287
|
-
|
288
|
-
end
|
307
|
+
singleton_class.send(:alias_method, :is_empty, :empty?)
|
308
|
+
|
289
309
|
def self.executable?(*args)
|
290
310
|
File.executable?(*args)
|
291
311
|
end
|
312
|
+
singleton_class.send(:alias_method, :is_executable, :executable?)
|
313
|
+
|
292
314
|
def self.symlink?(*args)
|
293
315
|
File.symlink?(*args)
|
294
316
|
end
|
317
|
+
singleton_class.send(:alias_method, :is_symlink, :symlink?)
|
318
|
+
|
295
319
|
def self.owned?(*args)
|
296
320
|
File.owned?(*args)
|
297
321
|
end
|
322
|
+
singleton_class.send(:alias_method, :is_owned, :owned?)
|
323
|
+
|
298
324
|
def self.pipe?(*args)
|
299
325
|
File.pipe?(*args)
|
300
326
|
end
|
327
|
+
singleton_class.send(:alias_method, :is_pipe, :pipe?)
|
328
|
+
|
301
329
|
def self.readable?(*args)
|
302
330
|
File.readable?(*args)
|
303
331
|
end
|
332
|
+
singleton_class.send(:alias_method, :is_readable, :readable?)
|
333
|
+
|
304
334
|
def self.size?(*args)
|
305
335
|
if File.directory?(args[0])
|
306
336
|
# recursively get the size of the folder
|
@@ -309,21 +339,33 @@ class FileSys
|
|
309
339
|
File.size?(*args)
|
310
340
|
end
|
311
341
|
end
|
342
|
+
singleton_class.send(:alias_method, :is_size, :size?)
|
343
|
+
|
312
344
|
def self.socket?(*args)
|
313
345
|
File.socket?(*args)
|
314
346
|
end
|
347
|
+
singleton_class.send(:alias_method, :is_socket, :socket?)
|
348
|
+
|
315
349
|
def self.world_readable?(*args)
|
316
350
|
File.world_readable?(*args)
|
317
351
|
end
|
352
|
+
singleton_class.send(:alias_method, :is_world_readable, :world_readable?)
|
353
|
+
|
318
354
|
def self.world_writable?(*args)
|
319
355
|
File.world_writable?(*args)
|
320
356
|
end
|
357
|
+
singleton_class.send(:alias_method, :is_world_writable, :world_writable?)
|
358
|
+
|
321
359
|
def self.writable?(*args)
|
322
360
|
File.writable?(*args)
|
323
361
|
end
|
362
|
+
singleton_class.send(:alias_method, :is_writable, :writable?)
|
363
|
+
|
324
364
|
def self.writable_real?(*args)
|
325
365
|
File.writable_real?(*args)
|
326
366
|
end
|
367
|
+
singleton_class.send(:alias_method, :is_writable_real, :writable_real?)
|
368
|
+
|
327
369
|
def self.expand_path(*args)
|
328
370
|
File.expand_path(*args)
|
329
371
|
end
|
@@ -368,5 +410,5 @@ class FileSys
|
|
368
410
|
FileSys.write(open(URI.encode(the_url)).read, to: file_name)
|
369
411
|
end
|
370
412
|
end
|
371
|
-
# create an FS
|
413
|
+
# create an FS singleton_class.send(:alias_method, :FS = :FileSys)
|
372
414
|
FS = FileSys
|
data/lib/atk/yaml_info_parser.rb
CHANGED
@@ -228,9 +228,11 @@ class Info
|
|
228
228
|
@@data = YAML.load_file(Info.source_path)
|
229
229
|
if @@data['(using_atk_version)'] != 1.0
|
230
230
|
raise <<-HEREDOC.remove_indent
|
231
|
+
|
232
|
+
|
231
233
|
When opening the info.yaml file, the (using_atk_version) was listed as: #{@@data['(using_atk_version)']}
|
232
234
|
The version of atk_toolbox you have installed is only capable of handling version 1.0
|
233
|
-
either atk_toolbox needs to be
|
235
|
+
either atk_toolbox needs to be changed, or the (using_atk_version) version needs to be changed.
|
234
236
|
HEREDOC
|
235
237
|
end
|
236
238
|
rescue => exception
|
@@ -238,7 +240,7 @@ class Info
|
|
238
240
|
raise exception
|
239
241
|
end
|
240
242
|
else
|
241
|
-
raise "
|
243
|
+
raise "\n\nCouldn't find an info.yaml file in #{Dir.pwd}"
|
242
244
|
end
|
243
245
|
@@project = @@data['(project)']
|
244
246
|
if @@project == nil
|
@@ -262,6 +264,10 @@ class Info
|
|
262
264
|
@@paths = @@settings['(paths)'] || {}
|
263
265
|
# TODO: make this deeply recursive
|
264
266
|
for each_key, each_value in @@paths
|
267
|
+
# if its an array, just join it together
|
268
|
+
if each_value.is_a?(Array)
|
269
|
+
each_value = FS.join(*each_value)
|
270
|
+
end
|
265
271
|
if each_value.is_a?(String)
|
266
272
|
# remove the ./ if it exists
|
267
273
|
if each_value =~ /\A\.\//
|
data/lib/atk_toolbox/version.rb
CHANGED
data/test/info.yaml
CHANGED
@@ -1,86 +1,46 @@
|
|
1
|
-
|
2
|
-
(using_atk_version): 1.0
|
1
|
+
(using_atk_version): 0.0
|
3
2
|
(project):
|
4
|
-
name:
|
5
|
-
description:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
compile: gcc *.cpp
|
23
|
-
# TODO: add inline support for doing things like auto-generating commands
|
24
|
-
[*auto_generated_commands]:
|
25
|
-
(environment_variables):
|
26
|
-
JAVA_VERSION: '8.9'
|
27
|
-
(structures):
|
28
|
-
npm-package: v1.0.0
|
29
|
-
vs-code-package: v1.0.0
|
30
|
-
git-repo: v1.0.0
|
31
|
-
(dependencies): &base_dependencies
|
32
|
-
python3: v3.7.0
|
33
|
-
node: v11.11.0
|
34
|
-
npm: v6.7.0
|
35
|
-
git: v2.21.0
|
3
|
+
name: A Project
|
4
|
+
description: A new project
|
5
|
+
|
6
|
+
paths: &paths
|
7
|
+
root: ./
|
8
|
+
testing_folder: &tests ./code/tests
|
9
|
+
cpp_tests: [ *tests, cpp ]
|
10
|
+
|
11
|
+
commands: &commands # if you dont know what the & means, see https://blog.daemonl.com/2016/02/yaml.html
|
12
|
+
build_mac: !language/ruby |
|
13
|
+
require 'atk_toolbox'
|
14
|
+
file = FS.read('./mac/setup_readable_version.sh')
|
15
|
+
# remove comments
|
16
|
+
file.gsub!(/^ *#.+\n/, "")
|
17
|
+
# make everything a single line
|
18
|
+
file = file.split("\n").join(";")
|
19
|
+
# save
|
20
|
+
FS.write(file, to: './mac/setup.sh')
|
36
21
|
|
22
|
+
dependencies: &dependencies
|
23
|
+
atk: 0.0.1
|
24
|
+
|
37
25
|
(advanced_setup):
|
38
|
-
(
|
39
|
-
|
40
|
-
|
41
|
-
# this injects all the (basic_setup) here
|
26
|
+
(paths):
|
27
|
+
<<: *paths
|
28
|
+
(put_new_dependencies_under): [ '(project)', 'basic_info', 'dependencies' ]
|
42
29
|
# caveats for a specific OS
|
43
30
|
when(--os is 'mac'):
|
31
|
+
(project_commands):
|
32
|
+
<<: *commands
|
44
33
|
(dependencies):
|
45
|
-
<<: *
|
46
|
-
|
47
|
-
|
34
|
+
<<: *dependencies
|
35
|
+
|
48
36
|
when(--os is 'windows'):
|
49
37
|
(project_commands):
|
50
|
-
<<: *
|
51
|
-
|
38
|
+
<<: *commands
|
39
|
+
(dependencies):
|
40
|
+
<<: *dependencies
|
41
|
+
|
52
42
|
when(--os is 'linux'):
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
# this injects all the (project_commands) here
|
58
|
-
my_ip_address: ip # this is a custom command specific to arch linux
|
59
|
-
# # caveats for a different context
|
60
|
-
# when(--context is 'testing'):
|
61
|
-
# (environment_variables):
|
62
|
-
# CMAKE_LIB: "testing"
|
63
|
-
# (project_commands):
|
64
|
-
# run: node tests.rb
|
65
|
-
# when(--os is 'windows'):
|
66
|
-
# (environment_variables):
|
67
|
-
# CMAKE_LIB: "C:\\testing"
|
68
|
-
test:
|
69
|
-
thing:
|
70
|
-
- 1
|
71
|
-
- 2
|
72
|
-
- 3
|
73
|
-
- alkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkad
|
74
|
-
challenges:
|
75
|
-
- A bit discouraging with how non-binary expressions are. Forcing them into categories feels inaccurate
|
76
|
-
- video contents:
|
77
|
-
- multiple faces (very hard to get one face with genuine expressions)
|
78
|
-
- people not directly facing the camera
|
79
|
-
- glasses, headphones, hats, microphones
|
80
|
-
- shaky video
|
81
|
-
- lighting
|
82
|
-
- |
|
83
|
-
single faces are generally people actively talking or interviewing, not being passive.
|
84
|
-
People who are passive are generally participating in something else, and usually that means other faces are on screen
|
85
|
-
This means very little
|
86
|
-
- face touching
|
43
|
+
(project_commands):
|
44
|
+
<<: *commands
|
45
|
+
(dependencies):
|
46
|
+
<<: *dependencies
|
data/test/main.rb
CHANGED
@@ -2,4 +2,4 @@ require_relative '../lib/atk_toolbox'
|
|
2
2
|
|
3
3
|
Dir.chdir __dir__
|
4
4
|
|
5
|
-
Info.
|
5
|
+
puts Info.paths.to_yaml
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atk_toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Hykin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zip
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.7.
|
138
|
+
rubygems_version: 2.7.6.2
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: The Ruby gem for all the standard tools ATK uses internally
|