Re.Mark

My Life As A Blog

Archive for the ‘nspectre’ Category

nspectre 1.0.1 release

leave a comment »

I’ve released version 1.0.1 of nspectre.  This version has one new feature: the ability to use JSON to store configuration.  Jayrock provides the JSON capability.
The purpose of adding JSON support to nspectre is to demonstrate the capability of storing configuration in multiple formats.
Download the new version of nspectre here.

Written by remark

May 13, 2007 at 2:21 pm

nspectre 1.0.0 released

leave a comment »

nspectre 1.0.0 has been released.  This version has a new type of simple specification which allows you to call functions.  Being able to call existing functions means not having to dabble in template language and being able to unit test the existing functions.  If you want to create a function for use as a specification it needs to be declared public and must return IFunctionResult (there’s an implementation of IFunctionResult in nspectre if you want to use it – just remember that passing an error to the constructor will automatically set the outcome to false, otherwise the outcome will be true.)  Bindings are used to pass arguments to the function – and if you declare Context or ILogger as arguments, they will be automatically wired up without you having to lift a finger.
In addition to this new feature, there’s also an enhancement to the way assemblies are referenced.  Some users were having an issue with web applications at runtime getting references to assemblies.  So the new version not only adds references to assemblies containing candidate types or existing functions, it also adds references to any assemblies these containing assemblies reference.
Go and try it out.  The example project that comes with the source project is a great place to start.  Download it here.

Written by remark

March 10, 2007 at 11:12 pm

Upcoming release

leave a comment »

nspectre is nearing a 1.0 release.  The new functionality that will be in 1.0 is the ability to use functions for specifications (instead of templates.)  I’ve completed the code that provides this functionality and amended the schema accordingly.

Written by remark

February 18, 2007 at 11:34 pm

A little more validation

leave a comment »

Version 3.0 of the Enterprise Library contains a Validator Block – there’s a CTP here.  Looking at the details on Tom Hollander’s blog, this block has the closest functionality to nspectre of any framework I’ve come across.  There is a difference in design philosophy – nspectre is designed to have as few dependencies as possible.  There are dependencies between the Enterprise Library blocks.

Written by remark

February 10, 2007 at 9:59 am

First Mono Release of nspectre

leave a comment »

I’ve released a mono version of nspectre 0.9.0. Get it here.

The NAnt buildfile is part of the source if you want to build it yourself (use the release or debug target.) The buildfile is still a little raw, but it does what’s needed right now.

I haven’t tested the mono version on Windows, so it may not work.

Written by remark

January 27, 2007 at 11:54 am

Posted in Mono, nspectre

One More Thing

leave a comment »

I ran into another issue with the nspectre Mono adventure I posted about yesterday. In order to load the assemblies in the bin folder, I passed the Location property of the assembly of a given type (ResourceLocator in this instance) to the constructor of FileInfo. I then used the Directory property to get a DirectoryInfo object with the intention of looping through the files in said directory. I was able to do this but the location of the directory was /home/user/files:/home/user/somefolder/someotherfolder (you get the gist.) As a short term measure I wrote a line (or two) of code to strip out the colon and all that precedes it. So I succeeded in getting it to work, but I’m sure there’s a better way or that I’ve missed something.

I have to say that I am mightily impressed by Mono. When I think of what nspectre is doing, only running into one real issue (Assembly.Load) is quite something.

Written by remark

January 9, 2007 at 3:41 pm

Posted in Mono, nspectre, Open Source

Monkeying around

leave a comment »

Over the last couple of days I’ve got nspectre working under Mono. I hope to be able to release a patched version later this month. Here’s how I got it to work. I installed NAnt 0.85 on Ubuntu 6.10 (which I run in Parallels.) I found this link via Cory Foy that shows how simple it is to install NAnt on Mono.

UPDATE: At this point I built TemplateEngine. I used MonoDevelop to build it – no issues to report.

With Nant up and running, I created a build script for NSpectre. To get started, the build script only builds NSpectre.Core, NSpectreExample and NSpectreExample.Entities. Once I had these compiled (on my set up, the csc task in NAnt targets gmcs by default – very impressed), I ran them.

And ran into problem number 1. It appears that Mono implements Assembly.Load differently to .NET. See here for further detail. As a short term fix, I modified ResourceLocator by adding a type initialiser to load all assemblies in the bin directory. I’ll take another look at this, there may be a better way of doing it, but for now it works.

Problem number 2. I set NAnt to use dynamic prefixing for the resources. The namespaces it uses are different to those that VS .NET would use – VS .NET would use the project namespace as the root namespace, whereas Nant uses the name of the folder that contains the project (for subfolders the behaviour is the same.) Pretty easy to fix – modified references in code and config files to use the NAnt generated namespaces.

Problem number 3. One hardcoded (a constant) backslash (used in Engine.) Oops. Modified to a forward slash for the purposes of getting it to work.

Problem number 4. NSpectreExample uses Win32 API calls to change the foreground colour of the console (.NET 2.0 supports this in managed code, so this won’t be a problem in the future.) Unsurprisingly, Win 32 API calls don’t work in Linux. So, I commented these lines out for now.

And that’s it. OK, so there were a few more issues along the way. But the other issues were about getting the build script “right” – in this case getting the csc tasks to build nspectre as closely to the way VS .NET does as possible.

So, a little more investigation, some minor modifications, some clean up of the build script and I’ll be able to release a Mono’ed version of nspectre.

Written by remark

January 8, 2007 at 11:03 pm