Format Ruby code blocks
This commit is contained in:
@@ -41,8 +41,8 @@ You will need the `valet-mapper-example` Azure DevOps pipeline ID to perform the
|
||||
To create a transformer, you need to create a Ruby file that looks as follows:
|
||||
``` ruby
|
||||
transform "azuredevopstaskname" do |item|
|
||||
# your ruby code here that produces output
|
||||
end
|
||||
# your ruby code here that produces output
|
||||
end
|
||||
```
|
||||
|
||||
We start by creating a new folder called `plugin` under the `valet` folder in your repository. In there create a file called `DotNetCoreCLI.rb`.
|
||||
@@ -53,8 +53,8 @@ The way you find this name is by clicking the **view yaml** button at a task in
|
||||
This results in the following code:
|
||||
``` ruby
|
||||
transform "DotNetCoreCLI@2" do |item|
|
||||
# your ruby code here that produces output
|
||||
end
|
||||
# your ruby code here that produces output
|
||||
end
|
||||
```
|
||||
The parameter item is a collection of items than contain the properties of the original task that was retrieved from Azure DevOps.
|
||||
In this case we can see in the yaml that the properties that are set are `command` and `projects`.
|
||||
@@ -63,21 +63,20 @@ Add the following code to the ruby file:
|
||||
``` Ruby
|
||||
transform "DotNetCoreCLI@2" do |item|
|
||||
projects = item["projects"]
|
||||
command = item['command']
|
||||
command = item["command"]
|
||||
run_command = []
|
||||
|
||||
if(projects.include?("$"))
|
||||
if(command.nil?)
|
||||
command = "build"
|
||||
end
|
||||
run_command << "shopt -s globstar; for f in ./**/*.csproj; do dotnet #{command} $f #{item['arguments'] } ; done"
|
||||
else
|
||||
run_command << "dotnet #{command} #{item['projects']} #{item['arguments'] }"
|
||||
end
|
||||
{
|
||||
shell: "bash",
|
||||
run: run_command.join("\n")
|
||||
}
|
||||
|
||||
if projects.include?("$")
|
||||
command = "build" if command.nil?
|
||||
run_command << "shopt -s globstar; for f in ./**/*.csproj; do dotnet #{command} $f #{item['arguments']} ; done"
|
||||
else
|
||||
run_command << "dotnet #{command} #{item['projects']} #{item['arguments']}"
|
||||
end
|
||||
|
||||
{
|
||||
shell: "bash",
|
||||
run: run_command.join("\n")
|
||||
}
|
||||
end
|
||||
```
|
||||
### Example
|
||||
|
||||
Reference in New Issue
Block a user