Skip to content

Commit

Permalink
Merge pull request #32 from StartAutomating/Eventful-Updates
Browse files Browse the repository at this point in the history
Eventful 0.1.8
  • Loading branch information
StartAutomating authored Jun 10, 2023
2 parents 5481da0 + 4cad3b6 commit 90511ed
Show file tree
Hide file tree
Showing 71 changed files with 1,182 additions and 524 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [StartAutomating]
3 changes: 3 additions & 0 deletions .github/workflows/TestAndPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,9 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: GitLogger
uses: GitLogging/GitLoggerAction@main
id: GitLogger
- name: Use PSSVG Action
uses: StartAutomating/PSSVG@main
id: PSSVG
Expand Down
8 changes: 4 additions & 4 deletions Assets/Eventful.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 25 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
## 0.1.7
## Eventful 0.1.8:

* Eventful Supports Sponsorship (#25)
* New Commands!
* Import-Event (#28)
* Export-Event (#27)
* Send-Event can now send -EventArguments and -MessageData (#26)
* Watch-Event now supports -MaxTriggerCount and -MessageData (#29)
* Simplifying event source registration (any `@*` script or function) (#30)
* Making one-time event sources more efficient (#31)

---

## Eventful 0.1.7:
* Adding On@CommandNotFound event source (Fixes #11)
* Watch-Event now allows eventsources -recursively (Fixes #15)

---

## 0.1.6
## Eventful 0.1.6
* Adding LocationChanged event source (Fixes #12)

---

## 0.1.5
## Eventful 0.1.5
* Adding On@Event (#2)
* Send-Event support for piping existing events (#4)
* Adding /docs (#5)

---

## 0.1.4
## Eventful 0.1.4

* Module Rebranded to Eventful.
* Get-EventHandler added

---

## 0.1.3
## Eventful 0.1.3
New Event Source:
* VariableSet

Expand All @@ -34,15 +47,15 @@ Bugfix: On@Repeat now actually starts it's timer.

---

## 0.1.2
## Eventful 0.1.2
New Event Source:
* UDP

PowerShellAsync Event Source now allows for a -Parameter dictionaries.

---

## 0.1.1
## Eventful 0.1.1
New Event Sources:
* HTTPResponse
* PowerShellAsync
Expand All @@ -54,11 +67,13 @@ New Event Source Capabilities:
Event Sources can now return an InitializeEvent property or provide a ComponentModel.InitializationEvent attribute.
This will be called directly after the subscription is created, so as to avoid signalling too soon.

## 0.1
---

## Eventful 0.1

Initial Module Release.

Fun simple event syntax (e.g. on mysignal {"do this"} or on delay "00:00:01" {"do that"})
Better pipelining support for Sending events.

---
'@
---
6 changes: 4 additions & 2 deletions @Delay.ps1 → EventSources/@Delay.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ $Wait
)

process {
$timer = New-Object Timers.Timer -Property @{Interval=$Wait.TotalMilliseconds;AutoReset=$false}
$timer = New-Object Timers.Timer -Property @{Interval=$Wait.TotalMilliseconds;AutoReset=$false}
$timer |
Add-Member NoteProperty EventName Elapsed -PassThru |
Add-Member NoteProperty MaxTriggerCount 1 -PassThru
$timer.Start()
$timer | Add-Member NoteProperty EventName Elapsed -PassThru
}
File renamed without changes.
3 changes: 2 additions & 1 deletion EventSources/@HttpResponse.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ $TransferEncoding = $([Text.Encoding]::UTF8)

process {
# Clear the event subscriber if one exists.
$eventSubscriber = Get-EventSubscriber -SourceIdentifier "@HttpResponse_Check" -ErrorAction SilentlyContinue
$eventSubscriber = Get-EventSubscriber -SourceIdentifier "@HttpResponse_Check" -ErrorAction Ignore
if ($eventSubscriber) {$eventSubscriber | Unregister-Event}

# Create a new subscriber for the request.
$httpResponseCheckTimer = New-Object Timers.Timer -Property @{
Interval = $PollingInterval.TotalMilliseconds # Every pollinginterval,
AutoReset = $true
}

$HttpResponseChecker =
Register-ObjectEvent -InputObject $httpResponseCheckTimer -EventName Elapsed -Action {
$toCallEnd = # check to see if any requests have completed.
Expand Down
3 changes: 2 additions & 1 deletion EventSources/@PowerShellAsync.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ process {
$psAsync |
Add-Member NoteProperty SourceIdentifier @(
"PowerShell.Async.$($psAsync.InstanceID)","PowerShell.Async.Failed.$($psAsync.InstanceID)"
) -Force -PassThru
) -Force -PassThru |
Add-Member MaxTriggerCount 1 -Force -PassThru

return
}
6 changes: 3 additions & 3 deletions EventSources/@Process.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<#
<#
.Synopsis
Watches a process.
.Description
Expand Down Expand Up @@ -48,7 +48,7 @@ process {
Add-Member EventName $eventNames -Force -PassThru
} else {
Get-Process -Id $ProcessID |
Add-Member EventName "Exited" -Force -PassThru
Add-Member EventName "Exited" -Force -PassThru |
Add-Member MaxTriggerCount 1 -Force -PassThru
}

}
File renamed without changes.
4 changes: 3 additions & 1 deletion @Time.ps1 → EventSources/@Time.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#>
[Diagnostics.Tracing.EventSource(Name='Elapsed')]
param(
# The specific date and time the event will be triggered.
[Parameter(Mandatory,Position=0,ParameterSetName='SpecificTime')]
[DateTime]
$DateTime
Expand All @@ -24,5 +25,6 @@ process {

if (-not $timer) { return }
$timer.Start()
return $timer
$timer |
Add-Member NoteProperty MaxTriggerCount 1 -PassThru
}
30 changes: 30 additions & 0 deletions EventSources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
This directory contains the built-in EventSources in Eventful.

_Technically speaking_, EventSources can exist in any directory, as long as they are named liked `@*.ps1` and match `^@\w`.

Event sources within Eventful or modules that tag Eventful will be automatically included.

Watch-Event will also check the local directory for event sources.


|Name |Synopsis |
|--------------------------------------------------------|----------------------------------------------|
|[@CommandNotFound](/docs/CommandNotFound-EventSource.md)|Sends events when a command is not found.<br/>|
|[@Delay](/docs/Delay-EventSource.md) |Send an event after a delay.<br/> |
|[@Event](/docs/Event-EventSource.md) |Watches for new events.<br/> |
|[@FileChange](/docs/FileChange-EventSource.md) |Watches for File Changes.<br/> |
|[@HttpResponse](/docs/HttpResponse-EventSource.md) |Sends events on HTTP Responses.<br/> |
|[@Job](/docs/Job-EventSource.md) |Watches a PowerShell Job's State.<br/> |
|[@LocationChanged](/docs/LocationChanged-EventSource.md)|Sends events when the directory changes.<br/> |
|[@ModuleChanged](/docs/ModuleChanged-EventSource.md) |Watches for Module loads and unloads.<br/> |
|[@PowerShellAsync](/docs/PowerShellAsync-EventSource.md)|Runs PowerShell asynchronously<br/> |
|[@Process](/docs/Process-EventSource.md) |Watches a process.<br/> |
|[@Repeat](/docs/Repeat-EventSource.md) |Send events on repeat.<br/> |
|[@Time](/docs/Time-EventSource.md) |Sends an event at a specific time.<br/> |
|[@UDP](/docs/UDP-EventSource.md) |Signals on UDP <br/> |
|[@VariableSet](/docs/VariableSet-EventSource.md) |Watches for variable sets.<br/> |





21 changes: 21 additions & 0 deletions EventSources/README.ps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This directory contains the built-in EventSources in Eventful.

_Technically speaking_, EventSources can exist in any directory, as long as they are named liked `@*.ps1` and match `^@\w`.

Event sources within Eventful or modules that tag Eventful will be automatically included.

Watch-Event will also check the local directory for event sources.

~~~PipeScript{
$imported = Import-Module ../ -Global -PassThru
[PSCustomObject]@{
Table = Get-EventSource |
.Name {
"[$($_.Name -replace '\.ps1$')](/docs/$($_.Name -replace '^@' -replace '\.ps1$')-EventSource.md)"
} .Synopsis
}
}
~~~


10 changes: 6 additions & 4 deletions Eventful.GithubWorkflow.psdevops.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
Import-BuildStep -Module Eventful
New-GitHubWorkflow -Name "Analyze, Test, Tag, and Publish" -On Push, PullRequest, Demand -Job PowerShellStaticAnalysis, TestPowerShellOnLinux, TagReleaseAndPublish, BuildEventful -Environment @{
NoCoverage = $true
}|
Set-Content .\.github\workflows\TestAndPublish.yml -Encoding UTF8 -PassThru
} -OutputPath (
Join-Path $PSScriptRoot .github\workflows\TestAndPublish.yml
)

New-GitHubWorkflow -On Issue, Demand -Job RunGitPub -Name OnIssueChanged |
Set-Content (Join-Path $PSScriptRoot .github\workflows\OnIssue.yml) -Encoding UTF8 -PassThru
New-GitHubWorkflow -On Issue, Demand -Job RunGitPub -Name OnIssueChanged -OutputPath (
Join-Path $PSScriptRoot .github\workflows\OnIssue.yml
)

2 changes: 1 addition & 1 deletion Eventful.PSSVG.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (-not (Test-Path $assetsPath)) {
$null = New-Item -ItemType Directory -path $assetsPath -Force
}
=<svg> -content $(
$commonParameters = @{
$commonParameters = [Ordered]@{
Fill = '#4488FF'
Stroke = 'black'
StrokeWidth = '0.05'
Expand Down
53 changes: 29 additions & 24 deletions Eventful.psd1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@{
RootModule = 'Eventful.psm1'
Description = 'Easy Eventful Asynchronous Scripting with PowerShell'
ModuleVersion = '0.1.7'
Description = 'Easy Eventful PowerShell'
ModuleVersion = '0.1.8'
GUID = 'f4d780da-be78-49c6-921a-436e053cb97c'
Author = 'James Brundage'
Copyright = '2021 Start-Automating'
Copyright = '2021-2023 Start-Automating'
FormatsToProcess = 'Eventful.format.ps1xml'
TypesToProcess = 'Eventful.types.ps1xml'
AliasesToExport = '*'
Expand All @@ -16,32 +16,45 @@
Tags = 'Eventful', 'Events'

ReleaseNotes = @'
## 0.1.7
## Eventful 0.1.8:
* Eventful Supports Sponsorship (#25)
* New Commands!
* Import-Event (#28)
* Export-Event (#27)
* Send-Event can now send -EventArguments and -MessageData (#26)
* Watch-Event now supports -MaxTriggerCount and -MessageData (#29)
* Simplifying event source registration (any `@*` script or function) (#30)
* Making one-time event sources more efficient (#31)
---
## Eventful 0.1.7:
* Adding On@CommandNotFound event source (Fixes #11)
* Watch-Event now allows eventsources -recursively (Fixes #15)
---
## 0.1.6
## Eventful 0.1.6
* Adding LocationChanged event source (Fixes #12)
---
## 0.1.5
## Eventful 0.1.5
* Adding On@Event (#2)
* Send-Event support for piping existing events (#4)
* Adding /docs (#5)
---
## 0.1.4
## Eventful 0.1.4
* Module Rebranded to Eventful.
* Get-EventHandler added
---
## 0.1.3
## Eventful 0.1.3
New Event Source:
* VariableSet
Expand All @@ -52,15 +65,15 @@ Bugfix: On@Repeat now actually starts it's timer.
---
## 0.1.2
## Eventful 0.1.2
New Event Source:
* UDP
PowerShellAsync Event Source now allows for a -Parameter dictionaries.
---
## 0.1.1
## Eventful 0.1.1
New Event Sources:
* HTTPResponse
* PowerShellAsync
Expand All @@ -72,7 +85,10 @@ New Event Source Capabilities:
Event Sources can now return an InitializeEvent property or provide a ComponentModel.InitializationEvent attribute.
This will be called directly after the subscription is created, so as to avoid signalling too soon.
## 0.1
---
## Eventful 0.1
Initial Module Release.
Fun simple event syntax (e.g. on mysignal {"do this"} or on delay "00:00:01" {"do that"})
Expand All @@ -82,19 +98,8 @@ Better pipelining support for Sending events.
'@
}


Eventful = @{
'Time' = '@Time.ps1'
'Delay' = '@Delay.ps1'
'Process' = 'EventSources/@Process.ps1'
'ModuleChanged' = 'EventSources/@ModuleChanged.ps1'
'Job' = 'EventSources/@Job.ps1'
'PowerShellAsync' = 'EventSources/@PowerShellAsync.ps1'
'HttpResponse' = 'EventSources/@HttpResponse.ps1'
'VariableSet' = 'EventSources/@VariableSet.ps1'
'UDP' = 'EventSources/@UDP.ps1'
'Event' = 'EventSources/@Event.ps1'
'LocationChanged' = 'EventSources/@LocationChanged.ps1'
CommandTypes = @{
EventSource = '^\@\w'
}
}
}
Loading

0 comments on commit 90511ed

Please sign in to comment.