Changeset 377
- Timestamp:
- 11/13/06 11:59:27 (2 years ago)
- Files:
-
- branches/win32-native_service/projects/mongrel_service/Rakefile (modified) (4 diffs)
- branches/win32-native_service/projects/mongrel_service/lib (modified) (1 prop)
- branches/win32-native_service/projects/mongrel_service/native/mongrel_service.bas (modified) (2 diffs)
- branches/win32-native_service/projects/mongrel_service/native/mongrel_service.bi (modified) (3 diffs)
- branches/win32-native_service/projects/mongrel_service/native/process.bas (added)
- branches/win32-native_service/projects/mongrel_service/native/process.bi (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/win32-native_service/projects/mongrel_service/Rakefile
r374 r377 15 15 16 16 desc "Does a full compile, test run" 17 task :default => [:test, : package]17 task :default => [:test, :compile, :package] 18 18 19 19 version="0.3.0" … … 44 44 end 45 45 46 # too hackish, but get the job done, compile the ugly c code. 47 task :compile_c do 48 sh %{cl /nologo /c native\\send_signal.cpp /Fonative\\send_signal.obj} 49 sh %{lib /nologo native\\send_signal.obj /out:lib\\libsend_signal.a} 50 end 51 task :compile => :compile_c 52 46 53 # ServiceFB namespace (lib) 47 54 namespace :lib do 48 55 project_task 'servicefb' do 49 lib 'ServiceFB'50 build_to 'lib'56 lib 'ServiceFB' 57 build_to 'lib' 51 58 52 source 'lib/ServiceFB/ServiceFB.bas' 59 define 'SERVICEFB_DEBUG_LOG' if ENV['DEBUG_LIB'] 60 source 'lib/ServiceFB/ServiceFB.bas' 53 61 end 54 62 … … 56 64 lib 'ServiceFB_Utils' 57 65 build_to 'lib' 58 66 67 define 'SERVICEFB_DEBUG_LOG' if ENV['DEBUG_LIB'] 59 68 source 'lib/ServiceFB/ServiceFB_Utils.bas' 60 69 end 61 70 end 62 #add lib namespace to global tasks 63 include_projects_of :lib 71 # add lib namespace to global tasks 72 #include_projects_of :lib 73 task :compile => "lib:build" 64 74 65 75 # mongrel_service (native) … … 70 80 71 81 main 'native/mongrel_service.bas' 82 source 'native/process.bas' 72 83 73 84 # including the precompiled file show warnings when linking with 74 85 # ld, due special m$ directives in the obj file 75 86 # will solve that later, when migrate the asm part of code to gcc 76 source 'native/send_signal.o'87 # source 'native/send_signal.o' 77 88 78 89 lib_path 'lib' 79 90 library 'ServiceFB', 'ServiceFB_Utils' 80 library 'user32', 'advapi32', 'psapi' 91 library 'send_signal' 92 library 'user32', 'advapi32', 'psapi' 81 93 end 82 94 end 83 include_projects_of :native 95 #include_projects_of :native 96 task :compile => "native:build" branches/win32-native_service/projects/mongrel_service/lib
- Property svn:externals changed from
ServiceFB http://opensvn.csie.org/servicefb/tags/release_0-2/lib/ServiceFB
to
ServiceFB http://opensvn.csie.org/servicefb/trunk/lib/ServiceFB
- Property svn:externals changed from
branches/win32-native_service/projects/mongrel_service/native/mongrel_service.bas
r374 r377 24 24 '# in a pre-compiled form (also included the modified source code). 25 25 '# The C code is ugly as hell, but get the job done. 26 '# 27 '# Compile instructions: 28 '# cl /c native\send_signal.cpp /Fonative\send_signal.obj 29 '# lib native\send_signal.obj /out:lib\libsend_signal.a 26 30 '# 27 31 '################################################################## … … 30 34 31 35 namespace mongrel_service 36 sub debug(byref message as string) 37 dim handle as integer 38 39 handle = freefile 40 open EXEPATH + "\service.log" for append as #handle 41 42 print #handle, message 43 44 close #handle 45 end sub 46 32 47 constructor SingleMongrel() 48 with this.__service 49 .name = "single" 50 .description = "Mongrel Single Process service" 51 52 '# TODO: fix inheritance here 53 .onInit = @single_onInit 54 .onStart = @single_onStart 55 .onStop = @single_onStop 56 end with 57 58 '# TODO: fix inheritance here 59 single_mongrel = @this 33 60 end constructor 34 61 35 62 destructor SingleMongrel() 63 '# TODO: fin inheritance here 36 64 end destructor 37 65 38 function SingleMongrel.onInit(byref self as ServiceProcess) as integer66 function single_onInit(byref self as ServiceProcess) as integer 39 67 dim result as integer 68 debug("single_onInit()") 40 69 70 debug("single_onInit() done") 41 71 return result 42 72 end function 43 73 44 sub SingleMongrel.onStart(byref self as ServiceProcess) 74 sub single_onStart(byref self as ServiceProcess) 75 debug("single_onStart()") 76 debug("single_onStart() done") 45 77 end sub 46 78 47 sub SingleMongrel.onStop(byref self as ServiceProcess) 79 sub single_onStop(byref self as ServiceProcess) 80 debug("single_onStop()") 81 debug("single_onStop() done") 82 end sub 83 84 sub application() 85 dim simple as SingleMongrel 86 dim host as ServiceHost 87 dim ctrl as ServiceController = ServiceController("Mongrel Win32 Service", "version 0.3.0", _ 88 "(c) 2006 The Mongrel development team.") 89 90 '# add SingleMongrel (service) 91 host.Add(simple.__service) 92 select case ctrl.RunMode() 93 '# call from Service Control Manager (SCM) 94 case RunAsService: 95 host.Run() 96 97 '# call from console, useful for debug purposes. 98 case RunAsConsole: 99 ctrl.Console() 100 101 case else: 102 ctrl.Banner() 103 print "mongrel_service is not designed to run form commandline," 104 print "please use mongrel_rails service:: commands to create a win32 service." 105 end select 48 106 end sub 49 107 end namespace 108 109 '# MAIN: start native mongrel_service here 110 mongrel_service.application() branches/win32-native_service/projects/mongrel_service/native/mongrel_service.bi
r374 r377 24 24 '# in a pre-compiled form (also included the modified source code). 25 25 '# The C code is ugly as hell, but get the job done. 26 '# 27 '# Compile instructions: 28 '# cl /c native\send_signal.cpp /Fonative\send_signal.obj 29 '# lib native\send_signal.obj /out:lib\libsend_signal.a 26 30 '# 27 31 '################################################################## … … 32 36 namespace mongrel_service 33 37 using fb.svc 38 using fb.svc.utils 39 40 declare function single_onInit(byref as ServiceProcess) as integer 41 declare sub single_onStart(byref as ServiceProcess) 42 declare sub single_onStop(byref as ServiceProcess) 34 43 35 44 '# SingleMongrel … … 38 47 declare destructor() 39 48 40 declare function onInit(byref self as ServiceProcess) as integer 41 declare sub onStart(byref self as ServiceProcess) 42 declare sub onStop(byref self as ServiceProcess) 49 '# TODO: replace for inheritance here 50 'declare function onInit() as integer 51 'declare sub onStart() 52 'declare sub onStop() 43 53 44 _ serviceas ServiceProcess45 _ child_pidas uinteger54 __service as ServiceProcess 55 __child_pid as uinteger 46 56 end type 57 58 '# TODO: replace with inheritance here 59 dim shared single_mongrel as SingleMongrel ptr 47 60 end namespace
