raykit 0.0.309 → 0.0.310
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 +62 -63
- data/lib/raykit/console.rb +63 -62
- 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 +27 -18
- data/lib/raykit/git/files.rb +4 -5
- data/lib/raykit/git/repositories.rb +7 -7
- data/lib/raykit/git/repository.rb +10 -10
- data/lib/raykit/log.rb +6 -8
- data/lib/raykit/logevent.rb +12 -13
- data/lib/raykit/logging.rb +7 -7
- data/lib/raykit/msbuild.rb +7 -13
- data/lib/raykit/project.rb +42 -43
- 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 +1 -1
- 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: 2e68283fb8818b8967d8969c03ecaff5ad373266c23d1f12e0dec5cb831bcb85
|
4
|
+
data.tar.gz: 8eb9ad11b5c78bf0b294d5a6fe34877477421344a47aeddc9637bebddc8ebdaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c824e3f9c5df95cc21523edd4c6a8372d6d6c25c8b15467ea006da7d27950c582f595925b64a0b0a553bcd8b343db8c699b70feaf01ea3b0d778c44113f579
|
7
|
+
data.tar.gz: fdec9ab13c0cad9fd9aa81b6b7f208e6b57be36d475dfc7f7acd28c161485adb5abb0488acf2d7a53f75de757b4f69ae6e3583d2285f3050ae44ab13e54d3847
|
data/lib/raykit/command.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
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
|
-
|
12
11
|
module Raykit
|
13
12
|
# Functionality to support executing and logging system commands
|
14
13
|
class Command
|
@@ -26,8 +25,8 @@ module Raykit
|
|
26
25
|
def init_defaults
|
27
26
|
@timeout = 0
|
28
27
|
@directory = Dir.pwd
|
29
|
-
@output =
|
30
|
-
@error =
|
28
|
+
@output = ''
|
29
|
+
@error = ''
|
31
30
|
@exitstatus = 0
|
32
31
|
@user = Environment.user
|
33
32
|
@machine = Environment.machine
|
@@ -74,10 +73,10 @@ module Raykit
|
|
74
73
|
if Gem.win_platform?
|
75
74
|
`taskkill /f /pid #{pid}`
|
76
75
|
else
|
77
|
-
Process.kill(
|
76
|
+
Process.kill('TERM', pid)
|
78
77
|
end
|
79
78
|
@exitstatus = 5
|
80
|
-
@error =
|
79
|
+
@error = 'timed out'
|
81
80
|
else
|
82
81
|
@exitstatus = thread.value.exitstatus
|
83
82
|
end
|
@@ -92,10 +91,10 @@ module Raykit
|
|
92
91
|
# puts '---logging---'
|
93
92
|
unless @success_log_level.nil?
|
94
93
|
e = to_log_event
|
95
|
-
e[
|
96
|
-
e[
|
97
|
-
e[
|
98
|
-
e[
|
94
|
+
e['Level'] = 'Verbose' if @success_log_level == 'Verbose'
|
95
|
+
e['Level'] = 'Debug' if @success_log_level == Logger::DEBUG
|
96
|
+
e['Level'] = 'Information' if @success_log_level == Logger::INFO
|
97
|
+
e['Level'] = 'Warning' if @elapsed > 60 * 2
|
99
98
|
e.to_seq
|
100
99
|
end
|
101
100
|
end
|
@@ -105,55 +104,55 @@ module Raykit
|
|
105
104
|
def to_log_event
|
106
105
|
secrets = Secrets.new
|
107
106
|
msg = secrets.hide(@command)
|
108
|
-
level =
|
109
|
-
level =
|
107
|
+
level = 'Verbose'
|
108
|
+
level = 'Warning' if @exitstatus != 0
|
110
109
|
output = @output
|
111
110
|
error = @error
|
112
111
|
output = @output[-1000..-1] if @output.length > 1200
|
113
112
|
error = @error[-1000..-1] if @error.length > 1200
|
114
113
|
Raykit::LogEvent.new(level, msg, {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
114
|
+
'SourceContext' => 'Raykit::Command',
|
115
|
+
'Category' => 'Command',
|
116
|
+
'Timeout' => @timeout,
|
117
|
+
'Directory' => @directory,
|
118
|
+
'Output' => output,
|
119
|
+
'Error' => error,
|
120
|
+
'ExitStatus' => @exitstatus,
|
121
|
+
'Elapsed' => elapsed_str,
|
122
|
+
'ElapsedSeconds' => @elapsed
|
123
|
+
})
|
125
124
|
end
|
126
125
|
|
127
126
|
def log
|
128
127
|
# --- Rolling File JSON -----
|
129
|
-
log = Logger.new("#{Raykit::Environment.log_dir}/Raykit.Commands.txt",
|
128
|
+
log = Logger.new("#{Raykit::Environment.log_dir}/Raykit.Commands.txt", 'daily')
|
130
129
|
log.formatter = proc do |_severity, _datetime, _progname, msg|
|
131
130
|
"#{msg}\n"
|
132
131
|
end
|
133
132
|
secrets = Secrets.new
|
134
133
|
msg = secrets.hide(@command) # "?"# self.summary(false)
|
135
|
-
level =
|
136
|
-
level =
|
134
|
+
level = 'Verbose'
|
135
|
+
level = 'Warning' if @exitstatus != 0
|
137
136
|
event = Raykit::LogEvent.new(level, msg, {
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
137
|
+
'Timeout' => @timeout,
|
138
|
+
'Directory' => @directory,
|
139
|
+
'Output' => @output,
|
140
|
+
'Error' => @error,
|
141
|
+
'ExitStatus' => @exitstatus,
|
142
|
+
'Elapsed' => elapsed_str
|
143
|
+
})
|
145
144
|
log.info event.to_json
|
146
145
|
# ---------------------------
|
147
146
|
begin
|
148
147
|
json = JSON.generate(to_hash)
|
149
|
-
log_filename = "#{Environment.get_dev_dir(
|
148
|
+
log_filename = "#{Environment.get_dev_dir('log')}/Raykit.Command/#{SecureRandom.uuid}.json"
|
150
149
|
log_dir = File.dirname(log_filename)
|
151
150
|
FileUtils.mkdir_p(log_dir) unless Dir.exist?(log_dir)
|
152
|
-
File.open(log_filename,
|
153
|
-
if
|
154
|
-
LOG.log(
|
151
|
+
File.open(log_filename, 'w') { |f| f.write(json) }
|
152
|
+
if @exitstatus.zero?
|
153
|
+
LOG.log('Raykit.Command', Logger::Severity::INFO, json)
|
155
154
|
else
|
156
|
-
LOG.log(
|
155
|
+
LOG.log('Raykit.Command', Logger::Severity::ERROR, json)
|
157
156
|
end
|
158
157
|
rescue JSON::GeneratorError => e
|
159
158
|
puts to_hash.to_s
|
@@ -165,15 +164,15 @@ module Raykit
|
|
165
164
|
def elapsed_str
|
166
165
|
if elapsed < 1.0
|
167
166
|
end
|
168
|
-
"#{format(
|
167
|
+
"#{format('%.0f', elapsed)}s"
|
169
168
|
end
|
170
169
|
|
171
170
|
def summary(show_directory = false)
|
172
171
|
checkmark = "\u2713"
|
173
172
|
# warning="\u26A0"
|
174
173
|
error = "\u0058"
|
175
|
-
symbol = Rainbow(checkmark.encode(
|
176
|
-
symbol = Rainbow(error.encode(
|
174
|
+
symbol = Rainbow(checkmark.encode('utf-8')).green
|
175
|
+
symbol = Rainbow(error.encode('utf-8')).red if @exitstatus != 0
|
177
176
|
if show_directory
|
178
177
|
puts "#{symbol} #{elapsed_str.rjust(4)} #{Rainbow(SECRETS.hide(@command)).yellow} (#{@directory})"
|
179
178
|
else
|
@@ -190,11 +189,11 @@ module Raykit
|
|
190
189
|
end
|
191
190
|
|
192
191
|
def save
|
193
|
-
filename = "#{Environment.get_dev_dir(
|
192
|
+
filename = "#{Environment.get_dev_dir('log')}/Commands/#{SecureRandom.uuid}"
|
194
193
|
log_dir = File.dirname(filename)
|
195
194
|
FileUtils.mkdir_p(log_dir) unless Dir.exist?(log_dir)
|
196
195
|
|
197
|
-
File.open(filename,
|
196
|
+
File.open(filename, 'w') do |f|
|
198
197
|
f.write(JSON.pretty_generate(to_hash))
|
199
198
|
end
|
200
199
|
self
|
@@ -207,30 +206,30 @@ module Raykit
|
|
207
206
|
hash[:timeout] = @timeout
|
208
207
|
hash[:start_time] = @start_time
|
209
208
|
hash[:elapsed] = @elapsed
|
210
|
-
hash[:output] = @output.force_encoding(
|
211
|
-
hash[:error] = @error.force_encoding(
|
209
|
+
hash[:output] = @output.force_encoding('ISO-8859-1').encode('UTF-8')
|
210
|
+
hash[:error] = @error.force_encoding('ISO-8859-1').encode('UTF-8')
|
212
211
|
hash[:exitstatus] = @exitstatus
|
213
212
|
hash[:user] = @user
|
214
213
|
hash[:machine] = @machine
|
215
|
-
hash[:context] =
|
214
|
+
hash[:context] = 'Raykit.Command'
|
216
215
|
hash
|
217
216
|
end
|
218
217
|
|
219
218
|
def from_hash(hash)
|
220
|
-
@command = hash[
|
221
|
-
@directory = hash[
|
222
|
-
@timeout = hash[
|
223
|
-
@start_time = hash[
|
224
|
-
@elapsed = hash[
|
225
|
-
@output = hash[
|
226
|
-
@error = hash[
|
227
|
-
@exitstatus = hash[
|
228
|
-
@user = hash[
|
229
|
-
@machine = hash[
|
219
|
+
@command = hash['command']
|
220
|
+
@directory = hash['directory']
|
221
|
+
@timeout = hash['timeout']
|
222
|
+
@start_time = hash['start_time']
|
223
|
+
@elapsed = hash['elapsed']
|
224
|
+
@output = hash['output']
|
225
|
+
@error = hash['error']
|
226
|
+
@exitstatus = hash['exitstatus']
|
227
|
+
@user = hash['user'] if hash.include?('user')
|
228
|
+
@machine = hash['machine'] if hash.include?('machine')
|
230
229
|
end
|
231
230
|
|
232
231
|
def self.parse(json)
|
233
|
-
cmd = Command.new(
|
232
|
+
cmd = Command.new('')
|
234
233
|
cmd.from_hash(JSON.parse(json))
|
235
234
|
cmd
|
236
235
|
end
|
@@ -243,8 +242,8 @@ module Raykit
|
|
243
242
|
|
244
243
|
def self.get_script_commands(hash)
|
245
244
|
commands = []
|
246
|
-
if hash.key?(
|
247
|
-
hash[
|
245
|
+
if hash.key?('script')
|
246
|
+
hash['script'].each do |cmd|
|
248
247
|
commands << cmd
|
249
248
|
end
|
250
249
|
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,16 +104,17 @@ 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
|
114
|
+
puts 'no matching urls found.'
|
115
|
+
|
115
116
|
else
|
116
|
-
remove_urls.each
|
117
|
+
remove_urls.each do |url|
|
117
118
|
REPOSITORIES.delete(url)
|
118
119
|
puts "url #{url} removed."
|
119
120
|
end
|
@@ -122,7 +123,7 @@ module Raykit
|
|
122
123
|
end
|
123
124
|
|
124
125
|
def show
|
125
|
-
pattern =
|
126
|
+
pattern = ''
|
126
127
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
127
128
|
REPOSITORIES.matches(pattern).each do |url|
|
128
129
|
puts url
|
@@ -130,7 +131,7 @@ module Raykit
|
|
130
131
|
end
|
131
132
|
|
132
133
|
def work
|
133
|
-
pattern =
|
134
|
+
pattern = ''
|
134
135
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
135
136
|
|
136
137
|
work_repositories = REPOSITORIES.matches(pattern)
|
@@ -138,18 +139,18 @@ module Raykit
|
|
138
139
|
puts "work: found #{work_repositories.length} matching urls"
|
139
140
|
work_repositories.each do |url|
|
140
141
|
exitstatus = work_url(url)
|
141
|
-
puts
|
142
|
+
puts ' ' if @opts.verbose?
|
142
143
|
return exitstatus if @opts[:stop] && exitstatus != 0
|
143
144
|
end
|
144
145
|
0
|
145
146
|
end
|
146
147
|
|
147
148
|
def work_url(url)
|
148
|
-
return 0 if url ==
|
149
|
+
return 0 if url == 'https://gitlab.com/lou-parslow/raykit.git'
|
149
150
|
|
150
151
|
puts Rainbow(url).yellow.bright if @opts.verbose?
|
151
152
|
repo = Raykit::Git::Repository.new(url)
|
152
|
-
work = Raykit::Git::Directory.new(repo.get_dev_dir(
|
153
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir('work'))
|
153
154
|
unless Dir.exist?(work.directory)
|
154
155
|
clone = Command.new("git clone #{url} #{work.directory} --recursive")
|
155
156
|
puts clone.summary unless @opts.quiet?
|
@@ -160,7 +161,7 @@ module Raykit
|
|
160
161
|
end
|
161
162
|
if Dir.exist?(work.directory)
|
162
163
|
Dir.chdir(work.directory) do
|
163
|
-
if File.exist?(
|
164
|
+
if File.exist?('rakefile.rb')
|
164
165
|
rake = Raykit::Command.new("rake #{@opts[:task]}")
|
165
166
|
rake.summary(true) if !@opts.quiet? || rake.exitstatus != 0
|
166
167
|
if rake.exitstatus != 0
|
@@ -178,17 +179,17 @@ module Raykit
|
|
178
179
|
end
|
179
180
|
|
180
181
|
def pull
|
181
|
-
pattern =
|
182
|
+
pattern = ''
|
182
183
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
183
184
|
REPOSITORIES.matches(pattern).each do |url|
|
184
185
|
repo = Raykit::Git::Repository.new(url)
|
185
|
-
work = Raykit::Git::Directory.new(repo.get_dev_dir(
|
186
|
-
if Dir.exist?(work.directory) && !work.directory ==
|
186
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir('work'))
|
187
|
+
if Dir.exist?(work.directory) && !work.directory == '.git'
|
187
188
|
Dir.chdir(work.directory) do
|
188
189
|
diff = `git diff`.strip
|
189
190
|
status = `git status`.strip
|
190
|
-
if diff.length.zero? && status.include?(
|
191
|
-
cmd = Command.new(
|
191
|
+
if diff.length.zero? && status.include?('nothing to commit')
|
192
|
+
cmd = Command.new('git pull')
|
192
193
|
cmd.summary if @opts.verbose?
|
193
194
|
|
194
195
|
if cmd.exitstatus != 0
|
@@ -209,9 +210,9 @@ module Raykit
|
|
209
210
|
end
|
210
211
|
|
211
212
|
def import
|
212
|
-
pattern =
|
213
|
+
pattern = ''
|
213
214
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
214
|
-
puts
|
215
|
+
puts 'scanning...'
|
215
216
|
count = REPOSITORIES.length
|
216
217
|
REPOSITORIES.import(pattern)
|
217
218
|
new_count = REPOSITORIES.length - count
|
@@ -219,11 +220,11 @@ module Raykit
|
|
219
220
|
end
|
220
221
|
|
221
222
|
def clean
|
222
|
-
pattern =
|
223
|
+
pattern = ''
|
223
224
|
pattern = @opts.arguments[1] if @opts.arguments.length > 1
|
224
225
|
REPOSITORIES.matches(pattern).each do |url|
|
225
226
|
repo = Raykit::Git::Repository.new(url)
|
226
|
-
work = Raykit::Git::Directory.new(repo.get_dev_dir(
|
227
|
+
work = Raykit::Git::Directory.new(repo.get_dev_dir('work'))
|
227
228
|
next unless Dir.exist?(work.directory)
|
228
229
|
|
229
230
|
puts "removing #{work.directory}"
|
@@ -249,7 +250,7 @@ module Raykit
|
|
249
250
|
|
250
251
|
def copy
|
251
252
|
if @opts.arguments.length < 3
|
252
|
-
puts
|
253
|
+
puts 'source and destination arguments are required for copy'
|
253
254
|
return 1
|
254
255
|
end
|
255
256
|
source = @opts.arguments[1]
|
@@ -264,7 +265,7 @@ module Raykit
|
|
264
265
|
|
265
266
|
begin
|
266
267
|
puts "remote: #{remote}"
|
267
|
-
cmd = Raykit::Rake.run(remote,
|
268
|
+
cmd = Raykit::Rake.run(remote, 'master')
|
268
269
|
elapsed_str = Timer.get_elapsed_str(cmd.elapsed)
|
269
270
|
if cmd.exitstatus.zero?
|
270
271
|
puts "#{elapsed_str} #{Rainbow(SECRETS.hide(cmd.command)).yellow.bright} (#{cmd.directory})"
|
@@ -272,11 +273,11 @@ module Raykit
|
|
272
273
|
puts "\r\n#{cmd.command}\r\n"
|
273
274
|
puts "\r\n#{cmd.output}\r\n"
|
274
275
|
puts "\r\n#{cmd.error}\r\n"
|
275
|
-
puts
|
276
|
+
puts ''
|
276
277
|
puts "#{Rainbow(elapsed_str).red.bright} #{Rainbow(cmd.command).white}"
|
277
278
|
end
|
278
279
|
rescue StandardError
|
279
|
-
puts
|
280
|
+
puts 'rescued...'
|
280
281
|
end
|
281
282
|
end
|
282
283
|
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|
|