Tuesday, August 12, 2008

Some more work done

New cmdlets implemented: Import-Csv, Export-Csv, ConvertTo-Html

Improved the PSObject implementation a nice amount. PSObject now implements all public methods that the PowerShell one does (except for IFormatable, but I am working on this).

Improved WildcardPattern, FileSystemProvider, Format-List, LanguagePrimatives.

These changes will be merged with the BZR branch on http://www.launchpad.net/pash later today. I still have some more kinks to work out.

Thursday, August 7, 2008

PSObject & Grammar

So our PSObject can use some work, and Format/Out cmdlets really depend on a good PSObject. Hmm sounds like a direction to head in. Next I am going to work on PSObject.

We need external help for the parser in Pash. So if anyone of my tens and tens of vistors are experts in automata theory or some such, you would be very helpful to us!

Friday, August 1, 2008

The logic of formatting

Since PowerShell (and Pash) deals with objects being passed along a pipeline instead of text streams, it becomes clear to some people that reporting this data requires some extra step. PowerShell takes an 'interesting' approach to this problem, using a combination of two cmdlet groups, Format-* and Out-*

My work right now is on Out-*

Interesting huh?

Friday, July 25, 2008

Format-* is hard

One of the hardest cmdlets to write for Pash thus far has been the various Format-* cmdlets. Fortunately Joel "Jaykul" Bennett who is some kind of PowerShell nut (no really, this guy is the master of PowerShell), has been helping me with the esoteric details of it's engineering (or as some would say, overengineering). So Format-* should be pretty usuable soon. Hopefully/maybe. :)

Tuesday, July 15, 2008

CompatabilityAssert

So I rewrote my custom Assert to use a stack of "drivers" for each "shell" (ie, only Pash and PowerShell). Given a set of shells, the Assert will execute a given script on each of the shells, retrieve the resulting objects, compare them against each other, and fail if they do not equal.

Got some kinks left to work out.

Unit testing

So for the testing framework, I will be building ontop of NUnit, an excellent "unit testing" framework.

Summary for the insulated:
Unit tests are basically automated tests which are designed to test individual "units" of an application. This is usually by declaring something called an "Assertion", basically a statement that says these and these conditions should always occur under these and these circumstances.

NUnit comes with many Assertions, but I don't think any are suitable for all of the kind of testing we are doing - fortunately NUnit can be extended with custom assertions, and that is what I am writing - a "Compatibility" assertion, which will take at least one string of PowerShell script, execute said script on any number of PowerShell (and Pash hosts), get the result (typically a collection of PSObjects) - take those results and compare the data stored within the objects with one another and ensure they are equal. If they are equal, the assertion is passed, if they are not the assertion fails (and typically the whole unit test fails).

This test will only run on Windows (since PowerShell runs on Windows), but the plan is to force the collection of unit tests to run when you want to create Release build of Pash. Should one fail, well, you are SOL. :)

Just one of the ways me and Igor are ensuring that we aren't making a competing shell, but that Pash will fundamentally be a cross platform implementation of PowerShell, and that most PowerShell scripts shall run on it without modification.

Monday, July 7, 2008

New project: Pash test framework

My mentor Igor told me that I should work on a test framework for Pash, and that is what my current work is right now. The idea is to have an easy and simple way to test compatibility between PowerShell and Pash. The test framework uses the PowerShell hosting API, and a custom Assert, AssertCompatability. Given a script string, the framework should be able to test it and retreieve the results on any number of implementations. It then compares the results and makes sure they are equal. If they are not, it fails.

URL:
https://blueprints.launchpad.net/pash/+spec/pash-test-framework

Tuesday, July 1, 2008

PowerShell Grammar

Just a bit of a microupdate.

Igor has written a fairly complete grammar for PowerShell. I've been trying to get said fairly complete grammar for PowerShell to fit into the scope of the DLR.

I am going to have a meeting with Igor hopefully tommorow so he can give me some more stuff to do. :)

Wednesday, June 25, 2008

Pash Improvements

This is my first attempt at writing on a blog, so I don't know if I should have a kind of five paragraph introduction/conclusion thing going on or I should use some kind of special prose or whatever. I think I'll hit the ground running..

Pash Improvements

As some of you already know, I am part of the 2008 Google Summer of Code working on a very interesting project called Pash, the fine work of Igor Moochnick, a person I met - personally. Instead of me explaining what Pash is, you can read about it here and here.

I've been writing a number of improvements to Pash. I separate my work into two projects, one that I have been working on since the beginning of the Summer of Code, and one I just started recently (it's a bit of an "experimental" project).

CoreCmdlets

CoreCmdlets is an implementation of all the basic, core cmdlets typically included with an installation of Microsoft PowerShell. For the Unix people around here, you can think of CoreCmdlets as the "GNU Coreutils" of the overall shell project. These are tested against Microsoft PowerShell excessively. We wish to ensure the cmdlets maintain a near perfect compatibility with the originals. I have implemented quite a few cmdlets now, and the project coming along nicely. Here is a sample of some of the cmdlets you can expect to be fairly complete:

Management Cmdlets
Get-Process
Stop-Process
Get-Service
Stop-Service
Restart-Service
Suspend-Service
Resume-Service

Utility Cmdlets
Get-Date
New-Object
Start-Sleep
Write-Host
Get-Random

Provider Cmdlets
Copy-Item
Move-Item
Rename-Item
Remove-Item
Get-ChildItem (based off of existing cmdlet)
New-Item
Get-Location (based off of existing cmdlet)

Other (Non-Standard) Cmdlets
Say-Cow
Get-Device

Large, but incomplete & in-progress cmdlets worth noting
Format-Table
Format-List

I feel as of most of the cmdlets I've written of are high quality, but some still need some work, and many are still missing. Most of the missing ones I can't do so much with, because many depend on the state of the runtime and other esoteric things inside of PowerShell, stuff which ISN'T public API, so I can't really write a cmdlet that I can test against Microsoft PowerShell. So it's a problem.

Pash Shell

You can't really have Pash without the shell. So this project is the one to write the actual engine which takes in a script file or command line input and does something meaningful with it. Pash SVN at Sourceforge already has a command line shell, but it at it's early stages. I am trying to improve this shell and add advanced features to it. This is a relatively new project. I've been planning it for a month or so, but I only began work on it two days ago. And I have quite a lot to show already. Here is the (blurry, taken from VNC) screenshot:



Okay, so it's not perfect PowerShell grammar. But come on, control statements and function calls! That must have been a lot of work. I must be lying and I really spent like three years or something on this. Or I am some kind of compiler genius, right? No!!!

This is DLR!!!!!!!!!

What you say? DLR? What the hell is that? Well you know, I am not even so sure. I can't give you a one sentence answer and perfectly describe what it does or how it helps. This is typically true for any innovative product, and DLR is quite an innovative product. So the best I can describe it is it is some kind of CLR but for dynamic languages, that also removes the ton of scaffolding you typically have to do when you implement a programming language. (Yes, Pash is a technically a programming language.) And you can get all these additional benefits like improved performance and a shared type system with other languages!

Yes, you may very well soon have a Python script manipulate a Pash object along a pipeline! Or have a Ruby script call functions in a Pash script with great ease! I hope the PowerShell team doesn't get mad if Pash becomes a cooler shell then PowerShell itself! =) I hope you can tell I am excited about this potential. PowerShell predates the DLR, so it's a given it doesn't use it, but PowerShell and the DLR can make a good team, and Pash will hopefully have super DLR powers.

That's all I have to say for now. But do not fear my tens and tens of visitors, I shall post again!

Sunday, June 22, 2008

First post!

In the Slashdot tradition, this is the FIRST POST. If you expected any interesting or insightful information, you shouldn't be reading the first post. :)