about summary refs log tree commit homepage
path: root/projects/mongrel_service
diff options
context:
space:
mode:
Diffstat (limited to 'projects/mongrel_service')
-rw-r--r--projects/mongrel_service/CHANGELOG41
-rw-r--r--projects/mongrel_service/COPYING20
-rw-r--r--projects/mongrel_service/LICENSE55
-rw-r--r--projects/mongrel_service/Manifest21
-rw-r--r--projects/mongrel_service/README11
-rw-r--r--projects/mongrel_service/Rakefile138
-rw-r--r--projects/mongrel_service/TODO19
-rw-r--r--projects/mongrel_service/lib/ServiceFB/ServiceFB.bas650
-rw-r--r--projects/mongrel_service/lib/ServiceFB/ServiceFB.bi109
-rw-r--r--projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bas493
-rw-r--r--projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bi70
-rw-r--r--projects/mongrel_service/lib/ServiceFB/_internals.bi50
-rw-r--r--projects/mongrel_service/lib/ServiceFB/_utils_internals.bi51
-rw-r--r--projects/mongrel_service/lib/mongrel_service/init.rb211
-rw-r--r--projects/mongrel_service/native/_debug.bi59
-rw-r--r--projects/mongrel_service/native/boolean.bi18
-rw-r--r--projects/mongrel_service/native/console_process.bas397
-rw-r--r--projects/mongrel_service/native/console_process.bi75
-rw-r--r--projects/mongrel_service/native/mongrel_service.bas179
-rw-r--r--projects/mongrel_service/native/mongrel_service.bi61
-rw-r--r--projects/mongrel_service/resources/defaults.yaml2
-rw-r--r--projects/mongrel_service/tests/all_tests.bas18
-rw-r--r--projects/mongrel_service/tests/fixtures/mock_process.bas92
-rw-r--r--projects/mongrel_service/tests/test_console_process.bas402
-rw-r--r--projects/mongrel_service/tests/test_helpers.bas35
-rw-r--r--projects/mongrel_service/tests/test_helpers.bi8
-rw-r--r--projects/mongrel_service/tools/freebasic.rb361
27 files changed, 0 insertions, 3646 deletions
diff --git a/projects/mongrel_service/CHANGELOG b/projects/mongrel_service/CHANGELOG
deleted file mode 100644
index 074c87a..0000000
--- a/projects/mongrel_service/CHANGELOG
+++ /dev/null
@@ -1,41 +0,0 @@
-* 0.3.5 *
-
-    * Wait longer for child process terminate properly (max 20 seconds). Imported
-    tests from RubyServices project. (Closes #18).
-    * Updated ServiceFB to work with FB > 0.18.
-
-* 0.3.4 *
-    
-    * Strict Gem dependencies for mongrel_service. This version is compatible
-      only with mongrel 1.0.x, 1.1.x and with win32-service 0.5.x.
-    
-    * Fixed issues realted to Win32::Service and gem_plugin being registered with
-      different names due win32-service changes.
-    
-* 0.3.3 *
-    
-    * Properly display package/gem version for mongrel_service. Closes #13823.
-    
-    * Updated ServiceFB to r80 to solve issue when compiling with FB > 0.17.
-    
-* 0.3.2 *
-    
-    * Solved detection of parent process at ServiceFB level
-      (solves the x64 Windows issues).
-    
-    * Upgraded to ServiceFB 'trunk' (but pistoned it, just in case).
-    
-    * Fixed problems with ruby installations outside PATH or inside folders with spaces.
-    
-    * Activate FB pedantic warnings by default (is really useful).
-    
-* 0.3.1 *
-    
-    * Single Service (SingleMongrel) object type implemented.
-    
-    * Updated Rakefile to reflect the new building steps.
-    
-    * Removed SendSignal, too hackish for my taste, replaced with complete FB solution.
-    
-    * Added basic Process monitoring and re-spawning.
-     \ No newline at end of file
diff --git a/projects/mongrel_service/COPYING b/projects/mongrel_service/COPYING
deleted file mode 100644
index 789d76e..0000000
--- a/projects/mongrel_service/COPYING
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2006 Luis Lavena, luislavena@gmail.com
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/projects/mongrel_service/LICENSE b/projects/mongrel_service/LICENSE
deleted file mode 100644
index e5a926e..0000000
--- a/projects/mongrel_service/LICENSE
+++ /dev/null
@@ -1,55 +0,0 @@
-Mongrel Web Server (Mongrel) is copyrighted free software by Zed A. Shaw
-<zedshaw at zedshaw dot com> and contributors. You can redistribute it
-and/or modify it under either the terms of the GPL2 or the conditions below:
-
-1. You may make and give away verbatim copies of the source form of the
-   software without restriction, provided that you duplicate all of the
-   original copyright notices and associated disclaimers.
-
-2. You may modify your copy of the software in any way, provided that
-   you do at least ONE of the following:
-
-     a) place your modifications in the Public Domain or otherwise make them
-     Freely Available, such as by posting said modifications to Usenet or an
-     equivalent medium, or by allowing the author to include your
-     modifications in the software.
-
-     b) use the modified software only within your corporation or
-        organization.
-
-     c) rename any non-standard executables so the names do not conflict with
-     standard executables, which must also be provided.
-
-     d) make other distribution arrangements with the author.
-
-3. You may distribute the software in object code or executable
-   form, provided that you do at least ONE of the following:
-
-     a) distribute the executables and library files of the software,
-     together with instructions (in the manual page or equivalent) on where
-     to get the original distribution.
-
-     b) accompany the distribution with the machine-readable source of the
-     software.
-
-     c) give non-standard executables non-standard names, with
-        instructions on where to get the original software distribution.
-
-     d) make other distribution arrangements with the author.
-
-4. You may modify and include the part of the software into any other
-   software (possibly commercial).  But some files in the distribution
-   are not written by the author, so that they are not under this terms.
-
-5. The scripts and library files supplied as input to or produced as
-   output from the software do not automatically fall under the
-   copyright of the software, but belong to whomever generated them,
-   and may be sold commercially, and may be aggregated with this
-   software.
-
-6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE.
-
-
diff --git a/projects/mongrel_service/Manifest b/projects/mongrel_service/Manifest
deleted file mode 100644
index d5351fa..0000000
--- a/projects/mongrel_service/Manifest
+++ /dev/null
@@ -1,21 +0,0 @@
-bin/mongrel_service.exe
-tools/freebasic.rb
-TODO
-resources/defaults.yaml
-README
-native/mongrel_service.bi
-native/mongrel_service.bas
-native/console_process.bi
-native/console_process.bas
-native/_debug.bi
-LICENSE
-lib/ServiceFB/ServiceFB_Utils.bi
-lib/ServiceFB/ServiceFB_Utils.bas
-lib/ServiceFB/ServiceFB.bi
-lib/ServiceFB/ServiceFB.bas
-lib/ServiceFB/_utils_internals.bi
-lib/ServiceFB/_internals.bi
-lib/mongrel_service/init.rb
-COPYING
-CHANGELOG
-Manifest
diff --git a/projects/mongrel_service/README b/projects/mongrel_service/README
deleted file mode 100644
index 45bf9c8..0000000
--- a/projects/mongrel_service/README
+++ /dev/null
@@ -1,11 +0,0 @@
-== Mongrel Native Win32 Service Plugin
-
-This plugin offer native win32 services for rails. This replace mongrel_rails_service.
-It will work like before, with this this syntax when calling mongrel_rails:
-
-service::install
-service::remove
-service::update
-
-= Author:
-  Luis Lavena
diff --git a/projects/mongrel_service/Rakefile b/projects/mongrel_service/Rakefile
deleted file mode 100644
index efc9810..0000000
--- a/projects/mongrel_service/Rakefile
+++ /dev/null
@@ -1,138 +0,0 @@
-
-require 'rubygems'
-gem 'echoe', '>=2.7.11'
-require 'echoe'
-require 'tools/freebasic'
-
-# Task :package needs compile before doing the gem stuff.
-# (weird behavior of Rake?)
-task :package => [:compile]
-
-echoe_spec = Echoe.new("mongrel_service") do |p|
-  p.summary = "Mongrel Native Win32 Service Plugin for Rails"
-  p.summary += " (debug build)" unless ENV['RELEASE']
-  p.description = "This plugin offer native win32 services for rails, powered by Mongrel."
-  p.author = "Luis Lavena"
-  p.email = "luislavena@gmail.com"
-  p.platform = Gem::Platform::CURRENT
-  p.dependencies = [['gem_plugin', '>=0.2.3', '<0.3.0'],
-                    ['mongrel', '>=1.0.2', '<1.2.0'],
-                    ['win32-service', '>=0.5.2', '<0.6.0']]
-
-  p.executable_pattern = ""
-  
-  p.need_tar_gz = false
-  p.need_zip = true
-  p.certificate_chain = [
-    '~/projects/gem_certificates/mongrel-public_cert.pem',
-    '~/projects/gem_certificates/luislavena-mongrel-public_cert.pem'
-  ]
-  p.require_signed = true
-end
-
-desc "Compile native code"
-task :compile => [:native_lib, :native_service]
-
-# global options shared by all the project in this Rakefile
-OPTIONS = {
-  :debug => false,
-  :profile => false,
-  :errorchecking => :ex,
-  :mt => true,
-  :pedantic => true }
-
-OPTIONS[:debug] = true if ENV['DEBUG']
-OPTIONS[:profile] = true if ENV['PROFILE']
-OPTIONS[:errorchecking] = :exx if ENV['EXX']
-OPTIONS[:pedantic] = false if ENV['NOPEDANTIC']
-
-# ServiceFB namespace (lib)
-namespace :lib do
-  project_task 'servicefb' do
-    lib       'ServiceFB'
-    build_to  'lib'
-
-    define    'SERVICEFB_DEBUG_LOG' unless ENV['RELEASE']
-    source    'lib/ServiceFB/ServiceFB.bas'
-    
-    option    OPTIONS
-  end
-  
-  project_task 'servicefb_utils' do
-    lib       'ServiceFB_Utils'
-    build_to  'lib'
-
-    define    'SERVICEFB_DEBUG_LOG' unless ENV['RELEASE']
-    source    'lib/ServiceFB/ServiceFB_Utils.bas'
-    
-    option    OPTIONS
-  end
-end
-
-# add lib namespace to global tasks
-#include_projects_of :lib
-task :native_lib => "lib:build"
-task :clean => "lib:clobber"
-
-# mongrel_service (native)
-namespace :native do
-  project_task  'mongrel_service' do
-    executable  'mongrel_service'
-    build_to    'bin'
-    
-    define      'DEBUG_LOG' unless ENV['RELEASE']
-    define      "GEM_VERSION=#{echoe_spec.version}"
-    
-    main        'native/mongrel_service.bas'
-    source      'native/console_process.bas'
-    
-    lib_path    'lib'
-    library     'ServiceFB', 'ServiceFB_Utils'
-    library     'user32', 'advapi32', 'psapi'
-    
-    option      OPTIONS
-  end
-end
-
-#include_projects_of :native
-task :native_service => "native:build"
-task :clean => "native:clobber"
-
-project_task :mock_process do
-  executable  :mock_process
-  build_to    'tests'
-  
-  main        'tests/fixtures/mock_process.bas'
-  
-  option      OPTIONS
-end
-
-task "all_tests:build" => "lib:build"
-project_task :all_tests do
-  executable  :all_tests
-  build_to    'tests'
-  
-  search_path 'src', 'lib', 'native'
-  lib_path    'lib'
-  
-  main        'tests/all_tests.bas'
-  
-  # this temporally fix the inverse namespace ctors of FB
-  source      Dir.glob("tests/test_*.bas").reverse
-  
-  library     'testly'
-  
-  source      'native/console_process.bas'
-  
-  option      OPTIONS
-end
-
-desc "Run all the internal tests for the library"
-task "all_tests:run" => ["mock_process:build", "all_tests:build"] do
-  Dir.chdir('tests') do
-    sh %{all_tests}
-  end
-end
-
-desc "Run all the test for this project"
-task :test => "all_tests:run"
diff --git a/projects/mongrel_service/TODO b/projects/mongrel_service/TODO
deleted file mode 100644
index e39b38c..0000000
--- a/projects/mongrel_service/TODO
+++ /dev/null
@@ -1,19 +0,0 @@
-Legend:
-[ ] not done
-[X] done
-[+] in progess
-
-### General
-[ ] Add more documentation about services and requirements
-[ ] Add process monitoring.
-
-### Dependencies
-[+] Remove win32/service extension dependency (instead of relying in the non-official 0.5.0 one).
-  [ ] Add service management (from ServiceFB) to install and remove services.
-    
-### SingleMongrel
-[+] Sanitize SingleMongrel and document the functions.
-
-### ClusterMongrel
-[ ] Parse mongrel_cluster configuration file (yaml) looking for port information
-  [ ] Reimplent SingleMongrel for ClusterMongrel, splitting source files for better organization.
diff --git a/projects/mongrel_service/lib/ServiceFB/ServiceFB.bas b/projects/mongrel_service/lib/ServiceFB/ServiceFB.bas
deleted file mode 100644
index 8364867..0000000
--- a/projects/mongrel_service/lib/ServiceFB/ServiceFB.bas
+++ /dev/null
@@ -1,650 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#include once "ServiceFB.bi"
-#include once "_internals.bi"
-
-namespace fb
-namespace svc
-    '# I started this as simple, unique service served from one process
-    '# but the idea of share the same process space (and reduce resources use) was good.
-    '# to do that, I needed a references table (similar to service_table, but we will
-    '# hold the ServiceProcess registered by ServiceHost (the multi services host).
-    '# also, I needed a locking mechanism to avoid problems of two calls changing the table
-    '# at the same time.
-    dim shared _svc_references as ServiceProcess ptr ptr
-    dim shared _svc_references_count as integer
-    dim shared _svc_references_lock as any ptr
-    
-    
-    '#####################
-    '# ServiceProcess
-    '# ctor()
-    constructor ServiceProcess()
-        constructor("NewServiceProcess")
-    end constructor
-    
-    
-    '# ctor(name)
-    constructor ServiceProcess(byref new_name as string)
-        _dprint("ServiceProcess(new_name)")
-        '# assign the service name
-        this.name = new_name
-
-        '# initialize the status structure
-        with this._svcStatus
-            .dwServiceType = SERVICE_WIN32_OWN_PROCESS
-            .dwCurrentState = SERVICE_STOPPED
-            .dwControlsAccepted = (SERVICE_ACCEPT_STOP or SERVICE_ACCEPT_SHUTDOWN)
-            .dwWin32ExitCode = NO_ERROR
-            .dwServiceSpecificExitCode = NO_ERROR
-            .dwCheckPoint = 0
-            .dwWaitHint = 0
-        end with
-        
-        '# use a state placeholder
-        this.state = this._svcStatus.dwCurrentState
-        
-        '# disable shared process by default
-        this.shared_process = FALSE
-        
-        '# create the stop event
-        this._svcStopEvent = CreateEvent( 0, FALSE, FALSE, 0 )
-        _dprint("ServiceProcess(new_name) done")
-    end constructor
-    
-    
-    '# dtor()
-    destructor ServiceProcess()
-        _dprint("ServiceProcess() destructor")
-        '# safe to destroy it. anyway, just checking
-        with this
-            .onInit = 0
-            .onStart = 0
-            .onStop = 0
-            .onPause = 0
-            .onContinue = 0
-            ._threadHandle = 0
-            CloseHandle(._svcStopEvent)
-        end with
-        _dprint("ServiceProcess() destructor done")
-    end destructor
-    
-    
-    '# for single process, here I create the references table and then
-    '# delegate control to _run() which will call the service control dispatcher
-    sub ServiceProcess.Run()
-        _dprint("ServiceProcess.Run()")
-        
-        '# add the unique reference
-        _add_to_references(this)
-        
-        '# delegate control to _run()
-        _run()
-        
-        _dprint("ServiceProcess.Run() done")
-    end sub
-    
-    
-    '# I use this method to simplify changing the service state
-    '# notification to the service manager.
-    '# is needed to set dwControlsAccepted = 0 if state is SERVICE_*_PENDING
-    '# also, StillAlive() call it to set the checkpoint and waithint
-    '# to avoid SCM shut us down.
-    '# is not for the the end-user (*you*) to access it, but implemented in this
-    '# way to reduce needed to pass the right service reference each time
-    sub ServiceProcess.UpdateState(byval state as DWORD, byval checkpoint as integer = 0, byval waithint as integer = 0)
-        _dprint("ServiceProcess.UpdateState()")
-        '# set the state
-        select case state
-            '# if the service is starting or stopping, I must disable the option to accept
-            '# other controls form SCM.
-            case SERVICE_START_PENDING, SERVICE_STOP_PENDING:
-                this._svcStatus.dwControlsAccepted = 0
-            
-            '# in this case, running or paused, stop and shutdown must be available
-            '# also, we must check here if our service is capable of pause/continue ç
-            '# functionality and allow them (or not).
-            case SERVICE_RUNNING, SERVICE_PAUSED:
-                this._svcStatus.dwControlsAccepted = (SERVICE_ACCEPT_STOP or SERVICE_ACCEPT_SHUTDOWN)
-                
-                '# from start, the service accept stop and shutdown (see ctor(name)).
-                '# configure the accepted controls.
-                '# Pause and Continue only will be enabled if you setup onPause and onContinue
-                if not (this.onPause = 0) and _
-                    not (this.onContinue = 0) then
-                    this._svcStatus.dwControlsAccepted or= SERVICE_ACCEPT_PAUSE_CONTINUE
-                end if
-                
-        end select
-        
-        '# set the structure status
-        '# also the property
-        this._svcStatus.dwCurrentState = state
-        this.state = state
-        
-        '# set checkpoint and waithint
-        this._svcStatus.dwCheckPoint = checkpoint
-        this._svcStatus.dwWaitHint = waithint
-        
-        '# call the API
-        '# only we will call is _svcHandle is valid
-        '# this will allow use of UpdateState (and StillAlive) from console
-        if not (this._svcHandle = 0) then
-            _dprint("SetServiceStatus() API")
-            SetServiceStatus(this._svcHandle, @this._svcStatus)
-        end if
-        _dprint("ServiceProcess.UpdateState() done")
-    end sub
-    
-    
-    '# use StillAlive() method when performing lengthly tasks during onInit or onStop
-    '# (if they take too much time).
-    '# by default we set a wait hint gap of 10 seconds, but you could specify how many
-    '# you could specify how many seconds more will require your *work*
-    sub ServiceProcess.StillAlive(byval waithint as integer = 10)
-        dim as integer checkpoint
-
-        _dprint("ServiceProcess.StillAlive()")
-        '# start or stop pending?
-        if (this._svcStatus.dwCurrentState = SERVICE_START_PENDING) or _
-            (this._svcStatus.dwCurrentState = SERVICE_STOP_PENDING) then
-                with this
-                    checkpoint = this._svcStatus.dwCheckPoint
-                    checkpoint += 1
-                    .UpdateState(._svcStatus.dwCurrentState, checkpoint, (waithint * 1000))
-                end with
-        end if
-        _dprint("ServiceProcess.StillAlive() done")
-    end sub
-    
-    
-    '# call_onStart() is a wrapper around the new limitation of threadcreate
-    '# sub used as pointers in threadcreate must conform the signature
-    sub ServiceProcess.call_onStart(byval any_service as any ptr)
-        var service = cast(ServiceProcess ptr, any_service)
-        service->onStart(*service)
-    end sub
-    
-    '#####################
-    '# ServiceHost
-    '# ctor()
-    '# currently isn't needed, why I defined it?
-    constructor ServiceHost()
-        _dprint("ServiceHost()")
-        _dprint("ServiceHost() done")
-    end constructor
-    
-    
-    '# dtor()
-    '# currently isn't needed, why I defined it?
-    destructor ServiceHost()
-        _dprint("ServiceHost() destructor")
-        _dprint("ServiceHost() destructor done")
-    end destructor
-    
-    
-    '# using Add() will register an already initialized service into the references
-    '# table, which will be used later to launch and control the different services
-    '# we should be careful when handling references, so for that reference_lock is
-    '# provided ;-)
-    sub ServiceHost.Add(byref service as ServiceProcess)
-        _dprint("ServiceHost.Add()")
-        
-        '# add the service reference to the references table
-        '# get the new count as result, so
-        '# increment the local counter
-        this.count = _add_to_references(service)
-        
-        _dprint("ServiceHost.Add() done")
-    end sub
-    
-    
-    '# ServiceHost.Run() is just a placeholder, it delegates control to _run()
-    '# pretty simple, but still must be present to simplify user interaction.
-    sub ServiceHost.Run()
-        _dprint("ServiceHost.Run()")
-        
-        '# the longest, hard coded function in the world!
-        '# just kidding
-        _run()
-        
-        _dprint("ServiceHost.Run() done")
-    end sub
-    
-    
-    '# the purpose of this sub is provide a generic service creation and running
-    '# this is be called from exisitng ServiceProcess and ServiceHost.
-    '# this construct the SERVICE_TABLE_ENTRY based on the the references table,
-    '# which will be sent to StartServiceCtrlDispatcher()
-    private sub _run()
-        dim ServiceTable(_svc_references_count) as SERVICE_TABLE_ENTRY
-        dim idx as integer
-        
-        _dprint("_run()")
-        
-        _dprint("creating service table for " + str(_svc_references_count) + " services")
-        for idx = 0 to (_svc_references_count - 1)
-            '# we take the service name from the references and set as ServiceMain the same
-            '# _main() routine for all the services
-            ServiceTable(idx) = type<SERVICE_TABLE_ENTRY>(strptr(_svc_references[idx]->name), @_main)
-            _dprint(str(idx) + ": " + _svc_references[idx]->name)
-        next idx
-        '# last member of the table must be null
-        ServiceTable(_svc_references_count) = type<SERVICE_TABLE_ENTRY>(0, 0)
-        _dprint("service table created")
-        
-        '# start the dispatcher
-        _dprint("start service dispatcher")
-        StartServiceCtrlDispatcher( @ServiceTable(0) )
-        
-        _dprint("_run() done")
-    end sub
-    
-    
-    '# this sub is fired by StartServiceCtrlDispatcher in another thread.
-    '# because it is a global _main for all the services in the table, looking up
-    '# in the references for the right service is needed prior registering its
-    '# control handler.
-    private sub _main(byval argc as DWORD, byval argv as LPSTR ptr)
-        dim success as integer
-        dim service as ServiceProcess ptr
-        dim run_mode as string
-        dim service_name as string
-        dim commandline as string
-        dim param_line as string
-        dim temp as string
-        
-        _dprint("_main()")
-        
-        '# debug dump of argc and argv
-        dim idx as integer = 0
-        for idx = 0 to (argc - 1)
-            _dprint(str(idx) + ": " + *argv[idx])
-        next idx
-        
-        '# retrieve all the information (mode, service name and command line
-        _build_commandline(run_mode, service_name, commandline)
-        service = _find_in_references(service_name)
-        
-        '# build parameter line (passed from SCM)
-        if (argc > 1) then
-            param_line = ""
-            for idx = 1 to (argc - 1)
-                temp = *argv[idx]
-                if (instr(temp, chr(32)) > 0) then
-                    param_line += """" + temp + """"
-                else
-                    param_line += temp
-                end if
-                param_line += " "
-            next idx
-        end if
-        
-        '# parameters passed using SCM have priority over ImagePath ones
-        if not (len(param_line) = 0) then
-            commandline = param_line
-        end if
-        
-        '# a philosofical question: to run or not to run?
-        if not (service = 0) then
-            _dprint("got a valid service reference")
-            _dprint("real service name: " + service->name)
-            
-            '# pass to the service the commandline
-            _dprint("passing service commandline: " + commandline)
-            service->commandline = commandline
-            
-            '# ok, its a service!, its alive!
-            '# register his ControlHandlerEx
-            _dprint("register control handler ex")
-            service->_svcHandle = RegisterServiceCtrlHandlerEx(strptr(service_name), @_control_ex, cast(LPVOID, service))
-            
-            '# check if evething is done right
-            if not (service->_svcHandle = 0) then
-                '# now, we are a single service or a bunch, like the bradys?
-                if (_svc_references_count > 1) then
-                    '# determine if we share or not the process
-                    if (service->shared_process = FALSE) then
-                        service->_svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS
-                    else
-                        '# this mean we will be sharing... hope neighbors don't crash the house!
-                        service->_svcStatus.dwServiceType = SERVICE_WIN32_SHARE_PROCESS
-                    end if
-                else
-                    '# ok, we have a full house (ehem, process) for us only!
-                    service->_svcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS
-                end if
-                
-                '# START_PENDING
-                _dprint("service start pending")
-                service->UpdateState(SERVICE_START_PENDING)
-                
-                '# now delegate to the long running initialization if it exist.
-                if not (service->onInit = 0) then
-                    _dprint("pass control to lengthly initialization")
-                    success = service->onInit(*service)
-                else
-                    '# if no onInit was defined (maybe you don't need it?)
-                    '# we should simulate it was successful to proceed
-                    success = (-1)
-                end if
-                _dprint("onInit result: " + str(success))
-                
-                '# check if everything is ok
-                '# if onInit showed problems, 0 was returned and service must not continue
-                if not (success = 0) then
-                    '# SERVICE_RUNNING
-                    '# we must launch the onStart as thread, but first setting state as running
-                    service->UpdateState(SERVICE_RUNNING)
-                    if not (service->onStart = 0) then
-                        _dprint("dispatch onStart() as new thread")
-                        service->_threadHandle = threadcreate(@ServiceProcess.call_onStart, service)
-                        '# my guess? was a hit!
-                    end if
-                    
-                    '# now that we are out of onStart thread, check if actually hit the stop sign
-                    _dprint("waiting for stop signal")
-                    do
-                        '# do nothing ...
-                        '# but not too often!
-                    loop while (WaitForSingleObject(service->_svcStopEvent, 100) = WAIT_TIMEOUT)
-                    
-                    '# now, wait for the thread (anyway, I hope it will be checking this.state, right?)
-                    '# we should do this, or actualy jump and wait for StopEvent?
-                    _dprint("waiting for onStart() thread to finish")
-                    threadwait(service->_threadHandle)
-                end if
-                
-                '# if we reach here, that means the service is not running, and the onStop was performed
-                '# so no more chat, stop it one and for all!
-                '# set SERVICE_STOPPED (just checking)
-                _dprint("service stopped")
-                service->UpdateState(SERVICE_STOPPED)
-            end if
-            
-            '# ok, we are done!
-        end if
-        
-        _dprint("_main() done")
-    end sub
-    
-    
-    '# this sub is used by _main when registering the ControlHandler for this service
-    '# (as callback from service manager).
-    '# we process each control codes and perform the actions using the pseudo-events (callbacks)
-    '# also we use lpContext to get the right reference when _main registered the control handler.
-    private function _control_ex(byval dwControl as DWORD, byval dwEventType as DWORD, byval lpEventData as LPVOID, byval lpContext as LPVOID) as DWORD
-        dim result as DWORD
-        dim service as ServiceProcess ptr
-        
-        _dprint("_control_ex()")
-        
-        '# we get a reference form the context
-        service = cast(ServiceProcess ptr, lpContext)
-        
-        '# show if the service reference is valid?
-        _dprint("service name: " + service->name)
-        
-        select case dwControl
-            case SERVICE_CONTROL_INTERROGATE:
-                '# we are running, so what we should do here?
-                _dprint("interrogation signal received")
-                '# in case we get a interrogation, we always should answer this way.
-                result = NO_ERROR
-                
-            case SERVICE_CONTROL_SHUTDOWN, SERVICE_CONTROL_STOP:
-                _dprint("stop signal received")
-                '# ok, service manager requested us to stop.
-                '# we must call onStop if was defined.
-                service->UpdateState(SERVICE_STOP_PENDING)
-                if not (service->onStop = 0) then
-                    _dprint("pass control to onStop()")
-                    service->onStop(*service)
-                end if
-                '# now signal the stop event so _main could take care of the rest.
-                _dprint("signal stop event")
-                SetEvent(service->_svcStopEvent)
-                
-            case SERVICE_CONTROL_PAUSE:
-                _dprint("pause signal received")
-                '# we must check if we could answer to the request.
-                if not (service->onPause = 0) and _
-                    not (service->onContinue = 0) then
-                    
-                    '# just to be sure
-                    if not (service->onPause = 0) then
-                        service->UpdateState(SERVICE_PAUSE_PENDING)
-                        
-                        _dprint("pass control to onPause()")
-                        service->onPause(*service)
-                        
-                        service->UpdateState(SERVICE_PAUSED)
-                        _dprint("service paused")
-                    end if
-                    result = NO_ERROR
-                    
-                else
-                    '# ok, our service didn't support pause or continue
-                    '# tell the service manager about that!
-                    result = ERROR_CALL_NOT_IMPLEMENTED
-                end if
-                
-            case SERVICE_CONTROL_CONTINUE:
-                _dprint("continue signal received")
-                '# we should resume from a paused state
-                '# we must check if we could answer to the request.
-                if not (service->onPause = 0) and _
-                    not (service->onContinue = 0) then
-                    
-                    '# just to be sure
-                    if not (service->onPause = 0) then
-                        service->UpdateState(SERVICE_CONTINUE_PENDING)
-                        
-                        _dprint("pass control to onContinue()")
-                        service->onContinue(*service)
-                        
-                        service->UpdateState(SERVICE_RUNNING)
-                        _dprint("service running")
-                    end if
-                    result = NO_ERROR
-                    
-                else
-                    '# ok, our service didn't support pause or continue
-                    '# tell the service manager about that!
-                    result = ERROR_CALL_NOT_IMPLEMENTED
-                end if
-                
-            case else:
-                result = NO_ERROR
-        end select
-        
-        _dprint("_control_ex() done")
-        return result
-    end function
-    
-    
-    '# add_to_references is a helper used to reduce code duplication (DRY).
-    '# here is used a lock around _svc_references to avoid two threads try change the
-    '# reference count (just in case).
-    function _add_to_references(byref service as ServiceProcess) as integer
-        _dprint("_add_to_references()")
-        
-        '# get a lock before even think touch references!
-        mutexlock(_svc_references_lock)
-        
-        '# now, reallocate space
-        _svc_references_count += 1
-        _svc_references = reallocate(_svc_references, sizeof(ServiceProcess ptr) * _svc_references_count)
-        
-        '# put the reference of this service into the table
-        _svc_references[(_svc_references_count - 1)] = @service
-        
-        '# ok, done, unlock our weapons! ;-)
-        mutexunlock(_svc_references_lock)
-        
-        _dprint("_add_to_references() done")
-        '# return the new references count
-        return _svc_references_count
-    end function
-    
-    
-    '# find_in_references is used by _main to lookup for the specified service in
-    '# references table.
-    function _find_in_references(byref service_name as string) as ServiceProcess ptr
-        dim result as ServiceProcess ptr
-        dim item as ServiceProcess ptr
-        dim idx as integer
-        
-        _dprint("_find_in_references()")
-        
-        '# we start with a pesimistic idea ;-)
-        result = 0
-        
-        for idx = 0 to (_svc_references_count - 1)
-            '# hold a reference to the item
-            item = _svc_references[idx]
-            
-            '# compare if we have a match
-            if (service_name = item->name) then
-                result = item
-                exit for
-            end if
-        next idx
-        
-        _dprint("_find_in_references() done")
-        '# return the found (or not) reference
-        return result
-    end function
-    
-    
-    '# namespace constructor
-    '# first we must create the mutex to be used with references
-    private sub _initialize() constructor
-        _dprint("_initialize() constructor")
-        '# we do this in case was already defined... don't know the situation,
-        '# just to be sure
-        if (_svc_references_lock = 0) then
-            _svc_references_lock = mutexcreate()
-            
-            '# also initialize our count :-)
-            _svc_references_count = 0
-        end if
-        
-        _dprint("_initialize() constructor done")
-    end sub
-    
-    
-    '# namespace destructor
-    private sub _terminate() destructor
-        _dprint("_terminate() destructor")
-        '# to avoid removing everything, we must lock to the references
-        mutexlock(_svc_references_lock)
-        
-        '# destroy our refernces allocated memory!
-        deallocate(_svc_references)
-        
-        '# unlock the mutex and destroy it too.
-        mutexunlock(_svc_references_lock)
-        mutexdestroy(_svc_references_lock)
-        
-        _dprint("_terminate() destructor done")
-    end sub
-    
-    
-    '# command line builder (helper)
-    '# this is used to gather information about:
-    '# mode (if present)
-    '# valid service name (after lookup in the table)
-    '# command line to be passed to service
-    sub _build_commandline(byref mode as string, byref service_name as string, byref commandline as string)
-        dim result_mode as string
-        dim result_name as string
-        dim result_cmdline as string
-        dim service as ServiceProcess ptr
-        dim idx as integer
-        dim temp as string
-        
-        idx = 1
-        '# first, determine if mode is pressent in commandline, must me command(1)
-        temp = lcase(command(idx))
-        
-        if (temp = "console") or _
-            (temp = "manage") then
-            result_mode = temp
-            idx += 1
-        end if
-        
-        '# now, check if service name is present
-        temp = command(idx)
-        
-        '# its present?
-        if (len(temp) > 0) then
-            '# lookup in references table
-            service = _find_in_references(temp)
-            if not (service = 0) then
-                '# was found, so must be valid
-                result_name = temp
-                '# adjust start index for cmdline
-                idx += 1
-            end if
-        end if
-
-        '# is service valid?
-        '# its really needed?
-        if (service = 0) then
-            if (_svc_references_count = 1) then
-                '# no, get the first one
-                service = _svc_references[0]
-                result_name = service->name
-                '# adjust start index for cmdline
-            else
-                '# this is needed!
-                result_name = ""
-            end if
-        end if
-        
-        result_cmdline = ""
-        
-        temp = command(idx)
-        do while (len(temp) > 0)
-            if (instr(temp, chr(32)) > 0) then
-                '# properly quote parameters with spaces
-                result_cmdline += """" + temp + """"
-            else
-                result_cmdline += temp
-            end if
-            result_cmdline += " "
-            idx += 1
-            
-            temp = command(idx)
-        loop
-        
-        '# now, return the results
-        mode = result_mode
-        service_name = result_name
-        commandline = result_cmdline
-    end sub
-    
-    
-    '# ### DEBUG ###
-    '# just for debuging purposes
-    '# (will be removed in the future when Loggers get implemented)
-#ifdef SERVICEFB_DEBUG_LOG
-    sub _dprint(byref message as string)
-        dim handle as integer
-        
-        handle = freefile
-        open EXEPATH + "\servicefb.log" for append as #handle
-        
-        print #handle, message
-        
-        close #handle
-    end sub
-#endif
-end namespace   '# fb.svc
-end namespace   '# fb
diff --git a/projects/mongrel_service/lib/ServiceFB/ServiceFB.bi b/projects/mongrel_service/lib/ServiceFB/ServiceFB.bi
deleted file mode 100644
index dc0acec..0000000
--- a/projects/mongrel_service/lib/ServiceFB/ServiceFB.bi
+++ /dev/null
@@ -1,109 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#if __FB_VERSION__ < "0.17"
-#error ServiceFB is designed to compile with FreeBASIC version "0.17"
-#else
-
-#ifndef __FB_WIN32__
-#error Platform unsupported. Compiling ServiceFB requires Windows platform.
-#else
-
-#ifndef __ServiceFB_bi__
-#define __ServiceFB_bi__
-
-#include once "windows.bi"
-#inclib "advapi32"
-
-namespace fb
-namespace svc   '# fb.svc
-#ifdef SERVICEFB_DEBUG_LOG
-    '# debug print
-    declare sub _dprint(byref as string)
-#else
-    #define _dprint(message)
-#endif
-    
-    '# service states used by end user with 'state' property
-    enum ServiceStateEnum
-        Running = SERVICE_RUNNING
-        Paused = SERVICE_PAUSED
-        Stopped = SERVICE_STOPPED
-    end enum
-    
-    
-    '# ServiceProcess type (object)
-    '# use this to create new services and reference the on*() methods to perform the related
-    '# tasks.
-    type ServiceProcess
-        '# ctor/dtor
-        declare constructor()
-        declare constructor(byref as string)
-        declare destructor()
-        
-        '# methods (public)
-        declare sub Run()
-        declare sub StillAlive(byval as integer = 10)
-        
-        '# helper methods (private)
-        declare sub UpdateState(byval as DWORD, byval as integer = 0, byval as integer = 0)
-        
-        '# pseudo-events
-        '# for onInit you should return FALSE (0) in case you want to abort
-        '# service initialization.
-        '# If everything was ok, then return TRUE (-1)
-        onInit          as function(byref as ServiceProcess) as integer
-        onStart         as sub(byref as ServiceProcess)
-        onStop          as sub(byref as ServiceProcess)
-        onPause         as sub(byref as ServiceProcess)
-        onContinue      as sub(byref as ServiceProcess)
-        
-        '# call_* are used to avoid the warning arround ThreadCreate
-        declare static sub call_onStart(byval as any ptr)
-        
-        '# properties (public)
-        name            as string
-        description     as string
-        state           as ServiceStateEnum
-        commandline     as string                   '# TODO
-        shared_process  as integer
-        
-        '# properties (private)
-        _svcStatus      as SERVICE_STATUS
-        _svcHandle      as SERVICE_STATUS_HANDLE
-        _svcStopEvent   as HANDLE
-        _threadHandle   as any ptr
-    end type
-    
-    
-    '# ServiceHost type (object)
-    '# use this, beside ServiceProcess, to manage the registration and running of
-    '# several services sharing the same process.
-    '# NOTE: ServiceHost.Run() and ServiceProcess.Run() are mutually exclusive, that
-    '# means don't mix single service with multiple service in the same program!
-    type ServiceHost
-        '# ctor/dtor()
-        declare constructor()
-        declare destructor()
-        
-        '# methods (public)
-        declare sub Add(byref as ServiceProcess)
-        declare sub Run()
-        
-        '# properties (public)
-        count           as integer
-    end type
-end namespace   '# fb.svc
-end namespace   '# fb
-
-#ifdef SERVICEFB_INCLUDE_UTILS
-#include once "ServiceFB_Utils.bi"
-#endif
-
-#endif '# __ServiceFB_bi__
-#endif '# __FB_WIN32__
-#endif '# __FB_VERSION__ \ No newline at end of file
diff --git a/projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bas b/projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bas
deleted file mode 100644
index c8a77a3..0000000
--- a/projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bas
+++ /dev/null
@@ -1,493 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#include once "ServiceFB.bi"
-#include once "_internals.bi"
-#include once "ServiceFB_Utils.bi"
-#include once "_utils_internals.bi"
-
-namespace fb
-namespace svc
-namespace utils   '# fb.svc.utils
-    '# private (internals) for ServiceProcess.Console()
-    dim shared _svc_stop_signal as any ptr
-    dim shared _svc_stop_mutex as any ptr
-    dim shared _svc_stopped as BOOL
-    dim shared _svc_in_console as ServiceProcess ptr
-    dim shared _svc_in_console_stop_flag as BOOL
-    
-    '#####################
-    '# ServiceController
-    '# ctor()
-    constructor ServiceController()
-        with this
-            .product = "My Product"
-            .version = "v0.1"
-            .copyright = "my copyright goes here."
-        end with
-    end constructor
-    
-    
-    '# ctor(product)
-    constructor ServiceController(byref new_product as string)
-        this.product = new_product
-    end constructor
-    
-    
-    '# ctor(product, version)
-    constructor ServiceController(byref new_product as string, byref new_version as string)
-        constructor(new_product)
-        this.version = new_version
-    end constructor
-    
-    
-    '# ctor(product, version, copyright)
-    constructor ServiceController(byref new_product as string, byref new_version as string, byref new_copyright as string)
-        constructor(new_product, new_version)
-        this.copyright = new_copyright
-    end constructor
-    
-    
-    '# dtor()
-    destructor ServiceController()
-    end destructor
-    
-    
-    '# Banner() will display in the console, information regarding your program
-    '# using this formatting:
-    '# 'Product', 'Version'
-    '# 'Copyright'
-    sub ServiceController.Banner()
-        '# display Product and Version
-        print this.product; ", "; this.version
-        print this.copyright
-        print ""
-        '# leave a empty line between banner (header) and other info
-    end sub
-    
-    
-    '# RunMode() provide a simple way to get (*you*) from where this process was started
-    '# and do the corresponding action.
-    function ServiceController.RunMode() as ServiceRunMode
-        dim result as ServiceRunMode
-        dim currPID as DWORD
-        dim parent_pid as uinteger
-        dim parent_name as string
-        dim start_mode as string
-        
-        _dprint("ServiceController.RunMode()")
-        
-        '# get this process PID
-        currPID = GetCurrentProcessId()
-        _dprint("CurrentPID: " + str(currPID))
-        
-        '# get the parent PID
-        parent_pid = _parent_pid(currPID)
-        _dprint("ParentPID: " + str(parent_pid))
-        
-        '# now the the name
-        parent_name = _process_name(parent_pid)
-        if (parent_name = "<unknown>") then
-          parent_name = _process_name_dyn_psapi(parent_pid)
-        end if
-        _dprint("Parent Name: " + parent_name)
-        
-        '# this process started as service?
-        '# that means his parent is services.exe
-        if (parent_name = "services.exe") then
-            result = RunAsService
-        else
-            '# ok, it didn't start as service, analyze command line then
-            start_mode = lcase(trim(command(1)))
-            if (start_mode = "manage") then
-                '# start ServiceController.Manage()
-                result = RunAsManager
-            elseif (start_mode = "console") then
-                '# start ServiceController.Console()
-                result = RunAsConsole
-            else
-                '# ok, the first paramenter in the commandline didn't work,
-                '# report back so we could send the banner!
-                result = RunAsUnknown
-            end if
-        end if
-        
-        _dprint("ServiceController.RunMode() done")
-        return result
-    end function
-    
-    
-    '# Manage will offer the user (end-user) option in the commandline to
-    '# install, remove, start, stop and query the status of the installed service
-    '# use Manage() when you code a multi-services (ServiceHost) based programs
-    '# for single services, use Manage(service)
-    sub ServiceController.Manage()
-    end sub
-    
-    
-    '# this is used when you want management capabilities for your service
-    '# use this for single services, or call Manage() for multi services
-    sub ServiceController.Manage(byref service as ServiceProcess)
-    end sub
-    
-    
-    '# this offer the user a way to test/debug your service or run it like a normal
-    '# program, from the command line
-    '# will let you SHUTDOWN the service using CTRL+C
-    '# use this for multi-services (ServiceHost) based programs
-    sub ServiceController.Console()
-        dim working_thread as any ptr
-        dim run_mode as string
-        dim service_name as string
-        dim service as ServiceProcess ptr
-        dim commandline as string
-        dim success as integer
-        
-        _dprint("ServiceController.Console()")
-        
-        '# show the controller banner
-        this.Banner()
-        
-        '# determine how many service exist in references
-        if (_svc_references_count > 0) then
-            _build_commandline(run_mode, service_name, commandline)
-            service = _find_in_references(service_name)
-            
-            if (service = 0) then
-                '# no valid service reference, list available services
-                _list_references()
-            else
-                '# build the command line, excluding 'console' and service_name
-                service->commandline = commandline
-                
-                '# got a service reference
-                '# also, set the global handler that will be used by _control_handler
-                _svc_in_console = service
-                
-                '# create the signal used to stop the service thread.
-                _svc_stop_signal = condcreate()
-                _svc_stop_mutex = mutexcreate()
-                
-                '# register the Console Handler
-                SetConsoleCtrlHandler(@_console_handler, TRUE)
-                
-                print "Starting service '"; service_name; "' in console mode, please wait..."
-                
-                '# onInit should be started inline,
-                '# and its result validated!
-                if not (service->onInit = 0) then
-                    success = service->onInit(*service)
-                end if
-                
-                '# only continue if success
-                if not (success = 0) then
-                    '# now set service.state to running
-                    service->state = Running
-                    
-                    '# now, fire the main loop (onStart)
-                    if not (service->onStart = 0) then
-                        '# create the thread
-                        working_thread = threadcreate(@ServiceProcess.call_onStart, service)
-                        if (working_thread = 0) then
-                            print "Failed to create working thread."
-                        end if
-                    end if
-                    
-                    print "Service is in running state."
-                    print "Press Ctrl-C to stop it."
-                
-                    '# now that onStart is running, must monitor the stop_signal
-                    '# in case it arrives, the service state must change to exit the
-                    '# working thread.
-                    mutexlock(_svc_stop_mutex)
-                    do while (_svc_stopped = FALSE)
-                        condwait(_svc_stop_signal, _svc_stop_mutex)
-                    loop
-                    mutexunlock(_svc_stop_mutex)
-                    
-                    print "Stop signal received, stopping..."
-                    
-                    '# received the signal, so set state = Stopped
-                    service->state = Stopped
-                    
-                    print "Waiting for onStart() to exit..."
-                    
-                    '# now wait for the thread to terminate
-                    if not (working_thread = 0) then
-                        threadwait(working_thread)
-                    end if
-                    
-                else
-                    print "Error starting the service, onInit() failed."
-                end if
-                
-                print "Service stopped, doing cleanup."
-                
-                '# remove the console handler
-                SetConsoleCtrlHandler(@_console_handler, FALSE)
-                
-                '# now that service was stopped, destroy the references.
-                conddestroy(_svc_stop_signal)
-                mutexdestroy(_svc_stop_mutex)
-                print "Done."
-            end if
-        else
-            print "ERROR: No services could be served by this program. Exiting."
-        end if
-        
-        _dprint("ServiceController.Console() done")
-    end sub
-    
-    
-    '# this offer the user a way to test/debug your service or run it like a normal
-    '# program, from the command line
-    '# will let you SHUTDOWN the service using CTRL+C
-    '# use this for single-services
-    sub ServiceController.Console(byref service as ServiceProcess)
-        
-        _dprint("ServiceController.RunMode(service)")
-        
-        '# register the service in the references table
-        _add_to_references(service)
-        
-        _dprint("delegate to Console()")
-        '# now delegate control to Console()
-        this.Console()
-        
-        _dprint("ServiceController.Console(service) done")
-    end sub
-    
-    
-    '# console_handler is used to get feedback form keyboard and allow
-    '# shutdown of service using Ctrl+C / Ctrl+Break from keyboard
-    function _console_handler(byval dwCtrlType as DWORD) as BOOL
-        dim result as BOOL
-        dim service as ServiceProcess ptr
-        
-        _dprint("_console_handler()")
-        
-        '# get the reference from svc_in_console
-        service = _svc_in_console
-        
-        '# we default processing of the message to false
-        result = FALSE
-        
-        '# avoid recursion problems
-        if (_svc_in_console_stop_flag = FALSE) then
-            _dprint("no previous signaled, process event")
-            '# all the CtrlType events listed will raise the onStop
-            '# of the service
-            '# here also will be raised the _svc_stop_signal
-            select case dwCtrlType
-                case CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_BREAK_EVENT, CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT:
-                    _dprint("got supported CTRL_*_EVENT")
-                    '# avoid recursion problems
-                    _svc_in_console_stop_flag = TRUE
-                    _dprint("set signaled to TRUE")
-                    
-                    '# the service defined onStop?
-                    if not (service->onStop = 0) then
-                        _dprint("pass control to onStop()")
-                        service->onStop(*service)
-                    end if
-                    
-                    '# now fire the signal
-                    _dprint("fire stop signal")
-                    mutexlock(_svc_stop_mutex)
-                    condsignal(_svc_stop_signal)
-                    result = TRUE
-                    _svc_in_console_stop_flag = FALSE
-                    _svc_stopped = TRUE
-                    mutexunlock(_svc_stop_mutex)
-                    
-                case else:
-                    _dprint("unsupported CTRL EVENT")
-                    result = FALSE
-            end select
-        else
-            _dprint("already running onStop(), do not pass the message to other message handlers!")
-            result = TRUE
-        end if
-        
-        _dprint("_console_handler() done")
-        return result
-    end function
-    
-    
-    '# helper private subs used to list the services and their descriptions
-    '# in _svc_references
-    private sub _list_references()
-        dim item as ServiceProcess ptr
-        dim idx as integer
-        
-        print "Available services in this program:"
-        
-        for idx = 0 to (_svc_references_count - 1)
-            item = _svc_references[idx]
-            
-            print space(2);
-            print trim(item->name), , trim(item->description)
-        next idx
-        
-    end sub
-    
-    
-    '# TODO: SimpleLogger
-    '# TODO: EventLogger
-    
-    
-    '#####################
-    '# private (internals)
-    '# _parent_pid is used to retrieve, based on the PID you passed by, the one of the parent
-    '# that launched that process.
-    '# on fail, it will return 0
-    '# Thanks to MichaelW (FreeBASIC forums) for his help about this.
-    private function _parent_pid(byval PID as uinteger) as uinteger
-        dim as uinteger result
-        dim as HANDLE hProcessSnap
-        dim as PROCESSENTRY32 pe32
-        
-        '# initialize result, 0 = fail, other number, ParentPID
-        result = 0
-        
-        hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
-        if not (hProcessSnap = INVALID_HANDLE_VALUE) then
-            pe32.dwSize = sizeof(PROCESSENTRY32)
-            if (Process32First(hProcessSnap, @pe32) = TRUE) then
-                do
-                    if (pe32.th32ProcessID = PID) then
-                        result = pe32.th32ParentProcessID
-                        exit do
-                    end if
-                loop while not (Process32Next(hProcessSnap, @pe32) = 0)
-            end if
-        end if
-        
-        CloseHandle(hProcessSnap)
-        return result
-    end function
-    
-    
-    '# _process_name is used to retrieve the name (ImageName, BaseModule, whatever) of the PID you
-    '# pass to it. if no module name was found, it should return <unknown>
-    private function _process_name(byval PID as uinteger) as string
-        dim result as string
-        dim hProcess as HANDLE
-        dim hMod as HMODULE
-        dim cbNeeded as DWORD
-        
-        '# assign "<unknown>" to process name, allocate MAX_PATH (260 bytes)
-        result = "<unknown>"
-        result += space(MAX_PATH - len(result))
-    
-        '# get a handle to the Process
-        hProcess = OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, FALSE, PID)
-        
-        '# if valid, get the process name
-        if not (hProcess = NULL) then
-            '# success getting Process modules
-            if not (EnumProcessModules(hProcess, @hMod, sizeof(hMod), @cbNeeded) = 0) then
-                result = space(cbNeeded)
-                GetModuleBaseName(hProcess, hMod, strptr(result), len(result))
-            end if
-        end if
-        
-        CloseHandle(hProcess)
-        
-        '# return a trimmed result
-        result = trim(result)
-        return result
-    end function
-    
-    '# _process_name_dyn_psapi is a workaround for some issues with x64 versions of Windows.
-    '# by default, 32bits process can't query information from 64bits modules.
-    private function _process_name_dyn_psapi(byval PID as uinteger) as string
-        dim result as string
-        dim chop as uinteger
-        dim zresult as zstring * MAX_PATH
-        dim hLib as any ptr
-        dim hProcess as HANDLE
-        dim cbNeeded as DWORD
-        dim GetProcessImageFileName as function (byval as HANDLE, byval as LPTSTR, byval as DWORD) as DWORD
-      
-        '# assign "<unknown>" to process name, allocate MAX_PATH (260 bytes)
-        zresult = "<unknown>" + chr(0)
-    
-        '# get dynlib
-        hLib = dylibload("psapi.dll")
-        if not (hlib = 0) then
-            GetProcessImageFileName = dylibsymbol(hlib, "GetProcessImageFileNameA")
-            if not (GetProcessImageFileName = 0) then
-                '# get a handle to the Process
-                hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, PID)
-                
-                '# if valid, get the process name
-                if not (hProcess = NULL) then
-                    cbNeeded = sizeof(zresult)
-                    if (GetProcessImageFileName(hProcess, @zresult, cbNeeded) = 0) then
-                        _dprint("Error with GetProcessImageFileName")
-                        _dprint("GetLastError: " + str(GetLastError()) + _show_error())
-                    else
-                        result = zresult
-                        chop = InStrRev(0, result, "\")
-                        if (chop > 0) then
-                          result = mid(result, chop + 1, (len(result) - chop))
-                        end if
-                    end if
-                else
-                    _dprint("Error with OpenProcess")
-                    _dprint("GetLastError: " + str(GetLastError()) + _show_error())
-                end if
-                
-                CloseHandle(hProcess)
-            else
-                _dprint("Unable to get a reference to dynamic symbol GetProcessImageFileNameA.")
-            end if
-        else
-            _dprint("Unable to dynamic load psapi.dll")
-        end if
-        
-        '# return a trimmed result
-        'result = trim(result)
-        return result
-    end function
-    
-    private function _show_error() as string
-        dim buffer as string * 1024
-        dim p as integer
-        
-        FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM,_
-                       0,_
-                       GetLastError(),_
-                       0,_
-                       strptr(buffer),_
-                       1024,_
-                       0 )
-        buffer = rtrim(buffer)
-        p = instr(buffer, chr(13))
-        if p then buffer = left(buffer, p - 1)
-        
-        return buffer
-    end function
-    
-    private function InStrRev(byval start as uinteger = 0, byref src as string, byref search as string) as uinteger
-        dim lensearch as uinteger = len(search)
-        dim as uinteger b, a = 0, exit_loop = 0
-        
-        do
-            b = a
-            a += 1
-            a = instr(a, src, search)
-            if start >= lensearch then if a + lensearch > start then exit_loop = 1
-        loop while (a > 0) and (exit_loop = 0)
-        
-        return b
-    end function
-
-end namespace     '# fb.svc.utils
-end namespace     '# fb.svc
-end namespace     '# fb
diff --git a/projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bi b/projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bi
deleted file mode 100644
index 8ae1f28..0000000
--- a/projects/mongrel_service/lib/ServiceFB/ServiceFB_Utils.bi
+++ /dev/null
@@ -1,70 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#if __FB_VERSION__ < "0.17"
-#error ServiceFB is designed to compile with FreeBASIC version "0.17"
-#else
-
-#ifndef __FB_WIN32__
-#error Platform unsupported. Compiling ServiceFB requires Windows platform.
-#else
-
-#ifndef __ServiceFB_Utils_bi__
-#define __ServiceFB_Utils_bi__
-
-#include once "win/psapi.bi"
-#include once "win/tlhelp32.bi"
-
-namespace fb
-namespace svc
-namespace utils   '# fb.svc.utils
-    '# use this to determine (using select case maybe?) the
-    '# mode which the service was invoked.
-    enum ServiceRunMode
-        RunAsUnknown = 0
-        RunAsService
-        RunAsManager
-        RunAsConsole
-    end enum
-    
-    
-    '# ServiceController type (object)
-    '# this is a helper object in case you want to implement
-    '# console mode (command line testing/debugging) and management (install/remove/control)
-    '# to your services, all from the same executable
-    type ServiceController
-        '# ctor/dtor()
-        declare constructor()
-        declare constructor(byref as string)
-        declare constructor(byref as string, byref as string)
-        declare constructor(byref as string, byref as string, byref as string)
-        declare destructor()
-        
-        '# methods (public)
-        declare sub Banner()
-        declare function RunMode() as ServiceRunMode
-        declare sub Manage()
-        declare sub Manage(byref as ServiceProcess)
-        declare sub Console()
-        declare sub Console(byref as ServiceProcess)
-        
-        '# properties (public)
-        '# use these properties for shwoing information on console/manager mode
-        '# as banner.
-        '# Product, version
-        '# copyright
-        product     as string
-        version     as string
-        copyright   as string
-    end type
-end namespace     '# fb.svc.utils
-end namespace     '# fb.svc
-end namespace     '# fb
-
-#endif '# __ServiceFB_bi__
-#endif '# __FB_WIN32__
-#endif '# __FB_VERSION__ \ No newline at end of file
diff --git a/projects/mongrel_service/lib/ServiceFB/_internals.bi b/projects/mongrel_service/lib/ServiceFB/_internals.bi
deleted file mode 100644
index 55ea882..0000000
--- a/projects/mongrel_service/lib/ServiceFB/_internals.bi
+++ /dev/null
@@ -1,50 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-'##################################################################
-'#
-'# DO NOT INCLUDE THIS FILE DIRECTLY!
-'# it is used internaly by ServiceFB
-'# use ServiceFB.bi instead
-'#
-'##################################################################
-
-namespace fb
-namespace svc
-    '# now due references locking, I needed a constructor and destructor for
-    '# the namespace to garantee everything is cleaned up on termination of the process
-    declare sub _initialize() constructor
-    declare sub _terminate() destructor
-    
-    '# global service procedures (private)
-    declare sub _main(byval as DWORD, byval as LPSTR ptr)
-    declare function _control_ex(byval as DWORD, byval as DWORD, byval as LPVOID, byval as LPVOID) as DWORD
-    declare sub _run()
-    
-    '# global references helper
-    declare function _add_to_references(byref as ServiceProcess) as integer
-    declare function _find_in_references(byref as string) as ServiceProcess ptr
-    
-    '# command line builder (helper)
-    '# this is used to gather information about:
-    '# mode (if present)
-    '# valid service name (after lookup in the table)
-    '# command line to be passed to service
-    declare sub _build_commandline(byref as string, byref as string, byref as string)
-    
-    '# I started this as simple, unique service served from one process
-    '# but the idea of share the same process space (and reduce resources use) was good.
-    '# to do that, I needed a references table (similar to service_table, but we will
-    '# hold the ServiceProcess registered by ServiceHost (the multi services host).
-    '# also, I needed a locking mechanism to avoid problems of two calls changing the table
-    '# at the same time.
-    extern _svc_references as ServiceProcess ptr ptr
-    extern _svc_references_count as integer
-    extern _svc_references_lock as any ptr
-end namespace   '# fb.svc
-end namespace   '# fb
-
diff --git a/projects/mongrel_service/lib/ServiceFB/_utils_internals.bi b/projects/mongrel_service/lib/ServiceFB/_utils_internals.bi
deleted file mode 100644
index fab00f0..0000000
--- a/projects/mongrel_service/lib/ServiceFB/_utils_internals.bi
+++ /dev/null
@@ -1,51 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-'##################################################################
-'#
-'# DO NOT INCLUDE THIS FILE DIRECTLY!
-'# it is used internaly by ServiceFB
-'# use ServiceFB_Utils.bi instead
-'#
-'##################################################################
-
-namespace fb
-namespace svc
-namespace utils   '# fb.svc.utils
-    '# console_handler is used to get feedback form keyboard and allow
-    '# shutdown of service using Ctrl+C / Ctrl+Break from keyboard
-    declare function _console_handler(byval as DWORD) as BOOL
-    
-    '# helper private subs used to list the services and their descriptions
-    '# in _svc_references
-    declare sub _list_references()
-    
-    '# internals functions used to get Parent PID and Process Name
-    '# using this we automatically determine if the service was started by SCM
-    '# or by the user, from commandline or from explorer
-    declare function _parent_pid(byval as uinteger) as uinteger
-    declare function _process_name(byval as uinteger) as string
-    declare function _process_name_dyn_psapi(byval as uinteger) as string
-    declare function _show_error() as string
-    
-    '# InStrRev (authored by ikkejw @ freebasic forums)
-    '# http://www.freebasic.net/forum/viewtopic.php?p=49315#49315
-    declare function InStrRev(byval as uinteger = 0, byref as string, byref as string) as uinteger
-    
-    '# use a signal (condition) in the console mode to know
-    '# when the service should be stopped.
-    '# the Console() main loop will wait for it, and the console_handler
-    '# will raise in case Ctrl+C / Ctrl+Break or other events are
-    '# received.
-    extern _svc_stop_signal as any ptr
-    extern _svc_stop_mutex as any ptr
-    extern _svc_stopped as BOOL
-    extern _svc_in_console as ServiceProcess ptr
-    extern _svc_in_console_stop_flag as BOOL
-end namespace     '# fb.svc.utils
-end namespace     '# fb.svc
-end namespace     '# fb
diff --git a/projects/mongrel_service/lib/mongrel_service/init.rb b/projects/mongrel_service/lib/mongrel_service/init.rb
deleted file mode 100644
index f1475f0..0000000
--- a/projects/mongrel_service/lib/mongrel_service/init.rb
+++ /dev/null
@@ -1,211 +0,0 @@
-require 'gem_plugin'
-require 'mongrel'
-require 'mongrel/rails'
-require 'rbconfig'
-require 'fileutils'
-
-module Service
-  class Install < GemPlugin::Plugin "/commands"
-    include Mongrel::Command::Base
-  
-    def configure
-        options [
-          ['-N', '--name SVC_NAME', "Required name for the service to be registered/installed.", :@svc_name, nil],
-          ['-D', '--display SVC_DISPLAY', "Adjust the display name of the service.", :@svc_display, nil],
-          ["-e", "--environment ENV", "Rails environment to run as", :@environment, ENV['RAILS_ENV'] || "development"],
-          ['-p', '--port PORT', "Which port to bind to", :@port, 3000],
-          ['-a', '--address ADDR', "Address to bind to", :@address, "0.0.0.0"],
-          ['-l', '--log FILE', "Where to write log messages", :@log_file, "log/mongrel.log"],
-          ['-P', '--pid FILE', "Where to write the PID", :@pid_file, "log/mongrel.pid"],
-          ['-n', '--num-procs INT', "Number of processors active before clients denied", :@num_procs, 1024],
-          ['-t', '--timeout TIME', "Timeout all requests after 100th seconds time", :@timeout, 0],
-          ['-m', '--mime PATH', "A YAML file that lists additional MIME types", :@mime_map, nil],
-          ['-c', '--chdir PATH', "Change to dir before starting (will be expanded)", :@cwd, Dir.pwd],
-          ['-r', '--root PATH', "Set the document root (default 'public')", :@docroot, "public"],
-          ['-B', '--debug', "Enable debugging mode", :@debug, false],
-          ['-C', '--config PATH', "Use a config file", :@config_file, nil],
-          ['-S', '--script PATH', "Load the given file as an extra config script.", :@config_script, nil],
-          ['', '--prefix PATH', "URL prefix for Rails app", :@prefix, nil]
-        ]
-    end
-    
-    # When we validate the options, we need to make sure the --root is actually RAILS_ROOT
-    # of the rails application we wanted to serve, because later "as service" no error
-    # show to trace this.
-    def validate
-      # TODO: investigate why Win32::Service interfere with gem_plugin
-      gem 'win32-service', '>= 0.5.2', '< 0.6.0'
-      require 'win32/service'
-
-      @cwd = File.expand_path(@cwd)
-      valid_dir? @cwd, "Invalid path to change to: #@cwd"
-  
-      # change there to start, then we'll have to come back after daemonize
-      Dir.chdir(@cwd)
-  
-      # start with the premise of app really exist.
-      app_exist = true
-      %w{app config log}.each do |path|
-        if !File.directory?(File.join(@cwd, path))
-          app_exist = false
-          break
-        end
-      end
-
-      valid?(@prefix[0].chr == "/" && @prefix[-1].chr != "/", "Prefix must begin with / and not end in /") if @prefix
-
-      valid? app_exist == true, "The path you specified isn't a valid Rails application."
-
-      valid_dir? File.dirname(@log_file), "Path to log file not valid: #@log_file"
-      valid_dir? File.dirname(@pid_file), "Path to pid file not valid: #@pid_file"
-      valid_dir? @docroot, "Path to docroot not valid: #@docroot"
-      valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map
-      valid_exists? @config_file, "Config file not there: #@config_file" if @config_file
-
-      # We should validate service existance here, right Zed?
-      begin
-        valid? !Win32::Service.exists?(@svc_name), "The service already exist, please remove it first."
-      rescue
-      end
-
-      valid? @svc_name != nil, "A service name is mandatory."
-      
-      # default service display to service name
-      @svc_display = @svc_name if !@svc_display
-
-      return @valid
-    end
-    
-    def run
-      gem 'win32-service', '>= 0.5.2', '< 0.6.0'
-      require 'win32/service'
-
-      # check if mongrel_service.exe is in ruby bindir.
-      gem_root = File.join(File.dirname(__FILE__), "..", "..")
-      gem_executable = File.join(gem_root, "bin/mongrel_service.exe")
-      bindir_executable = File.join(Config::CONFIG['bindir'], '/mongrel_service.exe')
-      
-      unless File.exist?(bindir_executable)
-        STDERR.puts "** Copying native mongrel_service executable..."
-        FileUtils.cp gem_executable, bindir_executable rescue nil
-      end
-      
-      unless FileUtils.compare_file(bindir_executable, gem_executable)
-        STDERR.puts "** Updating native mongrel_service executable..."
-        FileUtils.rm_f bindir_executable rescue nil
-        FileUtils.cp gem_executable, bindir_executable rescue nil
-      end
-      
-      # build the command line
-      argv = []
-      
-      # start using the native executable
-      argv << '"' + bindir_executable + '"'
-      
-      # use the 'single' service for now
-      argv << "single"
-      
-      # command line setting override config file settings
-      @options = { :host => @address,  :port => @port, :cwd => @cwd,
-        :log_file => @log_file, :pid_file => @pid_file, :environment => @environment,
-        :docroot => @docroot, :mime_map => @mime_map,
-        :debug => @debug, :includes => ["mongrel"], :config_script => @config_script,
-        :num_procs => @num_procs, :timeout => @timeout, :cpu => @cpu, :prefix => @prefix
-      }
-      
-      # if we are using a config file, pass -c and -C to the service instead of each start parameter.
-      if @config_file
-        STDERR.puts "** Using #{@config_file} instead of command line parameters."
-        conf = YAML.load_file(@config_file)
-        
-        # add the root folder (-c)
-        argv << "-c \"#{conf[:cwd]}\""
-        
-        # use the config file
-        argv << "-C \"#{@config_file}\""
-
-      else
-        # use the command line instead
-        # now the options
-        argv << "-e #{@options[:environment]}" if @options[:environment]
-        argv << "-p #{@options[:port]}"
-        argv << "-a #{@options[:host]}"  if @options[:host]
-        argv << "-l \"#{@options[:log_file]}\"" if @options[:log_file]
-        argv << "-P \"#{@options[:pid_file]}\""
-        argv << "-c \"#{@options[:cwd]}\"" if @options[:cwd]
-        argv << "-t #{@options[:timeout]}" if @options[:timeout]
-        argv << "-m \"#{@options[:mime_map]}\"" if @options[:mime_map]
-        argv << "-r \"#{@options[:docroot]}\"" if @options[:docroot]
-        argv << "-n #{@options[:num_procs]}" if @options[:num_procs]
-        argv << "-B" if @options[:debug]
-        argv << "-S \"#{@options[:config_script]}\"" if @options[:config_script]
-        argv << "-u #{@options[:cpu.to_i]}" if @options[:cpu]
-        argv << "--prefix \"#{@options[:prefix]}\"" if @options[:prefix]
-      end
-
-      svc = Win32::Service.new
-      begin
-        svc.create_service{ |s|
-          s.service_name     = @svc_name
-          s.display_name     = @svc_display
-          s.binary_path_name = argv.join ' '
-          s.dependencies     = []
-          s.service_type     = Win32::Service::WIN32_OWN_PROCESS
-        }
-        puts "Mongrel service '#{@svc_display}' installed as '#{@svc_name}'."
-      rescue Win32::ServiceError => err
-        puts "There was a problem installing the service:"
-        puts err
-      end
-      svc.close
-    end
-  end
-
-  module ServiceValidation
-    def configure
-      options [
-        ['-N', '--name SVC_NAME', "Required name for the service to be registered/installed.", :@svc_name, nil],
-      ]
-    end
-    
-    def validate
-      valid? @svc_name != nil, "A service name is mandatory."
-
-      gem 'win32-service', '>= 0.5.2', '< 0.6.0'
-      require 'win32/service'
-      
-      # Validate that the service exists
-      begin
-        valid? Win32::Service.exists?(@svc_name), "There is no service with that name, cannot proceed."
-        Win32::Service.open(@svc_name) do |svc|
-          valid? svc.binary_path_name.include?("mongrel_service"), "The service specified isn't a Mongrel service."
-        end
-      rescue
-      end
-      
-      return @valid
-    end
-  end
-  
-  class Remove < GemPlugin::Plugin "/commands"
-    include Mongrel::Command::Base
-    include ServiceValidation
-    
-    def run
-      gem 'win32-service', '>= 0.5.2', '< 0.6.0'
-      require 'win32/service'
-
-      display_name = Win32::Service.getdisplayname(@svc_name)
-      
-      begin
-        Win32::Service.stop(@svc_name)
-      rescue
-      end
-      begin
-        Win32::Service.delete(@svc_name)
-      rescue
-      end
-      puts "#{display_name} service removed."
-    end
-  end
-end
diff --git a/projects/mongrel_service/native/_debug.bi b/projects/mongrel_service/native/_debug.bi
deleted file mode 100644
index 277de2e..0000000
--- a/projects/mongrel_service/native/_debug.bi
+++ /dev/null
@@ -1,59 +0,0 @@
-'##################################################################
-'#
-'# mongrel_service: Win32 native implementation for mongrel
-'#                  (using ServiceFB and FreeBASIC)
-'#
-'# Copyright (c) 2006 Multimedia systems
-'# (c) and code by Luis Lavena
-'#
-'#  mongrel_service (native) and mongrel_service gem_pluing are licensed
-'#  in the same terms as mongrel, please review the mongrel license at
-'#  http://mongrel.rubyforge.org/license.html
-'#  
-'##################################################################
-
-'##################################################################
-'# Requirements:
-'# - FreeBASIC 0.17, Win32 CVS Build (as for November 09, 2006).
-'#
-'##################################################################
-
-#ifndef __Debug_bi__
-#define __Debug_bi__
-
-#ifdef DEBUG_LOG
-    #include once "vbcompat.bi"
-    #ifndef DEBUG_LOG_FILE
-        #define DEBUG_LOG_FILE EXEPATH + "\debug.log"
-    #endif
-
-    '# this procedure is only used for debugging purposed, will be removed from
-    '# final compilation
-    private sub debug_to_file(byref message as string, byref file as string, byval linenumber as uinteger, byref func as string)
-        dim handle as integer
-        static first_time as integer
-        
-        handle = freefile
-        open DEBUG_LOG_FILE for append as #handle
-        
-        if (first_time = 0) then
-            print #handle, "# Logfile created on "; format(now(), "dd/mm/yyyy HH:mm:ss")
-            print #handle, ""
-            first_time = 1
-        end if
-        
-        '# src/module.bas:123, namespace.function:
-        '#   message
-        '#
-        print #handle, file; ":"; str(linenumber); ", "; lcase(func); ":"
-        print #handle, space(2); message
-        print #handle, ""
-        
-        close #handle
-    end sub
-    #define debug(message) debug_to_file(message, __FILE__, __LINE__, __FUNCTION__)
-#else
-    #define debug(message)
-#endif '# DEBUG_LOG
-
-#endif '# __Debug_bi__
diff --git a/projects/mongrel_service/native/boolean.bi b/projects/mongrel_service/native/boolean.bi
deleted file mode 100644
index 8ca07c7..0000000
--- a/projects/mongrel_service/native/boolean.bi
+++ /dev/null
@@ -1,18 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#ifndef __BOOLEAN_BI__
-#define __BOOLEAN_BI__
-
-#undef BOOLEAN
-type BOOLEAN as byte
-#undef FALSE
-const FALSE as byte = 0
-#undef TRUE
-const TRUE as byte = not FALSE
-
-#endif ' __BOOLEAN_BI__ \ No newline at end of file
diff --git a/projects/mongrel_service/native/console_process.bas b/projects/mongrel_service/native/console_process.bas
deleted file mode 100644
index a2bb5c9..0000000
--- a/projects/mongrel_service/native/console_process.bas
+++ /dev/null
@@ -1,397 +0,0 @@
-'#--
-'# Copyright (c) 2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#include once "console_process.bi"
-
-constructor ConsoleProcess(byref new_filename as string = "", byref new_arguments as string = "")
-    '# assign filename and arguments
-    
-    '# if filename contains spaces, automatically quote it!
-    if (instr(new_filename, " ") > 0) then
-        _filename = !"\"" + new_filename + !"\""
-    else
-        _filename = new_filename
-    endif
-    
-    _arguments = new_arguments
-end constructor
-
-destructor ConsoleProcess()
-    '# in case process still running
-    if (running = true) then
-        terminate(true)
-        
-        '# close opened handles
-        '# ...
-        CloseHandle(_process_info.hProcess)
-        CloseHandle(_process_info.hThread)
-    end if
-end destructor
-
-property ConsoleProcess.filename() as string
-    return _filename
-end property
-
-property ConsoleProcess.filename(byref rhs as string)
-    if not (running = true) then
-        _filename = rhs
-    end if
-end property
-
-property ConsoleProcess.arguments() as string
-    return _arguments
-end property
-
-property ConsoleProcess.arguments(byref rhs as string)
-    if not (running = true) then
-        _arguments = rhs
-    end if
-end property
-
-property ConsoleProcess.redirected_stdout() as string
-    return _stdout_filename
-end property
-
-property ConsoleProcess.redirected_stderr() as string
-    return _stderr_filename
-end property
-
-'# running is a helper which evaluates _pid and exit_code
-property ConsoleProcess.running() as boolean
-    dim result as boolean
-
-    '# presume not running
-    result = false
-    
-    if not (_pid = 0) then
-        '# that means the process is/was running.
-        '# now evaluate if exit_code = STILL_ACTIVE
-        result = (exit_code = STILL_ACTIVE)
-    end if
-    
-    return result
-end property
-
-property ConsoleProcess.pid() as uinteger
-    return _pid
-end property
-
-property ConsoleProcess.exit_code() as uinteger
-    static previous_code as uinteger
-    dim result as uinteger
-    
-    result = 0
-    
-    '# is _pid valid?
-    if not (_pid = 0) then
-        if not (_process_info.hProcess = NULL) then
-            '# the process reference is valid, get the exit_code
-            if not (GetExitCodeProcess(_process_info.hProcess, @result) = 0) then
-                previous_code = result
-                '# OK
-                '# no error in the query, get result
-                if not (result = STILL_ACTIVE) then
-                    CloseHandle(_process_info.hProcess)
-                    _process_info.hProcess = NULL
-                end if '# (result = STILL_ACTIVE)
-            end if '# not (GetExitCodeProcess() = 0)
-        else
-            result = previous_code
-        end if '# not (proc = NULL)
-    end if '# not (_pid = 0)
-    
-    return result
-end property
-
-function ConsoleProcess.redirect(byval target as ProcessStdEnum, byref new_std_filename as string) as boolean
-    dim result as boolean
-    
-    if not (running = true) then
-        select case target
-            case ProcessStdOut:
-                _stdout_filename = new_std_filename
-                result = true
-                
-            case ProcessStdErr:
-                _stderr_filename = new_std_filename
-                result = true
-                
-            case ProcessStdBoth:
-                _stdout_filename = new_std_filename
-                _stderr_filename = new_std_filename
-                result = true
-        
-        end select
-    end if
-    
-    return result
-end function
-
-function ConsoleProcess.start() as boolean
-    dim result as boolean
-    dim success as boolean
-    
-    '# API
-    '# New Process resources
-    dim context as STARTUPINFO
-    dim proc_sa as SECURITY_ATTRIBUTES = type(sizeof(SECURITY_ATTRIBUTES), NULL, TRUE)
-    
-    '# StdIn, StdOut, StdErr Read and Write Pipes.
-    dim as HANDLE StdInRd, StdOutRd, StdErrRd
-    dim as HANDLE StdInWr, StdOutWr, StdErrWr
-    dim merged as boolean
-    
-    '# cmdline
-    dim cmdline as string
-    
-    '# assume start will fail
-    result = false
-    
-    if (running = false) then
-        '# we should create the std* for the new proc!
-        '# (like good parents, prepare everything!)
-        
-        '# to ensure everything will work, we must allocate a console
-        '# using AllocConsole, even if it fails.
-        '# This solve the problems when running as service.
-        '# we discard result of AllocConsole since we ALWAYS will allocate it.
-        AllocConsole()
-        
-        '# assume all the following steps succeed
-        success = true
-        
-        '# StdIn is the only std that will be created using pipes always
-        '# StdIn
-        if (CreatePipe(@StdInRd, @StdInWr, @proc_sa, 0) = 0) then
-            success = false
-        end if
-        
-        '# Ensure the handles to the pipe are not inherited.
-        if (SetHandleInformation(StdInWr, HANDLE_FLAG_INHERIT, 0) = 0) then
-            success = false
-        end if
-        
-        '# StdOut and StdErr should be redirected?
-        if (not _stdout_filename = "") or _
-            (not _stderr_filename = "") then
-            
-            '# out and err are the same? (merged)
-            if (_stdout_filename = _stderr_filename) then
-                merged = true
-            end if
-        end if
-        
-        '# StdOut if stdout_filename
-        if not (_stdout_filename = "") then
-            StdOutWr = CreateFile(strptr(_stdout_filename), _
-                                    GENERIC_WRITE, _
-                                    FILE_SHARE_READ or FILE_SHARE_WRITE, _
-                                    @proc_sa, _
-                                    OPEN_ALWAYS, _
-                                    FILE_ATTRIBUTE_NORMAL, _
-                                    NULL)
-            
-            if (StdOutWr = INVALID_HANDLE_VALUE) then
-                '# failed to open file
-                success = false
-            else
-                SetFilePointer(StdOutWr, 0, NULL, FILE_END)
-            end if
-        else
-            '# use pipes instead
-            '# StdOut
-            if (CreatePipe(@StdOutRd, @StdOutWr, @proc_sa, 0) = 0) then
-                success = false
-            end if
-            
-            if (SetHandleInformation(StdOutRd, HANDLE_FLAG_INHERIT, 0) = 0) then
-                success = false
-            end if
-        end if 'not (_stdout_filename = "")
-        
-        '# only create stderr if no merged.
-        if (merged = true) then
-            StdErrWr = StdOutWr
-        else
-            '# do the same for StdErr...
-            if not (_stderr_filename = "") then
-                StdErrWr = CreateFile(strptr(_stderr_filename), _
-                                        GENERIC_WRITE, _
-                                        FILE_SHARE_READ or FILE_SHARE_WRITE, _
-                                        @proc_sa, _
-                                        OPEN_ALWAYS, _
-                                        FILE_ATTRIBUTE_NORMAL, _
-                                        NULL)
-                
-                if (StdErrWr = INVALID_HANDLE_VALUE) then
-                    '# failed to open file
-                    success = false
-                else
-                    SetFilePointer(StdErrWr, 0, NULL, FILE_END)
-                end if
-            else
-                '# use pipes instead
-                '# StdOut
-                if (CreatePipe(@StdErrRd, @StdErrWr, @proc_sa, 0) = 0) then
-                    success = false
-                end if
-                
-                if (SetHandleInformation(StdErrRd, HANDLE_FLAG_INHERIT, 0) = 0) then
-                    success = false
-                end if
-                
-            end if 'not (_stderr_filename = "")
-        end if '(merged = true)
-        
-        '# now we must proceed to create the process
-        '# without the pipes, we shouldn't continue!
-        if (success = true) then
-            '# Set the Std* handles ;-)
-            with context
-                .cb = sizeof( context )
-                .hStdError = StdErrWr
-                .hStdOutput = StdOutWr
-                .hStdInput = StdInRd
-                .dwFlags = STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW
-                '# FIXME: .wShowWindow = iif((_show_console = true), SW_SHOW, SW_HIDE)
-                .wShowWindow = SW_HIDE
-            end with
-            
-            '# build the command line
-            cmdline = _filename + " " + _arguments
-            
-            '# now creates the process
-            if (CreateProcess(NULL, _
-                                strptr(cmdline), _
-                                NULL, _
-                                NULL, _
-                                1, _            '# win32 TRUE (1)
-                                0, _
-                                NULL, _
-                                NULL, _
-                                @context, _
-                                @_process_info) = 0) then
-                result = false
-            else
-                '# set the _pid
-                _pid = _process_info.dwProcessId
-                
-                '# OK? yeah, I think so.
-                result = true
-                
-                '# close the Std* handles
-                CloseHandle(StdInRd)
-                CloseHandle(StdInWr)
-                CloseHandle(StdOutRd)
-                CloseHandle(StdOutWr)
-                CloseHandle(StdErrRd)
-                CloseHandle(StdErrWr)
-                
-                '# close children main Thread handle and
-                '# NULLify to avoid issues
-                CloseHandle(_process_info.hThread)
-                _process_info.hThread = NULL
-            end if '# (CreateProcess() = 0)
-        else
-            result = false
-        end if '# (success = TRUE)
-    end if
-    
-    return result
-end function
-
-function ConsoleProcess.terminate(byval force as boolean = false) as boolean
-    dim result as boolean
-    dim success as boolean
-    
-    dim proc as HANDLE
-    dim code as uinteger
-    dim wait_code as uinteger
-    
-    '# is pid valid?
-    if (running = true) then
-        '# hook our custom console handler
-        if not (SetConsoleCtrlHandler(@_console_handler, 1) = 0) then
-            success = true
-        end if
-        
-        if (success = true) then
-            '# get a handle to Process
-            proc = _process_info.hProcess
-            if not (proc = NULL) then
-                '# process is valid, perform actions
-                success = false
-                
-                if not (force = true) then
-                    '# send CTRL_C_EVENT and wait for result
-                    if not (GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0) = 0) then
-                        '# it worked, wait 5 seconds terminates.
-                        wait_code = WaitForSingleObject(proc, 10000)
-                        if not (wait_code = WAIT_TIMEOUT) then
-                            success = true
-                        end if
-                    else
-                        success = false
-                    end if
-                    
-                    '# Ctrl-C didn't work, try Ctrl-Break
-                    if (success = false) then
-                        '# send CTRL_BREAK_EVENT and wait for result
-                        if not (GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0) = 0) then
-                            '# it worked, wait 5 seconds terminates.
-                            wait_code = WaitForSingleObject(proc, 10000)
-                            if not (wait_code = WAIT_TIMEOUT) then
-                                success = true
-                            end if
-                        else
-                            success = false
-                        end if
-                    end if
-                    
-                '# only do termination if force was set.
-                elseif (force = true) and (success = false) then
-                    '# still no luck? we should do a hard kill then
-                    if (TerminateProcess(proc, 0) = 0) then
-                        success = false
-                    else
-                        success = true
-                    end if
-                end if
-                
-                '# now get process exit code
-                if (success = true) then
-                    result = true
-                else
-                    result = false
-                end if
-            else
-                '# invalid process handler
-                result = false
-            end if
-            
-        end if '# (success = true)
-        
-        '# remove hooks
-        if not (SetConsoleCtrlHandler(@_console_handler, 0) = 0) then
-            success = true
-        end if
-    end if '# not (pid = 0)
-    
-    return result
-end function
-
-function ConsoleProcess._console_handler(byval dwCtrlType as DWORD) as BOOL
-    dim result as BOOL
-    
-    if (dwCtrlType = CTRL_C_EVENT) then
-        result = 1
-    elseif (dwCtrlType = CTRL_BREAK_EVENT) then
-        result = 1
-    end if
-    
-    return result
-end function
diff --git a/projects/mongrel_service/native/console_process.bi b/projects/mongrel_service/native/console_process.bi
deleted file mode 100644
index 3ad49ad..0000000
--- a/projects/mongrel_service/native/console_process.bi
+++ /dev/null
@@ -1,75 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#ifndef __CONSOLE_PROCESS_BI__
-#define __CONSOLE_PROCESS_BI__
-
-#include once "windows.bi"
-#include once "boolean.bi"
-
-enum ProcessStdEnum
-    ProcessStdOut   = 1
-    ProcessStdErr   = 2
-    ProcessStdBoth  = 3
-end enum
-
-type ConsoleProcess
-    '# this class provide basic functionality
-    '# to control child processes
-    
-    '# new ConsoleProcess(Filename, Parameters)
-    declare constructor(byref as string = "", byref as string = "")
-    
-    '# delete
-    declare destructor()
-    
-    '# properties (only getters)
-    declare property filename as string
-    declare property filename(byref as string)
-    
-    declare property arguments as string
-    declare property arguments(byref as string)
-    
-    '# stdout and stderr allow you redirect
-    '# console output and errors to files
-    declare property redirected_stdout as string
-    declare property redirected_stderr as string
-    
-    '# evaluate if the process is running
-    declare property running as boolean
-    
-    '# pid will return the current Process ID, or 0 if no process is running
-    declare property pid as uinteger
-    
-    '# exit_code is the value set by the process prior exiting.
-    declare property exit_code as uinteger
-    
-    '# methods
-    declare function redirect(byval as ProcessStdEnum, byref as string) as boolean
-    declare function start() as boolean
-    declare function terminate(byval as boolean = false) as boolean
-    
-    private:
-        _filename as string
-        _arguments as string
-        _pid as uinteger
-        _process_info as PROCESS_INFORMATION
-        _show_console as boolean = false
-        
-        _redirect_stdout as boolean
-        _stdout_filename as string
-        
-        _redirect_stderr as boolean
-        _stderr_filename as string
-        
-        '# this fake console handler
-        '# is used to trap ctrl-c
-        declare static function _console_handler(byval as DWORD) as BOOL
-        
-end type 'ConsoleProcess
-
-#endif '__CONSOLE_PROCESS_BI__
diff --git a/projects/mongrel_service/native/mongrel_service.bas b/projects/mongrel_service/native/mongrel_service.bas
deleted file mode 100644
index 49caa1b..0000000
--- a/projects/mongrel_service/native/mongrel_service.bas
+++ /dev/null
@@ -1,179 +0,0 @@
-'##################################################################
-'#
-'# mongrel_service: Win32 native implementation for mongrel
-'#                  (using ServiceFB and FreeBASIC)
-'#
-'# Copyright (c) 2006 Multimedia systems
-'# (c) and code by Luis Lavena
-'#
-'#  mongrel_service (native) and mongrel_service gem_pluing are licensed
-'#  in the same terms as mongrel, please review the mongrel license at
-'#  http://mongrel.rubyforge.org/license.html
-'#  
-'##################################################################
-
-'##################################################################
-'# Requirements:
-'# - FreeBASIC 0.18
-'#
-'##################################################################
-
-#include once "mongrel_service.bi"
-#define DEBUG_LOG_FILE EXEPATH + "\mongrel_service.log"
-#include once "_debug.bi"
-
-namespace mongrel_service
-    constructor SingleMongrel()
-        dim redirect_file as string
-        
-        with this.__service
-            .name = "single"
-            .description = "Mongrel Single Process service"
-            
-            '# disabling shared process
-            .shared_process = FALSE
-            
-            '# TODO: fix inheritance here
-            .onInit = @single_onInit
-            .onStart = @single_onStart
-            .onStop = @single_onStop
-        end with
-        
-        with this.__console
-            redirect_file = EXEPATH + "\mongrel.log"
-            debug("redirecting to: " + redirect_file)
-            .redirect(ProcessStdBoth, redirect_file)
-        end with
-        
-        '# TODO: fix inheritance here
-        single_mongrel_ref = @this
-    end constructor
-    
-    destructor SingleMongrel()
-        '# TODO: fin inheritance here
-    end destructor
-    
-    function single_onInit(byref self as ServiceProcess) as integer
-        dim result as integer
-        dim mongrel_cmd as string
-        
-        debug("single_onInit()")
-        
-        '# ruby.exe must be in the path, which we guess is already there.
-        '# because mongrel_service executable (.exe) is located in the same
-        '# folder than mongrel_rails ruby script, we complete the path with
-        '# EXEPATH + "\mongrel_rails" to make it work.
-        '# FIXED ruby installation outside PATH and inside folders with spaces
-        mongrel_cmd = !"\"" + EXEPATH + !"\\ruby.exe" + !"\" " + !"\"" + EXEPATH + !"\\mongrel_rails" + !"\"" + " start"
-        
-        '# due lack of inheritance, we use single_mongrel_ref as pointer to
-        '# SingleMongrel instance. now we should call StillAlive
-        self.StillAlive()
-        if (len(self.commandline) > 0) then
-            '# assign the program
-            single_mongrel_ref->__console.filename = mongrel_cmd
-            single_mongrel_ref->__console.arguments = self.commandline
-            
-            '# fix commandline, it currently contains params to be passed to
-            '# mongrel_rails, and not ruby.exe nor the script to be run.
-            self.commandline = mongrel_cmd + " " + self.commandline
-            
-            '# now launch the child process
-            debug("starting child process with cmdline: " + self.commandline)
-            single_mongrel_ref->__child_pid = 0
-            if (single_mongrel_ref->__console.start() = true) then
-                single_mongrel_ref->__child_pid = single_mongrel_ref->__console.pid
-            end if
-            self.StillAlive()
-            
-            '# check if pid is valid
-            if (single_mongrel_ref->__child_pid > 0) then
-                '# it worked
-                debug("child process pid: " + str(single_mongrel_ref->__child_pid))
-                result = not FALSE
-            end if
-        else
-            '# if no param, no service!
-            debug("no parameters was passed to this service!")
-            result = FALSE
-        end if
-        
-        debug("single_onInit() done")
-        return result
-    end function
-    
-    sub single_onStart(byref self as ServiceProcess)
-        debug("single_onStart()")
-        
-        do while (self.state = Running) or (self.state = Paused)
-            '# instead of sitting idle here, we must monitor the pid
-            '# and re-spawn a new process if needed
-            if not (single_mongrel_ref->__console.running = true) then
-                '# check if we aren't terminating
-                if (self.state = Running) or (self.state = Paused) then
-                    debug("child process terminated!, re-spawning a new one")
-                    
-                    single_mongrel_ref->__child_pid = 0
-                    if (single_mongrel_ref->__console.start() = true) then
-                        single_mongrel_ref->__child_pid = single_mongrel_ref->__console.pid
-                    end if
-                    
-                    if (single_mongrel_ref->__child_pid > 0) then
-                        debug("new child process pid: " + str(single_mongrel_ref->__child_pid))
-                    end if
-                end if
-            end if
-            
-            '# wait for 5 seconds
-            sleep 5000
-        loop
-        
-        debug("single_onStart() done")
-    end sub
-    
-    sub single_onStop(byref self as ServiceProcess)
-        debug("single_onStop()")
-        
-        '# now terminates the child process
-        if not (single_mongrel_ref->__child_pid = 0) then
-            debug("trying to kill pid: " + str(single_mongrel_ref->__child_pid))
-            if not (single_mongrel_ref->__console.terminate() = true) then
-                debug("Terminate() reported a problem when terminating process " + str(single_mongrel_ref->__child_pid))
-            else
-                debug("child process terminated with success.")
-                single_mongrel_ref->__child_pid = 0
-            end if
-        end if
-        
-        debug("single_onStop() done")
-    end sub
-    
-    sub application()
-        dim simple as SingleMongrel
-        dim host as ServiceHost
-        dim ctrl as ServiceController = ServiceController("Mongrel Win32 Service", "version " + VERSION, _
-                                                            "(c) 2006 The Mongrel development team.")
-        
-        '# add SingleMongrel (service)
-        host.Add(simple.__service)
-        select case ctrl.RunMode()
-            '# call from Service Control Manager (SCM)
-            case RunAsService:
-                debug("ServiceHost RunAsService")
-                host.Run()
-                
-            '# call from console, useful for debug purposes.
-            case RunAsConsole:
-                debug("ServiceController Console")
-                ctrl.Console()
-                
-            case else:
-                ctrl.Banner()
-                print "mongrel_service is not designed to run form commandline,"
-                print "please use mongrel_rails service:: commands to create a win32 service."
-        end select
-    end sub
-end namespace
-
-'# MAIN: start native mongrel_service here
-mongrel_service.application()
diff --git a/projects/mongrel_service/native/mongrel_service.bi b/projects/mongrel_service/native/mongrel_service.bi
deleted file mode 100644
index d5ea0dc..0000000
--- a/projects/mongrel_service/native/mongrel_service.bi
+++ /dev/null
@@ -1,61 +0,0 @@
-'##################################################################
-'#
-'# mongrel_service: Win32 native implementation for mongrel
-'#                  (using ServiceFB and FreeBASIC)
-'#
-'# Copyright (c) 2006 Multimedia systems
-'# (c) and code by Luis Lavena
-'#
-'#  mongrel_service (native) and mongrel_service gem_pluing are licensed
-'#  in the same terms as mongrel, please review the mongrel license at
-'#  http://mongrel.rubyforge.org/license.html
-'#  
-'##################################################################
-
-'##################################################################
-'# Requirements:
-'# - FreeBASIC 0.18.
-'#
-'##################################################################
-
-#define SERVICEFB_INCLUDE_UTILS
-#include once "lib/ServiceFB/ServiceFB.bi"
-#include once "console_process.bi"
-
-'# use for debug versions
-#if not defined(GEM_VERSION)
-  #define GEM_VERSION (debug mode)
-#endif
-
-'# preprocessor stringize
-#define PPSTR(x) #x
-
-namespace mongrel_service
-    const VERSION as string = PPSTR(GEM_VERSION)
-    
-    '# namespace include
-    using fb.svc
-    using fb.svc.utils
-    
-    declare function single_onInit(byref as ServiceProcess) as integer
-    declare sub single_onStart(byref as ServiceProcess)
-    declare sub single_onStop(byref as ServiceProcess)
-    
-    '# SingleMongrel
-    type SingleMongrel
-        declare constructor()
-        declare destructor()
-        
-        '# TODO: replace for inheritance here
-        'declare function onInit() as integer
-        'declare sub onStart()
-        'declare sub onStop()
-        
-        __service       as ServiceProcess
-        __console       as ConsoleProcess
-        __child_pid     as uinteger
-    end type
-    
-    '# TODO: replace with inheritance here
-    dim shared single_mongrel_ref as SingleMongrel ptr
-end namespace
diff --git a/projects/mongrel_service/resources/defaults.yaml b/projects/mongrel_service/resources/defaults.yaml
deleted file mode 100644
index 4a05eb1..0000000
--- a/projects/mongrel_service/resources/defaults.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-:debug: false
diff --git a/projects/mongrel_service/tests/all_tests.bas b/projects/mongrel_service/tests/all_tests.bas
deleted file mode 100644
index 0a8864f..0000000
--- a/projects/mongrel_service/tests/all_tests.bas
+++ /dev/null
@@ -1,18 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#include once "testly.bi"
-
-'# the code in this module runs after all
-'# the other modules have "registered" their suites.
-
-'# evaluate the result from run_tests() to
-'# return a error to the OS or not.
-if (run_tests() = false) then
-    end 1
-end if
-
diff --git a/projects/mongrel_service/tests/fixtures/mock_process.bas b/projects/mongrel_service/tests/fixtures/mock_process.bas
deleted file mode 100644
index e9405ab..0000000
--- a/projects/mongrel_service/tests/fixtures/mock_process.bas
+++ /dev/null
@@ -1,92 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-'# this program mock a common process that will:
-'# output some text to stdout
-'# output some error messages to stderr
-'# will wait until Ctrl-C is hit (only if commandline contains "wait")
-'# or drop an error if commandline contains "error"
-
-#include once "crt.bi"
-#include once "windows.bi"
-
-dim shared as any ptr control_signal, control_mutex
-dim shared flagged as byte
-dim shared result as integer
-
-function slow_console_handler(byval dwCtrlType as DWORD) as BOOL
-    dim result as BOOL
-    
-    if (dwCtrlType = CTRL_C_EVENT) then
-        fprintf(stdout, !"out: CTRL-C received\r\n")
-        mutexlock(control_mutex)
-        result = 1
-        flagged = 1
-        condsignal(control_signal)
-        mutexunlock(control_mutex)
-    elseif (dwCtrlType = CTRL_BREAK_EVENT) then
-        fprintf(stdout, !"out: CTRL-BREAK received\r\n")
-        mutexlock(control_mutex)
-        result = 1
-        flagged = 2
-        condsignal(control_signal)
-        mutexunlock(control_mutex)
-    end if
-    
-    return result
-end function
-
-sub wait_for(byval flag_level as integer)
-    flagged = 0
-    '# set handler
-    if (SetConsoleCtrlHandler(@slow_console_handler, 1) = 0) then
-        fprintf(stderr, !"err: cannot set console handler\r\n")
-    end if
-    fprintf(stdout, !"out: waiting for keyboard signal\r\n")
-    mutexlock(control_mutex)
-    do until (flagged = flag_level)
-        condwait(control_signal, control_mutex)
-    loop
-    mutexunlock(control_mutex)
-    fprintf(stdout, !"out: got keyboard signal\r\n")
-    if (SetConsoleCtrlHandler(@slow_console_handler, 0) = 0) then
-        fprintf(stderr, !"err: cannot unset console handler\r\n")
-    end if
-end sub
-
-function main() as integer
-    fprintf(stdout, !"out: message\r\n")
-    fprintf(stderr, !"err: error\r\n")
-    
-    select case lcase(command(1))
-        case "wait":
-            sleep
-            return 0
-
-        case "error":
-            '# terminate with error code
-            return 1
-        
-        case "slow1":
-            wait_for(1)
-            return 10
-        
-        case "slow2":
-            wait_for(2)
-            return 20
-    end select
-end function
-
-control_signal = condcreate()
-control_mutex = mutexcreate()
-
-result = main()
-
-conddestroy(control_signal)
-mutexdestroy(control_mutex)
-
-end result
diff --git a/projects/mongrel_service/tests/test_console_process.bas b/projects/mongrel_service/tests/test_console_process.bas
deleted file mode 100644
index d41c0fb..0000000
--- a/projects/mongrel_service/tests/test_console_process.bas
+++ /dev/null
@@ -1,402 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#include once "console_process.bi"
-#include once "file.bi"
-#include once "testly.bi"
-#include once "test_helpers.bi"
-
-namespace Suite_Test_Console_Process
-    '# test helpers
-    declare function process_cleanup() as boolean
-    
-    dim shared child as ConsoleProcess ptr
-    
-    sub before_all()
-        kill("out.log")
-        kill("err.log")
-        kill("both.log")
-        kill("both_slow.log")
-        kill("both_forced.log")
-    end sub
-    
-    sub after_each()
-        process_cleanup()
-    end sub
-    
-    sub test_process_create()
-        child = new ConsoleProcess()
-        assert_not_equal(0, child)
-        assert_equal("", child->filename)
-        assert_equal("", child->arguments)
-        assert_false(child->running)
-        delete child
-    end sub
-    
-    sub test_process_create_args()
-        child = new ConsoleProcess("mock_process.exe", "some params")
-        assert_equal("mock_process.exe", child->filename)
-        assert_equal("some params", child->arguments)
-        delete child
-    end sub
-    
-    sub test_properly_quoted_filename()
-        child = new ConsoleProcess("C:\path with spaces\my_executable.exe", "some params")
-        assert_not_equal(0, instr(child->filename, !"\""))
-        delete child
-    end sub
-    
-    sub test_failed_unexistant_process()
-        child = new ConsoleProcess("no_valid_file.exe", "some params")
-        assert_false(child->start())
-        assert_equal(0, child->pid)
-        assert_false(child->running)
-        delete child
-    end sub
-    
-    sub test_process_spawn_exit_code()
-        child = new ConsoleProcess("mock_process.exe", "error")
-        
-        '# start() should return true since it started, no matter if was terminated
-        '# improperly
-        assert_true(child->start())
-        sleep 500
-        
-        '# should not be running, but pid should be != than 0
-        assert_not_equal(0, child->pid)
-        
-        '# we need to wait a bit prior asking for state
-        '# the process could be still running
-        assert_false(child->running)
-        
-        '# get exit code, should be 1
-        assert_equal(1, child->exit_code)
-        
-        delete child
-    end sub
-    
-    sub test_redirected_output()
-        assert_false(fileexists("out.log"))
-        assert_false(fileexists("err.log"))
-        
-        '# redirected output is used with logging files.
-        child = new ConsoleProcess("mock_process.exe")
-        
-        '# redirect stdout
-        assert_true(child->redirect(ProcessStdOut, "out.log"))
-        assert_string_equal("out.log", child->redirected_stdout)
-        
-        '# redirect stderr
-        assert_true(child->redirect(ProcessStdErr, "err.log"))
-        assert_string_equal("err.log", child->redirected_stderr)
-        
-        '# start() will be true since process terminated nicely
-        assert_true(child->start())
-        sleep 500
-        
-        '# running should be false
-        assert_false(child->running)
-        
-        '# exit_code should be 0
-        assert_equal(0, child->exit_code)
-        
-        delete child
-        
-        '# now out.log and err.log must exist and content must be valid.
-        assert_true(fileexists("out.log"))
-        assert_string_equal("out: message", content_of_file("out.log"))
-        
-        assert_true(fileexists("err.log"))
-        assert_string_equal("err: error", content_of_file("err.log"))
-        
-        assert_equal(0, kill("out.log"))
-        assert_equal(0, kill("err.log"))
-    end sub
-    
-    sub test_redirected_merged_output()
-        dim content as string
-        
-        '# redirected output is used with logging files.
-        child = new ConsoleProcess("mock_process.exe")
-
-        '# redirect both stdout and stderr
-        child->redirect(ProcessStdBoth, "both.log")
-        assert_equal("both.log", child->redirected_stdout)
-        assert_equal("both.log", child->redirected_stderr)
-        
-        '# start() will be true since process terminated nicely
-        assert_true(child->start())
-        sleep 500
-        
-        '# running should be false
-        assert_false(child->running)
-        
-        '# exit_code should be 0
-        assert_equal(0, child->exit_code)
-        
-        delete child
-        
-        '# file must exists
-        assert_true(fileexists("both.log"))
-        
-        '# contents must match
-        content = content_of_file("both.log")
-        
-        assert_not_equal(0, instr(content, "out: message"))
-        assert_not_equal(0, instr(content, "err: error"))
-        
-        assert_equal(0, kill("both.log"))
-    end sub
-    
-    sub test_redirected_output_append()
-        dim content as string
-        
-        child = new ConsoleProcess("mock_process.exe")
-        
-        '# redirect both stdout and stderr
-        child->redirect(ProcessStdBoth, "both.log")
-        
-        '# start() will be true since process terminated nicely
-        assert_true(child->start())
-        sleep 500
-        
-        content = content_of_file("both.log")
-        
-        '# start() again
-        assert_true(child->start())
-        sleep 500
-        
-        delete child
-        
-        assert_not_equal(len(content), len(content_of_file("both.log")))
-        
-        assert_equal(0, kill("both.log"))
-    end sub
-    
-    sub test_process_terminate()
-        dim content as string
-        
-        '# redirected output is used with logging files.
-        child = new ConsoleProcess("mock_process.exe", "wait")
-        child->redirect(ProcessStdBoth, "both.log")
-        
-        '# start
-        assert_true(child->start())
-        sleep 500
-        
-        '# validate if running
-        assert_true(child->running)
-        
-        '# validate PID
-        assert_not_equal(0, child->pid)
-        
-        '# now terminates it
-        assert_true(child->terminate())
-        sleep 500
-        
-        assert_equal(9, child->exit_code)
-        
-        '# it should be done
-        assert_false(child->running)
-        
-        delete child
-        
-        '# validate output
-        '# file must exists
-        assert_true(fileexists("both.log"))
-        
-        '# contents must match
-        content = content_of_file("both.log")
-        
-        assert_not_equal(0, instr(content, "out: message"))
-        assert_not_equal(0, instr(content, "err: error"))
-        assert_not_equal(0, instr(content, "interrupted"))
-        
-        assert_equal(0, kill("both.log"))
-    end sub
-    
-    sub test_process_terminate_slow1()
-        dim content as string
-        
-        '# redirected output is used with logging files.
-        child = new ConsoleProcess("mock_process.exe", "slow1")
-        child->redirect(ProcessStdBoth, "both_slow1.log")
-        
-        '# start
-        assert_true(child->start())
-        sleep 500
-        
-        '# validate if running
-        assert_true(child->running)
-        
-        '# validate PID
-        assert_not_equal(0, child->pid)
-        
-        '# now terminates it
-        assert_true(child->terminate())
-        sleep 500
-        
-        assert_equal(10, child->exit_code)
-        
-        '# it should be done
-        assert_false(child->running)
-        
-        delete child
-        
-        '# validate output
-        '# file must exists
-        assert_true(fileexists("both_slow1.log"))
-        
-        '# contents must match
-        content = content_of_file("both_slow1.log")
-        
-        assert_equal(0, instr(content, "interrupted"))
-        assert_not_equal(0, instr(content, "out: CTRL-C received"))
-        assert_equal(0, instr(content, "out: CTRL-BREAK received"))
-        
-        assert_equal(0, kill("both_slow1.log"))
-    end sub
-    
-    sub test_process_terminate_slow2()
-        dim content as string
-        
-        '# redirected output is used with logging files.
-        child = new ConsoleProcess("mock_process.exe", "slow2")
-        child->redirect(ProcessStdBoth, "both_slow2.log")
-        
-        '# start
-        assert_true(child->start())
-        sleep 500
-        
-        '# validate if running
-        assert_true(child->running)
-        
-        '# validate PID
-        assert_not_equal(0, child->pid)
-        
-        '# now terminates it
-        assert_true(child->terminate())
-        sleep 500
-        
-        assert_equal(20, child->exit_code)
-        
-        '# it should be done
-        assert_false(child->running)
-        
-        delete child
-        
-        '# validate output
-        '# file must exists
-        assert_true(fileexists("both_slow2.log"))
-        
-        '# contents must match
-        content = content_of_file("both_slow2.log")
-        
-        assert_equal(0, instr(content, "interrupted"))
-        assert_not_equal(0, instr(content, "out: CTRL-C received"))
-        assert_not_equal(0, instr(content, "out: CTRL-BREAK received"))
-        
-        '# cleanup
-        assert_equal(0, kill("both_slow2.log"))
-    end sub
-
-    sub test_process_terminate_forced()
-        dim content as string
-        
-        '# redirected output is used with logging files.
-        child = new ConsoleProcess("mock_process.exe", "wait")
-        child->redirect(ProcessStdBoth, "both_forced.log")
-        
-        '# start
-        assert_true(child->start())
-        sleep 500
-        
-        '# validate if running
-        assert_true(child->running)
-        
-        '# validate PID
-        assert_not_equal(0, child->pid)
-        
-        '# now terminates it
-        assert_true(child->terminate(true))
-        sleep 500
-        
-        '# it should be done
-        assert_false(child->running)
-        
-        '# look for termination code
-        assert_equal(0, child->exit_code)
-        
-        delete child
-        
-        '# validate output
-        '# file must exists
-        assert_true(fileexists("both_forced.log"))
-        
-        '# contents must match
-        content = content_of_file("both_forced.log")
-        
-        assert_equal(0, instr(content, "out: message"))
-        assert_equal(0, instr(content, "err: error"))
-        assert_equal(0, instr(content, "interrupted"))
-        
-        assert_equal(0, kill("both_forced.log"))
-    end sub
-    
-    sub test_reuse_object_instance()
-        dim first_pid as uinteger
-        
-        child = new ConsoleProcess("mock_process.exe")
-        
-        '# start
-        assert_true(child->start())
-        sleep 500
-        
-        '# validate not running
-        assert_false(child->running)
-        
-        '# validate PID
-        assert_not_equal(0, child->pid)
-        
-        '# saves PID
-        first_pid = child->pid
-        
-        '# start it again
-        assert_true(child->start())
-        sleep 500
-        
-        '# it should have stopped by now
-        assert_false(child->running)
-        assert_not_equal(0, child->pid)
-        assert_not_equal(first_pid, child->pid)
-        
-        delete child
-    end sub
-    
-    private sub register() constructor
-        add_suite(Suite_Test_Console_Process)
-        add_test(test_process_create)
-        add_test(test_process_create_args)
-        add_test(test_properly_quoted_filename)
-        add_test(test_failed_unexistant_process)
-        add_test(test_process_spawn_exit_code)
-        add_test(test_redirected_output)
-        add_test(test_redirected_merged_output)
-        add_test(test_redirected_output_append)
-        add_test(test_process_terminate)
-        add_test(test_process_terminate_slow1)
-        add_test(test_process_terminate_slow2)
-        add_test(test_process_terminate_forced)
-        add_test(test_reuse_object_instance)
-    end sub
-    
-    '# test helpers below this point
-    private function process_cleanup() as boolean
-        shell "taskkill /f /im mock_process.exe 1>NUL 2>&1"
-        return true
-    end function
-end namespace
diff --git a/projects/mongrel_service/tests/test_helpers.bas b/projects/mongrel_service/tests/test_helpers.bas
deleted file mode 100644
index c4647c0..0000000
--- a/projects/mongrel_service/tests/test_helpers.bas
+++ /dev/null
@@ -1,35 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-#include once "testly.bi"
-#include once "test_helpers.bi"
-#include once "file.bi"
-
-'# Global Helpers
-function content_of_file(byref filename as string) as string
-    dim result as string
-    dim handle as integer
-    dim buffer as string
-    
-    result = ""
-    buffer = ""
-    
-    if (fileexists(filename) = true) then
-        handle = freefile
-        open filename for input as #handle
-        do while not (eof(handle))
-            input #handle, buffer
-            result += buffer
-            buffer = ""
-        loop
-        close #handle
-    else
-        result = ""
-    end if
-    
-    return result
-end function
diff --git a/projects/mongrel_service/tests/test_helpers.bi b/projects/mongrel_service/tests/test_helpers.bi
deleted file mode 100644
index 9397962..0000000
--- a/projects/mongrel_service/tests/test_helpers.bi
+++ /dev/null
@@ -1,8 +0,0 @@
-'#--
-'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
-'#
-'# This source code is released under the MIT License.
-'# See MIT-LICENSE file for details
-'#++
-
-declare function content_of_file(byref as string) as string \ No newline at end of file
diff --git a/projects/mongrel_service/tools/freebasic.rb b/projects/mongrel_service/tools/freebasic.rb
deleted file mode 100644
index 0b3e445..0000000
--- a/projects/mongrel_service/tools/freebasic.rb
+++ /dev/null
@@ -1,361 +0,0 @@
-#--
-# FreeBASIC project builder
-# inspired by Asset Compiler by Jeremy Voorhis
-# coded by Luis Lavena
-#--
-
-# FreeBASIC Project library for compilation.
-# For example:
-#
-# namespace :projects do
-#   project_task :my_fb_project do
-#     lib         'static'
-#     dylib       'dynamic library'
-#     executable  'exename'
-#    
-#     build_to    'bin'
-#    
-#     define      'MY_DEFINE'
-#    
-#     main        'src/main.bas'
-#     source      'src/other_module.bas'
-#     source      "src/*.bas"
-#   end
-# end
-#
-# This example defines the following tasks:
-#
-#   rake projects:build                 # Build all projects
-#   rake projects:clobber               # Clobber all projects
-#   rake projects:my_fb_project:build   # Build the my_fb_project files
-#   rake projects:my_fb_project:clobber # Remove the my_fb_project files
-#   rake projects:my_fb_project:rebuild # Force a rebuild of the my_fb_project files
-#   rake projects:rebuild               # Rebuild all projects
-
-require 'rake/tasklib'
-require 'pp'
-
-module FreeBASIC
-  # this help me reduce the attempts to remove already removed files.
-  # works with src_files
-  CLOBBER = Rake::FileList.new
-  ON_WINDOWS = (RUBY_PLATFORM =~ /mswin|cygwin|bccwin/)
-  
-  class ProjectTask
-    attr_accessor :name
-    attr_accessor :output_name
-    attr_accessor :type
-    attr_accessor :build_path
-    attr_accessor :defines
-    attr_accessor :main_file
-    attr_accessor :sources
-    attr_accessor :libraries
-    attr_accessor :search_path
-    attr_accessor :libraries_path
-    
-    def initialize(name, &block)
-      @name = name.to_s
-      @build_path = '.'
-      @defines = []
-      @sources = Rake::FileList.new
-      @libraries = []
-      @search_path = []
-      @libraries_path = []
-      @options = {}
-      
-      instance_eval(&block) if block_given?
-      
-      do_cleanup
-      
-      namespace @name do
-        define_clobber_task
-        define_rebuild_task
-        define_build_directory_task
-        define_build_task
-      end
-      add_dependencies_to_main_task
-    end
-    
-    public
-      # using this will set your project type to :executable
-      # and assign exe_name as the output_name for the project
-      # it dynamically will assign extension when running on windows
-      def executable(exe_name)
-        @type = :executable
-        @output_name = "#{exe_name}.#{(ON_WINDOWS ? "exe" : "")}"
-        @real_file_name = @output_name
-      end
-      
-      # lib will set type to :lib and assign 'lib#{lib_name}.a'
-      # as output_name for the project
-      def lib(lib_name)
-        @type = :lib
-        @output_name = "#{lib_name}"
-        @real_file_name = "lib#{lib_name}.a"
-      end
-      
-      # dynlib will set type to :dynlib and assign '#{dll_name}.dll|so'
-      # as output_name for this project
-      def dylib(dll_name)
-        @type = :dylib
-        @output_name = "#{dll_name}.#{(ON_WINDOWS ? "dll" : "so")}"
-        @real_file_name = @output_name
-        @complement_file = "lib#{@output_name}.a"
-      end
-      
-      # this set where the final, compiled executable should be linked
-      # uses @build_path as variable
-      def build_to(path)
-        @build_path = path
-      end
-      
-      # define allow you set compiler time options
-      # collect them into @defines and use later
-      # to call source file compilation process (it wil require cleanup)
-      def define(*defines)
-        @defines << defines
-      end
-      
-      # main set @main_file to be the main module used during the linking
-      # process. also, this module requires special -m flag during his
-      # own compile process
-      # question: in case @no main_file was set, will use the first 'source'
-      # file defined as main? or it should raise a error?
-      def main(main_file)
-        @main_file = main_file
-      end
-      
-      # used to collect sources files for compilation
-      # it will take .bas, .rc, .res as sources
-      # before compilation we should clean @sources!
-      def source(*sources)
-        @sources.include sources
-      end
-    
-      # this is similar to sources, instead library linking is used
-      # also will require cleanup services ;-)
-      def library(*libraries)
-        @libraries << libraries
-      end
-  
-      # use this to set the include path when looking for, ehem, includes
-      # (equals -i fbc compiler param)
-      def search_path(*search_path)
-        @search_path << search_path
-      end
-      
-      # use this to tell the compiler where to look for libraries
-      # (equals -p fbc compiler param)
-      def lib_path(*libraries_path)
-        @libraries_path << libraries_path
-      end
-      
-      # use this to add additional compiler parameters (like debug or errorchecking options)
-      #
-      def option(new_options = {})
-        @options.merge!(new_options)
-      end
-      
-    protected
-      # this method will fix nested libraries and defines
-      # also, if main_file is missing (or wasn't set) will shift the first one
-      # as main
-      def do_cleanup
-        # remove duplicated definitions, flatten
-        @defines.flatten!
-        @defines.uniq! if @defines.length > 1
-
-        # set main_file
-        if @type == :executable
-          @main_file = @sources.shift unless defined?(@main_file)
-        end
-        
-        # empty path? must be corrected
-        @build_path = '.' if @build_path == ''
-        
-        # remove duplicates from sources
-        @sources.uniq! if @sources.length > 1
-        
-        # now the libraries
-        @libraries.flatten!
-        @libraries.uniq! if @libraries.length > 1
-        
-        # search path
-        @search_path.flatten!
-        @search_path.uniq! if @search_path.length > 1
-        
-        # libraries path
-        @libraries_path.flatten!
-        @libraries_path.uniq! if @libraries_path.length > 1
-        
-        # if no target was set, default to executable
-        unless defined?(@output_name)
-          executable(@name)
-        end
-      end
-      
-      # return the compiled name version of the passed source file (src)
-      # compiled_form("test.bas") => "test.o"
-      def compiled_form(src)
-        unless src.nil?
-          src.ext({ ".bas" => "o", ".rc" => "obj" }[File.extname(src)])
-        end
-      end
-      
-      def compiled_project_file
-        File.join @build_path, @real_file_name
-      end
-      
-      def fbc_compile(source, target, main = nil)
-        cmdline = []
-        cmdline << "fbc"
-        cmdline << "-w pedantic" if (@options.has_key?(:pedantic) && @options[:pedantic] == true)
-        cmdline << "-g" if (@options.has_key?(:debug) && @options[:debug] == true)
-        cmdline << "-#{@options[:errorchecking].to_s}" if @options.has_key?(:errorchecking)
-        cmdline << "-mt" if (@options.has_key?(:mt) && @options[:mt] == true)
-        cmdline << "-profile" if (@options.has_key?(:profile) && @options[:profile] == true)
-        cmdline << "-c #{source}"
-        cmdline << "-o #{target}"
-        cmdline << "-m #{main}" unless main.nil?
-        cmdline << @defines.collect { |defname| "-d #{defname}" }
-        cmdline << @search_path.collect { |path| "-i #{path}" }
-        cmdline.flatten.join(' ')
-      end
-      
-      def fbc_link(target, files, extra_files = [])
-        cmdline = []
-        cmdline << "fbc"
-        cmdline << "-g" if (@options.has_key?(:debug) && @options[:debug] == true)
-        cmdline << "-mt" if (@options.has_key?(:mt) && @options[:mt] == true)
-        cmdline << "-profile" if (@options.has_key?(:profile) && @options[:profile] == true)
-        cmdline << "-#{@type.to_s}" unless @type == :executable
-        cmdline << "-x #{target}"
-        cmdline << files << extra_files
-        cmdline << @defines.collect { |defname| "-d #{defname}" }
-        unless @type == :lib
-          cmdline << @libraries_path.collect { |path| "-p #{path}" }
-          cmdline << @libraries.collect { |libname| "-l #{libname}" }
-        end
-        cmdline.flatten.join(' ')
-      end
-      
-      def define_clobber_task
-        desc "Remove all compiled files for #{@name}"
-        task :clobber do
-          # remove compiled and linked file
-          rm compiled_project_file rescue nil if File.exist?(compiled_project_file)
-          if @type == :dylib
-            rm File.join(@build_path, @complement_file) rescue nil if File.exist?(File.join(@build_path, @complement_file))
-          end
-          
-          # remove main file
-          unless @main_file.nil? || !File.exists?(compiled_form(@main_file))
-            rm compiled_form(@main_file) rescue nil
-          end
-          
-          # now the sources files
-          # avoid attempt to remove the file two times (this is a bug in Rake)
-          @sources.each do |src|
-            # exclude compiled source files (c obj).
-            unless src =~ /o$/
-              target = compiled_form(src)
-              unless CLOBBER.include?(target)
-                CLOBBER.include(target)
-                rm target rescue nil if File.exist?(target)
-              end
-            end
-          end
-        end
-      end
-      
-      def define_rebuild_task
-        desc "Force a rebuild of files for #{@name}"
-        task :rebuild => [:clobber, :build]
-      end
-      
-      def define_build_directory_task
-        directory @build_path
-        task :build => @build_path
-      end
-      
-      def define_build_task
-        desc "Build project #{@name}"
-        task :build
-        
-        # empty file task
-        file compiled_project_file
-        
-        # compile main_file
-        # use as pre-requisite the source filename
-        if @type == :executable
-          file compiled_form(@main_file) => @main_file do |t|
-            # remove the path and the extension
-            main_module = File.basename(t.name).ext
-            sh fbc_compile(@main_file, t.name, main_module)
-          end
-        
-          # add dependency
-          file compiled_project_file => compiled_form(@main_file)
-        end
-        
-        # gather files that are passed "as-is" to the compiler
-        unprocessed_files = @sources.select { |rcfile| rcfile =~ /(res|rc|o|obj)$/ }
-        
-        @sources.each do |src|
-          # is a unprocessed file?
-          unless unprocessed_files.include?(src)
-            target = compiled_form(src)
-            
-            # is already in our list of tasks?
-            if not Rake::Task.task_defined?(target)
-              # if not, compile
-              
-              file target => src do
-                sh fbc_compile(src, target)
-              end
-            end
-          
-            # include dependency
-            file compiled_project_file => target
-          end
-        end
-        
-        # now the linking process
-        file compiled_project_file do |t|
-          target = File.join(@build_path, @output_name)
-          sh fbc_link(target, t.prerequisites, unprocessed_files)
-        end
-        
-        # add the dependency
-        task :build => compiled_project_file
-      end
-
-      # Adds dependencies in the parent namespace
-      def add_dependencies_to_main_task
-        desc 'Build all projects' unless task( :build ).comment
-        task :build => "#{@name}:build"
-        
-        desc 'Clobber all projects' unless task( :clobber ).comment
-        task :clobber => "#{@name}:clobber"
-        
-        desc 'Rebuild all projects' unless task( :rebuild ).comment
-        task :rebuild => ["#{@name}:clobber", "#{@name}:build"]
-      end
-  end
-end
-  
-# helper method to define a FreeBASIC::ProjectTask in the current namespace
-def project_task name, &block
-  FreeBASIC::ProjectTask.new name, &block
-end
-
-def include_projects_of name
-  desc 'Build all projects' unless task( :build ).comment
-  task :build => "#{name}:build"
-  
-  desc 'Clobber all projects' unless task( :clobber ).comment
-  task :clobber => "#{name}:clobber"
-  
-  desc 'Rebuild all projects' unless task( :rebuild ).comment
-  task :rebuild => "#{name}:rebuild"
-end