atk_toolbox 0.0.84 → 0.0.85

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: 8841a9aa0feefe4e47ae2e17eabaaf215250ae696c34609451568378413d64bf
4
- data.tar.gz: '04488e8100cb9104c52170b481154140a2ccac0bbb9ed3d9aaa671ee7dc34f2d'
3
+ metadata.gz: d1be06eba95081b6c96474395cec11725013051340b97824f372f8a6c4db543e
4
+ data.tar.gz: 8278323e7bc9ccbd279d3e335d30f1a92c863b1487909d4c168da681dce52efe
5
5
  SHA512:
6
- metadata.gz: 4b559b9aa56477166b510d1d3a12ca3be8f7fb1f0d560a1e8c290941ac2c5a65454341de6b512a30f61c0c1ad53d6613d4ef0f657e9b286d6409df39b127e897
7
- data.tar.gz: a27421f4c09fee847348920fcdcdac08ef84bc026e3d85da4e78f9f36900909c3622b40f110a82e571e8d7f2f4a2b6132f8317a8b608bb8c08bcb5edfee727d9
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
- self + "\\" + next_string
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
- def self.abs?(path)
185
- Pathname.new(path).absolute?
186
- end
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
- def self.rel?(path)
191
- Pathname.new(path).relative?
192
- end
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
- def self.folder?(*args)
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
- self + "\\" + next_string
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(self, next_string)
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.directory?(*args)
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
- def self.exist?(*args)
287
- File.exist?(*args)
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 alias
413
+ # create an FS singleton_class.send(:alias_method, :FS = :FileSys)
372
414
  FS = FileSys
@@ -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 updated, or the info.yaml version needs to be updated.
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 "Couldn't find an info.yaml file in #{Dir.pwd}"
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\.\//
@@ -1,3 +1,3 @@
1
1
  module AtkToolbox
2
- VERSION = '0.0.84'
2
+ VERSION = '0.0.85'
3
3
  end
data/test/info.yaml CHANGED
@@ -1,86 +1,46 @@
1
- # Example of Project settings
2
- (using_atk_version): 1.0
1
+ (using_atk_version): 0.0
3
2
  (project):
4
- name: The ATK Repo
5
- description: Blah
6
- homepage: www.blah.com
7
-
8
- auto_generated_commands: &auto_generated_commands !evaluate/ruby |
9
- commands = {}
10
- # check for a scripts directory
11
- script_file_paths = Dir["scripts/*"]
12
- for each in script_file_paths
13
- commands[File.basename(each, ".*")] = "./#{each}"
14
- end
15
- commands
16
-
17
- basic_setup: &basic_setup_reference
18
- (project_commands): &basic_commands
19
- # auto-insert the !lang/console if they dont put one
20
- run: !language/ruby puts "hi"
21
- stop: \`pkill node`
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
- (local_package_managers): [npm, pip] # by default the local package managers are always here
39
- (put_new_dependencies_under): [(project), basic_info, (dependencies)]
40
- <<: *basic_setup_reference
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
- <<: *base_dependencies
46
- python2: v2.7
47
-
34
+ <<: *dependencies
35
+
48
36
  when(--os is 'windows'):
49
37
  (project_commands):
50
- <<: *basic_commands
51
- show_files: dir # this is a custom command specific to windows
38
+ <<: *commands
39
+ (dependencies):
40
+ <<: *dependencies
41
+
52
42
  when(--os is 'linux'):
53
- # caveats for a specific OS sub-version
54
- when(--os is 'arch'):
55
- (project_commands):
56
- <<: *basic_commands
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.set_key(["test"], { "thing" => [1,2,3,"alkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkadalkdjfajdlkfjadsfljkad"] })
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.84
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-28 00:00:00.000000000 Z
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.3
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