makit 0.0.99 → 0.0.111
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/README.md +41 -0
- data/exe/makit +5 -0
- data/lib/makit/apache.rb +7 -11
- data/lib/makit/cli/build_commands.rb +500 -0
- data/lib/makit/cli/generators/base_generator.rb +74 -0
- data/lib/makit/cli/generators/dotnet_generator.rb +50 -0
- data/lib/makit/cli/generators/generator_factory.rb +49 -0
- data/lib/makit/cli/generators/node_generator.rb +50 -0
- data/lib/makit/cli/generators/ruby_generator.rb +77 -0
- data/lib/makit/cli/generators/rust_generator.rb +50 -0
- data/lib/makit/cli/generators/templates/dotnet_templates.rb +167 -0
- data/lib/makit/cli/generators/templates/node_templates.rb +161 -0
- data/lib/makit/cli/generators/templates/ruby/gemfile.rb +26 -0
- data/lib/makit/cli/generators/templates/ruby/gemspec.rb +40 -0
- data/lib/makit/cli/generators/templates/ruby/main_lib.rb +33 -0
- data/lib/makit/cli/generators/templates/ruby/rakefile.rb +35 -0
- data/lib/makit/cli/generators/templates/ruby/readme.rb +63 -0
- data/lib/makit/cli/generators/templates/ruby/test.rb +39 -0
- data/lib/makit/cli/generators/templates/ruby/test_helper.rb +29 -0
- data/lib/makit/cli/generators/templates/ruby/version.rb +29 -0
- data/lib/makit/cli/generators/templates/rust_templates.rb +128 -0
- data/lib/makit/cli/main.rb +48 -19
- data/lib/makit/cli/project_commands.rb +868 -0
- data/lib/makit/cli/repository_commands.rb +661 -0
- data/lib/makit/cli/utility_commands.rb +521 -0
- data/lib/makit/command_runner.rb +187 -128
- data/lib/makit/commands/compatibility.rb +365 -0
- data/lib/makit/commands/factory.rb +359 -0
- data/lib/makit/commands/middleware/base.rb +73 -0
- data/lib/makit/commands/middleware/cache.rb +248 -0
- data/lib/makit/commands/middleware/command_logger.rb +323 -0
- data/lib/makit/commands/middleware/unified_logger.rb +243 -0
- data/lib/makit/commands/middleware/validator.rb +269 -0
- data/lib/makit/commands/request.rb +254 -0
- data/lib/makit/commands/result.rb +323 -0
- data/lib/makit/commands/runner.rb +317 -0
- data/lib/makit/commands/strategies/base.rb +160 -0
- data/lib/makit/commands/strategies/synchronous.rb +134 -0
- data/lib/makit/commands.rb +24 -3
- data/lib/makit/configuration/gitlab_helper.rb +60 -0
- data/lib/makit/configuration/project.rb +127 -0
- data/lib/makit/configuration/rakefile_helper.rb +43 -0
- data/lib/makit/configuration/step.rb +34 -0
- data/lib/makit/configuration.rb +14 -0
- data/lib/makit/content/default_gitignore.rb +4 -2
- data/lib/makit/content/default_rakefile.rb +4 -2
- data/lib/makit/content/gem_rakefile.rb +4 -2
- data/lib/makit/context.rb +1 -0
- data/lib/makit/data.rb +9 -10
- data/lib/makit/directories.rb +48 -52
- data/lib/makit/directory.rb +38 -52
- data/lib/makit/docs/files.rb +5 -10
- data/lib/makit/docs/rake.rb +16 -20
- data/lib/makit/dotnet/cli.rb +65 -0
- data/lib/makit/dotnet/project.rb +153 -0
- data/lib/makit/dotnet/solution.rb +38 -0
- data/lib/makit/dotnet/solution_classlib.rb +239 -0
- data/lib/makit/dotnet/solution_console.rb +264 -0
- data/lib/makit/dotnet/solution_maui.rb +354 -0
- data/lib/makit/dotnet/solution_wasm.rb +275 -0
- data/lib/makit/dotnet/solution_wpf.rb +304 -0
- data/lib/makit/dotnet.rb +54 -171
- data/lib/makit/email.rb +46 -17
- data/lib/makit/environment.rb +22 -19
- data/lib/makit/examples/runner.rb +370 -0
- data/lib/makit/exceptions.rb +45 -0
- data/lib/makit/fileinfo.rb +3 -5
- data/lib/makit/files.rb +12 -16
- data/lib/makit/gems.rb +40 -39
- data/lib/makit/git/cli.rb +54 -0
- data/lib/makit/git/repository.rb +90 -0
- data/lib/makit/git.rb +44 -91
- data/lib/makit/gitlab_runner.rb +0 -1
- data/lib/makit/humanize.rb +31 -23
- data/lib/makit/indexer.rb +15 -24
- data/lib/makit/logging/configuration.rb +305 -0
- data/lib/makit/logging/format_registry.rb +84 -0
- data/lib/makit/logging/formatters/base.rb +39 -0
- data/lib/makit/logging/formatters/console_formatter.rb +127 -0
- data/lib/makit/logging/formatters/json_formatter.rb +65 -0
- data/lib/makit/logging/formatters/plain_text_formatter.rb +71 -0
- data/lib/makit/logging/formatters/text_formatter.rb +64 -0
- data/lib/makit/logging/log_request.rb +115 -0
- data/lib/makit/logging/logger.rb +159 -0
- data/lib/makit/logging/sinks/base.rb +91 -0
- data/lib/makit/logging/sinks/console.rb +72 -0
- data/lib/makit/logging/sinks/file_sink.rb +92 -0
- data/lib/makit/logging/sinks/structured.rb +129 -0
- data/lib/makit/logging/sinks/unified_file_sink.rb +303 -0
- data/lib/makit/logging.rb +452 -37
- data/lib/makit/markdown.rb +18 -18
- data/lib/makit/mp/basic_object_mp.rb +5 -4
- data/lib/makit/mp/command_mp.rb +5 -5
- data/lib/makit/mp/command_request.mp.rb +3 -2
- data/lib/makit/mp/project_mp.rb +85 -96
- data/lib/makit/mp/string_mp.rb +245 -73
- data/lib/makit/nuget.rb +27 -25
- data/lib/makit/port.rb +25 -27
- data/lib/makit/process.rb +127 -29
- data/lib/makit/protoc.rb +27 -24
- data/lib/makit/rake/cli.rb +196 -0
- data/lib/makit/rake.rb +6 -6
- data/lib/makit/ruby/cli.rb +185 -0
- data/lib/makit/ruby.rb +25 -0
- data/lib/makit/secrets.rb +18 -18
- data/lib/makit/serializer.rb +29 -27
- data/lib/makit/services/builder.rb +186 -0
- data/lib/makit/services/error_handler.rb +226 -0
- data/lib/makit/services/repository_manager.rb +229 -0
- data/lib/makit/services/validator.rb +112 -0
- data/lib/makit/setup/classlib.rb +53 -0
- data/lib/makit/setup/gem.rb +250 -0
- data/lib/makit/setup/runner.rb +40 -0
- data/lib/makit/show.rb +16 -16
- data/lib/makit/storage.rb +32 -37
- data/lib/makit/symbols.rb +12 -0
- data/lib/makit/task_hooks.rb +125 -0
- data/lib/makit/task_info.rb +63 -21
- data/lib/makit/tasks/at_exit.rb +13 -0
- data/lib/makit/tasks/build.rb +18 -0
- data/lib/makit/tasks/clean.rb +11 -0
- data/lib/makit/tasks/hook_manager.rb +239 -0
- data/lib/makit/tasks/init.rb +47 -0
- data/lib/makit/tasks/integrate.rb +15 -0
- data/lib/makit/tasks/pull_incoming.rb +12 -0
- data/lib/makit/tasks/setup.rb +6 -0
- data/lib/makit/tasks/sync.rb +11 -0
- data/lib/makit/tasks/task_monkey_patch.rb +79 -0
- data/lib/makit/tasks.rb +5 -150
- data/lib/makit/test_cache.rb +239 -0
- data/lib/makit/v1/makit.v1_pb.rb +34 -35
- data/lib/makit/v1/makit.v1_services_pb.rb +2 -0
- data/lib/makit/version.rb +1 -57
- data/lib/makit/wix.rb +23 -23
- data/lib/makit/yaml.rb +18 -6
- data/lib/makit.rb +2 -261
- metadata +109 -145
- data/lib/makit/cli/clean.rb +0 -14
- data/lib/makit/cli/clone.rb +0 -59
- data/lib/makit/cli/init.rb +0 -38
- data/lib/makit/cli/make.rb +0 -54
- data/lib/makit/cli/new.rb +0 -37
- data/lib/makit/cli/nuget_cache.rb +0 -38
- data/lib/makit/cli/pull.rb +0 -31
- data/lib/makit/cli/setup.rb +0 -71
- data/lib/makit/cli/work.rb +0 -21
- data/lib/makit/content/default_gitignore.txt +0 -222
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base_generator"
|
4
|
+
require_relative "templates/dotnet_templates"
|
5
|
+
|
6
|
+
module Makit
|
7
|
+
module Cli
|
8
|
+
module Generators
|
9
|
+
# Generator for .NET projects
|
10
|
+
class DotnetGenerator < BaseGenerator
|
11
|
+
def file_definitions
|
12
|
+
{
|
13
|
+
"#{name}.csproj" => :csproj_content,
|
14
|
+
"Program.cs" => :program_cs_content,
|
15
|
+
"README.md" => :readme_content,
|
16
|
+
".gitignore" => :gitignore_content,
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def project_type
|
21
|
+
".NET project"
|
22
|
+
end
|
23
|
+
|
24
|
+
def display_custom_next_steps
|
25
|
+
puts " dotnet build"
|
26
|
+
puts " dotnet run"
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def csproj_content
|
33
|
+
Templates::Dotnet::Csproj.new(name).render
|
34
|
+
end
|
35
|
+
|
36
|
+
def program_cs_content
|
37
|
+
Templates::Dotnet::ProgramCs.new(name).render
|
38
|
+
end
|
39
|
+
|
40
|
+
def readme_content
|
41
|
+
Templates::Dotnet::Readme.new(name).render
|
42
|
+
end
|
43
|
+
|
44
|
+
def gitignore_content
|
45
|
+
Templates::Dotnet::Gitignore.new(name).render
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "ruby_generator"
|
4
|
+
require_relative "rust_generator"
|
5
|
+
require_relative "dotnet_generator"
|
6
|
+
require_relative "node_generator"
|
7
|
+
|
8
|
+
module Makit
|
9
|
+
module Cli
|
10
|
+
module Generators
|
11
|
+
# Factory class for creating appropriate generator instances based on project type
|
12
|
+
class GeneratorFactory
|
13
|
+
# Mapping of project types to their corresponding generator classes
|
14
|
+
GENERATORS = {
|
15
|
+
"gem" => RubyGenerator,
|
16
|
+
"crate" => RustGenerator,
|
17
|
+
"nuget" => DotnetGenerator,
|
18
|
+
"dotnet" => DotnetGenerator,
|
19
|
+
"node" => NodeGenerator,
|
20
|
+
}.freeze
|
21
|
+
|
22
|
+
# Create a generator instance for the specified project type
|
23
|
+
#
|
24
|
+
# @param type [String] the project type (gem, crate, nuget, dotnet, node)
|
25
|
+
# @param name [String] the project name
|
26
|
+
# @param options [Hash] additional options for the generator
|
27
|
+
# @return [BaseGenerator] an instance of the appropriate generator
|
28
|
+
# @raise [ArgumentError] if the project type is not supported
|
29
|
+
def self.create(type, name, options = {})
|
30
|
+
generator_class = GENERATORS[type.downcase]
|
31
|
+
|
32
|
+
unless generator_class
|
33
|
+
available_types = GENERATORS.keys.join(", ")
|
34
|
+
raise ArgumentError, "Unknown project type '#{type}'. Available types: #{available_types}"
|
35
|
+
end
|
36
|
+
|
37
|
+
generator_class.new(name, options)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get list of available project types
|
41
|
+
#
|
42
|
+
# @return [Array<String>] list of supported project types
|
43
|
+
def self.available_types
|
44
|
+
GENERATORS.keys
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base_generator"
|
4
|
+
require_relative "templates/node_templates"
|
5
|
+
|
6
|
+
module Makit
|
7
|
+
module Cli
|
8
|
+
module Generators
|
9
|
+
# Generator for Node.js projects
|
10
|
+
class NodeGenerator < BaseGenerator
|
11
|
+
def file_definitions
|
12
|
+
{
|
13
|
+
"package.json" => :package_json_content,
|
14
|
+
"index.js" => :index_js_content,
|
15
|
+
"README.md" => :readme_content,
|
16
|
+
".gitignore" => :gitignore_content,
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def project_type
|
21
|
+
"Node.js project"
|
22
|
+
end
|
23
|
+
|
24
|
+
def display_custom_next_steps
|
25
|
+
puts " npm install"
|
26
|
+
puts " node index.js"
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def package_json_content
|
33
|
+
Templates::Node::PackageJson.new(name).render
|
34
|
+
end
|
35
|
+
|
36
|
+
def index_js_content
|
37
|
+
Templates::Node::IndexJs.new(name).render
|
38
|
+
end
|
39
|
+
|
40
|
+
def readme_content
|
41
|
+
Templates::Node::Readme.new(name).render
|
42
|
+
end
|
43
|
+
|
44
|
+
def gitignore_content
|
45
|
+
Templates::Node::Gitignore.new(name).render
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base_generator"
|
4
|
+
require_relative "templates/ruby/gemfile"
|
5
|
+
require_relative "templates/ruby/gemspec"
|
6
|
+
require_relative "templates/ruby/main_lib"
|
7
|
+
require_relative "templates/ruby/version"
|
8
|
+
require_relative "templates/ruby/rakefile"
|
9
|
+
require_relative "templates/ruby/readme"
|
10
|
+
require_relative "templates/ruby/test_helper"
|
11
|
+
require_relative "templates/ruby/test"
|
12
|
+
|
13
|
+
module Makit
|
14
|
+
module Cli
|
15
|
+
module Generators
|
16
|
+
# Generator for Ruby gem projects
|
17
|
+
class RubyGenerator < BaseGenerator
|
18
|
+
def file_definitions
|
19
|
+
{
|
20
|
+
"Gemfile" => :gemfile_content,
|
21
|
+
"#{name}.gemspec" => :gemspec_content,
|
22
|
+
"lib/#{name}.rb" => :main_lib_content,
|
23
|
+
"lib/#{name}/version.rb" => :version_content,
|
24
|
+
"Rakefile" => :rakefile_content,
|
25
|
+
"README.md" => :readme_content,
|
26
|
+
"test/test_helper.rb" => :test_helper_content,
|
27
|
+
"test/#{name}_test.rb" => :test_content,
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def project_type
|
32
|
+
"Ruby gem"
|
33
|
+
end
|
34
|
+
|
35
|
+
def display_custom_next_steps
|
36
|
+
puts " bundle install"
|
37
|
+
puts " bundle exec rake test"
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def gemfile_content
|
44
|
+
Templates::Ruby::Gemfile.new(name).render
|
45
|
+
end
|
46
|
+
|
47
|
+
def gemspec_content
|
48
|
+
Templates::Ruby::Gemspec.new(name).render
|
49
|
+
end
|
50
|
+
|
51
|
+
def main_lib_content
|
52
|
+
Templates::Ruby::MainLib.new(name).render
|
53
|
+
end
|
54
|
+
|
55
|
+
def version_content
|
56
|
+
Templates::Ruby::Version.new(name).render
|
57
|
+
end
|
58
|
+
|
59
|
+
def rakefile_content
|
60
|
+
Templates::Ruby::Rakefile.new(name).render
|
61
|
+
end
|
62
|
+
|
63
|
+
def readme_content
|
64
|
+
Templates::Ruby::Readme.new(name).render
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_helper_content
|
68
|
+
Templates::Ruby::TestHelper.new(name).render
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_content
|
72
|
+
Templates::Ruby::Test.new(name).render
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base_generator"
|
4
|
+
require_relative "templates/rust_templates"
|
5
|
+
|
6
|
+
module Makit
|
7
|
+
module Cli
|
8
|
+
module Generators
|
9
|
+
# Generator for Rust crate projects
|
10
|
+
class RustGenerator < BaseGenerator
|
11
|
+
def file_definitions
|
12
|
+
{
|
13
|
+
"Cargo.toml" => :cargo_toml_content,
|
14
|
+
"src/main.rs" => :main_rs_content,
|
15
|
+
"README.md" => :readme_content,
|
16
|
+
".gitignore" => :gitignore_content,
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def project_type
|
21
|
+
"Rust crate"
|
22
|
+
end
|
23
|
+
|
24
|
+
def display_custom_next_steps
|
25
|
+
puts " cargo build"
|
26
|
+
puts " cargo run"
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def cargo_toml_content
|
33
|
+
Templates::Rust::CargoToml.new(name).render
|
34
|
+
end
|
35
|
+
|
36
|
+
def main_rs_content
|
37
|
+
Templates::Rust::MainRs.new(name).render
|
38
|
+
end
|
39
|
+
|
40
|
+
def readme_content
|
41
|
+
Templates::Rust::Readme.new(name).render
|
42
|
+
end
|
43
|
+
|
44
|
+
def gitignore_content
|
45
|
+
Templates::Rust::Gitignore.new(name).render
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
module Cli
|
5
|
+
module Generators
|
6
|
+
module Templates
|
7
|
+
# .NET project template generators
|
8
|
+
#
|
9
|
+
# This module contains template classes for generating .NET project files
|
10
|
+
# including .csproj files, Program.cs, README.md, and .gitignore files.
|
11
|
+
#
|
12
|
+
# @example Generate a .csproj file
|
13
|
+
# csproj = Makit::Cli::Generators::Templates::Dotnet::Csproj.new("my-app")
|
14
|
+
# content = csproj.render
|
15
|
+
module Dotnet
|
16
|
+
# Template generator for .NET .csproj project files
|
17
|
+
#
|
18
|
+
# Generates a basic .NET 6.0 console application project file with
|
19
|
+
# standard configuration including nullable reference types and implicit usings.
|
20
|
+
#
|
21
|
+
# @example
|
22
|
+
# csproj = Csproj.new("MyApp")
|
23
|
+
# xml_content = csproj.render
|
24
|
+
class Csproj
|
25
|
+
# Initialize a new .csproj template generator
|
26
|
+
#
|
27
|
+
# @param project_name [String] the name of the .NET project
|
28
|
+
def initialize(project_name)
|
29
|
+
@project_name = project_name
|
30
|
+
end
|
31
|
+
|
32
|
+
# Render the .csproj XML content
|
33
|
+
#
|
34
|
+
# @return [String] the complete .csproj XML content
|
35
|
+
def render
|
36
|
+
<<~XML
|
37
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
38
|
+
|
39
|
+
<PropertyGroup>
|
40
|
+
<OutputType>Exe</OutputType>
|
41
|
+
<TargetFramework>net6.0</TargetFramework>
|
42
|
+
<ImplicitUsings>enable</ImplicitUsings>
|
43
|
+
<Nullable>enable</Nullable>
|
44
|
+
</PropertyGroup>
|
45
|
+
|
46
|
+
</Project>
|
47
|
+
XML
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Template generator for .NET Program.cs main entry point files
|
52
|
+
#
|
53
|
+
# Generates a basic C# console application with a Main method that
|
54
|
+
# outputs "Hello, World!" to the console. The namespace is derived
|
55
|
+
# from the project name by capitalizing and joining segments.
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# program = ProgramCs.new("my-console-app")
|
59
|
+
# csharp_content = program.render
|
60
|
+
class ProgramCs
|
61
|
+
# Initialize a new Program.cs template generator
|
62
|
+
#
|
63
|
+
# @param project_name [String] the name of the .NET project
|
64
|
+
def initialize(project_name)
|
65
|
+
@project_name = project_name
|
66
|
+
end
|
67
|
+
|
68
|
+
# Render the Program.cs C# source code content
|
69
|
+
#
|
70
|
+
# @return [String] the complete C# source code with namespace and Main method
|
71
|
+
def render
|
72
|
+
<<~CSHARP
|
73
|
+
namespace #{@project_name.split(/[-_]/).map(&:capitalize).join};
|
74
|
+
|
75
|
+
class Program
|
76
|
+
{
|
77
|
+
static void Main(string[] args)
|
78
|
+
{
|
79
|
+
Console.WriteLine("Hello, World!");
|
80
|
+
}
|
81
|
+
}
|
82
|
+
CSHARP
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Template generator for .NET project README.md files
|
87
|
+
#
|
88
|
+
# Generates a standard README.md file with project name, description,
|
89
|
+
# and common .NET build/run/test commands. Provides a good starting
|
90
|
+
# point for .NET project documentation.
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# readme = Readme.new("MyProject")
|
94
|
+
# markdown_content = readme.render
|
95
|
+
class Readme
|
96
|
+
# Initialize a new README.md template generator
|
97
|
+
#
|
98
|
+
# @param project_name [String] the name of the .NET project
|
99
|
+
def initialize(project_name)
|
100
|
+
@project_name = project_name
|
101
|
+
end
|
102
|
+
|
103
|
+
# Render the README.md markdown content
|
104
|
+
#
|
105
|
+
# @return [String] the complete README.md content with build instructions
|
106
|
+
def render
|
107
|
+
<<~README
|
108
|
+
# #{@project_name}
|
109
|
+
|
110
|
+
A .NET project.
|
111
|
+
|
112
|
+
## Building
|
113
|
+
|
114
|
+
```bash
|
115
|
+
dotnet build
|
116
|
+
```
|
117
|
+
|
118
|
+
## Running
|
119
|
+
|
120
|
+
```bash
|
121
|
+
dotnet run
|
122
|
+
```
|
123
|
+
|
124
|
+
## Testing
|
125
|
+
|
126
|
+
```bash
|
127
|
+
dotnet test
|
128
|
+
```
|
129
|
+
README
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Template generator for .NET project .gitignore files
|
134
|
+
#
|
135
|
+
# Generates a .gitignore file with common .NET build artifacts and
|
136
|
+
# IDE-specific files that should not be committed to version control.
|
137
|
+
# Includes bin/, obj/, and various Visual Studio cache files.
|
138
|
+
#
|
139
|
+
# @example
|
140
|
+
# gitignore = Gitignore.new("MyProject")
|
141
|
+
# ignore_content = gitignore.render
|
142
|
+
class Gitignore
|
143
|
+
# Initialize a new .gitignore template generator
|
144
|
+
#
|
145
|
+
# @param project_name [String] the name of the .NET project (unused but kept for consistency)
|
146
|
+
def initialize(project_name)
|
147
|
+
@project_name = project_name
|
148
|
+
end
|
149
|
+
|
150
|
+
# Render the .gitignore file content
|
151
|
+
#
|
152
|
+
# @return [String] the complete .gitignore content for .NET projects
|
153
|
+
def render
|
154
|
+
<<~GITIGNORE
|
155
|
+
bin/
|
156
|
+
obj/
|
157
|
+
*.user
|
158
|
+
*.suo
|
159
|
+
*.cache
|
160
|
+
GITIGNORE
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
module Cli
|
5
|
+
module Generators
|
6
|
+
module Templates
|
7
|
+
# Node.js project template generators
|
8
|
+
#
|
9
|
+
# This module contains template classes for generating Node.js project files
|
10
|
+
# including package.json, index.js, README.md, and .gitignore files.
|
11
|
+
#
|
12
|
+
# @example Generate a package.json file
|
13
|
+
# package = Makit::Cli::Generators::Templates::Node::PackageJson.new("my-app")
|
14
|
+
# content = package.render
|
15
|
+
module Node
|
16
|
+
# Template generator for Node.js package.json files
|
17
|
+
#
|
18
|
+
# Generates a standard package.json file with basic metadata,
|
19
|
+
# MIT license, and placeholder test script. Sets up a Node.js
|
20
|
+
# project ready for npm package management.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# package = PackageJson.new("my-node-app")
|
24
|
+
# json_content = package.render
|
25
|
+
class PackageJson
|
26
|
+
# Initialize a new package.json template generator
|
27
|
+
#
|
28
|
+
# @param project_name [String] the name of the Node.js project
|
29
|
+
def initialize(project_name)
|
30
|
+
@project_name = project_name
|
31
|
+
end
|
32
|
+
|
33
|
+
# Render the package.json content
|
34
|
+
#
|
35
|
+
# @return [String] the complete package.json content with project metadata
|
36
|
+
def render
|
37
|
+
<<~JSON
|
38
|
+
{
|
39
|
+
"name": "#{@project_name}",
|
40
|
+
"version": "0.1.0",
|
41
|
+
"description": "A Node.js project",
|
42
|
+
"main": "index.js",
|
43
|
+
"scripts": {
|
44
|
+
"test": "echo \\"Error: no test specified\\" && exit 1"
|
45
|
+
},
|
46
|
+
"keywords": [],
|
47
|
+
"author": "",
|
48
|
+
"license": "MIT"
|
49
|
+
}
|
50
|
+
JSON
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Template generator for Node.js index.js entry point files
|
55
|
+
#
|
56
|
+
# Generates a simple JavaScript file that outputs "Hello, World!"
|
57
|
+
# to the console. Provides a basic starting point for Node.js
|
58
|
+
# applications.
|
59
|
+
#
|
60
|
+
# @example
|
61
|
+
# index = IndexJs.new("my-app")
|
62
|
+
# js_content = index.render
|
63
|
+
class IndexJs
|
64
|
+
# Initialize a new index.js template generator
|
65
|
+
#
|
66
|
+
# @param project_name [String] the name of the Node.js project (unused but kept for consistency)
|
67
|
+
def initialize(project_name)
|
68
|
+
@project_name = project_name
|
69
|
+
end
|
70
|
+
|
71
|
+
# Render the index.js JavaScript content
|
72
|
+
#
|
73
|
+
# @return [String] the complete JavaScript code for the main entry point
|
74
|
+
def render
|
75
|
+
<<~JAVASCRIPT
|
76
|
+
console.log("Hello, World!");
|
77
|
+
JAVASCRIPT
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Template generator for Node.js project README.md files
|
82
|
+
#
|
83
|
+
# Generates a standard README.md file with project name, description,
|
84
|
+
# and common npm commands (install, run, test). Provides documentation
|
85
|
+
# structure for Node.js projects.
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# readme = Readme.new("MyNodeApp")
|
89
|
+
# markdown_content = readme.render
|
90
|
+
class Readme
|
91
|
+
# Initialize a new README.md template generator
|
92
|
+
#
|
93
|
+
# @param project_name [String] the name of the Node.js project
|
94
|
+
def initialize(project_name)
|
95
|
+
@project_name = project_name
|
96
|
+
end
|
97
|
+
|
98
|
+
# Render the README.md markdown content
|
99
|
+
#
|
100
|
+
# @return [String] the complete README.md content with npm instructions
|
101
|
+
def render
|
102
|
+
<<~README
|
103
|
+
# #{@project_name}
|
104
|
+
|
105
|
+
A Node.js project.
|
106
|
+
|
107
|
+
## Installation
|
108
|
+
|
109
|
+
```bash
|
110
|
+
npm install
|
111
|
+
```
|
112
|
+
|
113
|
+
## Running
|
114
|
+
|
115
|
+
```bash
|
116
|
+
node index.js
|
117
|
+
```
|
118
|
+
|
119
|
+
## Testing
|
120
|
+
|
121
|
+
```bash
|
122
|
+
npm test
|
123
|
+
```
|
124
|
+
README
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Template generator for Node.js project .gitignore files
|
129
|
+
#
|
130
|
+
# Generates a .gitignore file with common Node.js artifacts and
|
131
|
+
# log files that should not be committed to version control.
|
132
|
+
# Includes node_modules/, npm debug logs, and yarn error logs.
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
# gitignore = Gitignore.new("MyProject")
|
136
|
+
# ignore_content = gitignore.render
|
137
|
+
class Gitignore
|
138
|
+
# Initialize a new .gitignore template generator
|
139
|
+
#
|
140
|
+
# @param project_name [String] the name of the Node.js project (unused but kept for consistency)
|
141
|
+
def initialize(project_name)
|
142
|
+
@project_name = project_name
|
143
|
+
end
|
144
|
+
|
145
|
+
# Render the .gitignore file content
|
146
|
+
#
|
147
|
+
# @return [String] the complete .gitignore content for Node.js projects
|
148
|
+
def render
|
149
|
+
<<~GITIGNORE
|
150
|
+
node_modules/
|
151
|
+
npm-debug.log*
|
152
|
+
yarn-debug.log*
|
153
|
+
yarn-error.log*
|
154
|
+
GITIGNORE
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
module Cli
|
5
|
+
module Generators
|
6
|
+
module Templates
|
7
|
+
module Ruby
|
8
|
+
# Template for Ruby gem Gemfile
|
9
|
+
class Gemfile
|
10
|
+
def initialize(project_name)
|
11
|
+
@project_name = project_name
|
12
|
+
end
|
13
|
+
|
14
|
+
def render
|
15
|
+
<<~GEMFILE
|
16
|
+
source "https://rubygems.org"
|
17
|
+
|
18
|
+
gem "#{@project_name}"
|
19
|
+
GEMFILE
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Makit
|
4
|
+
module Cli
|
5
|
+
module Generators
|
6
|
+
module Templates
|
7
|
+
module Ruby
|
8
|
+
# Template for Ruby gem gemspec file
|
9
|
+
class Gemspec
|
10
|
+
def initialize(project_name)
|
11
|
+
@project_name = project_name
|
12
|
+
end
|
13
|
+
|
14
|
+
def render
|
15
|
+
<<~GEMSPEC
|
16
|
+
Gem::Specification.new do |spec|
|
17
|
+
spec.name = "#{@project_name}"
|
18
|
+
spec.version = "0.1.0"
|
19
|
+
spec.authors = ["Author Name"]
|
20
|
+
spec.email = ["author@example.com"]
|
21
|
+
spec.summary = "A Ruby gem"
|
22
|
+
spec.description = "A longer description of the gem"
|
23
|
+
spec.homepage = "https://github.com/author/#{@project_name}"
|
24
|
+
spec.license = "MIT"
|
25
|
+
#{" "}
|
26
|
+
spec.files = Dir["lib/**/*", "README.md"]
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
#{" "}
|
29
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
30
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
32
|
+
end
|
33
|
+
GEMSPEC
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|