Class: Makit::Configuration::DotNetProject

Inherits:
Object
  • Object
show all
Defined in:
lib/makit/configuration/dotnet_project.rb

Overview

Project configuration management

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDotNetProject

set the default values



12
13
14
15
16
17
# File 'lib/makit/configuration/dotnet_project.rb', line 12

def initialize
  @name = "MyClassLib"
  @output_dir = "source/MyClassLib"
  @frameworks = ["net8.0", "net8.0-browser"]
  @template = "classlib"
end

Instance Attribute Details

#frameworksObject

Returns the value of attribute frameworks.



9
10
11
# File 'lib/makit/configuration/dotnet_project.rb', line 9

def frameworks
  @frameworks
end

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/makit/configuration/dotnet_project.rb', line 9

def name
  @name
end

#output_dirObject

Returns the value of attribute output_dir.



9
10
11
# File 'lib/makit/configuration/dotnet_project.rb', line 9

def output_dir
  @output_dir
end

#templateObject

Returns the value of attribute template.



9
10
11
# File 'lib/makit/configuration/dotnet_project.rb', line 9

def template
  @template
end

Instance Method Details

#get_build_commandsObject



23
24
25
26
27
28
# File 'lib/makit/configuration/dotnet_project.rb', line 23

def get_build_commands
  commands = []
  commands << "dotnet build #{get_csproj_path} --configuration Release"
  commands << "dotnet build #{get_csproj_path} --configuration Debug"
  commands
end

#get_csproj_pathObject



19
20
21
# File 'lib/makit/configuration/dotnet_project.rb', line 19

def get_csproj_path
  "#{@output_dir}/#{@name}.csproj"
end

#get_publish_commandsObject



30
31
32
33
34
35
# File 'lib/makit/configuration/dotnet_project.rb', line 30

def get_publish_commands
  commands = []
  commands << "dotnet publish #{get_csproj_path} --configuration Release --output artifacts/Publish"
  commands << "dotnet publish #{get_csproj_path} --configuration Debug --output artifacts/Publish"
  commands
end

#to_jsonObject



37
38
39
40
41
42
43
44
# File 'lib/makit/configuration/dotnet_project.rb', line 37

def to_json
  {
    name: @name,
    output_dir: @output_dir,
    frameworks: @frameworks,
    template: @template
  }.to_json
end