raykit 0.0.319 → 0.0.320
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 +4 -4
- data/lib/raykit/command.rb +63 -62
- data/lib/raykit/console.rb +62 -63
- data/lib/raykit/dir.rb +6 -6
- data/lib/raykit/dotnet.rb +1 -1
- data/lib/raykit/environment.rb +19 -19
- data/lib/raykit/git/directory.rb +18 -18
- data/lib/raykit/git/files.rb +5 -4
- data/lib/raykit/git/repositories.rb +7 -7
- data/lib/raykit/git/repository.rb +10 -10
- data/lib/raykit/log.rb +8 -6
- data/lib/raykit/logevent.rb +13 -12
- data/lib/raykit/logging.rb +7 -7
- data/lib/raykit/msbuild.rb +14 -7
- data/lib/raykit/project.rb +16 -17
- data/lib/raykit/rake.rb +6 -6
- data/lib/raykit/runner.rb +10 -10
- data/lib/raykit/secrets.rb +7 -7
- data/lib/raykit/sourceImport.rb +16 -16
- data/lib/raykit/sourceImports.rb +4 -4
- data/lib/raykit/string.rb +3 -3
- data/lib/raykit/tasks.rb +26 -26
- data/lib/raykit/text.rb +2 -4
- data/lib/raykit/timer.rb +2 -2
- data/lib/raykit/version.rb +12 -12
- data/lib/raykit/vstest.rb +8 -8
- data/lib/raykit.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 152e4c8b22e94bb4ad50c07cc9e56652b361c2ef789d72151f94d39b5dd14dbc
|
4
|
+
data.tar.gz: 2ca35b6636af0f2a15d4a9b2f459271c4de7d302e7115edf568fc4da47cca131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94e56223f2a16539f20daee53208995331bb0dd9978add2a7e6928b3d25810baa5c050b1dedd13e7e401ef3718598f60df9891518b40a7a4a4d91309862f1870
|
7
|
+
data.tar.gz: b68117a401b8dc5175ed139e55adc8575339b7c3b0a989626f12a168afa52d9ff1a0bde2b8173b2eb34de82e657022cfa73f93a160c9e922489e8c292c3d1172
|
data/lib/raykit/command.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
3
|
+
require "open3"
|
4
|
+
require "timeout"
|
5
|
+
require "json"
|
6
|
+
require "yaml"
|
7
|
+
require "logger"
|
8
|
+
require "securerandom"
|
9
9
|
|
10
10
|
BUFFER_SIZE = 1024 unless defined?(BUFFER_SIZE)
|
11
|
+
|
11
12
|
module Raykit
|
12
13
|
# Functionality to support executing and logging system commands
|
13
14
|
class Command
|
@@ -25,8 +26,8 @@ module Raykit
|
|
25
26
|
def init_defaults
|
26
27
|
@timeout = 0
|
27
28
|
@directory = Dir.pwd
|
28
|
-
@output =
|
29
|
-
@error =
|
29
|
+
@output = ""
|
30
|
+
@error = ""
|
30
31
|
@exitstatus = 0
|
31
32
|
@user = Environment.user
|
32
33
|
@machine = Environment.machine
|
@@ -73,10 +74,10 @@ module Raykit
|
|
73
74
|
if Gem.win_platform?
|
74
75
|
`taskkill /f /pid #{pid}`
|
75
76
|
else
|
76
|
-
Process.kill(
|
77
|
+
Process.kill("TERM", pid)
|
77
78
|
end
|
78
79
|
@exitstatus = 5
|
79
|
-
@error =
|
80
|
+
@error = "timed out"
|
80
81
|
else
|
81
82
|
@exitstatus = thread.value.exitstatus
|
82
83
|
end
|
@@ -91,10 +92,10 @@ module Raykit
|
|
91
92
|
# puts '---logging---'
|
92
93
|
unless @success_log_level.nil?
|
93
94
|
e = to_log_event
|
94
|
-
e[
|
95
|
-
e[
|
96
|
-
e[
|
97
|
-
e[
|
95
|
+
e["Level"] = "Verbose" if @success_log_level == "Verbose"
|
96
|
+
e["Level"] = "Debug" if @success_log_level == Logger::DEBUG
|
97
|
+
e["Level"] = "Information" if @success_log_level == Logger::INFO
|
98
|
+
e["Level"] = "Warning" if @elapsed > 60 * 2
|
98
99
|
e.to_seq
|
99
100
|
end
|
100
101
|
end
|
@@ -104,55 +105,55 @@ module Raykit
|
|
104
105
|
def to_log_event
|
105
106
|
secrets = Secrets.new
|
106
107
|
msg = secrets.hide(@command)
|
107
|
-
level =
|
108
|
-
level =
|
108
|
+
level = "Verbose"
|
109
|
+
level = "Warning" if @exitstatus != 0
|
109
110
|
output = @output
|
110
111
|
error = @error
|
111
112
|
output = @output[-1000..-1] if @output.length > 1200
|
112
113
|
error = @error[-1000..-1] if @error.length > 1200
|
113
114
|
Raykit::LogEvent.new(level, msg, {
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
"SourceContext" => "Raykit::Command",
|
116
|
+
"Category" => "Command",
|
117
|
+
"Timeout" => @timeout,
|
118
|
+
"Directory" => @directory,
|
119
|
+
"Output" => output,
|
120
|
+
"Error" => error,
|
121
|
+
"ExitStatus" => @exitstatus,
|
122
|
+
"Elapsed" => elapsed_str,
|
123
|
+
"ElapsedSeconds" => @elapsed,
|
124
|
+
})
|
124
125
|
end
|
125
126
|
|
126
127
|
def log
|
127
128
|
# --- Rolling File JSON -----
|
128
|
-
log = Logger.new("#{Raykit::Environment.log_dir}/Raykit.Commands.txt",
|
129
|
+
log = Logger.new("#{Raykit::Environment.log_dir}/Raykit.Commands.txt", "daily")
|
129
130
|
log.formatter = proc do |_severity, _datetime, _progname, msg|
|
130
131
|
"#{msg}\n"
|
131
132
|
end
|
132
133
|
secrets = Secrets.new
|
133
134
|
msg = secrets.hide(@command) # "?"# self.summary(false)
|
134
|
-
level =
|
135
|
-
level =
|
135
|
+
level = "Verbose"
|
136
|
+
level = "Warning" if @exitstatus != 0
|
136
137
|
event = Raykit::LogEvent.new(level, msg, {
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
138
|
+
"Timeout" => @timeout,
|
139
|
+
"Directory" => @directory,
|
140
|
+
"Output" => @output,
|
141
|
+
"Error" => @error,
|
142
|
+
"ExitStatus" => @exitstatus,
|
143
|
+
"Elapsed" => elapsed_str,
|
144
|
+
})
|
144
145
|
log.info event.to_json
|
145
146
|
# ---------------------------
|
146
147
|
begin
|
147
148
|
json = JSON.generate(to_hash)
|
148
|
-
log_filename = "#{Environment.get_dev_dir(
|
149
|
+
log_filename = "#{Environment.get_dev_dir("log")}/Raykit.Command/#{SecureRandom.uuid}.json"
|
149
150
|
log_dir = File.dirname(log_filename)
|
150
151
|
FileUtils.mkdir_p(log_dir) unless Dir.exist?(log_dir)
|
151
|
-
File.open(log_filename,
|
152
|
-
if @exitstatus.zero?
|
153
|
-
LOG.log(
|
152
|
+
File.open(log_filename, "w") { |f| f.write(json) }
|
153
|
+
if !@exitstatus.nil? && @exitstatus.zero?
|
154
|
+
LOG.log("Raykit.Command", Logger::Severity::INFO, json)
|
154
155
|
else
|
155
|
-
LOG.log(
|
156
|
+
LOG.log("Raykit.Command", Logger::Severity::ERROR, json)
|
156
157
|
end
|
157
158
|
rescue JSON::GeneratorError => e
|
158
159
|
puts to_hash.to_s
|
@@ -164,15 +165,15 @@ module Raykit
|
|
164
165
|
def elapsed_str
|
165
166
|
if elapsed < 1.0
|
166
167
|
end
|
167
|
-
"#{format(
|
168
|
+
"#{format("%.0f", elapsed)}s"
|
168
169
|
end
|
169
170
|
|
170
171
|
def summary(show_directory = false)
|
171
172
|
checkmark = "\u2713"
|
172
173
|
# warning="\u26A0"
|
173
174
|
error = "\u0058"
|
174
|
-
symbol = Rainbow(checkmark.encode(
|
175
|
-
symbol = Rainbow(error.encode(
|
175
|
+
symbol = Rainbow(checkmark.encode("utf-8")).green
|
176
|
+
symbol = Rainbow(error.encode("utf-8")).red if @exitstatus != 0
|
176
177
|
if show_directory
|
177
178
|
puts "#{symbol} #{elapsed_str.rjust(4)} #{Rainbow(SECRETS.hide(@command)).yellow} (#{@directory})"
|
178
179
|
else
|
@@ -189,11 +190,11 @@ module Raykit
|
|
189
190
|
end
|
190
191
|
|
191
192
|
def save
|
192
|
-
filename = "#{Environment.get_dev_dir(
|
193
|
+
filename = "#{Environment.get_dev_dir("log")}/Commands/#{SecureRandom.uuid}"
|
193
194
|
log_dir = File.dirname(filename)
|
194
195
|
FileUtils.mkdir_p(log_dir) unless Dir.exist?(log_dir)
|
195
196
|
|
196
|
-
File.open(filename,
|
197
|
+
File.open(filename, "w") do |f|
|
197
198
|
f.write(JSON.pretty_generate(to_hash))
|
198
199
|
end
|
199
200
|
self
|
@@ -206,30 +207,30 @@ module Raykit
|
|
206
207
|
hash[:timeout] = @timeout
|
207
208
|
hash[:start_time] = @start_time
|
208
209
|
hash[:elapsed] = @elapsed
|
209
|
-
hash[:output] = @output.force_encoding(
|
210
|
-
hash[:error] = @error.force_encoding(
|
210
|
+
hash[:output] = @output.force_encoding("ISO-8859-1").encode("UTF-8")
|
211
|
+
hash[:error] = @error.force_encoding("ISO-8859-1").encode("UTF-8")
|
211
212
|
hash[:exitstatus] = @exitstatus
|
212
213
|
hash[:user] = @user
|
213
214
|
hash[:machine] = @machine
|
214
|
-
hash[:context] =
|
215
|
+
hash[:context] = "Raykit.Command"
|
215
216
|
hash
|
216
217
|
end
|
217
218
|
|
218
219
|
def from_hash(hash)
|
219
|
-
@command = hash[
|
220
|
-
@directory = hash[
|
221
|
-
@timeout = hash[
|
222
|
-
@start_time = hash[
|
223
|
-
@elapsed = hash[
|
224
|
-
@output = hash[
|
225
|
-
@error = hash[
|
226
|
-
@exitstatus = hash[
|
227
|
-
@user = hash[
|
228
|
-
@machine = hash[
|
220
|
+
@command = hash["command"]
|
221
|
+
@directory = hash["directory"]
|
222
|
+
@timeout = hash["timeout"]
|
223
|
+
@start_time = hash["start_time"]
|
224
|
+
@elapsed = hash["elapsed"]
|
225
|
+
@output = hash["output"]
|
226
|
+
@error = hash["error"]
|
227
|
+
@exitstatus = hash["exitstatus"]
|
228
|
+
@user = hash["user"] if hash.include?("user")
|
229
|
+
@machine = hash["machine"] if hash.include?("machine")
|
229
230
|
end
|
230
231
|
|
231
232
|
def self.parse(json)
|
232
|
-
cmd = Command.new(
|
233
|
+
cmd = Command.new("")
|
233
234
|
cmd.from_hash(JSON.parse(json))
|
234
235
|
cmd
|
235
236
|
end
|
@@ -242,8 +243,8 @@ module Raykit
|
|
242
243
|
|
243
244
|
def self.get_script_commands(hash)
|
244
245
|
commands = []
|
245
|
-
if hash.key?(
|
246
|
-
hash[
|
246
|
+
if hash.key?("script")
|
247
|
+
hash["script"].each do |cmd|
|
247
248
|
commands << cmd
|
248
249
|
end
|
249
250
|
end
|
data/lib/raykit/console.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require_relative(
|
3
|
+
require "optparse"
|
4
|
+
require "slop"
|
5
|
+
require_relative("./logging")
|
6
6
|
|
7
7
|
module Raykit
|
8
8
|
# The implementation for the raykit console application
|
@@ -11,10 +11,10 @@ module Raykit
|
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
@opts = Slop.parse do |o|
|
14
|
-
o.string
|
15
|
-
o.bool
|
16
|
-
o.bool
|
17
|
-
o.bool
|
14
|
+
o.string "-t", "--task", "rake task", default: "default"
|
15
|
+
o.bool "-v", "--verbose", "print detailed output", default: false
|
16
|
+
o.bool "-q", "--quiet", "minimal output", default: false
|
17
|
+
o.bool "-s", "--stop", "stop on error", default: true
|
18
18
|
end
|
19
19
|
|
20
20
|
if opts.verbose?
|
@@ -24,28 +24,28 @@ module Raykit
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def run
|
27
|
-
verb =
|
27
|
+
verb = "usage"
|
28
28
|
verb = @opts.arguments[0] if @opts.arguments.length.positive?
|
29
29
|
case verb
|
30
|
-
when
|
30
|
+
when "usage"
|
31
31
|
usage
|
32
|
-
when
|
32
|
+
when "add"
|
33
33
|
add
|
34
|
-
when
|
34
|
+
when "remove"
|
35
35
|
remove
|
36
|
-
when
|
36
|
+
when "show"
|
37
37
|
show
|
38
|
-
when
|
38
|
+
when "work"
|
39
39
|
work
|
40
|
-
when
|
40
|
+
when "import"
|
41
41
|
import
|
42
|
-
when
|
42
|
+
when "clean"
|
43
43
|
clean
|
44
|
-
when
|
44
|
+
when "sync_version"
|
45
45
|
sync_version
|
46
|
-
when
|
46
|
+
when "copy"
|
47
47
|
copy
|
48
|
-
when
|
48
|
+
when "pull"
|
49
49
|
pull
|
50
50
|
else
|
51
51
|
puts "unrecognized command #{verb}"
|
@@ -54,33 +54,33 @@ module Raykit
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def verb_descriptions
|
57
|
-
{
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
57
|
+
{ "add" => "add a git url",
|
58
|
+
"remove" => "remove one or more git urls",
|
59
|
+
"show" => "show git urls matching a specific pattern",
|
60
|
+
"work" => "clone and rake a git repository",
|
61
|
+
"import" => "import git urls matching a specific pattern",
|
62
|
+
"clean" => "clean one or more working directories",
|
63
|
+
"pull" => "preform git pull on one or more working directories",
|
64
|
+
"sync_version" => "synchronize the version number between two files",
|
65
|
+
"copy" => "copy a file" }
|
66
66
|
end
|
67
67
|
|
68
68
|
def verb_usage
|
69
|
-
{
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
69
|
+
{ "add" => "add GIT_URL",
|
70
|
+
"remove" => "remove URL_PATTERN",
|
71
|
+
"show" => "show URL_PATTERN",
|
72
|
+
"work" => "work URL_PATTERN [--task RAKE_TASK]",
|
73
|
+
"import" => "import URL_PATTERN",
|
74
|
+
"clean" => "clean URL_PATTERN",
|
75
|
+
"pull" => "pull URL_PATTERN",
|
76
|
+
"sync_version" => "sync_version SOURCE_FILENAME DESTINATION_FILENAME",
|
77
|
+
"copy" => "copy SOURCE DESTINATION" }
|
78
78
|
end
|
79
79
|
|
80
80
|
def usage
|
81
|
-
puts
|
81
|
+
puts "Usage: raykit VERB [GIT_URL|PATTERN] [OPTIONS]"
|
82
82
|
verb_descriptions.each do |k, v|
|
83
|
-
puts "#{k.ljust(15,
|
83
|
+
puts "#{k.ljust(15, " ")} - #{v}"
|
84
84
|
end
|
85
85
|
# puts @opts
|
86
86
|
# puts "verbs: " + verbs.to_s
|
@@ -89,7 +89,7 @@ module Raykit
|
|
89
89
|
|
90
90
|
def add
|
91
91
|
if @opts.arguments.length < 2
|
92
|
-
puts
|
92
|
+
puts "add requires a url"
|
93
93
|
return 1
|
94
94
|
end
|
95
95
|
url = @opts.arguments[1]
|
@@ -104,17 +104,16 @@ module Raykit
|
|
104
104
|
|
105
105
|
def remove
|
106
106
|
if @opts.arguments.length < 2
|
107
|
-
puts
|
107
|
+
puts "remove requires a url or pattern"
|
108
108
|
return 1
|
109
109
|
end
|
110
|
-
pattern =
|
110
|
+
pattern = ""
|
111
111
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
112
112
|
remove_urls = REPOSITORIES.matches(pattern)
|
113
113
|
if remove_urls.length.zero?
|
114
|
-
puts
|
115
|
-
|
114
|
+
puts "no matching urls found."
|
116
115
|
else
|
117
|
-
remove_urls.each
|
116
|
+
remove_urls.each do |url|
|
118
117
|
REPOSITORIES.delete(url)
|
119
118
|
puts "url #{url} removed."
|
120
119
|
end
|
@@ -123,7 +122,7 @@ module Raykit
|
|
123
122
|
end
|
124
123
|
|
125
124
|
def show
|
126
|
-
pattern =
|
125
|
+
pattern = ""
|
127
126
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
128
127
|
REPOSITORIES.matches(pattern).each do |url|
|
129
128
|
puts url
|
@@ -131,7 +130,7 @@ module Raykit
|
|
131
130
|
end
|
132
131
|
|
133
132
|
def work
|
134
|
-
pattern =
|
133
|
+
pattern = ""
|
135
134
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
136
135
|
|
137
136
|
work_repositories = REPOSITORIES.matches(pattern)
|
@@ -139,18 +138,18 @@ module Raykit
|
|
139
138
|
puts "work: found #{work_repositories.length} matching urls"
|
140
139
|
work_repositories.each do |url|
|
141
140
|
exitstatus = work_url(url)
|
142
|
-
puts
|
141
|
+
puts " " if @opts.verbose?
|
143
142
|
return exitstatus if @opts[:stop] && exitstatus != 0
|
144
143
|
end
|
145
144
|
0
|
146
145
|
end
|
147
146
|
|
148
147
|
def work_url(url)
|
149
|
-
return 0 if url ==
|
148
|
+
return 0 if url == "https://gitlab.com/lou-parslow/raykit.git"
|
150
149
|
|
151
150
|
puts Rainbow(url).yellow.bright if @opts.verbose?
|
152
151
|
repo = Raykit::Git::Repository.new(url)
|
153
|
-
work = Raykit::Git::Directory.new(repo.get_dev_dir(
|
152
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir("work"))
|
154
153
|
unless Dir.exist?(work.directory)
|
155
154
|
clone = Command.new("git clone #{url} #{work.directory} --recursive")
|
156
155
|
puts clone.summary unless @opts.quiet?
|
@@ -161,7 +160,7 @@ module Raykit
|
|
161
160
|
end
|
162
161
|
if Dir.exist?(work.directory)
|
163
162
|
Dir.chdir(work.directory) do
|
164
|
-
if File.exist?(
|
163
|
+
if File.exist?("rakefile.rb")
|
165
164
|
rake = Raykit::Command.new("rake #{@opts[:task]}")
|
166
165
|
rake.summary(true) if !@opts.quiet? || rake.exitstatus != 0
|
167
166
|
if rake.exitstatus != 0
|
@@ -179,17 +178,17 @@ module Raykit
|
|
179
178
|
end
|
180
179
|
|
181
180
|
def pull
|
182
|
-
pattern =
|
181
|
+
pattern = ""
|
183
182
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
184
183
|
REPOSITORIES.matches(pattern).each do |url|
|
185
184
|
repo = Raykit::Git::Repository.new(url)
|
186
|
-
work = Raykit::Git::Directory.new(repo.get_dev_dir(
|
187
|
-
if Dir.exist?(work.directory) && !work.directory ==
|
185
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir("work"))
|
186
|
+
if Dir.exist?(work.directory) && !work.directory == ".git"
|
188
187
|
Dir.chdir(work.directory) do
|
189
188
|
diff = `git diff`.strip
|
190
189
|
status = `git status`.strip
|
191
|
-
if diff.length.zero? && status.include?(
|
192
|
-
cmd = Command.new(
|
190
|
+
if diff.length.zero? && status.include?("nothing to commit")
|
191
|
+
cmd = Command.new("git pull")
|
193
192
|
cmd.summary if @opts.verbose?
|
194
193
|
|
195
194
|
if cmd.exitstatus != 0
|
@@ -210,9 +209,9 @@ module Raykit
|
|
210
209
|
end
|
211
210
|
|
212
211
|
def import
|
213
|
-
pattern =
|
212
|
+
pattern = ""
|
214
213
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
215
|
-
puts
|
214
|
+
puts "scanning..."
|
216
215
|
count = REPOSITORIES.length
|
217
216
|
REPOSITORIES.import(pattern)
|
218
217
|
new_count = REPOSITORIES.length - count
|
@@ -220,11 +219,11 @@ module Raykit
|
|
220
219
|
end
|
221
220
|
|
222
221
|
def clean
|
223
|
-
pattern =
|
222
|
+
pattern = ""
|
224
223
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
225
224
|
REPOSITORIES.matches(pattern).each do |url|
|
226
225
|
repo = Raykit::Git::Repository.new(url)
|
227
|
-
work = Raykit::Git::Directory.new(repo.get_dev_dir(
|
226
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir("work"))
|
228
227
|
next unless Dir.exist?(work.directory)
|
229
228
|
|
230
229
|
puts "removing #{work.directory}"
|
@@ -250,7 +249,7 @@ module Raykit
|
|
250
249
|
|
251
250
|
def copy
|
252
251
|
if @opts.arguments.length < 3
|
253
|
-
puts
|
252
|
+
puts "source and destination arguments are required for copy"
|
254
253
|
return 1
|
255
254
|
end
|
256
255
|
source = @opts.arguments[1]
|
@@ -265,7 +264,7 @@ module Raykit
|
|
265
264
|
|
266
265
|
begin
|
267
266
|
puts "remote: #{remote}"
|
268
|
-
cmd = Raykit::Rake.run(remote,
|
267
|
+
cmd = Raykit::Rake.run(remote, "master")
|
269
268
|
elapsed_str = Timer.get_elapsed_str(cmd.elapsed)
|
270
269
|
if cmd.exitstatus.zero?
|
271
270
|
puts "#{elapsed_str} #{Rainbow(SECRETS.hide(cmd.command)).yellow.bright} (#{cmd.directory})"
|
@@ -273,11 +272,11 @@ module Raykit
|
|
273
272
|
puts "\r\n#{cmd.command}\r\n"
|
274
273
|
puts "\r\n#{cmd.output}\r\n"
|
275
274
|
puts "\r\n#{cmd.error}\r\n"
|
276
|
-
puts
|
275
|
+
puts ""
|
277
276
|
puts "#{Rainbow(elapsed_str).red.bright} #{Rainbow(cmd.command).white}"
|
278
277
|
end
|
279
278
|
rescue StandardError
|
280
|
-
puts
|
279
|
+
puts "rescued..."
|
281
280
|
end
|
282
281
|
end
|
283
282
|
end
|
data/lib/raykit/dir.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require_relative
|
3
|
+
require "tmpdir"
|
4
|
+
require_relative "./environment"
|
5
5
|
|
6
6
|
class Dir
|
7
7
|
def self.get_text(dir, relative_name)
|
@@ -9,13 +9,13 @@ class Dir
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.set_text(dir, relative_name, text)
|
12
|
-
File.open("#{dir}/#{relative_name}",
|
12
|
+
File.open("#{dir}/#{relative_name}", "w") { |f| f.write text }
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.get_git_directories(dir)
|
16
16
|
git_dirs = []
|
17
17
|
Dir.chdir(dir) do
|
18
|
-
Dir.glob(
|
18
|
+
Dir.glob("**/.git/index") do |f|
|
19
19
|
git_dir = File.dirname(File.dirname(f))
|
20
20
|
git_dirs << git_dir
|
21
21
|
end
|
@@ -37,8 +37,8 @@ class Dir
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def self.get_data_dir
|
40
|
-
unless ENV[
|
41
|
-
data_dir = ENV[
|
40
|
+
unless ENV["DATA_DIR"].nil?
|
41
|
+
data_dir = ENV["DATA_DIR"]
|
42
42
|
return data_dir if Dir.exist?(data_dir)
|
43
43
|
end
|
44
44
|
home_dir = Raykit::Environment.home_dir
|
data/lib/raykit/dotnet.rb
CHANGED
@@ -93,7 +93,7 @@ module Raykit
|
|
93
93
|
|
94
94
|
def self.get_package_names(filename)
|
95
95
|
package_names = []
|
96
|
-
if File.exist?(filename) && filename.include?(
|
96
|
+
if File.exist?(filename) && filename.include?(".csproj")
|
97
97
|
regex = /<PackageReference Include="([\w.-]+)"/
|
98
98
|
text = IO.read(filename)
|
99
99
|
text.scan(regex).each do |m|
|