atk_toolbox 0.0.141 → 0.0.146
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/after_gem_update.rb +1 -1
- data/lib/atk/atk_info.rb +14 -11
- data/lib/atk/autocomplete.rb +27 -0
- data/lib/atk/commands/project.rb +8 -2
- data/lib/atk/console.rb +7 -2
- data/lib/atk/file_system.rb +46 -0
- data/lib/atk/info.rb +1 -0
- data/lib/atk_toolbox.rb +2 -0
- data/lib/atk_toolbox/version.rb +1 -1
- data/lib/console_colors.rb +1 -1
- data/test/info.yaml +11 -42
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee7360620aad7d051e61244d65e447827376658930abdfa15139461799e750fd
|
4
|
+
data.tar.gz: 232c4358d173dc80c584979988e7d67685b4cdf937561ce4bf7c4ced901b5148
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e6a3af6e1bdd5973f8410bed1fe61cb136c3b6be2702e6ae969f3c832f9dfefe3a209037a7f43ac69ba267893e7e11327c2e5bbcfd8e90bdafbad9e8606a4e1
|
7
|
+
data.tar.gz: 755f9dbe27434729fbaf983a1d22c1f80db31a7f342ba45525a90f89b60ad3c7a3ba45b47d51634ad300e7cc29e1b67257d3854397f77039ce275b9ea791cc09
|
data/lib/after_gem_update.rb
CHANGED
data/lib/atk/atk_info.rb
CHANGED
@@ -103,7 +103,7 @@ module Atk
|
|
103
103
|
errors = {}
|
104
104
|
|
105
105
|
# make sure ruby is the corrct version
|
106
|
-
if VERSION_OF_RUBY >= Version.new("
|
106
|
+
if VERSION_OF_RUBY >= Version.new("2.6.0")
|
107
107
|
errors[:ruby_version_too_high] = true
|
108
108
|
elsif VERSION_OF_RUBY < Version.new("2.5")
|
109
109
|
errors[:ruby_version_too_low] = true
|
@@ -138,7 +138,10 @@ module Atk
|
|
138
138
|
#
|
139
139
|
# TODO: talk about any found errors
|
140
140
|
#
|
141
|
-
|
141
|
+
if errors.include?[:ruby_version_too_high]
|
142
|
+
puts "It looks like your ruby version is too high for ATK"
|
143
|
+
puts "some parts of ATK might still work, however expect it to be broken"
|
144
|
+
end
|
142
145
|
end
|
143
146
|
|
144
147
|
def self.setup(package_name, arguments)
|
@@ -398,25 +401,25 @@ class AtkPackage
|
|
398
401
|
|
399
402
|
if @dont_exist[:yaml_file]
|
400
403
|
custom_message += <<-HEREDOC.remove_indent
|
401
|
-
#{bad
|
404
|
+
#{bad["there was no info.yaml for that package"]}
|
402
405
|
and an info.yaml is the location for defining a run action
|
403
406
|
|
404
407
|
HEREDOC
|
405
408
|
elsif @dont_exist[:correctly_formatted_yaml_file]
|
406
409
|
custom_message += <<-HEREDOC.remove_indent
|
407
|
-
#{good
|
408
|
-
#{bad
|
410
|
+
#{good["there was a info.yaml for that package"]}
|
411
|
+
#{bad["the info.yaml is not parseable"]}
|
409
412
|
and an info.yaml is the location for defining a run action
|
410
413
|
|
411
414
|
HEREDOC
|
412
415
|
elsif @dont_exist[:using_atk_version]
|
413
416
|
custom_message += <<-HEREDOC.remove_indent
|
414
|
-
#{good
|
415
|
-
#{good
|
416
|
-
#{@dont_exist[:using_atk_version] && bad
|
417
|
-
#{@dont_exist[:package_info] && bad
|
418
|
-
#{@dont_exist[:actions] && bad
|
419
|
-
#{@dont_exist[:run_action] && bad
|
417
|
+
#{good["there was a info.yaml for that package"]}
|
418
|
+
#{good["the info.yaml was parseable"]}
|
419
|
+
#{@dont_exist[:using_atk_version] && bad["the info.yaml didn't have a (using_atk_version) key"]}
|
420
|
+
#{@dont_exist[:package_info] && bad["the info.yaml didn't have a (package_info) key"]}
|
421
|
+
#{@dont_exist[:actions] && bad["the info.yaml didn't have a (package_info): (actions) key"]}
|
422
|
+
#{@dont_exist[:run_action] && bad["the info.yaml didn't have a (package_info): (actions): (run) key"]}
|
420
423
|
HEREDOC
|
421
424
|
end
|
422
425
|
|
data/lib/atk/autocomplete.rb
CHANGED
@@ -10,4 +10,31 @@ module Atk
|
|
10
10
|
# end
|
11
11
|
# end
|
12
12
|
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# zsh autocomplete
|
16
|
+
#
|
17
|
+
#compdef _
|
18
|
+
|
19
|
+
# _atk()
|
20
|
+
# {
|
21
|
+
# orig_words=( ${words[@]} )
|
22
|
+
# local comp_words="${COMP_WORDS[1]}"
|
23
|
+
# local comp_cword="${COMP_CWORD}"
|
24
|
+
# local mylist="$( ruby -e '
|
25
|
+
# require "yaml"
|
26
|
+
# class Nil ; def [](); end; end;
|
27
|
+
# if ARGV.length == 2
|
28
|
+
# puts YAML.load_file("./info.yaml")["(project)"]["(commands)"].keys.map{|each| each.inspect}
|
29
|
+
# else
|
30
|
+
# # puts `ls`
|
31
|
+
# end
|
32
|
+
# ' $orig_words
|
33
|
+
# )"
|
34
|
+
# COMPREPLY=($(compgen -W $mylist) )
|
35
|
+
# _alternative "arguments:custom arg:(($mylist))"
|
36
|
+
# }
|
37
|
+
|
38
|
+
# complete -F _atk _
|
39
|
+
# compdef _atk _
|
13
40
|
end
|
data/lib/atk/commands/project.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require_relative '../atk_info'
|
2
2
|
|
3
3
|
module Atk
|
4
|
+
class ExecFailed < Exception
|
5
|
+
end
|
6
|
+
|
7
|
+
class NoSuchCommand < Exception
|
8
|
+
end
|
9
|
+
|
4
10
|
def self.project(args)
|
5
11
|
#
|
6
12
|
# no arguments
|
@@ -140,13 +146,13 @@ module Atk
|
|
140
146
|
elsif command.is_a?(Code)
|
141
147
|
result = command.run(*command_args)
|
142
148
|
elsif command == nil
|
143
|
-
|
149
|
+
raise NoSuchCommand
|
144
150
|
end
|
145
151
|
|
146
152
|
# if command resulted in error then raise an error
|
147
153
|
if not result
|
148
154
|
colored_command_name = command_name.color_as :key_term
|
149
|
-
raise <<-HEREDOC.remove_indent
|
155
|
+
raise ExecFailed, <<-HEREDOC.remove_indent
|
150
156
|
|
151
157
|
When running: #{"project execute ".color_as :code}#{colored_command_name}
|
152
158
|
The script for #{colored_command_name} hit an error and had an exit code of: #{$?.exitstatus}
|
data/lib/atk/console.rb
CHANGED
@@ -63,7 +63,7 @@ Console = Class.new do
|
|
63
63
|
CACHE::prompt = TTY::Prompt.new
|
64
64
|
end
|
65
65
|
# generate interface for TTY prompt with lazy require
|
66
|
-
for each in [ :ask, :keypress, :multiline, :mask, :yes?, :no?, :select, :multi_select, :enum_select, :expand, :collect, :suggest, :slider, :say, :
|
66
|
+
for each in [ :ask, :keypress, :multiline, :mask, :yes?, :no?, :select, :multi_select, :enum_select, :expand, :collect, :suggest, :slider, :say, :warn, :error ]
|
67
67
|
eval(<<-HEREDOC)
|
68
68
|
def #{each}(*args, **kwargs)
|
69
69
|
self._load_prompt() if CACHE::prompt == nil
|
@@ -78,6 +78,11 @@ Console = Class.new do
|
|
78
78
|
HEREDOC
|
79
79
|
end
|
80
80
|
|
81
|
+
def ok(message)
|
82
|
+
puts message.green + "\n[press enter to continue]".light_black
|
83
|
+
gets
|
84
|
+
end
|
85
|
+
alias :ok? :ok
|
81
86
|
|
82
87
|
attr_accessor :verbose
|
83
88
|
|
@@ -235,7 +240,7 @@ Console = Class.new do
|
|
235
240
|
|
236
241
|
# users are going to have to manually escape things like ^, !, % etc depending on the context they're used in
|
237
242
|
|
238
|
-
simple_char = "[a-zA-Z0-9_
|
243
|
+
simple_char = "[a-zA-Z0-9_.,;`=\\-*?\\/\\[\\]]"
|
239
244
|
|
240
245
|
# if its a simple argument just pass it on
|
241
246
|
if argument =~ /\A(#{simple_char})*\z/
|
data/lib/atk/file_system.rb
CHANGED
@@ -141,6 +141,52 @@ module FileSystem
|
|
141
141
|
return output
|
142
142
|
end
|
143
143
|
|
144
|
+
def self.merge(from, into: nil, force: true)
|
145
|
+
to = into
|
146
|
+
if !FS.exist?(from)
|
147
|
+
raise <<~HEREDOC
|
148
|
+
|
149
|
+
|
150
|
+
When calling FileSystem.merge(#{from.inspect}, into: #{into.inspect})
|
151
|
+
The path: #{from.inspect}
|
152
|
+
Doesn't exist
|
153
|
+
HEREDOC
|
154
|
+
end
|
155
|
+
|
156
|
+
# recursive case (folder)
|
157
|
+
if FS.is_folder(from)
|
158
|
+
# if theres a target file in the way
|
159
|
+
if FS.exist?(to) && ( !FS.is_folder(to) )
|
160
|
+
if force
|
161
|
+
# remove it
|
162
|
+
FS.delete(to)
|
163
|
+
else
|
164
|
+
# continue with the process
|
165
|
+
return
|
166
|
+
end
|
167
|
+
end
|
168
|
+
# create a folder if needed
|
169
|
+
if !FS.exist?(to)
|
170
|
+
FS.touch_dir(to)
|
171
|
+
end
|
172
|
+
# become recursive for all contents
|
173
|
+
for each in FS.ls(from)
|
174
|
+
FS.merge(from/each, into: to/each, force: force)
|
175
|
+
end
|
176
|
+
# base case (file)
|
177
|
+
else
|
178
|
+
if FS.exist?(to)
|
179
|
+
if force
|
180
|
+
FS.delete(to)
|
181
|
+
else
|
182
|
+
# do nothing
|
183
|
+
return
|
184
|
+
end
|
185
|
+
end
|
186
|
+
FS.copy(from: from, to: FS.dirname(to), new_name: nil)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
144
190
|
def self.copy(from:nil, to:nil, new_name:"", force: true, preserve: false, dereference_root: false)
|
145
191
|
if new_name == ""
|
146
192
|
raise "\n\nFileSystem.copy() needs a new_name: argument\nset new_name:nil if you wish the file/folder to keep the same name\ne.g. FileSystem.copy(from:'place/thing', to:'place', new_name:nil)"
|
data/lib/atk/info.rb
CHANGED
data/lib/atk_toolbox.rb
CHANGED
data/lib/atk_toolbox/version.rb
CHANGED
data/lib/console_colors.rb
CHANGED
data/test/info.yaml
CHANGED
@@ -1,46 +1,15 @@
|
|
1
|
-
(using_atk_version): 1.0
|
1
|
+
(using_atk_version): 1.1.0
|
2
2
|
(project):
|
3
3
|
name: A Project
|
4
4
|
description: A new project
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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')
|
21
|
-
|
22
|
-
dependencies: &dependencies
|
23
|
-
atk: 0.0.1
|
24
|
-
|
25
|
-
(advanced_setup):
|
26
|
-
(paths):
|
27
|
-
<<: *paths
|
28
|
-
(put_new_dependencies_under): [ '(project)', 'basic_info', 'dependencies' ]
|
29
|
-
# caveats for a specific OS
|
30
|
-
when(--os is 'mac'):
|
31
|
-
(project_commands):
|
32
|
-
<<: *commands
|
33
|
-
(dependencies):
|
34
|
-
<<: *dependencies
|
35
|
-
|
36
|
-
when(--os is 'windows'):
|
37
|
-
(project_commands):
|
38
|
-
<<: *commands
|
39
|
-
(dependencies):
|
40
|
-
<<: *dependencies
|
41
|
-
|
42
|
-
when(--os is 'linux'):
|
43
|
-
(project_commands):
|
44
|
-
<<: *commands
|
45
|
-
(dependencies):
|
46
|
-
<<: *dependencies
|
6
|
+
(commands): &commands # if you dont know what the & means, see https://blog.daemonl.com/2016/02/yaml.html
|
7
|
+
test_commands:
|
8
|
+
ruby test/main.rb
|
9
|
+
(setup):
|
10
|
+
# a library that helps with publishing
|
11
|
+
gem install gem-release
|
12
|
+
publish:
|
13
|
+
ruby scripts/publish.rb
|
14
|
+
test_changes:
|
15
|
+
ruby scripts/test_changes.rb && ruby ./lib/after_gem_update.rb
|
metadata
CHANGED
@@ -1,33 +1,33 @@
|
|
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.146
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Hykin
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-prompt
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.19.0
|
20
|
-
- - "
|
20
|
+
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 0.19.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.19.0
|
30
|
-
- - "
|
30
|
+
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 0.19.0
|
33
33
|
description: ''
|
@@ -58,7 +58,7 @@ homepage: http://github.com//atk-toolbox
|
|
58
58
|
licenses:
|
59
59
|
- CC-BY-ND-4.0
|
60
60
|
metadata: {}
|
61
|
-
post_install_message:
|
61
|
+
post_install_message:
|
62
62
|
rdoc_options: []
|
63
63
|
require_paths:
|
64
64
|
- "./lib"
|
@@ -73,9 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
|
77
|
-
|
78
|
-
signing_key:
|
76
|
+
rubygems_version: 3.0.3
|
77
|
+
signing_key:
|
79
78
|
specification_version: 4
|
80
79
|
summary: The Ruby gem for all the standard tools ATK uses internally
|
81
80
|
test_files: []
|