raykit 0.0.504 → 0.0.505

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) 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 +373 -373
  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 +318 -314
  11. data/lib/raykit/default_content.rb +227 -227
  12. data/lib/raykit/dir.rb +49 -49
  13. data/lib/raykit/dotnet.rb +174 -174
  14. data/lib/raykit/environment.rb +114 -114
  15. data/lib/raykit/filesystem.rb +34 -34
  16. data/lib/raykit/git/commit.rb +16 -16
  17. data/lib/raykit/git/directory.rb +216 -216
  18. data/lib/raykit/git/files.rb +46 -46
  19. data/lib/raykit/git/repositories.rb +89 -89
  20. data/lib/raykit/git/repository.rb +376 -376
  21. data/lib/raykit/installer.rb +17 -17
  22. data/lib/raykit/log.rb +80 -80
  23. data/lib/raykit/logevent.rb +49 -49
  24. data/lib/raykit/logger.rb +98 -0
  25. data/lib/raykit/logging.rb +57 -57
  26. data/lib/raykit/markdown.rb +21 -21
  27. data/lib/raykit/msbuild.rb +54 -54
  28. data/lib/raykit/nugetpackage.rb +54 -54
  29. data/lib/raykit/nunit.rb +13 -13
  30. data/lib/raykit/project.rb +343 -343
  31. data/lib/raykit/rake.rb +39 -39
  32. data/lib/raykit/runner.rb +42 -42
  33. data/lib/raykit/secrets.rb +38 -38
  34. data/lib/raykit/sourceImport.rb +76 -76
  35. data/lib/raykit/sourceImports.rb +43 -43
  36. data/lib/raykit/string.rb +18 -18
  37. data/lib/raykit/symbols.rb +115 -16
  38. data/lib/raykit/tasks.rb +99 -99
  39. data/lib/raykit/text.rb +32 -32
  40. data/lib/raykit/timer.rb +31 -31
  41. data/lib/raykit/version.rb +89 -103
  42. data/lib/raykit/vstest.rb +24 -24
  43. data/lib/raykit/wt.rb +28 -28
  44. data/lib/raykit/zip.rb +73 -73
  45. data/lib/raykit.rb +126 -125
  46. metadata +4 -3
data/lib/raykit/zip.rb CHANGED
@@ -1,73 +1,73 @@
1
- require "zip"
2
-
3
- module Raykit
4
- class Zip
5
- @filename
6
- @source_dir
7
- @include_globs
8
- @exclude_globs
9
-
10
- def initialize(filename)
11
- @filename = filename
12
- @source_dir = Dir.pwd
13
- @include_globs = []
14
- @exclude_globs = []
15
- self
16
- end
17
-
18
- def source_dir(dir)
19
- @source_dir = dir
20
- self
21
- end
22
-
23
- def include_glob(glob)
24
- @include_globs << glob
25
- self
26
- end
27
-
28
- def exclude_glob(glob)
29
- @exclude_globs << glob
30
- self
31
- end
32
-
33
- def zip
34
- path = File.dirname(@filename)
35
- FileUtils.mkdir_p(path) unless Dir.exist?(path)
36
-
37
- files_to_archive = Array::new()
38
- Dir.chdir(@source_dir) do
39
- #include_files = []
40
- @include_globs.each do |include_glob|
41
- Dir.glob(include_glob) { |f|
42
- #puts "\n" + f
43
- files_to_archive << f
44
- }
45
- end
46
- end
47
-
48
- ::Zip::File::open(@filename, ::Zip::File::CREATE) { |zipfile|
49
- count = 0
50
- files_to_archive.each do |file|
51
- zipfile.get_output_stream(file) { |f|
52
- fr = ::File.open("#{@source_dir}/#{file}", "rb")
53
- f.puts(fr.read)
54
- fr.close()
55
- f.close()
56
- count = count + 1
57
- }
58
- end
59
- zipfile.close
60
- puts " added " << count.to_s << " files to " << @filename
61
- }
62
- end
63
-
64
- def self.zip_directory(directory, zipfile_name, overwrite = true)
65
- File.delete(zipfile_name) if File.exist?(zipfile_name) && overwrite
66
- ::Zip::File.open(zipfile_name, ::Zip::File::CREATE) do |zipfile|
67
- Dir[File.join(directory, "**", "**")].each do |file|
68
- zipfile.add(file.sub(directory + "/", ""), file)
69
- end
70
- end
71
- end
72
- end
73
- end
1
+ require "zip"
2
+
3
+ module Raykit
4
+ class Zip
5
+ @filename
6
+ @source_dir
7
+ @include_globs
8
+ @exclude_globs
9
+
10
+ def initialize(filename)
11
+ @filename = filename
12
+ @source_dir = Dir.pwd
13
+ @include_globs = []
14
+ @exclude_globs = []
15
+ self
16
+ end
17
+
18
+ def source_dir(dir)
19
+ @source_dir = dir
20
+ self
21
+ end
22
+
23
+ def include_glob(glob)
24
+ @include_globs << glob
25
+ self
26
+ end
27
+
28
+ def exclude_glob(glob)
29
+ @exclude_globs << glob
30
+ self
31
+ end
32
+
33
+ def zip
34
+ path = File.dirname(@filename)
35
+ FileUtils.mkdir_p(path) unless Dir.exist?(path)
36
+
37
+ files_to_archive = Array::new()
38
+ Dir.chdir(@source_dir) do
39
+ #include_files = []
40
+ @include_globs.each do |include_glob|
41
+ Dir.glob(include_glob) { |f|
42
+ #puts "\n" + f
43
+ files_to_archive << f
44
+ }
45
+ end
46
+ end
47
+
48
+ ::Zip::File::open(@filename, ::Zip::File::CREATE) { |zipfile|
49
+ count = 0
50
+ files_to_archive.each do |file|
51
+ zipfile.get_output_stream(file) { |f|
52
+ fr = ::File.open("#{@source_dir}/#{file}", "rb")
53
+ f.puts(fr.read)
54
+ fr.close()
55
+ f.close()
56
+ count = count + 1
57
+ }
58
+ end
59
+ zipfile.close
60
+ puts " added " << count.to_s << " files to " << @filename
61
+ }
62
+ end
63
+
64
+ def self.zip_directory(directory, zipfile_name, overwrite = true)
65
+ File.delete(zipfile_name) if File.exist?(zipfile_name) && overwrite
66
+ ::Zip::File.open(zipfile_name, ::Zip::File::CREATE) do |zipfile|
67
+ Dir[File.join(directory, "**", "**")].each do |file|
68
+ zipfile.add(file.sub(directory + "/", ""), file)
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
data/lib/raykit.rb CHANGED
@@ -1,125 +1,126 @@
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
-
17
- # Load all the files in the raykit directory
18
-
19
- lib_dir = File.dirname(__FILE__)
20
- Dir.glob("#{lib_dir}/raykit/**/*.rb").sort.each { |file| require file }
21
-
22
- # Constants
23
- DEFAULT_GITIGNORE_CONTENT = Raykit::DefaultContent::gitignore unless defined?(DEFAULT_GITIGNORE_CONTENT)
24
- PROJECT = Raykit::Project.new
25
- SECRETS = Raykit::Secrets.new
26
- REPOSITORIES = Raykit::Git::Repositories.new("#{Raykit::Environment.get_dev_dir("log")}/Raykit.Git.Repositories.json")
27
- GIT_DIRECTORY = Raykit::Git::Directory.new(Rake.application.original_dir)
28
- NUGET_DIR = Raykit::Environment::get_dev_dir("nuget")
29
- PUBLISH_DIR = Raykit::Environment::get_dev_dir("publish")
30
-
31
- LOG = Raykit::Logging.new
32
- MARKDOWN = Raykit::Markdown.new
33
-
34
- Raykit::MsBuild::fix_msbuild_path
35
-
36
- Raykit::AutoSetup.run if RAYKIT_AUTO_SETUP
37
-
38
- def backup_git_directory
39
- if ENV["GIT_BACKUP_DIR"] && !ENV["GIT_BACKUP_DIR"].empty?
40
- puts "Backing up #{GIT_DIRECTORY.repository.url}"
41
- Raykit::Git::Repository::backup GIT_DIRECTORY.repository.url, "#{ENV["GIT_BACKUP_DIR"]}/#{GIT_DIRECTORY.repository.relative_path}"
42
- else
43
- puts "Environment variable GIT_BACKUP_DIR is not set"
44
- end
45
- end
46
-
47
- # include Raykit::TopLevel to make run method accessible from the global scope
48
- module Raykit
49
- module TopLevel
50
- def self.run(command, quit_on_failure = true)
51
- PROJECT.run(command, quit_on_failure)
52
- end
53
- end
54
- end
55
-
56
- if defined?(RAYKIT_GLOBALS)
57
- def run(command, quit_on_failure = true)
58
- Raykit::TopLevel.run(command, quit_on_failure)
59
- end
60
-
61
- def try(command)
62
- Raykit::TopLevel.run(command, false)
63
- end
64
-
65
- def dir(name)
66
- FileUtils.mkdir("artifacts") if (!Dir.exist?(name))
67
- end
68
-
69
- def make(artifact, command)
70
- if (File.exist?(artifact))
71
- puts " #{artifact} exists"
72
- else
73
- cmd = run(command)
74
- if (cmd.exitstatus != 0)
75
- File.delete(artifact) if (File.exist?(artifact))
76
- end
77
- cmd
78
- end
79
- end
80
-
81
- def make_log(artifact, command)
82
- if (File.exist?(artifact))
83
- puts " #{artifact} exists"
84
- else
85
- cmd = run(command).log_to_file(artifact)
86
- if (cmd.exitstatus != 0)
87
- File.delete(artifact) if (File.exist?(artifact))
88
- end
89
- cmd
90
- end
91
- end
92
-
93
- def tag(name)
94
- puts Rainbow(": #{name}").blue.bright
95
- end
96
-
97
- def start_task(task_name)
98
- Raykit::Log.start_task(task_name)
99
- end
100
-
101
- def show(symbol)
102
- show_binding(symbol, binding)
103
- end
104
-
105
- def show_binding(symbol, the_binding)
106
- show_value symbol.to_s, eval(symbol.to_s, the_binding)
107
- end
108
-
109
- def show_value(name, value)
110
- Raykit::Log.show_value(name, value)
111
- PROJECT.values[name] = value
112
- end
113
-
114
- def show_table(symbols)
115
- Raykit::Log.show_table(symbols)
116
- end
117
-
118
- def copy_files(src_dir, target_dir, glob)
119
- Raykit::FileSystem::copy_files(src_dir, target_dir, glob)
120
- end
121
-
122
- def copy_file_to_dir(file, dir)
123
- Raykit::FileSystem::copy_file_to_dir(file, dir)
124
- end
125
- 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
+ DEFAULT_GITIGNORE_CONTENT = Raykit::DefaultContent::gitignore unless defined?(DEFAULT_GITIGNORE_CONTENT)
25
+ PROJECT = Raykit::Project.new
26
+ SECRETS = Raykit::Secrets.new
27
+ REPOSITORIES = Raykit::Git::Repositories.new("#{Raykit::Environment.get_dev_dir("log")}/Raykit.Git.Repositories.json")
28
+ GIT_DIRECTORY = Raykit::Git::Directory.new(Rake.application.original_dir)
29
+ NUGET_DIR = Raykit::Environment::get_dev_dir("nuget")
30
+ PUBLISH_DIR = Raykit::Environment::get_dev_dir("publish")
31
+
32
+ LOG = Raykit::Logging.new
33
+ MARKDOWN = Raykit::Markdown.new
34
+
35
+ Raykit::MsBuild::fix_msbuild_path
36
+
37
+ Raykit::AutoSetup.run if RAYKIT_AUTO_SETUP
38
+
39
+ def backup_git_directory
40
+ if ENV["GIT_BACKUP_DIR"] && !ENV["GIT_BACKUP_DIR"].empty?
41
+ puts "Backing up #{GIT_DIRECTORY.repository.url}"
42
+ Raykit::Git::Repository::backup GIT_DIRECTORY.repository.url, "#{ENV["GIT_BACKUP_DIR"]}/#{GIT_DIRECTORY.repository.relative_path}"
43
+ else
44
+ puts "Environment variable GIT_BACKUP_DIR is not set"
45
+ end
46
+ end
47
+
48
+ # include Raykit::TopLevel to make run method accessible from the global scope
49
+ module Raykit
50
+ module TopLevel
51
+ def self.run(command, quit_on_failure = true)
52
+ PROJECT.run(command, quit_on_failure)
53
+ end
54
+ end
55
+ end
56
+
57
+ if defined?(RAYKIT_GLOBALS)
58
+ def run(command, quit_on_failure = true)
59
+ Raykit::TopLevel.run(command, quit_on_failure)
60
+ end
61
+
62
+ def try(command)
63
+ Raykit::TopLevel.run(command, false)
64
+ end
65
+
66
+ def dir(name)
67
+ FileUtils.mkdir("artifacts") if (!Dir.exist?(name))
68
+ end
69
+
70
+ def make(artifact, command)
71
+ if (File.exist?(artifact))
72
+ puts " #{artifact} exists"
73
+ else
74
+ cmd = run(command)
75
+ if (cmd.exitstatus != 0)
76
+ File.delete(artifact) if (File.exist?(artifact))
77
+ end
78
+ cmd
79
+ end
80
+ end
81
+
82
+ def make_log(artifact, command)
83
+ if (File.exist?(artifact))
84
+ puts " #{artifact} exists"
85
+ else
86
+ cmd = run(command).log_to_file(artifact)
87
+ if (cmd.exitstatus != 0)
88
+ File.delete(artifact) if (File.exist?(artifact))
89
+ end
90
+ cmd
91
+ end
92
+ end
93
+
94
+ def tag(name)
95
+ puts Rainbow(": #{name}").blue.bright
96
+ end
97
+
98
+ def start_task(task_name)
99
+ Raykit::Log.start_task(task_name)
100
+ end
101
+
102
+ def show(symbol)
103
+ show_binding(symbol, binding)
104
+ end
105
+
106
+ def show_binding(symbol, the_binding)
107
+ show_value symbol.to_s, eval(symbol.to_s, the_binding)
108
+ end
109
+
110
+ def show_value(name, value)
111
+ Raykit::Log.show_value(name, value)
112
+ PROJECT.values[name] = value
113
+ end
114
+
115
+ def show_table(symbols)
116
+ Raykit::Log.show_table(symbols)
117
+ end
118
+
119
+ def copy_files(src_dir, target_dir, glob)
120
+ Raykit::FileSystem::copy_files(src_dir, target_dir, glob)
121
+ end
122
+
123
+ def copy_file_to_dir(file, dir)
124
+ Raykit::FileSystem::copy_file_to_dir(file, dir)
125
+ end
126
+ 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.504
4
+ version: 0.0.505
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-03 00:00:00.000000000 Z
11
+ date: 2023-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -110,6 +110,7 @@ files:
110
110
  - lib/raykit/installer.rb
111
111
  - lib/raykit/log.rb
112
112
  - lib/raykit/logevent.rb
113
+ - lib/raykit/logger.rb
113
114
  - lib/raykit/logging.rb
114
115
  - lib/raykit/markdown.rb
115
116
  - lib/raykit/msbuild.rb
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  - !ruby/object:Gem::Version
150
151
  version: '0'
151
152
  requirements: []
152
- rubygems_version: 3.4.20
153
+ rubygems_version: 3.3.7
153
154
  signing_key:
154
155
  specification_version: 4
155
156
  summary: ruby gem to support rake ci/cd tasks