Class: Web::Install::IIS
Constant Summary collapse
- ADS_PROPERTY_CLEAR =
1
- ADS_PROPERTY_UPDATE =
2
- ADS_PROPERTY_APPEND =
3
- ADS_PROPERTY_DELETE =
4
Instance Attribute Summary collapse
-
#install_dir ⇒ Object
Returns the value of attribute install_dir.
Class Method Summary collapse
Instance Method Summary collapse
- #backup ⇒ Object
-
#initialize(install_dir) ⇒ IIS
constructor
A new instance of IIS.
- #install ⇒ Object
Constructor Details
#initialize(install_dir) ⇒ IIS
Returns a new instance of IIS.
12 13 14 |
# File 'lib/web/sapi/install/iis.rb', line 12 def initialize( install_dir ) @install_dir = install_dir end |
Instance Attribute Details
#install_dir ⇒ Object
Returns the value of attribute install_dir.
11 12 13 |
# File 'lib/web/sapi/install/iis.rb', line 11 def install_dir @install_dir end |
Class Method Details
Instance Method Details
#backup ⇒ Object
16 17 18 |
# File 'lib/web/sapi/install/iis.rb', line 16 def backup "#{httpd_conf}.ruby-web.backup.#{Time::now::strftime('%Y.%m.%d') }" end |
#install ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/web/sapi/install/iis.rb', line 20 def install puts "******************************************", "* Installing .rhtml and .rb mappings *", "* for Microsoft IIS *", "******************************************" done = Hash.new require 'win32ole' # http://www.west-wind.com/presentations/WebServerConfig/WebServerConfig.htm iis = WIN32OLE.connect 'IIS://LOCALHOST/W3SVC' iis.each do |site| unless site.name =~ /info|filters/i site.each do |d| if d.name =~ /^root$/i scriptmaps = d.scriptmaps scriptmaps.each_with_index do |mapping, i| m = mapping.split(/,/) if m.first =~ /^\.(rb|rhtml)$/ done[m.first] = true m[1] = install_dir + "\\bin\\ruby-web.exe" m = m.join(',') scriptmaps[i] = m end end ['.rb', '.rhtml'].each do |ext| unless done[ext] scriptmaps[scriptmaps.length] = "#{ext},#{install_dir}\\bin\\ruby-web.exe,1" end end # http://www.microsoft.com/technet/scriptcenter/guide/sas_ads_kbwl.mspx d.PutEx( ADS_PROPERTY_UPDATE, "ScriptMaps", scriptmaps ) index_files = d.DefaultDoc index_files += ",index.rhtml" unless index_files =~ /index\.rhtml/ index_files += ",index.rb" unless index_files =~ /index\.rb/ d.DefaultDoc = index_files d.SetInfo() end end end end #require 'pp' #pp iis.scriptmaps puts "Restarting IIS..." unless system('iisreset') raise "Error restarting IIS" end end |