diff options
-rw-r--r-- | projects/mongrel_service/CHANGELOG | 17 | ||||
-rw-r--r-- | projects/mongrel_service/Rakefile | 10 | ||||
-rw-r--r-- | projects/mongrel_service/native/console_process.bi | 75 | ||||
-rw-r--r-- | projects/mongrel_service/native/console_process.o | bin | 0 -> 6137 bytes |
4 files changed, 81 insertions, 21 deletions
diff --git a/projects/mongrel_service/CHANGELOG b/projects/mongrel_service/CHANGELOG index 67f0697..e69de29 100644 --- a/projects/mongrel_service/CHANGELOG +++ b/projects/mongrel_service/CHANGELOG @@ -1,17 +0,0 @@ - -v0.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. - Replaced Spawn/Terminate functions with experimental ConsoleProcess Class. - -v0.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). - -v0.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. diff --git a/projects/mongrel_service/Rakefile b/projects/mongrel_service/Rakefile index 015fe47..4502a8f 100644 --- a/projects/mongrel_service/Rakefile +++ b/projects/mongrel_service/Rakefile @@ -1,6 +1,10 @@ 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", "0.3.3") do |p|
p.summary = "Mongrel Native Win32 Service Plugin for Rails"
p.summary += " (debug build)" unless ENV['RELEASE']
@@ -11,16 +15,14 @@ echoe_spec = Echoe.new("mongrel_service", "0.3.3") do |p| p.need_tar_gz = false
p.need_zip = true
- p.certificate_chain = ['~/gem_certificates/mongrel-public_cert.pem',
- '~/gem_certificates/luislavena-mongrel-public_cert.pem']
+ p.certificate_chain = ['D:/Users/Developer/gem_certificates/mongrel-public_cert.pem',
+ 'D:/Users/Developer/gem_certificates/luislavena-mongrel-public_cert.pem']
p.require_signed = true
end
desc "Compile native code"
task :compile => [:native_lib, :native_service]
-#task :"bin/mongrel_service.exe" => [:clean, :compile]
-
# global options shared by all the project in this Rakefile
OPTIONS = {
:debug => false,
diff --git a/projects/mongrel_service/native/console_process.bi b/projects/mongrel_service/native/console_process.bi new file mode 100644 index 0000000..3ad49ad --- /dev/null +++ b/projects/mongrel_service/native/console_process.bi @@ -0,0 +1,75 @@ +'#--
+'# 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/console_process.o b/projects/mongrel_service/native/console_process.o Binary files differnew file mode 100644 index 0000000..8ef9552 --- /dev/null +++ b/projects/mongrel_service/native/console_process.o |