raykit 0.0.387 → 0.0.388

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a80020a05d9f3956475e1fb248254ec2555f055311c476aec08fd1b7fc64d60
4
- data.tar.gz: c584d553c7d2a14572671a00856b863e5209a20eec2b16f27230437b3ca0785e
3
+ metadata.gz: 3b11546d1b5398f5248ef90d704add21b831f91ef7a79d38212086262aa3b9cc
4
+ data.tar.gz: 453b28fa4e041b94d05abd069ffdc3f4fa254ed476f2249f60a3865c8b1dac01
5
5
  SHA512:
6
- metadata.gz: b667b122ba6f9e42d9ec5b269ca4cb96585fc7ff161cabcf821284a58a5b72b0ccc844e6f70ca9a357e4b380b9038f6f594a5ec73bd817713d7bcc0d421f2be1
7
- data.tar.gz: 57d45c0c24b2687429b97fd2ec9ca1ec2505bc853868709fe57adffeb33187ff0a9d7fbdb94047be7379ab4f022d30a39ffd74bff38c12c780d8f390d6ff9208
6
+ metadata.gz: a823d9b9b52e8fe70789b847521cf5ec368e58f555edf4843798bff487d8d5e4455062f0a083a097612ceb3cc4e2bdf6803417b266b0f4c51ae14bd7af27de80
7
+ data.tar.gz: 80beabddb4f3bba256d48db6f9f3358163a63ea36f3198f7e7f438e717865b8f4266587fa5f8ef67db02b31503d0eacdaba793fce5ae983d8273cbe4f521794b
data/README.md CHANGED
@@ -4,3 +4,5 @@ ruby gem supporting rake ci/cd tasks
4
4
 
5
5
  ## raykit console application
6
6
 
7
+ # TODO
8
+ - consider using https://github.com/tj/terminal-table to display name value pairs
@@ -224,6 +224,16 @@ module Raykit
224
224
  end
225
225
  end
226
226
 
227
+ def to_markdown
228
+ checkmark = "\u2713"
229
+ error = "\u0058"
230
+ symbol = checkmark.encode("utf-8")
231
+ symbol = error.encode("utf-8") if @exitstatus != 0
232
+ cmd = "#{SECRETS.hide(@command)}"
233
+ md = "#{symbol} #{SECRETS.hide(@command)} (#{elapsed_str})"
234
+ md
235
+ end
236
+
227
237
  def save
228
238
  filename = "#{Environment.get_dev_dir("log")}/Commands/#{SecureRandom.uuid}"
229
239
  log_dir = File.dirname(filename)
@@ -134,6 +134,20 @@ module Raykit
134
134
  run(cmd)
135
135
  end
136
136
  end
137
+
138
+ def self.make(url, commit_id, command)
139
+ repo = Raykit::Git::Repository.new(url)
140
+ make_dir = roam.get_dev_dir("make") + "/" + commit_id
141
+ FileUtils.mkdir_p(roam.get_dev_dir("make")) if !Dir.exists?(roam.get_dev_dir("make"))
142
+ run("git clone #{url} #{make_dir}") if (!Dir.exists?(make_dir))
143
+ cmd = 0
144
+ Dir.chdir(make_dir) do
145
+ run("git checkout #{commit_id}")
146
+ cmd = run(command)
147
+ end
148
+ FileUtils.rm_rf(make_dir) if (cmd.exitstatus == 0)
149
+ cmd
150
+ end
137
151
  end
138
152
  end
139
153
  end
data/lib/raykit/log.rb CHANGED
@@ -42,10 +42,12 @@ module Raykit
42
42
 
43
43
  def self.start_task(task_name)
44
44
  puts Rainbow(": #{task_name}").blue.bright
45
+ MARKDOWN.puts(": #{task_name}")
45
46
  end
46
47
 
47
48
  def self.show_value(name, value)
48
49
  puts " " + Rainbow(name).cyan + " " + Rainbow("#{value}").white.bold
50
+ MARKDOWN.puts("#{name} #{value}")
49
51
  end
50
52
  end
51
53
  end
@@ -0,0 +1,23 @@
1
+ module Raykit
2
+ class Markdown
3
+ attr_accessor :text
4
+
5
+ def initialize()
6
+ @text = ""
7
+ end
8
+
9
+ def puts(line)
10
+ @text = @text + "\n" + line
11
+ end
12
+
13
+ def to_s()
14
+ @text
15
+ end
16
+
17
+ def save_as(filename)
18
+ File.write("rake.md", @text)
19
+ end
20
+ end
21
+ end
22
+
23
+ MARKDOWN = Raykit::Markdown.new
@@ -14,6 +14,8 @@ module Raykit
14
14
  @repository
15
15
  @git_directory
16
16
  @timeout
17
+ @values
18
+ @commands
17
19
 
18
20
  # @log
19
21
  # @commit_message_filename
@@ -53,6 +55,8 @@ module Raykit
53
55
  end
54
56
  end
55
57
  @repository = Raykit::Git::Repository.new(@remote)
58
+ @values = Hash::new()
59
+ @commands = Array::new()
56
60
  end
57
61
 
58
62
  def get_dev_dir(subdir)
@@ -75,6 +79,10 @@ module Raykit
75
79
  @git_directory.branch
76
80
  end
77
81
 
82
+ def values
83
+ @values
84
+ end
85
+
78
86
  # latest local commit
79
87
  def latest_commit
80
88
  return "" if detached?
@@ -211,9 +219,28 @@ module Raykit
211
219
  self
212
220
  end
213
221
 
222
+ def to_markdown()
223
+ md = "# #{@name}"
224
+ md += get_markdown_nvp("Name", "Value", " ")
225
+ md += get_markdown_nvp("-", "-", "-")
226
+ md += get_markdown_nvp("Version", "#{@version}", " ")
227
+ md += get_markdown_nvp("Machine", "#{Raykit::Environment::machine}", " ")
228
+ md += get_markdown_nvp("User", "#{Raykit::Environment::user}", " ")
229
+ @values.each do |key, value|
230
+ md += get_markdown_nvp(key, value, " ")
231
+ end
232
+ @commands.each do |cmd|
233
+ md = md + "\n" + cmd.to_markdown
234
+ end
235
+ md
236
+ end
237
+
238
+ def get_markdown_nvp(key, value, pad_char)
239
+ "\n| " + key.to_s.ljust(36, pad_char) + "| " + value.to_s.ljust(36, pad_char)
240
+ end
241
+
214
242
  def summary
215
243
  info if @verbose
216
-
217
244
  puts "[#{elapsed}] #{Rainbow(@name).yellow.bright} #{Rainbow(version).yellow.bright}"
218
245
  end
219
246
 
@@ -295,13 +322,12 @@ module Raykit
295
322
  else
296
323
  # display error details
297
324
  cmd.details
298
- #puts cmd.output
299
- #$stderr.puts cmd.error
300
325
  if quit_on_failure
301
326
  abort
302
327
  end
303
328
  end
304
329
  cmd.save
330
+ @commands << cmd
305
331
  cmd
306
332
  end
307
333
  end
data/lib/raykit.rb CHANGED
@@ -10,6 +10,7 @@ lib_dir = File.dirname(__FILE__)
10
10
  Dir.glob("#{lib_dir}/raykit/**/*.rb").sort.each { |file| require file }
11
11
 
12
12
  PROJECT = Raykit::Project.new
13
+
13
14
  SECRETS = Raykit::Secrets.new
14
15
 
15
16
  REPOSITORIES = Raykit::Git::Repositories.new("#{Raykit::Environment.get_dev_dir("log")}/Raykit.Git.Repositories.json")
@@ -38,6 +39,7 @@ if defined?(RAYKIT_GLOBALS)
38
39
 
39
40
  def show_value(name, value)
40
41
  Raykit::Log.show_value(name, value)
42
+ PROJECT.values[name] = value
41
43
  end
42
44
 
43
45
  def copy_files(src_dir, target_dir, glob)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.387
4
+ version: 0.0.388
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-13 00:00:00.000000000 Z
11
+ date: 2022-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -107,6 +107,7 @@ files:
107
107
  - lib/raykit/log.rb
108
108
  - lib/raykit/logevent.rb
109
109
  - lib/raykit/logging.rb
110
+ - lib/raykit/markdown.rb
110
111
  - lib/raykit/msbuild.rb
111
112
  - lib/raykit/nugetpackage.rb
112
113
  - lib/raykit/nunit.rb