Category: Uncategorized

  • Building a Module

    In the post about how to make a module with Azure DevOps, I mention a file, build.ps1. Basically, I tell you to copy what I got. Maybe you want to understand what I’m trying to do in that file. Here’s that explanation:

    1. Initialization:
      • It sets $buildVersion to the value of the BUILDVER environment variable.
      • It determines the path of the current script’s directory and assigns it to $projectRoot.
      • The projectRoot variable is then saved as a pipeline variable using Write-Host. This and a few more to come are used in other steps of the process. Saving as pipeline variable allows me to find the value here and use it later.
    2. Reading Configuration:
      • The script reads a JSON configuration file named module-config.json located in the project root directory.
    3. Checking for Public Folder:
      • The script checks if there’s a Public folder in the project root directory, throwing an error if not found. This folder is critical to the module and should contain all your PowerShell functions.
    4. Checking for Private Folder:
      • Similarly, it checks for a Private folder in the project root directory.
      • If this folder exists, it sets the $hasPrivateFunctions variable to $true and saves it as a pipeline variable.
    5. Checking for Tests Folder:
      • The script looks for a Tests folder in the project root directory.
      • If it finds one, it sets the $hasPesterTests variable to $true and saves it as a pipeline variable.
    6. Assembling the Manifest Data:
      • The script then enters the Manifest region, which is responsible for building the module manifest file.
      • It sets the $manifestPath variable to the path of the module manifest file, which is located in the project root directory and has the same name as the module, followed by the .psd1 extension.
      • The $copyrightDate variable is set based on the CopyrightStartYear property in the configuration file. If the start year is the current year, only the current year is used. Otherwise, a range of years is used.
    7. Creating the Module Manifest:
      • Finally, the script creates a new module manifest file (*.psd1) with the specified metadata.
    8. Loads the Functions:
      • Updates the manifest file with the public functions found in the Public folder.
    9. Create Nuspec File:
      • The next region is for finding the values and saving Nuspec file.
      • Builds a NuGet package (*.nuspec) for the module, including the module files and any private functions or Pester tests.
    10. Create Module File:
      • In a simple module, this file might contain all the functions for the module. In this case, we have them in separate files.
      • This exports PowerShell code into a module file (*.psm1) that will dynamically load all the functions in the public and private folders into the current session. The list of functions in the public folder will be exported as part of the module.

  • When I grow up I want to be…

    http://www.cyclingnews.com/news/lloyd-makes-the-most-of-local-knowledge-at-the-tour-of-britain?ns_campaign=news&ns_mchannel=rss&ns_source=cyclingnews&ns_linkname=0&ns_fee=0

    … a route programmer for a Pro-Tour team.  Who cares about radios if you have the data in your cyclo-computer; the riders can dictate their own tactics.  What happens to those who are not sponsored by a company who can provide the hardware?

    How do I get this service to be my job?