makit 0.0.83 → 0.0.85
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/generated/makit/v1/makit.v1_pb.rb +35 -0
- data/lib/generated/makit/v1/web/link_pb.rb +20 -0
- data/lib/makit/apache.rb +32 -32
- data/lib/makit/cli/clean.rb +14 -14
- data/lib/makit/cli/clone.rb +59 -59
- data/lib/makit/cli/init.rb +38 -38
- data/lib/makit/cli/main.rb +33 -33
- data/lib/makit/cli/make.rb +54 -54
- data/lib/makit/cli/new.rb +37 -37
- data/lib/makit/cli/nuget_cache.rb +38 -38
- data/lib/makit/cli/pull.rb +31 -31
- data/lib/makit/cli/setup.rb +71 -71
- data/lib/makit/cli/work.rb +21 -21
- data/lib/makit/command_runner.rb +404 -404
- data/lib/makit/commands.rb +21 -21
- data/lib/makit/content/default_gitignore.rb +5 -5
- data/lib/makit/content/default_gitignore.txt +222 -222
- data/lib/makit/content/default_rakefile.rb +11 -11
- data/lib/makit/content/gem_rakefile.rb +14 -14
- data/lib/makit/data.rb +50 -50
- data/lib/makit/directories.rb +144 -144
- data/lib/makit/directory.rb +264 -264
- data/lib/makit/docs/files.rb +94 -94
- data/lib/makit/docs/rake.rb +106 -106
- data/lib/makit/dotnet.rb +219 -219
- data/lib/makit/email.rb +61 -61
- data/lib/makit/environment.rb +131 -131
- data/lib/makit/fileinfo.rb +26 -26
- data/lib/makit/files.rb +47 -47
- data/lib/makit/git.rb +145 -145
- data/lib/makit/gitlab_runner.rb +60 -60
- data/lib/makit/humanize.rb +129 -129
- data/lib/makit/indexer.rb +56 -56
- data/lib/makit/logging.rb +106 -106
- data/lib/makit/markdown.rb +75 -75
- data/lib/makit/mp/basic_object_mp.rb +16 -16
- data/lib/makit/mp/command_mp.rb +13 -13
- data/lib/makit/mp/command_request.mp.rb +16 -16
- data/lib/makit/mp/project_mp.rb +210 -210
- data/lib/makit/mp/string_mp.rb +137 -137
- data/lib/makit/nuget.rb +72 -72
- data/lib/makit/process.rb +26 -26
- data/lib/makit/protoc.rb +104 -104
- data/lib/makit/rake.rb +25 -25
- data/lib/makit/secrets.rb +51 -51
- data/lib/makit/serializer.rb +115 -115
- data/lib/makit/show.rb +110 -110
- data/lib/makit/storage.rb +131 -131
- data/lib/makit/symbols.rb +149 -149
- data/lib/makit/task_info.rb +86 -86
- data/lib/makit/tasks.rb +158 -144
- data/lib/makit/tree.rb +37 -37
- data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
- data/lib/makit/version.rb +64 -65
- data/lib/makit/wix.rb +95 -95
- data/lib/makit/yaml.rb +17 -17
- data/lib/makit/zip.rb +17 -17
- data/lib/makit.rb +267 -267
- metadata +5 -3
data/lib/makit/dotnet.rb
CHANGED
@@ -1,219 +1,219 @@
|
|
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
|
-
def self.project_short_name(project_path)
|
12
|
-
project_name = File.basename(project_path, ".csproj")
|
13
|
-
project_name
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.new_project(template, name, output, args = "")
|
17
|
-
if Dir.exist? output
|
18
|
-
puts " .csproj ".colorize(:grey) + "#{name}".colorize(:green)
|
19
|
-
else
|
20
|
-
"dotnet new #{template} --name #{name} --output #{output} #{args}".run
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.set_project_target_framework(project_hint, target_framework)
|
25
|
-
project_path = find_project(project_hint)
|
26
|
-
project_content = File.read(project_path)
|
27
|
-
project_content.gsub!(/<TargetFramework>.*<\/TargetFramework>/, "<TargetFramework>#{target_framework}</TargetFramework>")
|
28
|
-
File.write(project_path, project_content)
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.find_project(project_hint)
|
32
|
-
matches = []
|
33
|
-
Dir.glob("**/*.csproj").each do |project_path|
|
34
|
-
#project_name = File.basename(project_path, ".csproj")
|
35
|
-
if project_path.include?(project_hint)
|
36
|
-
matches << project_path
|
37
|
-
end
|
38
|
-
end
|
39
|
-
if matches.length == 1
|
40
|
-
return matches.first
|
41
|
-
elsif matches.length > 1
|
42
|
-
raise "Multiple projects found matching #{project_hint}".colorize(:red)
|
43
|
-
end
|
44
|
-
raise "No project found matching #{project_hint}".colorize(:red)
|
45
|
-
end
|
46
|
-
|
47
|
-
def self.add_package(project_path, package_name)
|
48
|
-
if (!File.exist?(project_path))
|
49
|
-
actual_project_path = Makit::DotNet::find_project(project_path)
|
50
|
-
if (!File.exist?(actual_project_path))
|
51
|
-
raise "Project #{project_path} does not exist".colorize(:red)
|
52
|
-
else
|
53
|
-
project_path = actual_project_path
|
54
|
-
end
|
55
|
-
end
|
56
|
-
project_content = File.read(project_path)
|
57
|
-
if (!project_content.include?("\"#{package_name}\""))
|
58
|
-
"dotnet add #{project_path} package #{package_name}".run
|
59
|
-
else
|
60
|
-
puts " package ".colorize(:grey) + "#{package_name}".colorize(:green)
|
61
|
-
#puts " #{project_short_name(project_path)} has package #{package_name}".colorize(:grey)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.add_packages(project_path, packages)
|
66
|
-
packages.each do |package|
|
67
|
-
add_package(project_path, package)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.add_reference(project_path, reference_path)
|
72
|
-
if (!File.exist?(project_path))
|
73
|
-
actual_project_path = Makit::DotNet::find_project(project_path)
|
74
|
-
if (!File.exist?(actual_project_path))
|
75
|
-
raise "Project #{project_path} does not exist".colorize(:red)
|
76
|
-
else
|
77
|
-
project_path = actual_project_path
|
78
|
-
end
|
79
|
-
end
|
80
|
-
if (!File.exist?(reference_path))
|
81
|
-
actual_reference_path = Makit::DotNet::find_project(reference_path)
|
82
|
-
if (!File.exist?(actual_reference_path))
|
83
|
-
raise "Project #{reference_path} does not exist".colorize(:red)
|
84
|
-
else
|
85
|
-
reference_path = actual_reference_path
|
86
|
-
end
|
87
|
-
end
|
88
|
-
project_content = File.read(project_path)
|
89
|
-
if (project_content.include?(File.basename(reference_path)))
|
90
|
-
puts " reference ".colorize(:grey) + "#{reference_path}".colorize(:green)
|
91
|
-
#puts " #{project_short_name(project_path)} references #{project_short_name(reference_path)}".colorize(:grey)
|
92
|
-
#puts " reference ".colorize(:grey) + "#{reference_path}".colorize(:yellow) + " is in ".colorize(:grey) + "#{project_path}".colorize(:yellow)
|
93
|
-
else
|
94
|
-
"dotnet add #{project_path} reference #{reference_path}".run
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def self.add_references(project_path, references)
|
99
|
-
references.each do |reference|
|
100
|
-
add_reference(project_path, reference)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def self.new_solution(name)
|
105
|
-
if File.exist? "#{name}.sln"
|
106
|
-
#puts "Solution #{name}.sln already exists".colorize(:yellow)
|
107
|
-
#puts " #{name}.sln".colorize(:green) + " exists".colorize(:grey)
|
108
|
-
else
|
109
|
-
"dotnet new sln --name #{name}".run
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def self.build(project_path, configuration = "Release", output = "artifacts")
|
114
|
-
project_dir = File.dirname(project_path)
|
115
|
-
newest_file = Makit::Directory::get_newest_file(project_dir)
|
116
|
-
command_request = Makit::RUNNER::parse_command_request("dotnet build #{project_path} --configuration #{configuration} --output #{output}")
|
117
|
-
if newest_file.nil?
|
118
|
-
newest_file_date = Time.now
|
119
|
-
RUNNER.cache_run(command_request, newest_file_date)
|
120
|
-
else
|
121
|
-
newest_file_date = File.mtime(newest_file)
|
122
|
-
RUNNER.cache_run(command_request, newest_file_date)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.publish(project_path, configuration = "Release", output = "artifacts")
|
127
|
-
project_dir = File.dirname(project_path)
|
128
|
-
newest_file = Makit::Directory::get_newest_file(project_dir)
|
129
|
-
command_request = Makit::RUNNER::parse_command_request("dotnet publish #{project_path} --configuration #{configuration} --output #{output}")
|
130
|
-
if newest_file.nil?
|
131
|
-
newest_file_date = Time.now
|
132
|
-
RUNNER.cache_run(command_request, newest_file_date)
|
133
|
-
else
|
134
|
-
newest_file_date = File.mtime(newest_file)
|
135
|
-
RUNNER.cache_run(command_request, newest_file_date)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def self.test(project_path, configuration = "Release", output = "artifacts")
|
140
|
-
project_dir = File.dirname(project_path)
|
141
|
-
newest_file = Makit::Directory::get_newest_file(project_dir)
|
142
|
-
command_request = Makit::RUNNER::parse_command_request("dotnet test #{project_path} --configuration #{configuration} --output #{output}")
|
143
|
-
if newest_file.nil?
|
144
|
-
newest_file_date = Time.now
|
145
|
-
RUNNER.cache_run(command_request, newest_file_date)
|
146
|
-
else
|
147
|
-
newest_file_date = File.mtime(newest_file)
|
148
|
-
RUNNER.cache_run(command_request, newest_file_date)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def self.sln_add_projects(sln_name)
|
153
|
-
if !File.exist? "#{sln_name}.sln"
|
154
|
-
raise "Solution #{sln_name}.sln does not exist"
|
155
|
-
else
|
156
|
-
sln_path = "#{sln_name}.sln"
|
157
|
-
sln_content = File.read(sln_path)
|
158
|
-
Dir.glob("**/*.csproj").each do |project_path|
|
159
|
-
project_name = File.basename(project_path, ".csproj")
|
160
|
-
if (sln_content.include?("\"#{project_name}\""))
|
161
|
-
#puts " #{project_name}".colorize(:green) + " is in ".colorize(:grey) + "#{sln_path}".colorize(:green)
|
162
|
-
#puts "Project #{project_name} already exists in #{sln_path}".colorize(:yellow)
|
163
|
-
else
|
164
|
-
"dotnet sln #{sln_path} add #{project_path}".run
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def self.format_project(project_path)
|
171
|
-
project_name = File.basename(project_path, ".csproj")
|
172
|
-
"dotnet tool update --global dotnet-format".run
|
173
|
-
"dotnet format #{project_path}".run
|
174
|
-
end
|
175
|
-
|
176
|
-
def self.upgrade_project(project_path)
|
177
|
-
project_name = File.basename(project_path, ".csproj")
|
178
|
-
"dotnet tool install --global dotnet-outdated-tool".run
|
179
|
-
"dotnet outdated #{project_path} --upgrade:Auto".run
|
180
|
-
end
|
181
|
-
|
182
|
-
#
|
183
|
-
# generate docs/DotNet.md
|
184
|
-
#
|
185
|
-
def self.generate_docs
|
186
|
-
content = "# DotNet\n\n"
|
187
|
-
content += "## Projects\n\n"
|
188
|
-
# scan for .csproj files in src directory
|
189
|
-
src_projects = Dir.glob("src/**/*.csproj")
|
190
|
-
src_projects.each do |project_path|
|
191
|
-
project_name = File.basename(project_path, ".csproj")
|
192
|
-
#"dotnet tool update --global dotnet-aspnet-codegenerator".run
|
193
|
-
#"dotnet aspnet-codegenerator controller --name #{project_name}Controller --output ~/Projects/makit/src/makit/Controllers --controllerName #{project_name}Controller --useAsyncActions --relativeFolderPath Controllers".run
|
194
|
-
end
|
195
|
-
content += "## Packages\n\n"
|
196
|
-
# scan for packages.config files in src directory
|
197
|
-
src_packages = Dir.glob("src/**/packages.config")
|
198
|
-
src_packages.each do |packages_path|
|
199
|
-
packages_name = File.basename(packages_path, ".packages.config")
|
200
|
-
end
|
201
|
-
content += "## References\n\n"
|
202
|
-
# scan for project.json files in src directory
|
203
|
-
src_references = Dir.glob("src/**/project.json")
|
204
|
-
src_references.each do |references_path|
|
205
|
-
references_name = File.basename(references_path, ".project.json")
|
206
|
-
end
|
207
|
-
|
208
|
-
# write content to docs/DotNet.md file
|
209
|
-
if (File.exist?("docs/DotNet.md"))
|
210
|
-
existing_content = File.read("docs/DotNet.md")
|
211
|
-
if (existing_content != content)
|
212
|
-
File.write("docs/DotNet.md", content)
|
213
|
-
end
|
214
|
-
else
|
215
|
-
File.write("docs/DotNet.md", content)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
end # class DotNet
|
219
|
-
end # module Makit
|
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
|
+
def self.project_short_name(project_path)
|
12
|
+
project_name = File.basename(project_path, ".csproj")
|
13
|
+
project_name
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.new_project(template, name, output, args = "")
|
17
|
+
if Dir.exist? output
|
18
|
+
puts " .csproj ".colorize(:grey) + "#{name}".colorize(:green)
|
19
|
+
else
|
20
|
+
"dotnet new #{template} --name #{name} --output #{output} #{args}".run
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.set_project_target_framework(project_hint, target_framework)
|
25
|
+
project_path = find_project(project_hint)
|
26
|
+
project_content = File.read(project_path)
|
27
|
+
project_content.gsub!(/<TargetFramework>.*<\/TargetFramework>/, "<TargetFramework>#{target_framework}</TargetFramework>")
|
28
|
+
File.write(project_path, project_content)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.find_project(project_hint)
|
32
|
+
matches = []
|
33
|
+
Dir.glob("**/*.csproj").each do |project_path|
|
34
|
+
#project_name = File.basename(project_path, ".csproj")
|
35
|
+
if project_path.include?(project_hint)
|
36
|
+
matches << project_path
|
37
|
+
end
|
38
|
+
end
|
39
|
+
if matches.length == 1
|
40
|
+
return matches.first
|
41
|
+
elsif matches.length > 1
|
42
|
+
raise "Multiple projects found matching #{project_hint}".colorize(:red)
|
43
|
+
end
|
44
|
+
raise "No project found matching #{project_hint}".colorize(:red)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.add_package(project_path, package_name)
|
48
|
+
if (!File.exist?(project_path))
|
49
|
+
actual_project_path = Makit::DotNet::find_project(project_path)
|
50
|
+
if (!File.exist?(actual_project_path))
|
51
|
+
raise "Project #{project_path} does not exist".colorize(:red)
|
52
|
+
else
|
53
|
+
project_path = actual_project_path
|
54
|
+
end
|
55
|
+
end
|
56
|
+
project_content = File.read(project_path)
|
57
|
+
if (!project_content.include?("\"#{package_name}\""))
|
58
|
+
"dotnet add #{project_path} package #{package_name}".run
|
59
|
+
else
|
60
|
+
puts " package ".colorize(:grey) + "#{package_name}".colorize(:green)
|
61
|
+
#puts " #{project_short_name(project_path)} has package #{package_name}".colorize(:grey)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.add_packages(project_path, packages)
|
66
|
+
packages.each do |package|
|
67
|
+
add_package(project_path, package)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.add_reference(project_path, reference_path)
|
72
|
+
if (!File.exist?(project_path))
|
73
|
+
actual_project_path = Makit::DotNet::find_project(project_path)
|
74
|
+
if (!File.exist?(actual_project_path))
|
75
|
+
raise "Project #{project_path} does not exist".colorize(:red)
|
76
|
+
else
|
77
|
+
project_path = actual_project_path
|
78
|
+
end
|
79
|
+
end
|
80
|
+
if (!File.exist?(reference_path))
|
81
|
+
actual_reference_path = Makit::DotNet::find_project(reference_path)
|
82
|
+
if (!File.exist?(actual_reference_path))
|
83
|
+
raise "Project #{reference_path} does not exist".colorize(:red)
|
84
|
+
else
|
85
|
+
reference_path = actual_reference_path
|
86
|
+
end
|
87
|
+
end
|
88
|
+
project_content = File.read(project_path)
|
89
|
+
if (project_content.include?(File.basename(reference_path)))
|
90
|
+
puts " reference ".colorize(:grey) + "#{reference_path}".colorize(:green)
|
91
|
+
#puts " #{project_short_name(project_path)} references #{project_short_name(reference_path)}".colorize(:grey)
|
92
|
+
#puts " reference ".colorize(:grey) + "#{reference_path}".colorize(:yellow) + " is in ".colorize(:grey) + "#{project_path}".colorize(:yellow)
|
93
|
+
else
|
94
|
+
"dotnet add #{project_path} reference #{reference_path}".run
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.add_references(project_path, references)
|
99
|
+
references.each do |reference|
|
100
|
+
add_reference(project_path, reference)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.new_solution(name)
|
105
|
+
if File.exist? "#{name}.sln"
|
106
|
+
#puts "Solution #{name}.sln already exists".colorize(:yellow)
|
107
|
+
#puts " #{name}.sln".colorize(:green) + " exists".colorize(:grey)
|
108
|
+
else
|
109
|
+
"dotnet new sln --name #{name}".run
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.build(project_path, configuration = "Release", output = "artifacts")
|
114
|
+
project_dir = File.dirname(project_path)
|
115
|
+
newest_file = Makit::Directory::get_newest_file(project_dir)
|
116
|
+
command_request = Makit::RUNNER::parse_command_request("dotnet build #{project_path} --configuration #{configuration} --output #{output}")
|
117
|
+
if newest_file.nil?
|
118
|
+
newest_file_date = Time.now
|
119
|
+
RUNNER.cache_run(command_request, newest_file_date)
|
120
|
+
else
|
121
|
+
newest_file_date = File.mtime(newest_file)
|
122
|
+
RUNNER.cache_run(command_request, newest_file_date)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.publish(project_path, configuration = "Release", output = "artifacts")
|
127
|
+
project_dir = File.dirname(project_path)
|
128
|
+
newest_file = Makit::Directory::get_newest_file(project_dir)
|
129
|
+
command_request = Makit::RUNNER::parse_command_request("dotnet publish #{project_path} --configuration #{configuration} --output #{output}")
|
130
|
+
if newest_file.nil?
|
131
|
+
newest_file_date = Time.now
|
132
|
+
RUNNER.cache_run(command_request, newest_file_date)
|
133
|
+
else
|
134
|
+
newest_file_date = File.mtime(newest_file)
|
135
|
+
RUNNER.cache_run(command_request, newest_file_date)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def self.test(project_path, configuration = "Release", output = "artifacts")
|
140
|
+
project_dir = File.dirname(project_path)
|
141
|
+
newest_file = Makit::Directory::get_newest_file(project_dir)
|
142
|
+
command_request = Makit::RUNNER::parse_command_request("dotnet test #{project_path} --configuration #{configuration} --output #{output}")
|
143
|
+
if newest_file.nil?
|
144
|
+
newest_file_date = Time.now
|
145
|
+
RUNNER.cache_run(command_request, newest_file_date)
|
146
|
+
else
|
147
|
+
newest_file_date = File.mtime(newest_file)
|
148
|
+
RUNNER.cache_run(command_request, newest_file_date)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def self.sln_add_projects(sln_name)
|
153
|
+
if !File.exist? "#{sln_name}.sln"
|
154
|
+
raise "Solution #{sln_name}.sln does not exist"
|
155
|
+
else
|
156
|
+
sln_path = "#{sln_name}.sln"
|
157
|
+
sln_content = File.read(sln_path)
|
158
|
+
Dir.glob("**/*.csproj").each do |project_path|
|
159
|
+
project_name = File.basename(project_path, ".csproj")
|
160
|
+
if (sln_content.include?("\"#{project_name}\""))
|
161
|
+
#puts " #{project_name}".colorize(:green) + " is in ".colorize(:grey) + "#{sln_path}".colorize(:green)
|
162
|
+
#puts "Project #{project_name} already exists in #{sln_path}".colorize(:yellow)
|
163
|
+
else
|
164
|
+
"dotnet sln #{sln_path} add #{project_path}".run
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.format_project(project_path)
|
171
|
+
project_name = File.basename(project_path, ".csproj")
|
172
|
+
"dotnet tool update --global dotnet-format".run
|
173
|
+
"dotnet format #{project_path}".run
|
174
|
+
end
|
175
|
+
|
176
|
+
def self.upgrade_project(project_path)
|
177
|
+
project_name = File.basename(project_path, ".csproj")
|
178
|
+
"dotnet tool install --global dotnet-outdated-tool".run
|
179
|
+
"dotnet outdated #{project_path} --upgrade:Auto".run
|
180
|
+
end
|
181
|
+
|
182
|
+
#
|
183
|
+
# generate docs/DotNet.md
|
184
|
+
#
|
185
|
+
def self.generate_docs
|
186
|
+
content = "# DotNet\n\n"
|
187
|
+
content += "## Projects\n\n"
|
188
|
+
# scan for .csproj files in src directory
|
189
|
+
src_projects = Dir.glob("src/**/*.csproj")
|
190
|
+
src_projects.each do |project_path|
|
191
|
+
project_name = File.basename(project_path, ".csproj")
|
192
|
+
#"dotnet tool update --global dotnet-aspnet-codegenerator".run
|
193
|
+
#"dotnet aspnet-codegenerator controller --name #{project_name}Controller --output ~/Projects/makit/src/makit/Controllers --controllerName #{project_name}Controller --useAsyncActions --relativeFolderPath Controllers".run
|
194
|
+
end
|
195
|
+
content += "## Packages\n\n"
|
196
|
+
# scan for packages.config files in src directory
|
197
|
+
src_packages = Dir.glob("src/**/packages.config")
|
198
|
+
src_packages.each do |packages_path|
|
199
|
+
packages_name = File.basename(packages_path, ".packages.config")
|
200
|
+
end
|
201
|
+
content += "## References\n\n"
|
202
|
+
# scan for project.json files in src directory
|
203
|
+
src_references = Dir.glob("src/**/project.json")
|
204
|
+
src_references.each do |references_path|
|
205
|
+
references_name = File.basename(references_path, ".project.json")
|
206
|
+
end
|
207
|
+
|
208
|
+
# write content to docs/DotNet.md file
|
209
|
+
if (File.exist?("docs/DotNet.md"))
|
210
|
+
existing_content = File.read("docs/DotNet.md")
|
211
|
+
if (existing_content != content)
|
212
|
+
File.write("docs/DotNet.md", content)
|
213
|
+
end
|
214
|
+
else
|
215
|
+
File.write("docs/DotNet.md", content)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end # class DotNet
|
219
|
+
end # module Makit
|
data/lib/makit/email.rb
CHANGED
@@ -1,61 +1,61 @@
|
|
1
|
-
require 'mail'
|
2
|
-
|
3
|
-
module Makit
|
4
|
-
class Email
|
5
|
-
def configure_gmail_defaults
|
6
|
-
Mail.defaults do
|
7
|
-
delivery_method :smtp, {
|
8
|
-
address: 'smtp.gmail.com',
|
9
|
-
port: 587,
|
10
|
-
domain: 'gmail.com',
|
11
|
-
user_name: ENV['SMTP_USERNAME'],
|
12
|
-
password: ENV['SMTP_PASSWORD'],
|
13
|
-
authentication: 'plain',
|
14
|
-
enable_starttls_auto: true
|
15
|
-
}
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def send_test_email(to: ENV['MAKIT_EMAIL_RECIPIENT'], subject:, body:)
|
20
|
-
raise ArgumentError, "Recipient email not set. Please set MAKIT_EMAIL_RECIPIENT environment variable" unless to
|
21
|
-
|
22
|
-
mail = Mail.new do
|
23
|
-
from ENV['SMTP_USERNAME']
|
24
|
-
to to
|
25
|
-
subject subject
|
26
|
-
body body
|
27
|
-
end
|
28
|
-
|
29
|
-
begin
|
30
|
-
mail.deliver!
|
31
|
-
true
|
32
|
-
rescue => e
|
33
|
-
puts "Failed to send email: #{e.message}"
|
34
|
-
false
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def send(subject:, body:)
|
39
|
-
send_to(to: ENV['MAKIT_EMAIL_RECIPIENT'], subject: subject, body: body)
|
40
|
-
end
|
41
|
-
|
42
|
-
def send_to(to:, subject:, body:)
|
43
|
-
raise ArgumentError, "Recipient email not set" unless to
|
44
|
-
|
45
|
-
mail = Mail.new do
|
46
|
-
from ENV['SMTP_USERNAME']
|
47
|
-
to to
|
48
|
-
subject subject
|
49
|
-
body body
|
50
|
-
end
|
51
|
-
|
52
|
-
begin
|
53
|
-
mail.deliver!
|
54
|
-
true
|
55
|
-
rescue => e
|
56
|
-
puts "Failed to send email: #{e.message}"
|
57
|
-
false
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
1
|
+
require 'mail'
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
class Email
|
5
|
+
def configure_gmail_defaults
|
6
|
+
Mail.defaults do
|
7
|
+
delivery_method :smtp, {
|
8
|
+
address: 'smtp.gmail.com',
|
9
|
+
port: 587,
|
10
|
+
domain: 'gmail.com',
|
11
|
+
user_name: ENV['SMTP_USERNAME'],
|
12
|
+
password: ENV['SMTP_PASSWORD'],
|
13
|
+
authentication: 'plain',
|
14
|
+
enable_starttls_auto: true
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def send_test_email(to: ENV['MAKIT_EMAIL_RECIPIENT'], subject:, body:)
|
20
|
+
raise ArgumentError, "Recipient email not set. Please set MAKIT_EMAIL_RECIPIENT environment variable" unless to
|
21
|
+
|
22
|
+
mail = Mail.new do
|
23
|
+
from ENV['SMTP_USERNAME']
|
24
|
+
to to
|
25
|
+
subject subject
|
26
|
+
body body
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
mail.deliver!
|
31
|
+
true
|
32
|
+
rescue => e
|
33
|
+
puts "Failed to send email: #{e.message}"
|
34
|
+
false
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def send(subject:, body:)
|
39
|
+
send_to(to: ENV['MAKIT_EMAIL_RECIPIENT'], subject: subject, body: body)
|
40
|
+
end
|
41
|
+
|
42
|
+
def send_to(to:, subject:, body:)
|
43
|
+
raise ArgumentError, "Recipient email not set" unless to
|
44
|
+
|
45
|
+
mail = Mail.new do
|
46
|
+
from ENV['SMTP_USERNAME']
|
47
|
+
to to
|
48
|
+
subject subject
|
49
|
+
body body
|
50
|
+
end
|
51
|
+
|
52
|
+
begin
|
53
|
+
mail.deliver!
|
54
|
+
true
|
55
|
+
rescue => e
|
56
|
+
puts "Failed to send email: #{e.message}"
|
57
|
+
false
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|