feat: Posh-GitHub 0.0.1

https://github.com/Iristyle/Posh-GitHub
This commit is contained in:
Iristyle
2013-05-09 13:14:27 -04:00
parent ed4f40f5de
commit 3581791906
3 changed files with 126 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata>
<id>Posh-GitHub</id>
<title>Posh-GitHub - PowerShell GitHub API helpers</title>
<version>0.0.1</version>
<authors>Ethan J Brown</authors>
<owners>Ethan J Brown</owners>
<summary>PowerShell cmdlet helpers for working with GitHub</summary>
<description>PowerShell cmdlet helpers for working with the GitHub API.
* New-GitHubOAuthToken - creates an OAuth token for use with GitHub
* Get-GitHubOAuthTokens - Used to list all the authorizations you have provided
to applications / tooling
* Set-GitHubUserName - Adds the username to the current PowerShell session and
sets a global User environment variable
* Set-GitHubOrganization - Adds the organization to the current PowerShell
session and sets a global User environment variable
* Get-GitHubRepositories - List all your repositories - gives a fork indicator,
a date for when the last update (push) occurred, how many open issues and size
* New-GitHubRepository - Creates a new GitHub repository and clones it locally
by default.
* New-GitHubFork - Forks a repository, clones it locally, then properly adds a
remote named upstream to point back to the parent repository. Aborts if there
is a directory in the current working directory that shares the name of the
repository.
* Get-GitHubIssues - List issues against the repository for the current working
directory, or can list issues against a specific repo and owner.
* New-GitHubPullRequest - Initiates a new pull request to the upstream repo.
* Get-GitHubPullRequests - List pull requests against the repository for the
current working directory, or can list pull requests against all forks from a user.
* Get-GitHubTeams - The default parameterless version will use the GITHUB_ORG
environment variable to get the list of teams, their ids and members.
* Get-GitHubEvents - Will list, in chronological order, the last 30 events that
you have generated
* Clear-GitMergedBranches - Will remove any local branch cruft from branches
that have been merged into the master branch.
</description>
<projectUrl>http://github.com/Iristyle/Posh-GitHub/</projectUrl>
<tags>powershell shell git github</tags>
<!-- Eula is in installer
<licenseUrl></licenseUrl>
-->
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<iconUrl>https://github.com/Iristyle/ChocolateyPackages/raw/master/Posh-GitHub/Posh-GitHub.png</iconUrl>
<releaseNotes></releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
<file src="..\core\PowerShellHelpers.ps1" target="tools" />
</files>
</package>

BIN
Posh-GitHub/Posh-GitHub.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,74 @@
$package = 'Posh-GitHub'
$version = '0.0.1'
function Get-CurrentDirectory
{
$thisName = $MyInvocation.MyCommand.Name
[IO.Path]::GetDirectoryName((Get-Content function:$thisName).File)
}
try {
$current = Get-CurrentDirectory
. (Join-Path $current 'PowerShellHelpers.ps1')
# find user specific module directory
$moduleDirectory = Get-ModuleDirectory
$installDirectory = Join-Path $moduleDirectory $package
# unload module if its already loaded
Get-Module -Name $package | Remove-Module
try
{
if (Test-Path($installDirectory))
{
Remove-Item $installDirectory -Recurse -Force
}
}
catch
{
Write-Host "Could not remove existing $package folder"
}
Write-Host "Installing $package to $installDirectory..."
$params = @{
PackageName = $package;
Url = "https://github.com/Iristyle/Posh-GitHub/zipball/$version";
UnzipLocation = $moduleDirectory;
}
Install-ChocolateyZipPackage @params
# github tarballs are versioned and we don't want that ;0
Get-ChildItem -Path $moduleDirectory |
? { $_.Name -match 'Posh\-GitHub' } |
Sort-Object -Property CreationTime -Descending |
Select -First 1 |
Rename-Item -NewName $installDirectory
if (!(Test-Path $PROFILE))
{
$profileRoot = Split-Path $PROFILE
New-Item -Path $profileRoot -Type Directory -ErrorAction SilentlyContinue
Set-Content -Path $PROFILE -Value '' -Force -Encoding UTF8
}
if (!(Select-String -Pattern 'Posh\-GitHub\-Profile\.ps1' -Path $PROFILE))
{
$loaderFile = 'Posh-GitHub-Profile.ps1'
"`n`n# Load Posh-GitHub`n. '$installDirectory\$loaderFile'" |
Out-File -FilePath $PROFILE -Append -Encoding UTF8
. $PROFILE
}
Write-Host @'
Reload the current profile to access Posh-Github with:
. $PROFILE
'@
Write-ChocolateySuccess $package
}
catch
{
Write-ChocolateyFailure $package "$($_.Exception.Message)"
throw
}