Created
June 23, 2016 03:50
-
-
Save burn2delete/40a7e25c89f6e5dcfb25da37be782037 to your computer and use it in GitHub Desktop.
Poshjure - Clojure from within Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Module manifest for module 'module' | |
# | |
# Generated by: | |
# | |
# Generated on: | |
# | |
@{ | |
# Script module or binary module file associated with this manifest. | |
RootModule = 'Poshjure.psm1' | |
# Version number of this module. | |
ModuleVersion = '1.0' | |
# ID used to uniquely identify this module | |
GUID = 'bd4390dc-a8ad-4bce-8d69-f53ccf8e4163' | |
# Author of this module | |
Author = 'Matthew Ratzke' | |
# Company or vendor of this module | |
CompanyName = 'Degree9' | |
# Copyright statement for this module | |
Copyright = '(c) 2016 Degree9 Solutions Inc. All rights reserved.' | |
# Description of the functionality provided by this module | |
# Description = '' | |
# Minimum version of the Windows PowerShell engine required by this module | |
# PowerShellVersion = '' | |
# 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 | |
# DotNetFrameworkVersion = '' | |
# Minimum version of the common language runtime (CLR) required by this module | |
# 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 = @() | |
# Assemblies that must be loaded prior to importing this module | |
RequiredAssemblies = @('./clojure/Clojure.dll') | |
# 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 | |
FunctionsToExport = '*' | |
# Cmdlets to export from this module | |
CmdletsToExport = '*' | |
# Variables to export from this module | |
VariablesToExport = '*' | |
# Aliases to export from this module | |
AliasesToExport = '*' | |
# 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 | |
# PrivateData = '' | |
# HelpInfo URI of this module | |
# HelpInfoURI = '' | |
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. | |
# DefaultCommandPrefix = '' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Poshjure | |
by Matthew Ratzke | |
#> | |
function Import-PoshjFile { | |
Param([string] $Path) | |
$loadfile = [clojure.clr.api.Clojure]::var("clojure.core", "load-file") | |
$loadfile.invoke([clojure.clr.api.Clojure]::read($Path)) | |
} | |
function Invoke-PoshjEval { | |
Param([string] $Body) | |
$eval = [clojure.clr.api.Clojure]::var("clojure.core", "eval") | |
$eval.invoke([clojure.clr.api.Clojure]::read($Body)) | |
} | |
function Start-PoshjREPL { | |
While ($true) { | |
$input = Read-Host -Prompt "Poshjure>" | |
Invoke-PoshjEval -Body $input | |
} | |
} | |
function Start-Poshjure { | |
Param( | |
[boolean] $repl = $true, | |
[string] $eval, | |
[string] $script) | |
if ($eval -ne "") { | |
Invoke-PoshjEval -Body $eval | |
} elseif ($script -ne "") { | |
Import-PoshjFile -Path $script | |
} elseif ($repl) { | |
Write-Output "" | |
Start-PoshjREPL | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This assumes you have clojure-clr dll in a subfolder called 'clojure', I also assume you are able to load the 'Poshjure' module yourself into powershell.
A Powershell module via one-get will come later.