Skip to content

Commit

Permalink
Merge pull request #35 from webmd-health-services/develop
Browse files Browse the repository at this point in the history
0.13.0
  • Loading branch information
decoyjoe committed Apr 9, 2019
2 parents dc6d608 + e3e215e commit 10e499b
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 307 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These owners will be the default owners for everything in
# the repo. The owners will be requested for review when
# someone opens a pull request.
* @webmd-health-services/devops
2 changes: 1 addition & 1 deletion GitAutomation/Functions/ConvertTo-GitFullPath.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function ConvertTo-GitFullPath
{
if( $Uri.Scheme )
{
return $Uri.ToString()
return $Uri.AbsoluteUri
}

$Path = $Uri.ToString()
Expand Down
18 changes: 15 additions & 3 deletions GitAutomation/Functions/Receive-GitCommit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ function Receive-GitCommit
param(
[string]
# The repository to fetch updates for. Defaults to the current directory.
$RepoRoot = (Get-Location).ProviderPath
$RepoRoot = (Get-Location).ProviderPath,

[pscredential]
# The credentials to use to connect to the source repository.
$Credential
)

Set-StrictMode -Version 'Latest'
Expand All @@ -44,13 +48,21 @@ function Receive-GitCommit
return
}

$options = New-Object 'libgit2sharp.FetchOptions'
if( $Credential )
{
$gitCredential = New-Object 'LibGit2Sharp.SecureUsernamePasswordCredentials'
$gitCredential.Username = $Credential.UserName
$gitCredential.Password = $Credential.Password
$options.CredentialsProvider = { return $gitCredential }
}

try
{
$fetchOptions = New-Object 'LibGit2Sharp.FetchOptions'
foreach( $remote in $repo.Network.Remotes )
{
[string[]]$refspecs = $remote.FetchRefSpecs | Select-Object -ExpandProperty 'Specification'
[LibGit2Sharp.Commands]::Fetch($repo, $remote.Name, $refspecs, $fetchOptions, $null)
[LibGit2Sharp.Commands]::Fetch($repo, $remote.Name, $refspecs, $options, $null)
}
}
finally
Expand Down
6 changes: 3 additions & 3 deletions GitAutomation/GitAutomation.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
RootModule = 'GitAutomation.psm1'

# Version number of this module.
ModuleVersion = '0.12.0'
ModuleVersion = '0.13.0'

# ID used to uniquely identify this module
GUID = '119a2511-62d9-4626-9728-0c8ec7068c57'
Expand Down Expand Up @@ -148,8 +148,8 @@
# ReleaseNotes of this module

ReleaseNotes = @'
* Added `Get-GitConfiguration` function for getting Git configuration values.
* Added `Remove-GitConfiguration` function for removing/unsetting Git configuration values.
* Fixed: `ConvertTo-GitFullPath` doesn't properly encode the returned Uri string. (thanks @thorbenw)
* Added `Credential` parameter to the `Receive-GitCommit` function. (thanks @thorbenw)
'@

} # End of PSData hashtable
Expand Down
Binary file modified GitAutomation/GitAutomation.psm1
Binary file not shown.
4 changes: 2 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Carbon
GitAutomation

Copyright 2012 - 2015 Aaron Jensen
Copyright 2012 - 2019 WebMD Health Services
145 changes: 0 additions & 145 deletions New-Website.ps1

This file was deleted.

43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
You can find the GitAutomation PowerShell module documentation at [http://get-gitautomation.org](http://get-gitautomation.org).

[![Build status](https://ci.appveyor.com/api/projects/status/pm83uey7k498pe9d?svg=true)](https://ci.appveyor.com/project/WebMD-Health-Services/gitautomation)
[![latest](https://img.shields.io/badge/dynamic/json.svg?label=latest&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fwebmd-health-services%2FGitAutomation%2Freleases%2Flatest&query=%24.name&colorB=brightgreen)](https://www.powershellgallery.com/packages/BitbucketServerAutomation)

# Overview
GitAutomation is a PowerShell module for working with Git repositories. You can use it to create, clone, query, push, pull, commit, and even more with Git repositories.

This module uses [LibGit2Sharp](https://github.com/libgit2/libgit2sharp), the .NET wrapper of [libgit2](https://libgit2.org/), "a portable, pure C implementation of... Git", which allows you to call Git via API instead using the Git command line interface.

# Installation

## Install from PowerShell Gallery

Ensure you have [PowerShellGet](https://docs.microsoft.com/en-us/powershell/gallery/installing-psget) installed and make [PowerShell Gallery](https://www.powershellgallery.com/) a trusted source:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

Then to install the module run:

Install-Module -Name GitAutomation

# Contributing

Contributions are welcome and encouraged!

## Building and Testing

We use [Whiskey](https://github.com/webmd-health-services/Whiskey) to build, test, and publish the module. [Pester](https://github.com/pester/Pester) is the testing framework used for our tests.

To build and run all tests, use the `build.ps1` script:

.\build.ps1

If you want to run only specific tests, first import `Pester`:

Import-Module -Name '.\PSModules\Pester'

Then invoke a single test script:

Invoke-Pester -Path .\Tests\Get-GitCommit.Tests.ps1

Test scripts go in the `Tests` directory. New module functions go in the `GitAutomation\Functions` directory.
Loading

0 comments on commit 10e499b

Please sign in to comment.