Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
gep13 committed Sep 2, 2019
2 parents 7e8a1b9 + bf87d43 commit 67e1805
Show file tree
Hide file tree
Showing 8 changed files with 330 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tmp/
125 changes: 125 additions & 0 deletions PoshBot.Soon/PoshBot.Soon.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#
# Module manifest for module 'PoshBot.Soon'
#
# Generated by: Gary Ewan Park
#
# Generated on: 3/4/2019
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'PoshBot.Soon.psm1'

# Version number of this module.
ModuleVersion = '0.1.0'

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = 'bd719e1d-b82c-44ff-8852-6c21458fbcba'

# Author of this module
Author = 'Gary Ewan Park'

# Company or vendor of this module
CompanyName = 'Community'

# Copyright statement for this module
Copyright = '(c) 2019 Gary Ewan Park. All rights reserved.'

# Description of the functionality provided by this module
Description = 'A soon plugin for PoshBot'

# Minimum version of the Windows PowerShell engine required by this module
PowerShellVersion = '5.0.0'

# Name of the Windows PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the Windows PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# CLRVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName='PoshBot'; ModuleVersion='0.11.8'; Guid='7bfb126c-b432-4921-989a-9802f525693f'})

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = @(
'Get-Soon'
)

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = @()

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = @('PoshBot', 'Soon', 'ChatOps')

# A URL to the license for this module.
LicenseUri = 'https://raw.githubusercontent.com/gep13/PoshBot.Soon/develop/LICENSE'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/gep13/PoshBot.Soon'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'https://raw.githubusercontent.com/gep13/PoshBot.Soon/develop/CHANGELOG.md'

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

49 changes: 49 additions & 0 deletions PoshBot.Soon/PoshBot.Soon.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
function Get-Soon {
[PoshBot.BotCommand(
Command = $false,
TriggerType = 'regex',
Regex = 'soon'
)]
[cmdletbinding()]
param(
[object[]]$Arguments
)

$imageArray = "https://i.imgur.com/TVxNL84.png",
"https://i.imgur.com/bFb5qZt.jpg",
"https://i.imgur.com/qNiLQz3.png",
"https://i.imgur.com/8niosvC.gif",
"https://i.imgur.com/qX5jkRi.jpg",
"https://i.imgur.com/Rqe94Xw.jpg",
"https://i.imgur.com/i2leGDn.jpg",
"https://i.imgur.com/QdnGKdY.jpg",
"https://i.imgur.com/bkox94P.jpg",
"https://i.imgur.com/hdG9IOk.jpg",
"https://i.imgur.com/ne6T0UP.png",
"https://i.imgur.com/41vZ1zP.png",
"https://i.imgur.com/yweXMrA.jpg",
"https://i.imgur.com/GcnzEjU.jpg",
"https://i.imgur.com/J0PLa1k.jpg",
"https://i.imgur.com/GHHLFqK.jpg",
"https://i.imgur.com/o25zB5O.jpg",
"https://i.imgur.com/6yyeCBR.jpg",
"https://i.imgur.com/GKSdoAm.png",
"https://i.imgur.com/3L0UQ8A.jpg",
"https://i.imgur.com/7WhKHPh.gif",
"https://i.imgur.com/xZuKr9v.gif",
"https://i.imgur.com/GWSQBxx.jpg",
"https://i.imgur.com/eCvTcTQ.jpg",
"https://i.imgur.com/0ypfizN.jpg",
"https://i.imgur.com/JyaroGd.jpg",
"https://i.imgur.com/xUgmD93.jpg",
"https://i.imgur.com/ftGheRE.jpg",
"https://i.imgur.com/Y4ExtS5.gif",
"https://i.imgur.com/pDXRVjp.jpg",
"https://i.imgur.com/L2SZuzG.gif"

$randomlySelectedImage = Get-Random -InputObject $imageArray

if ($randomlySelectedImage) {
New-PoshBotCardResponse -ImageUrl $randomlySelectedImage
}
}
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# PoshBot.Soon

A simple [PoshBot](https://github.com/poshbotio/PoshBot) plugin to show random images any time someone writes the word `soon`.

## Install Module

To install the module from the [PowerShell Gallery](https://www.powershellgallery.com/):

```
PS C:\> Install-Module -Name PoshBot.Soon -Repository PSGallery
```

## Install Plugin

To install the plugin from within PoshBot:

```
!install-plugin --name poshbot.soon
```
13 changes: 13 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 1.0.{build}

image: Visual Studio 2015

build: off

# Uncomment this block to enable RDP access to the AppVeyor test instance for
# debugging purposes.
# on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

test_script:
- ps: . .\build.ps1 -Task Test
33 changes: 33 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@


[cmdletbinding(DefaultParameterSetName = 'task')]
param(
[parameter(ParameterSetName = 'task', Position = 0)]
[string[]]$Task = 'default',

[parameter(ParameterSetName = 'help')]
[switch]$Help
)

Get-PackageProvider -Name Nuget -ForceBootstrap | Out-Null
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

if (-not (Get-Module -Name PSDepend -ListAvailable)) {
Install-module -Name PSDepend -Repository PSGallery
}
Import-Module -Name PSDepend
Invoke-PSDepend -Path .\requirements.psd1 -Install -Import -Force
if (-not (Get-Module -Name BuildHelpers -ListAvailable)) {
Install-Module -Name BuildHelpers -AllowClobber
}
Import-Module -Name BuildHelpers

if ($PSBoundParameters.ContainsKey('help')) {
Get-PSakeScriptTasks -buildFile "$PSScriptRoot\psake.ps1" |
Format-Table -Property Name, Description, Alias, DependsOn
} else {
Set-BuildEnvironment -Force

Invoke-psake -buildFile "$PSScriptRoot\psake.ps1" -taskList $Task -nologo
exit ( [int]( -not $psake.build_success ) )
}
81 changes: 81 additions & 0 deletions psake.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
properties {
$projectRoot = $ENV:BHProjectPath
if(-not $projectRoot) {
$projectRoot = $PSScriptRoot
}

$sut = "$projectRoot\$env:BHProjectName"
$tests = "$projectRoot\Tests"
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest

$psVersion = $PSVersionTable.PSVersion.Major
}

task default -depends Test

task Init {
"`nSTATUS: Testing with PowerShell $psVersion"
"Build System Details:"
Get-Item ENV:BH*
} -description 'Initialize build environment'

task Test -Depends Init, Analyze, Pester -description 'Run test suite'

task Analyze -Depends Init {
$analysis = Invoke-ScriptAnalyzer -Path $sut -Recurse -Verbose:$false
$errors = $analysis | Where-Object {$_.Severity -eq 'Error'}
$warnings = $analysis | Where-Object {$_.Severity -eq 'Warning'}
if (@($errors).Count -gt 0) {
Write-Error -Message 'One or more Script Analyzer errors were found. Build cannot continue!'
$errors | Format-Table
}

if (@($warnings).Count -gt 0) {
Write-Warning -Message 'One or more Script Analyzer warnings were found. These should be corrected.'
$warnings | Format-Table
}
} -description 'Run PSScriptAnalyzer'

task Pester -Depends Init {
Remove-Module $ENV:BHProjectName -ErrorAction SilentlyContinue -Verbose:$false
Import-Module -Name $env:BHPSModuleManifest -Force -Verbose:$false

# Prep for testing
$PesterParams = @{}
$testResultFile = ''
switch ($ENV:BHBuildSystem) {
'AppVeyor' {
$testResultFile = Join-Path -Path $projectRoot -ChildPath 'pester.xml'
$PesterParams = @{
OutputFile = $testResultFile
OutputFormat = 'NUnitXML'
}
break
}
Default {}
}

# Run tests
if (Test-Path -Path $tests) {
$testResults = Invoke-Pester -Path $tests -PassThru @PesterParams

# Post test results
switch ($ENV:BHBuildSystem) {
'AppVeyor' {
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", $testResultFile)
break
}
Default {}
}
}

if ($testResults.FailedCount -gt 0) {
throw "$($testResults.FailedCount) tests failed!"
}

} -description 'Run Pester tests'

Task Publish -Depends Test {
" Publishing version [$($manifest.ModuleVersion)] to PSGallery..."
Publish-Module -Path $sut -NuGetApiKey $env:PSGalleryApiKey -Repository PSGallery
}
9 changes: 9 additions & 0 deletions requirements.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
PSDependOptions = @{
Target = 'CurrentUser'
}
psake = 'latest'
pester = 'latest'
psscriptanalyzer = 'latest'
poshbot = 'latest'
}

0 comments on commit 67e1805

Please sign in to comment.