makit 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.makit.project.json +4 -0
  3. data/.makit.project.yml +2 -0
  4. data/.rubocop.yml +22 -0
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +8 -0
  7. data/CODE_OF_CONDUCT.md +84 -0
  8. data/LICENSE +21 -0
  9. data/README.md +119 -0
  10. data/Rakefile +190 -0
  11. data/docs/Commands.md +50 -0
  12. data/docs_/Commands.md +166 -0
  13. data/docs_/Minitest.Timeouts.md +332 -0
  14. data/examples/protoc/Rakefile +31 -0
  15. data/examples/rake_default/Rakefile +5 -0
  16. data/examples/rubygem-foo/.gitkeep +0 -0
  17. data/examples/rubygem-foo/Rakefile +3 -0
  18. data/examples/run_mp/Rakefile +8 -0
  19. data/exe/makit +5 -0
  20. data/lib/makit/apache.rb +32 -0
  21. data/lib/makit/cli/clean.rb +14 -0
  22. data/lib/makit/cli/clone.rb +59 -0
  23. data/lib/makit/cli/init.rb +38 -0
  24. data/lib/makit/cli/main.rb +33 -0
  25. data/lib/makit/cli/make.rb +54 -0
  26. data/lib/makit/cli/new.rb +37 -0
  27. data/lib/makit/cli/nuget_cache.rb +38 -0
  28. data/lib/makit/cli/pull.rb +31 -0
  29. data/lib/makit/cli/setup.rb +71 -0
  30. data/lib/makit/cli/work.rb +21 -0
  31. data/lib/makit/command_runner.rb +237 -0
  32. data/lib/makit/commands.rb +21 -0
  33. data/lib/makit/content/default_gitignore.rb +5 -0
  34. data/lib/makit/content/default_gitignore.txt +222 -0
  35. data/lib/makit/content/default_rakefile.rb +11 -0
  36. data/lib/makit/content/gem_rakefile.rb +14 -0
  37. data/lib/makit/content/ruby_gitlab-ci.yml +15 -0
  38. data/lib/makit/data.rb +50 -0
  39. data/lib/makit/directories.rb +140 -0
  40. data/lib/makit/directory.rb +120 -0
  41. data/lib/makit/dotnet.rb +16 -0
  42. data/lib/makit/environment.rb +123 -0
  43. data/lib/makit/files.rb +47 -0
  44. data/lib/makit/git.rb +66 -0
  45. data/lib/makit/gitlab_runner.rb +60 -0
  46. data/lib/makit/humanize.rb +89 -0
  47. data/lib/makit/logging.rb +96 -0
  48. data/lib/makit/markdown.rb +75 -0
  49. data/lib/makit/mp/basic_object_mp.rb +16 -0
  50. data/lib/makit/mp/project_mp.rb +160 -0
  51. data/lib/makit/mp/string_mp.rb +101 -0
  52. data/lib/makit/nuget.rb +57 -0
  53. data/lib/makit/protoc.rb +61 -0
  54. data/lib/makit/serializer.rb +70 -0
  55. data/lib/makit/storage.rb +131 -0
  56. data/lib/makit/symbols.rb +149 -0
  57. data/lib/makit/tasks.rb +63 -0
  58. data/lib/makit/tree.rb +37 -0
  59. data/lib/makit/v1/makit.v1.proto +103 -0
  60. data/lib/makit/v1/makit.v1_pb.rb +30 -0
  61. data/lib/makit/v1/makit.v1_services_pb.rb +26 -0
  62. data/lib/makit/version.rb +12 -0
  63. data/lib/makit/wix.rb +92 -0
  64. data/lib/makit/zip.rb +17 -0
  65. data/lib/makit.rb +243 -0
  66. data/makit.generated.sln +30 -0
  67. data/makit.sln +69 -0
  68. data/pages/.gitignore +5 -0
  69. data/pages/404.html +25 -0
  70. data/pages/Gemfile +33 -0
  71. data/pages/Gemfile.lock +88 -0
  72. data/pages/_config.yml +55 -0
  73. data/pages/_layouts/default.html +1 -0
  74. data/pages/_posts/2024-10-05-welcome-to-jekyll.markdown +29 -0
  75. data/pages/about.markdown +18 -0
  76. data/pages/index.markdown +6 -0
  77. data/sig/makit.rbs +4 -0
  78. data/src/ClassLib/Class1.cs +6 -0
  79. data/src/ClassLib/ClassLib.csproj +13 -0
  80. metadata +251 -0
@@ -0,0 +1,222 @@
1
+ # General
2
+ [Aa]rtifacts/
3
+ [Ii]ntermediate/
4
+ [Gg]enerated/
5
+ third_party/
6
+
7
+ # Ruby
8
+ *.gem
9
+ *.rbc
10
+ /.config
11
+ /coverage/
12
+ /InstalledFiles
13
+ /pkg/
14
+ /spec/reports/
15
+ /spec/examples.txt
16
+ /test/tmp/
17
+ /test/version_tmp/
18
+ /tmp/
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+ /.bundle/
24
+ /vendor/bundle
25
+ /lib/bundler/man/
26
+ .rvmrc
27
+
28
+ # Rust
29
+ /target/
30
+ Cargo.lock
31
+ **/*.rs.bk
32
+ /target
33
+ /Cargo.lock
34
+
35
+ # DotNet
36
+ *.rsuser
37
+ *.suo
38
+ *.user
39
+ *.userosscache
40
+ *.sln.docstates
41
+ *.txt
42
+ *.userprefs
43
+ BenchmarkDotNet.Artifacts/
44
+ [Dd]ebug/
45
+ [Dd]ebugPublic/
46
+ [Rr]elease/
47
+ [Rr]eleases/
48
+ x64/
49
+ x86/
50
+ [Aa][Rr][Mm]/
51
+ [Aa][Rr][Mm]64/
52
+ bld/
53
+ [Bb]in/
54
+ [Oo]bj/
55
+ [Ll]og/
56
+ [Aa]rtifacts/
57
+ .vs/
58
+ Generated\ Files/
59
+ [Tt]est[Rr]esult*/
60
+ [Bb]uild[Ll]og.*
61
+ *.VisualState.xml
62
+ TestResult.xml
63
+ [Dd]ebugPS/
64
+ [Rr]eleasePS/
65
+ dlldata.c
66
+ BenchmarkDotNet.Artifacts/
67
+
68
+ project.lock.json
69
+ project.fragment.lock.json
70
+ artifacts/
71
+ StyleCopReport.xml
72
+ *_i.c
73
+ *_p.c
74
+ *_h.h
75
+ *.ilk
76
+ *.meta
77
+ *.obj
78
+ *.iobj
79
+ *.pch
80
+ *.pdb
81
+ *.ipdb
82
+ *.pgc
83
+ *.pgd
84
+ *.rsp
85
+ *.sbr
86
+ *.tlb
87
+ *.tli
88
+ *.tlh
89
+ *.tmp
90
+ *.tmp_proj
91
+ *_wpftmp.csproj
92
+ *.log
93
+ *.vspscc
94
+ *.vssscc
95
+ .builds
96
+ *.pidb
97
+ *.svclog
98
+ *.scc
99
+ _Chutzpah*
100
+ ipch/
101
+ *.aps
102
+ *.ncb
103
+ *.opendb
104
+ *.opensdf
105
+ *.sdf
106
+ *.cachefile
107
+ *.VC.db
108
+ *.VC.VC.opendb
109
+ *.psess
110
+ *.vsp
111
+ *.vspx
112
+ *.sap
113
+ *.e2e
114
+ $tf/
115
+ *.gpState
116
+ _ReSharper*/
117
+ *.[Rr]e[Ss]harper
118
+ *.DotSettings.user
119
+ .JustCode
120
+ _TeamCity*
121
+ *.dotCover
122
+ .axoCover/*
123
+ !.axoCover/settings.json
124
+ *.coverage
125
+ *.coveragexml
126
+ _NCrunch_*
127
+ .*crunch*.local.xml
128
+ nCrunchTemp_*
129
+ *.mm.*
130
+ AutoTest.Net/
131
+ .sass-cache/
132
+ [Ee]xpress/
133
+ DocProject/buildhelp/
134
+ DocProject/Help/*.HxT
135
+ DocProject/Help/*.HxC
136
+ DocProject/Help/*.hhc
137
+ DocProject/Help/*.hhk
138
+ DocProject/Help/*.hhp
139
+ DocProject/Help/Html2
140
+ DocProject/Help/html
141
+ publish/
142
+ *.[Pp]ublish.xml
143
+ *.azurePubxml
144
+ *.pubxml
145
+ *.publishproj
146
+ PublishScripts/
147
+ *.nupkg
148
+ **/[Pp]ackages/*
149
+ !**/[Pp]ackages/build/
150
+ *.nuget.props
151
+ *.nuget.targets
152
+ csx/
153
+ *.build.csdef
154
+ ecf/
155
+ rcf/
156
+ AppPackages/
157
+ BundleArtifacts/
158
+ Package.StoreAssociation.xml
159
+ _pkginfo.txt
160
+ *.appx
161
+ *.[Cc]ache
162
+ # but keep track of directories ending in .cache
163
+ !*.[Cc]ache/
164
+ ClientBin/
165
+ ~$*
166
+ *~
167
+ *.dbmdl
168
+ *.dbproj.schemaview
169
+ *.jfm
170
+ *.pfx
171
+ *.publishsettings
172
+ orleans.codegen.cs
173
+ **/wwwroot/lib/
174
+ Generated_Code/
175
+ _UpgradeReport_Files/
176
+ Backup*/
177
+ UpgradeLog*.XML
178
+ UpgradeLog*.htm
179
+ ServiceFabricBackup/
180
+ *.rptproj.bak
181
+ *.mdf
182
+ *.ldf
183
+ *.ndf
184
+ *.rdl.data
185
+ *.bim.layout
186
+ *.bim_*.settings
187
+ *.rptproj.rsuser
188
+ FakesAssemblies/
189
+ *.GhostDoc.xml
190
+ .ntvs_analysis.dat
191
+ node_modules/
192
+ *.plg
193
+ *.opt
194
+ *.vbw
195
+ **/*.HTMLClient/GeneratedArtifacts
196
+ **/*.DesktopClient/GeneratedArtifacts
197
+ **/*.DesktopClient/ModelManifest.xml
198
+ **/*.Server/GeneratedArtifacts
199
+ **/*.Server/ModelManifest.xml
200
+ _Pvt_Extensions
201
+ .paket/paket.exe
202
+ paket-files/
203
+ .fake/
204
+ .idea/
205
+ *.sln.iml
206
+ .cr/personal
207
+ __pycache__/
208
+ *.pyc
209
+ tools/**
210
+ !tools/packages.config
211
+ *.tss
212
+ *.jmconfig
213
+ *.btp.cs
214
+ *.btm.cs
215
+ *.odx.cs
216
+ *.xsd.cs
217
+ OpenCover/
218
+ ASALocalRun/
219
+ *.binlog
220
+ *.nvuser
221
+ .mfractor/
222
+ .localhistory/
@@ -0,0 +1,11 @@
1
+ module Makit
2
+ module Content
3
+ RAKEFILE = <<~HEREDOC
4
+ require "makit"
5
+
6
+ task :default do
7
+ end
8
+
9
+ HEREDOC
10
+ end # module Content
11
+ end # module Makit
@@ -0,0 +1,14 @@
1
+ module Makit
2
+ module Content
3
+ GEM_RAKEFILE = <<~HEREDOC
4
+ require "bundler/gem_tasks" # for build, install and release tasks
5
+ require "minitest/test_task"
6
+ Minitest::TestTask.create
7
+ require "makit"
8
+
9
+ task :default => [:build, :install] do
10
+ end
11
+
12
+ HEREDOC
13
+ end # module Content
14
+ end # module Makit
@@ -0,0 +1,15 @@
1
+ image: image: ruby:3.2.3
2
+
3
+ before_script:
4
+ - pwd
5
+ - git --version
6
+ - ruby --version
7
+ - gem install rake bundler
8
+ - rake --version
9
+ - gem install bundler -v 2.5.10
10
+ - bundle install
11
+
12
+ example_job:
13
+ script:
14
+ - ruby -r minitest/autorun test/test_makit.rb
15
+ - bundle exec rake
data/lib/makit/data.rb ADDED
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+ require "digest"
3
+ # This module provides classes for the Makit gem.
4
+ module Makit
5
+ # This class provide methods for managing persistent data for the makit gem
6
+ class Data
7
+ attr_accessor :directory, :use_jsonks
8
+
9
+ def initialize(attributes = {})
10
+ @directory = attributes[:directory] || File.join(Dir.home, ".makit")
11
+ @use_json = false
12
+ attributes.each do |key, value|
13
+ instance_variable_set("@#{key}", value) if self.class.method_defined?("#{key}=")
14
+ end
15
+ end
16
+
17
+ # remove all data
18
+ def clear
19
+ # remove the data directory
20
+ FileUtils.rm_rf(@directory) if Dir.exist?(@directory)
21
+ end
22
+
23
+ def get_content_id(item)
24
+ # get the content id for the item
25
+ bytes_string = item.to_proto.bytes.pack("C*") # Convert the byte array to a string
26
+ Digest::SHA256.hexdigest(bytes_string)
27
+ end
28
+
29
+ # save the content
30
+ # data.save_content(git_version)
31
+ def save(item)
32
+ content_id = get_content_id(item)
33
+ # save the content
34
+ if @use_json
35
+ # save the content to a json file
36
+ File.open(File.join(@directory, "#{content_id}.json"), "w") do |file|
37
+ file.write(item.to_json)
38
+ end
39
+ end
40
+ end
41
+
42
+ def get_content(content_id)
43
+ nil
44
+ end
45
+
46
+ def self.gem_db_filename
47
+ gem_data_directory = File.join(Dir.home, ".makit", "makit.db")
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,140 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "directory"
4
+ require_relative "environment"
5
+ require_relative "protoc"
6
+ require_relative "nuget"
7
+ require_relative "version"
8
+ require "rake"
9
+
10
+ # This module provides classes for the Makit gem.
11
+ module Makit
12
+ # This class provide methods for working with the system Environment.
13
+ #
14
+ module Directories
15
+ ROOT = File.join(Dir.home, ".makit")
16
+ CLONE = File.join(Dir.home, ".makit", "clone")
17
+ MAKE = File.join(Dir.home, ".makit", "make")
18
+ LOG = File.join(Dir.home, ".makit", "log")
19
+ WORK = File.join(Dir.home, ".makit", "work")
20
+ REPOS = File.join(Dir.home, ".makit", "repos")
21
+ TEMP = File.join(Dir.home, ".makit", "temp")
22
+ INSTALL = File.join(Dir.home, ".makit", "install")
23
+ HOME = Makit::Directory.normalize(Dir.home)
24
+ ONEDRIVE = File.join(Dir.home, "OneDrive")
25
+ CURRENT = Dir.pwd
26
+ #Rake.application.init
27
+ #Rake.application.load_rakefile
28
+ RAKEDIR = Dir.pwd #File.dirname(Rake.application.rakefile)
29
+
30
+ PROJECT_ROOT = Makit::Directory.find_directory_with_patterns(RAKEDIR, ["Rakefile", "rakefile.rb", ".gitignore"])
31
+ #PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "Rakefile")
32
+ #PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, "rakefile.rb")
33
+ #PROJECT_ROOT = Makit::Directory.find_directory_with_pattern(RAKEDIR, ".gitignore")
34
+ if (PROJECT_ROOT.nil?)
35
+ PROJECT_ARTIFACTS = nil
36
+ else
37
+ PROJECT_ARTIFACTS = File.join(PROJECT_ROOT, "artifacts")
38
+ end
39
+ LOCAL_NUGET_SOURCE = File.join(Dir.home, ".makit", "nuget")
40
+ if Makit::Environment::get_os == "Windows"
41
+ #NUGET_PACKAGE_CACHE = "#{ENV["USERPROFILE"]}\\.nuget\\packages"
42
+ NUGET_PACKAGE_CACHE = File.join(HOME, ".nuget", "packages")
43
+ SERVICES = File.join("C:", "Program Files")
44
+ else
45
+ NUGET_PACKAGE_CACHE = Makit::Directory.normalize("#{ENV["HOME"]}/.nuget/packages")
46
+ if Makit::Environment::get_os == "macOS"
47
+ SERVICES = "/Library/LaunchDaemons"
48
+ else
49
+ SERVICES = "/etc/systemd/system"
50
+ end
51
+ end
52
+ if Makit::NuGet::get_latest_version("Grpc.Tools").nil?
53
+ puts " warning: Grpc.Tools not found in Nuget cache"
54
+ else
55
+ GRPC_TOOLS_PATH = File.join(NUGET_PACKAGE_CACHE, "grpc.tools", Makit::Protoc::get_latest_grpc_tools_version)
56
+ GRPC_CSHARP_PLUGIN_PATH = Makit::Protoc::find_plugin_path("grpc_csharp_plugin")
57
+ end
58
+
59
+ Dir.mkdir(ROOT) unless Dir.exist?(ROOT)
60
+ Dir.mkdir(CLONE) unless Dir.exist?(CLONE)
61
+ Dir.mkdir(MAKE) unless Dir.exist?(MAKE)
62
+ Dir.mkdir(LOG) unless Dir.exist?(LOG)
63
+ Dir.mkdir(WORK) unless Dir.exist?(WORK)
64
+ Dir.mkdir(REPOS) unless Dir.exist?(REPOS)
65
+ Dir.mkdir(TEMP) unless Dir.exist?(TEMP)
66
+ Dir.mkdir(INSTALL) unless Dir.exist?(INSTALL)
67
+ if (!Dir.exist?(LOCAL_NUGET_SOURCE))
68
+ Dir.mkdir(LOCAL_NUGET_SOURCE)
69
+ system("dotnet nuget add source #{LOCAL_NUGET_SOURCE} --name local")
70
+ end
71
+
72
+ def self.get_project_path(relative_path)
73
+ File.join(PROJECT_ROOT, relative_path)
74
+ end
75
+
76
+ def self.get_clone_directory(url)
77
+ File.join(CLONE, get_relative_directory(url))
78
+ end
79
+
80
+ def self.get_work_directory(url)
81
+ File.join(WORK, get_relative_directory(url))
82
+ end
83
+
84
+ def self.get_make_directory(url)
85
+ File.join(MAKE, get_relative_directory(url))
86
+ end
87
+
88
+ def self.get_make_commit_directory(url, commit_id)
89
+ File.join(MAKE, get_relative_directory(url), commit_id)
90
+ end
91
+
92
+ def self.get_log_directory(url)
93
+ File.join(LOG, get_relative_directory(url))
94
+ end
95
+ def self.get_make_commit_log_filename(url, commit_id)
96
+ File.join(LOG, get_relative_directory(url), commit_id + ".json")
97
+ end
98
+
99
+ def self.get_relative_directory(url)
100
+ # if url start with Directories::REPOS, then it is a local repository
101
+ if url.start_with?(REPOS)
102
+ return url.gsub(REPOS, "")
103
+ end
104
+ url = url.gsub("https://", "").gsub("http://", "")
105
+ url = url.gsub("gitlab.com", "gitlab")
106
+ url = url.gsub("github.com", "github")
107
+
108
+ # if the url ends with .git, remove it
109
+ url = url.gsub(".git", "") if url.end_with?(".git")
110
+ url
111
+ end
112
+
113
+ # show all the directory constants in a nicely formatted table format with the name of the constant and the value
114
+ def self.show
115
+ # Array of constant names (symbols)
116
+ constant_names = [:ROOT, :CLONE, :MAKE, :LOG, :WORK, :REPOS, :TEMP, :INSTALL, :HOME, :ONEDRIVE,
117
+ :CURRENT, :RAKEDIR,
118
+ :PROJECT_ROOT, :PROJECT_ARTIFACTS, :LOCAL_NUGET_SOURCE, :NUGET_PACKAGE_CACHE, :SERVICES,
119
+ :GRPC_TOOLS_PATH, :GRPC_CSHARP_PLUGIN_PATH]
120
+
121
+ # Find the length of the longest constant name and add 1
122
+ max_length = constant_names.map(&:to_s).max_by(&:length).length + 1
123
+
124
+ # Iterate through each constant name
125
+ constant_names.each do |constant_name|
126
+ begin
127
+ constant_value = const_get(constant_name) # Fetch the value of the constant
128
+ if (constant_value != nil && Dir.exist?(constant_value))
129
+ constant_value = constant_value.colorize(:green)
130
+ end
131
+ # Print the constant name right justified to the max_length
132
+ puts "#{constant_name.to_s.rjust(max_length)} = #{constant_value}"
133
+ rescue NameError
134
+ # Handle the case where the constant is not defined
135
+ puts "#{constant_name.to_s.rjust(max_length)} = [Constant not defined]"
136
+ end
137
+ end
138
+ end
139
+ end # end module Directories
140
+ end # end module Makit
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "find"
4
+ require "pathname"
5
+ #require "gitignore"
6
+
7
+ # This module provides classes for the Makit gem.
8
+ module Makit
9
+ # This class provide methods for working with Directories/
10
+ #
11
+ # Example:
12
+ #
13
+ # Makit::Directory.find_directory_with_pattern("/home/user", "*.rb")
14
+ #
15
+ class Directory
16
+ def self.get_line_count(file)
17
+ line_count = 0
18
+ File.foreach(file) { line_count += 1 }
19
+ line_count
20
+ end
21
+
22
+ def self.find_directory_with_patterns(starting_directory, patterns)
23
+ patterns.each do |pattern|
24
+ result = find_directory_with_pattern(starting_directory, pattern)
25
+ if(Dir.exist?(result))
26
+ return result
27
+ end
28
+ end
29
+
30
+ nil
31
+ end
32
+
33
+ def self.find_directory_with_pattern(starting_directory, pattern)
34
+ current_directory = File.expand_path(starting_directory)
35
+
36
+ loop do
37
+ return current_directory if contains_pattern?(current_directory, pattern)
38
+
39
+ parent_directory = File.dirname(current_directory)
40
+ break if parent_directory == current_directory # Reached the root directory
41
+
42
+ current_directory = parent_directory
43
+ end
44
+
45
+ nil
46
+ end
47
+
48
+ def self.contains_pattern?(directory, pattern)
49
+ Dir.foreach(directory) do |entry|
50
+ next if [".", ".."].include?(entry)
51
+ return true if File.fnmatch(pattern, entry)
52
+ end
53
+ false
54
+ end
55
+
56
+ def self.get_size(directory)
57
+ total_size = 0
58
+
59
+ Find.find(directory) do |file|
60
+ total_size += File.size(file) if File.file?(file)
61
+ end
62
+
63
+ total_size
64
+ end
65
+
66
+ def self.get_humanized_size(size_in_bytes, precision = 2)
67
+ end
68
+
69
+ def self.zip_source_files(directory_path, zip_file_name)
70
+ raise ArgumentError, "Directory path cannot be nil" if directory_path.nil?
71
+ raise ArgumentError, "Zip file name cannot be nil or empty" if zip_file_name.nil? || zip_file_name.strip.empty?
72
+
73
+ unless Dir.exist?(directory_path)
74
+ raise ArgumentError, "Directory '#{directory_path}' does not exist."
75
+ end
76
+
77
+ tracked_files = get_git_tracked_files(directory_path)
78
+
79
+ if tracked_files.empty?
80
+ raise "No tracked files found in the directory."
81
+ end
82
+
83
+ Zip::File.open(zip_file_name, Zip::File::CREATE) do |zipfile|
84
+ tracked_files.each do |file|
85
+ full_path = File.join(directory_path, file)
86
+ if File.exist?(full_path)
87
+ zipfile.add(file, full_path)
88
+ end
89
+ end
90
+ end
91
+ end
92
+
93
+ def self.get_git_tracked_files(directory_path)
94
+ output, status = Open3.capture2("git ls-files", chdir: directory_path)
95
+ raise "Failed to list git-tracked files" unless status.success?
96
+
97
+ output.split("\n")
98
+ end
99
+
100
+ # Normalize the path by removing any leading or trailing slashes
101
+ # and replacing any backslashes with forward slashes
102
+ def self.normalize(path)
103
+ path = path.gsub("\\", "/")
104
+ #path = path[1..-1] if path.start_with?("/")
105
+ path = path[0..-2] if path.end_with?("/")
106
+ path
107
+ end
108
+
109
+ # for a given path, collect all the subdirectories that match a version pattern.
110
+ # for example 2.57.0, 2.62, or 2.65.0
111
+ def self.get_version_directories(path)
112
+ version_directories = []
113
+ Dir.foreach(path) do |entry|
114
+ next if [".", ".."].include?(entry)
115
+ version_directories << entry if entry.match?(/^\d+\.\d+\.\d+$/)
116
+ end
117
+ version_directories
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,16 @@
1
+ module Makit
2
+ class DotNet
3
+ def self.is_installed?
4
+ File.exist?(Makit::Environment.which("dotnet"))
5
+ end
6
+
7
+ def self.version
8
+ `dotnet --version`
9
+ end
10
+
11
+ #Makit::DotNet::setup_classlib(package_name,package_dir)
12
+ def self.new(template, name, output)
13
+ "dotnet new classlib --name #{name} --output #{output}" unless Dir.exist? output
14
+ end
15
+ end # class DotNet
16
+ end # module Makit