raykit 0.0.543 → 0.0.544

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +25 -25
  4. data/bin/raykit +6 -6
  5. data/lib/raykit/auto_setup.rb +69 -69
  6. data/lib/raykit/command.rb +374 -374
  7. data/lib/raykit/conan/buildinfo.rb +69 -69
  8. data/lib/raykit/conanpackage.rb +49 -49
  9. data/lib/raykit/configuration.rb +53 -53
  10. data/lib/raykit/console.rb +310 -310
  11. data/lib/raykit/default_content.rb +8 -8
  12. data/lib/raykit/default_content.txt +219 -219
  13. data/lib/raykit/dir.rb +127 -127
  14. data/lib/raykit/dotnet.rb +174 -174
  15. data/lib/raykit/environment.rb +115 -115
  16. data/lib/raykit/filesystem.rb +34 -34
  17. data/lib/raykit/git/commit.rb +16 -16
  18. data/lib/raykit/git/directory.rb +279 -279
  19. data/lib/raykit/git/files.rb +46 -46
  20. data/lib/raykit/git/repositories.rb +89 -89
  21. data/lib/raykit/git/repository.rb +362 -362
  22. data/lib/raykit/installer.rb +17 -17
  23. data/lib/raykit/log.rb +80 -80
  24. data/lib/raykit/logevent.rb +29 -29
  25. data/lib/raykit/logger.rb +100 -100
  26. data/lib/raykit/logging.rb +57 -57
  27. data/lib/raykit/markdown.rb +21 -21
  28. data/lib/raykit/msbuild.rb +54 -54
  29. data/lib/raykit/nugetpackage.rb +54 -54
  30. data/lib/raykit/nunit.rb +13 -13
  31. data/lib/raykit/project.rb +343 -343
  32. data/lib/raykit/rake.rb +39 -39
  33. data/lib/raykit/runner.rb +42 -42
  34. data/lib/raykit/secrets.rb +38 -38
  35. data/lib/raykit/sourceImport.rb +76 -76
  36. data/lib/raykit/sourceImports.rb +43 -43
  37. data/lib/raykit/string.rb +18 -18
  38. data/lib/raykit/symbols.rb +115 -115
  39. data/lib/raykit/tasks.rb +91 -91
  40. data/lib/raykit/text.rb +32 -32
  41. data/lib/raykit/timer.rb +31 -31
  42. data/lib/raykit/version.rb +97 -95
  43. data/lib/raykit/vstest.rb +24 -24
  44. data/lib/raykit/wix.rb +61 -61
  45. data/lib/raykit/wt.rb +28 -28
  46. data/lib/raykit/zip.rb +73 -73
  47. data/lib/raykit.rb +143 -140
  48. metadata +3 -3
data/lib/raykit.rb CHANGED
@@ -1,140 +1,143 @@
1
- # frozen_string_literal: true
2
-
3
- require "rainbow"
4
- require "rake/clean"
5
- require "open3"
6
- require "rake/testtask"
7
- require "digest"
8
-
9
- # Constants
10
- BUFFER_SIZE = 1024 unless defined?(BUFFER_SIZE)
11
- RAKE_DIRECTORY = Rake.application.original_dir unless defined?(RAKE_DIRECTORY)
12
- DEFAULT_SUBDIRECTORIES = %w[src test examples] unless defined?(DEFAULT_SUBDIRECTORIES)
13
- DEFAULT_FILES = %w[README.md LICENSE.md .gitignore] unless defined?(DEFAULT_FILES)
14
- RAYKIT_GLOBALS = true unless defined?(RAYKIT_GLOBALS)
15
- RAYKIT_AUTO_SETUP = false unless defined?(RAYKIT_AUTO_SETUP)
16
- LOG_FILENAME = ARGV.empty? ? "log/rake.txt" : "log/rake.#{ARGV.join(".")}.txt"
17
-
18
- # Load all the files in the raykit directory
19
-
20
- lib_dir = File.dirname(__FILE__)
21
- Dir.glob("#{lib_dir}/raykit/**/*.rb").sort.each { |file| require file }
22
-
23
- # Constants
24
- DEV_ROOT = Raykit::Environment::root_dir
25
- DEFAULT_GITIGNORE_CONTENT = Raykit::DefaultContent::gitignore unless defined?(DEFAULT_GITIGNORE_CONTENT)
26
- PROJECT = Raykit::Project.new
27
- SECRETS = Raykit::Secrets.new
28
- REPOSITORIES = Raykit::Git::Repositories.new("#{Raykit::Environment.get_dev_dir("log")}/Raykit.Git.Repositories.json")
29
- GIT_DIRECTORY = Raykit::Git::Directory.new(Rake.application.original_dir)
30
- NUGET_DIR = Raykit::Environment::get_dev_dir("nuget")
31
- PUBLISH_DIR = Raykit::Environment::get_dev_dir("publish")
32
- ARTIFACTS_DIR = Raykit::Environment::get_dev_dir("artifacts")
33
-
34
- LAST_MODIFIED_SOURCE_FILE = GIT_DIRECTORY.last_modified_src_file
35
- LAST_MODIFIED_SOURCE_TIME = GIT_DIRECTORY.last_modified_src_time
36
- LAST_MODIFIED_FILE = GIT_DIRECTORY.last_modified_filename
37
- LAST_MODIFIED_TIME = GIT_DIRECTORY.last_modified_time
38
- LAST_MODIFIED_ARTIFACT_TIME = GIT_DIRECTORY.last_modified_artifact_time
39
-
40
- LOG = Raykit::Logging.new
41
- MARKDOWN = Raykit::Markdown.new
42
-
43
- Raykit::MsBuild::fix_msbuild_path
44
-
45
- File.write(".gitignore", DEFAULT_GITIGNORE_CONTENT) unless File.exist?(".gitignore")
46
- Raykit::AutoSetup.run if RAYKIT_AUTO_SETUP
47
-
48
- def backup_git_directory
49
- if ENV["GIT_BACKUP_DIR"] && !ENV["GIT_BACKUP_DIR"].empty?
50
- puts "Backing up #{GIT_DIRECTORY.repository.url}"
51
- Raykit::Git::Repository::backup GIT_DIRECTORY.repository.url, "#{ENV["GIT_BACKUP_DIR"]}/#{GIT_DIRECTORY.repository.relative_path}"
52
- else
53
- puts "Environment variable GIT_BACKUP_DIR is not set"
54
- end
55
- end
56
-
57
- # include Raykit::TopLevel to make run method accessible from the global scope
58
- module Raykit
59
- module TopLevel
60
- def self.run(command, quit_on_failure = true)
61
- PROJECT.run(command, quit_on_failure)
62
- end
63
- end
64
- end
65
-
66
- if defined?(RAYKIT_GLOBALS)
67
- def run(command, quit_on_failure = true)
68
- Raykit::TopLevel.run(command, quit_on_failure)
69
- end
70
-
71
- def run_details(command)
72
- cmd = Raykit::Command.new(command).run
73
- cmd.details
74
- end
75
-
76
- def try(command)
77
- Raykit::TopLevel.run(command, false)
78
- end
79
-
80
- def dir(name)
81
- FileUtils.mkdir("artifacts") if (!Dir.exist?(name))
82
- end
83
-
84
- def make(artifact, command)
85
- if (File.exist?(artifact))
86
- puts " #{artifact} exists"
87
- else
88
- cmd = run(command)
89
- if (cmd.exitstatus != 0)
90
- File.delete(artifact) if (File.exist?(artifact))
91
- end
92
- cmd
93
- end
94
- end
95
-
96
- def make_log(artifact, command)
97
- if (File.exist?(artifact))
98
- puts " #{artifact} exists"
99
- else
100
- cmd = run(command).log_to_file(artifact)
101
- if (cmd.exitstatus != 0)
102
- File.delete(artifact) if (File.exist?(artifact))
103
- end
104
- cmd
105
- end
106
- end
107
-
108
- def tag(name)
109
- puts Rainbow(": #{name}").blue.bright
110
- end
111
-
112
- def start_task(task_name)
113
- Raykit::Log.start_task(task_name)
114
- end
115
-
116
- def show(symbol)
117
- show_binding(symbol, binding)
118
- end
119
-
120
- def show_binding(symbol, the_binding)
121
- show_value symbol.to_s, eval(symbol.to_s, the_binding)
122
- end
123
-
124
- def show_value(name, value)
125
- Raykit::Log.show_value(name, value)
126
- PROJECT.values[name] = value
127
- end
128
-
129
- def show_table(symbols)
130
- Raykit::Log.show_table(symbols)
131
- end
132
-
133
- def copy_files(src_dir, target_dir, glob)
134
- Raykit::FileSystem::copy_files(src_dir, target_dir, glob)
135
- end
136
-
137
- def copy_file_to_dir(file, dir)
138
- Raykit::FileSystem::copy_file_to_dir(file, dir)
139
- end
140
- end # if defined?(RAYKIT_GLOBALS)
1
+ # frozen_string_literal: true
2
+
3
+ require "rainbow"
4
+ require "rake/clean"
5
+ require "open3"
6
+ require "rake/testtask"
7
+ require "digest"
8
+
9
+ # Constants
10
+ BUFFER_SIZE = 1024 unless defined?(BUFFER_SIZE)
11
+ RAKE_DIRECTORY = Rake.application.original_dir unless defined?(RAKE_DIRECTORY)
12
+ DEFAULT_SUBDIRECTORIES = %w[src test examples] unless defined?(DEFAULT_SUBDIRECTORIES)
13
+ DEFAULT_FILES = %w[README.md LICENSE.md .gitignore] unless defined?(DEFAULT_FILES)
14
+ RAYKIT_GLOBALS = true unless defined?(RAYKIT_GLOBALS)
15
+ RAYKIT_AUTO_SETUP = false unless defined?(RAYKIT_AUTO_SETUP)
16
+ LOG_FILENAME = ARGV.empty? ? "log/rake.txt" : "log/rake.#{ARGV.join(".")}.txt"
17
+
18
+ # Load all the files in the raykit directory
19
+
20
+ lib_dir = File.dirname(__FILE__)
21
+ Dir.glob("#{lib_dir}/raykit/**/*.rb").sort.each { |file| require file }
22
+
23
+ # Constants
24
+ DEV_ROOT = Raykit::Environment::root_dir
25
+ DEFAULT_GITIGNORE_CONTENT = Raykit::DefaultContent::gitignore unless defined?(DEFAULT_GITIGNORE_CONTENT)
26
+ unless defined?(VERSION)
27
+ VERSION = Raykit::Version.detect(File.basename(RAKE_DIRECTORY))
28
+ end
29
+ PROJECT = Raykit::Project.new
30
+ SECRETS = Raykit::Secrets.new
31
+ REPOSITORIES = Raykit::Git::Repositories.new("#{Raykit::Environment.get_dev_dir("log")}/Raykit.Git.Repositories.json")
32
+ GIT_DIRECTORY = Raykit::Git::Directory.new(Rake.application.original_dir)
33
+ NUGET_DIR = Raykit::Environment::get_dev_dir("nuget")
34
+ PUBLISH_DIR = Raykit::Environment::get_dev_dir("publish")
35
+ ARTIFACTS_DIR = Raykit::Environment::get_dev_dir("artifacts")
36
+
37
+ LAST_MODIFIED_SOURCE_FILE = GIT_DIRECTORY.last_modified_src_file
38
+ LAST_MODIFIED_SOURCE_TIME = GIT_DIRECTORY.last_modified_src_time
39
+ LAST_MODIFIED_FILE = GIT_DIRECTORY.last_modified_filename
40
+ LAST_MODIFIED_TIME = GIT_DIRECTORY.last_modified_time
41
+ LAST_MODIFIED_ARTIFACT_TIME = GIT_DIRECTORY.last_modified_artifact_time
42
+
43
+ LOG = Raykit::Logging.new
44
+ MARKDOWN = Raykit::Markdown.new
45
+
46
+ Raykit::MsBuild::fix_msbuild_path
47
+
48
+ File.write(".gitignore", DEFAULT_GITIGNORE_CONTENT) unless File.exist?(".gitignore")
49
+ Raykit::AutoSetup.run if RAYKIT_AUTO_SETUP
50
+
51
+ def backup_git_directory
52
+ if ENV["GIT_BACKUP_DIR"] && !ENV["GIT_BACKUP_DIR"].empty?
53
+ puts "Backing up #{GIT_DIRECTORY.repository.url}"
54
+ Raykit::Git::Repository::backup GIT_DIRECTORY.repository.url, "#{ENV["GIT_BACKUP_DIR"]}/#{GIT_DIRECTORY.repository.relative_path}"
55
+ else
56
+ puts "Environment variable GIT_BACKUP_DIR is not set"
57
+ end
58
+ end
59
+
60
+ # include Raykit::TopLevel to make run method accessible from the global scope
61
+ module Raykit
62
+ module TopLevel
63
+ def self.run(command, quit_on_failure = true)
64
+ PROJECT.run(command, quit_on_failure)
65
+ end
66
+ end
67
+ end
68
+
69
+ if defined?(RAYKIT_GLOBALS)
70
+ def run(command, quit_on_failure = true)
71
+ Raykit::TopLevel.run(command, quit_on_failure)
72
+ end
73
+
74
+ def run_details(command)
75
+ cmd = Raykit::Command.new(command).run
76
+ cmd.details
77
+ end
78
+
79
+ def try(command)
80
+ Raykit::TopLevel.run(command, false)
81
+ end
82
+
83
+ def dir(name)
84
+ FileUtils.mkdir("artifacts") if (!Dir.exist?(name))
85
+ end
86
+
87
+ def make(artifact, command)
88
+ if (File.exist?(artifact))
89
+ puts " #{artifact} exists"
90
+ else
91
+ cmd = run(command)
92
+ if (cmd.exitstatus != 0)
93
+ File.delete(artifact) if (File.exist?(artifact))
94
+ end
95
+ cmd
96
+ end
97
+ end
98
+
99
+ def make_log(artifact, command)
100
+ if (File.exist?(artifact))
101
+ puts " #{artifact} exists"
102
+ else
103
+ cmd = run(command).log_to_file(artifact)
104
+ if (cmd.exitstatus != 0)
105
+ File.delete(artifact) if (File.exist?(artifact))
106
+ end
107
+ cmd
108
+ end
109
+ end
110
+
111
+ def tag(name)
112
+ puts Rainbow(": #{name}").blue.bright
113
+ end
114
+
115
+ def start_task(task_name)
116
+ Raykit::Log.start_task(task_name)
117
+ end
118
+
119
+ def show(symbol)
120
+ show_binding(symbol, binding)
121
+ end
122
+
123
+ def show_binding(symbol, the_binding)
124
+ show_value symbol.to_s, eval(symbol.to_s, the_binding)
125
+ end
126
+
127
+ def show_value(name, value)
128
+ Raykit::Log.show_value(name, value)
129
+ PROJECT.values[name] = value
130
+ end
131
+
132
+ def show_table(symbols)
133
+ Raykit::Log.show_table(symbols)
134
+ end
135
+
136
+ def copy_files(src_dir, target_dir, glob)
137
+ Raykit::FileSystem::copy_files(src_dir, target_dir, glob)
138
+ end
139
+
140
+ def copy_file_to_dir(file, dir)
141
+ Raykit::FileSystem::copy_file_to_dir(file, dir)
142
+ end
143
+ end # if defined?(RAYKIT_GLOBALS)
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.543
4
+ version: 0.0.544
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-12 00:00:00.000000000 Z
11
+ date: 2024-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
- rubygems_version: 3.5.3
155
+ rubygems_version: 3.5.8
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: ruby gem to support rake ci/cd tasks