ruwiki 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. data/Readme.rubygems +86 -0
  2. data/Readme.tarfile +65 -0
  3. data/bin/ruwiki +58 -0
  4. data/bin/ruwiki.cgi +87 -0
  5. data/bin/ruwiki_convert +56 -0
  6. data/bin/ruwiki_service.rb +82 -0
  7. data/bin/ruwiki_servlet +53 -0
  8. data/contrib/enscript-token.rb +55 -0
  9. data/contrib/rublog_integrator.rb +68 -0
  10. data/data/Default/ProjectIndex.ruwiki +49 -0
  11. data/data/Ruwiki/Antispam.ruwiki +65 -0
  12. data/data/Ruwiki/BugTracking.ruwiki +33 -0
  13. data/data/Ruwiki/ChangeLog.ruwiki +102 -0
  14. data/data/Ruwiki/Configuring_Ruwiki.ruwiki +151 -0
  15. data/data/Ruwiki/Extending_Ruwiki.ruwiki +317 -0
  16. data/data/Ruwiki/LicenseAndAuthorInfo.ruwiki +30 -0
  17. data/data/Ruwiki/ProjectIndex.ruwiki +84 -0
  18. data/data/Ruwiki/Roadmap.ruwiki +225 -0
  19. data/data/Ruwiki/RuwikiTemplatingLibrary.ruwiki +156 -0
  20. data/data/Ruwiki/RuwikiUtilities.ruwiki +157 -0
  21. data/data/Ruwiki/SandBox.ruwiki +9 -0
  22. data/data/Ruwiki/To_Do.ruwiki +51 -0
  23. data/data/Ruwiki/TroubleShooting.ruwiki +33 -0
  24. data/data/Ruwiki/WikiFeatures.ruwiki +17 -0
  25. data/data/Ruwiki/WikiMarkup.ruwiki +261 -0
  26. data/data/Tutorial/AddingPages.ruwiki +16 -0
  27. data/data/Tutorial/AddingProjects.ruwiki +16 -0
  28. data/data/Tutorial/ProjectIndex.ruwiki +11 -0
  29. data/data/Tutorial/SandBox.ruwiki +9 -0
  30. data/data/agents.banned +60 -0
  31. data/data/agents.readonly +321 -0
  32. data/data/hostip.banned +30 -0
  33. data/data/hostip.readonly +28 -0
  34. data/lib/ruwiki.rb +622 -0
  35. data/lib/ruwiki/auth.rb +56 -0
  36. data/lib/ruwiki/auth/gforge.rb +73 -0
  37. data/lib/ruwiki/backend.rb +318 -0
  38. data/lib/ruwiki/backend/flatfiles.rb +217 -0
  39. data/lib/ruwiki/config.rb +244 -0
  40. data/lib/ruwiki/exportable.rb +192 -0
  41. data/lib/ruwiki/handler.rb +342 -0
  42. data/lib/ruwiki/lang/de.rb +339 -0
  43. data/lib/ruwiki/lang/en.rb +334 -0
  44. data/lib/ruwiki/lang/es.rb +339 -0
  45. data/lib/ruwiki/page.rb +262 -0
  46. data/lib/ruwiki/servlet.rb +38 -0
  47. data/lib/ruwiki/template.rb +553 -0
  48. data/lib/ruwiki/utils.rb +24 -0
  49. data/lib/ruwiki/utils/command.rb +102 -0
  50. data/lib/ruwiki/utils/converter.rb +297 -0
  51. data/lib/ruwiki/utils/manager.rb +639 -0
  52. data/lib/ruwiki/utils/servletrunner.rb +295 -0
  53. data/lib/ruwiki/wiki.rb +147 -0
  54. data/lib/ruwiki/wiki/tokens.rb +136 -0
  55. data/lib/ruwiki/wiki/tokens/00default.rb +211 -0
  56. data/lib/ruwiki/wiki/tokens/01wikilinks.rb +166 -0
  57. data/lib/ruwiki/wiki/tokens/02actions.rb +63 -0
  58. data/lib/ruwiki/wiki/tokens/abbreviations.rb +40 -0
  59. data/lib/ruwiki/wiki/tokens/calendar.rb +147 -0
  60. data/lib/ruwiki/wiki/tokens/headings.rb +43 -0
  61. data/lib/ruwiki/wiki/tokens/lists.rb +112 -0
  62. data/lib/ruwiki/wiki/tokens/rubylists.rb +48 -0
  63. data/ruwiki.conf +22 -0
  64. data/ruwiki.pkg +0 -0
  65. data/templates/default/body.tmpl +19 -0
  66. data/templates/default/content.tmpl +7 -0
  67. data/templates/default/controls.tmpl +23 -0
  68. data/templates/default/edit.tmpl +27 -0
  69. data/templates/default/error.tmpl +14 -0
  70. data/templates/default/footer.tmpl +23 -0
  71. data/templates/default/ruwiki.css +297 -0
  72. data/templates/default/save.tmpl +8 -0
  73. data/templates/sidebar/body.tmpl +19 -0
  74. data/templates/sidebar/content.tmpl +8 -0
  75. data/templates/sidebar/controls.tmpl +8 -0
  76. data/templates/sidebar/edit.tmpl +27 -0
  77. data/templates/sidebar/error.tmpl +13 -0
  78. data/templates/sidebar/footer.tmpl +22 -0
  79. data/templates/sidebar/ruwiki.css +347 -0
  80. data/templates/sidebar/save.tmpl +10 -0
  81. data/templates/simple/body.tmpl +13 -0
  82. data/templates/simple/content.tmpl +7 -0
  83. data/templates/simple/controls.tmpl +8 -0
  84. data/templates/simple/edit.tmpl +25 -0
  85. data/templates/simple/error.tmpl +10 -0
  86. data/templates/simple/footer.tmpl +10 -0
  87. data/templates/simple/ruwiki.css +192 -0
  88. data/templates/simple/save.tmpl +8 -0
  89. data/tests/harness.rb +52 -0
  90. data/tests/tc_backend_flatfile.rb +103 -0
  91. data/tests/tc_bugs.rb +74 -0
  92. data/tests/tc_exportable.rb +64 -0
  93. data/tests/tc_template.rb +145 -0
  94. data/tests/tc_tokens.rb +335 -0
  95. data/tests/testall.rb +20 -0
  96. metadata +182 -0
@@ -0,0 +1,86 @@
1
+ Ruwiki 0.9.0
2
+ ------------
3
+ Ruwiki is a simple, extensible Wiki-clone written in Ruby. It supports both
4
+ CGI and WEBrick interfaces, templates, and CSS formatting. This Wiki differs
5
+ from most other Wikis in that it supports project namespaces, so that two
6
+ topics may be named the same for differing projects without colliding or
7
+ having to resort to odd naming conventions. Please see the ::Ruwiki project in
8
+ the running Wiki for more information. Ruwiki 0.9.0 has German and Spanish
9
+ translations available.
10
+
11
+ Upgrading
12
+ ---------
13
+ Ruwiki 0.9.0 has a flatfile format that is incompatible with older versions of
14
+ Ruwiki. If you are upgrading from one of these versions, you must use the
15
+ bin/convert. The simple case will be (assuming that your data files are in
16
+ ./data):
17
+
18
+ % convert ./data
19
+
20
+ The convert utility is automatically installed by RubyGems.
21
+
22
+ Requirements
23
+ ------------
24
+ Ruwiki currently requires:
25
+ * Ruby 1.8
26
+ * Diff::LCS 1.2.0
27
+ * Archive::Tar::Minitar 0.5.1
28
+
29
+ The YAML backend requires Ruby 1.8.2 after preview2. You should have been
30
+ prompted to load these dependencies on installation.
31
+
32
+ Quick Start (WEBrick Readonly)
33
+ ------------------------------
34
+ 1. Type:
35
+
36
+ % ruwiki_servlet --gem-data
37
+
38
+ 2. Point your web browser to <http://localhost:8808/>.
39
+
40
+ Quick Start (CGI)
41
+ -----------------
42
+ 1. Create a directory in a place that your webserver can execute CGI programs
43
+ and type:
44
+
45
+ % ruwiki install cgi,data --to <directory>
46
+
47
+ 2. Ensure that ruwiki.cgi is executable on your webserver.
48
+ 3. Point your web browser to the appropriate URL.
49
+
50
+ Quick Start (WEBrick)
51
+ ---------------------
52
+ 1. Create a directory to store your data and templates and type:
53
+
54
+ % ruwiki install data --to <directory>
55
+
56
+ 2. Type:
57
+
58
+ % ruwiki_servlet
59
+
60
+ 3. Point your web browser to <http://localhost:8808/>.
61
+
62
+ Configuration
63
+ -------------
64
+ There are extensive configuration options available. The Ruwiki WEBrick
65
+ servlet offers command-line options that simplify the configuration of Ruwiki
66
+ without editing the servlet; use ruwiki_servlet --help for more information.
67
+
68
+ Copyright
69
+ ---------
70
+ Copyright: Copyright � 2002 - 2004, Alan Chen and Austin Ziegler
71
+ Authors: Alan Chen (alan@digikata.com)
72
+ Austin Ziegler (ruwiki@halostatue.ca)
73
+ Licence: Ruby's
74
+
75
+ Credits
76
+ -------
77
+ * This software includes portions of Diff::LCS by Austin Ziegler, available
78
+ for download from the Ruwiki RubyForge project:
79
+ [http://rubyforge.org/projects/ruwiki/]
80
+ * Portions of this software are derived from Dave Thomas's RDoc system, now
81
+ part of the Ruby distribution.
82
+
83
+ * Translation to German by [mailto:chneukirchen@yahoo.de Christian Neukirchen].
84
+ * Translation to Spanish by [mailto:batsman.geo@yahoo.com Mauricio Fern�ndez].
85
+
86
+ $Id: Readme.rubygems,v 1.3 2004/11/28 23:59:18 austin Exp $
@@ -0,0 +1,65 @@
1
+ Ruwiki 0.9.0
2
+ ------------
3
+ Ruwiki is a simple, extensible Wiki-clone written in Ruby. It supports both
4
+ CGI and WEBrick interfaces, templates, and CSS formatting. This Wiki differs
5
+ from most other Wikis in that it supports project namespaces, so that two
6
+ topics may be named the same for differing projects without colliding or
7
+ having to resort to odd naming conventions. Please see the ::Ruwiki project in
8
+ the running Wiki for more information. Ruwiki 0.9.0 has German and Spanish
9
+ translations available.
10
+
11
+ Upgrading
12
+ ---------
13
+ Ruwiki 0.9.0 has a flatfile format that is incompatible with versions of
14
+ Ruwiki older than 0.8.0. If you are upgrading from one of these versions, you
15
+ must use the bin/convert. The simplest case will be (assuming that your data
16
+ files are in ./data):
17
+
18
+ % bin/convert ./data
19
+
20
+ Requirements
21
+ ------------
22
+ Ruwiki currently requires:
23
+ * Ruby 1.8
24
+ * Diff::LCS 1.2.0
25
+ * Archive::Tar::Minitar 0.5.1
26
+
27
+ The YAML backend requires Ruby 1.8.2 after preview2. Portions of Diff::LCS and
28
+ Archive::Tar::Minitar have been included in this version of Ruwiki.
29
+
30
+ Quick Start (CGI)
31
+ -----------------
32
+ 1. Place the Ruwiki directory in a place that your webserver can execute CGI
33
+ programs and ensure that ruwiki.cgi is executable on your webserver.
34
+ 2. Point your web browser to the appropriate URL.
35
+
36
+ Quick Start (WEBrick)
37
+ ---------------------
38
+ 1. Run bin/ruwiki_servlet (ruby bin/ruwiki_servlet under Windows).
39
+ 2. Point your web browser to <http://localhost:8808/>.
40
+
41
+ Configuration
42
+ -------------
43
+ There are extensive configuration options available. The Ruwiki WEBrick
44
+ servlet offers command-line options that simplify the configuration of Ruwiki
45
+ without editing the servlet; use ruwiki_servlet --help for more information.
46
+
47
+ Copyright
48
+ ---------
49
+ Copyright: Copyright � 2002 - 2004, Alan Chen and Austin Ziegler
50
+ Authors: Alan Chen (alan@digikata.com)
51
+ Austin Ziegler (ruwiki@halostatue.ca)
52
+ Licence: Ruby's
53
+
54
+ Credits
55
+ -------
56
+ * This software includes portions of Diff::LCS and Archive::Tar::Minitar by
57
+ Austin Ziegler, available for download from the Ruwiki RubyForge project:
58
+ [http://rubyforge.org/projects/ruwiki/]
59
+ * Portions of this software are derived from Dave Thomas's RDoc system, now
60
+ part of the Ruby distribution.
61
+
62
+ * Translation to German by [mailto:chneukirchen@yahoo.de Christian Neukirchen].
63
+ * Translation to Spanish by [mailto:batsman.geo@yahoo.com Mauricio Fern�ndez].
64
+
65
+ $Id: Readme.tarfile,v 1.1 2004/09/22 15:13:30 austin Exp $
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Ruwiki
4
+ # Copyright � 2002 - 2004, Digikata and HaloStatue
5
+ # Alan Chen (alan@digikata.com)
6
+ # Austin Ziegler (ruwiki@halostatue.ca)
7
+ #
8
+ # Licensed under the same terms as Ruby.
9
+ #
10
+ # $Id: ruwiki,v 1.5 2004/11/26 12:18:46 austin Exp $
11
+ #++
12
+
13
+ # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
14
+ # and ../lib/).
15
+ # 2) Try to load Ruwiki from the directory structure of the running script
16
+ # (e.g., File.dirname($0)/lib and File.dirname($0)/../lib).
17
+ # 3) Try to load Ruwiki from the directory structure of the current file
18
+ # (e.g., File.dirname(__FILE__)/lib and File.dirname(__FILE__)/../lib).
19
+ # 4) Try to load Ruwiki from an unmodified $LOAD_PATH, e.g., site_ruby.
20
+ # 5) Try to load Ruwiki from Rubygems.
21
+ # 6) Fail hard.
22
+ load_state = 1
23
+
24
+ $LOAD_PATH.unshift "#{Dir.pwd}/lib", "#{Dir.pwd}/../lib"
25
+
26
+ begin
27
+ require 'ruwiki'
28
+ rescue LoadError
29
+ if (1..3).include?(load_state)
30
+ $LOAD_PATH.shift # Oh, what I'd give for $LOAD_PATH.shift(2)
31
+ $LOAD_PATH.shift
32
+ end
33
+
34
+ load_state += 1
35
+
36
+ case load_state
37
+ when 2
38
+ $LOAD_PATH.unshift "#{File.dirname($0)}/lib", "#{File.dirname($0)}/../lib"
39
+ when 3
40
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib", "#{File.dirname(__FILE__)}/../lib"
41
+ when 5
42
+ require 'rubygems'
43
+ when 6
44
+ raise
45
+ end
46
+ retry
47
+ end
48
+
49
+ require 'ruwiki/utils'
50
+ require 'ruwiki/utils/manager'
51
+
52
+ # RPA Maintainers: Change this to the appropriate location on installation.
53
+ # This is the right place for RubyGems, basically.
54
+ ss = "#{File.dirname(File.expand_path(__FILE__))}/.."
55
+
56
+ Ruwiki::Utils::Manager.shared = ss
57
+
58
+ exit Ruwiki::Utils::Manager.run(ARGV)
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Ruwiki
4
+ # Copyright � 2002 - 2004, Digikata and HaloStatue
5
+ # Alan Chen (alan@digikata.com)
6
+ # Austin Ziegler (ruwiki@halostatue.ca)
7
+ #
8
+ # Licensed under the same terms as Ruby.
9
+ #
10
+ # This file may be renamed to change the URI for the wiki.
11
+ #
12
+ # $Id: ruwiki.cgi,v 1.6 2004/11/26 12:18:46 austin Exp $
13
+ #++
14
+
15
+ # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
16
+ # and ../lib/).
17
+ # 2) Try to load Ruwiki from the directory structure of the running script
18
+ # (e.g., File.dirname($0)/lib and File.dirname($0)/../lib).
19
+ # 3) Try to load Ruwiki from the directory structure of the current file
20
+ # (e.g., File.dirname(__FILE__)/lib and File.dirname(__FILE__)/../lib).
21
+ # 4) Try to load Ruwiki from an unmodified $LOAD_PATH, e.g., site_ruby.
22
+ # 5) Try to load Ruwiki from Rubygems.
23
+ # 6) Fail hard.
24
+ load_state = 1
25
+
26
+ $LOAD_PATH.unshift "#{Dir.pwd}/lib", "#{Dir.pwd}/../lib"
27
+
28
+ begin
29
+ require 'ruwiki'
30
+ rescue LoadError
31
+ if (1..3).include?(load_state)
32
+ $LOAD_PATH.shift # Oh, what I'd give for $LOAD_PATH.shift(2)
33
+ $LOAD_PATH.shift
34
+ end
35
+
36
+ load_state += 1
37
+
38
+ case load_state
39
+ when 2
40
+ $LOAD_PATH.unshift "#{File.dirname($0)}/lib", "#{File.dirname($0)}/../lib"
41
+ when 3
42
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib", "#{File.dirname(__FILE__)}/../lib"
43
+ when 5
44
+ require 'rubygems'
45
+ when 6
46
+ raise
47
+ end
48
+ retry
49
+ end
50
+
51
+ # This is the CGI version of Ruwiki. Therefore, when we create the Ruwiki
52
+ # instance, we specify that the request and response handlers are to be
53
+ # generated from a new CGI object.
54
+ wiki = Ruwiki.new(Ruwiki::Handler.from_cgi(CGI.new))
55
+
56
+ config_file = File.join(Dir.pwd, Ruwiki::Config::CONFIG_NAME)
57
+
58
+ if File.exists?(config_file)
59
+ wiki.load_config(config_file)
60
+ config = Ruwiki::Config.read(config_file)
61
+ if config.webmaster.nil? or config.webmaster.empty?
62
+ config.webmaster = "webmaster@domain.tld"
63
+ end
64
+ else
65
+ # Configuration defaults to certain values. This overrides the defaults.
66
+ # The webmaster.
67
+ wiki.config.webmaster = "webmaster@domain.tld"
68
+
69
+ # wiki.config.debug = false
70
+ # wiki.config.title = "Ruwiki"
71
+ # wiki.config.default_page = "ProjectIndex"
72
+ # wiki.config.default_project = "Default"
73
+ # This next defaults to 'flatfiles'. Conversion of the default data will
74
+ # be necessary to use other formats.
75
+ # wiki.config.storage_type = 'flatfiles'
76
+ # wiki.config.storage_options[wiki.config.storage_type][:data_path] = "./data/"
77
+ wiki.config.storage_options[wiki.config.storage_type][:extension] = "ruwiki"
78
+ # wiki.config.template_path = "./templates/"
79
+ # wiki.config.template_set = "default"
80
+ # wiki.config.css = "ruwiki.css"
81
+ # wiki.config.time_format = "%H:%M:%S"
82
+ # wiki.config.date_format = "%Y.%m.%d"
83
+ # wiki.config.datetime_format = "%Y.%m.%d %H:%M:%S"
84
+ end
85
+
86
+ wiki.config!
87
+ wiki.run
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Ruwiki
4
+ # Copyright � 2002 - 2004, Digikata and HaloStatue
5
+ # Alan Chen (alan@digikata.com)
6
+ # Austin Ziegler (ruwiki@halostatue.ca)
7
+ #
8
+ # Licensed under the same terms as Ruby.
9
+ #
10
+ # This file may be renamed to change the URI for the wiki.
11
+ #
12
+ # $Id: ruwiki_convert,v 1.1 2004/11/28 02:26:57 austin Exp $
13
+ #++
14
+
15
+ # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
16
+ # and ../lib/).
17
+ # 2) Try to load Ruwiki from the directory structure of the running script
18
+ # (e.g., File.dirname($0)/lib and File.dirname($0)/../lib).
19
+ # 3) Try to load Ruwiki from the directory structure of the current file
20
+ # (e.g., File.dirname(__FILE__)/lib and File.dirname(__FILE__)/../lib).
21
+ # 4) Try to load Ruwiki from an unmodified $LOAD_PATH, e.g., site_ruby.
22
+ # 5) Try to load Ruwiki from Rubygems.
23
+ # 6) Fail hard.
24
+ load_state = 1
25
+
26
+ $LOAD_PATH.unshift "#{Dir.pwd}/lib", "#{Dir.pwd}/../lib"
27
+
28
+ begin
29
+ require 'ruwiki'
30
+ rescue LoadError
31
+ if (1..3).include?(load_state)
32
+ $LOAD_PATH.shift # Oh, what I'd give for $LOAD_PATH.shift(2)
33
+ $LOAD_PATH.shift
34
+ end
35
+
36
+ load_state += 1
37
+
38
+ case load_state
39
+ when 2
40
+ $LOAD_PATH.unshift "#{File.dirname($0)}/lib", "#{File.dirname($0)}/../lib"
41
+ when 3
42
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib", "#{File.dirname(__FILE__)}/../lib"
43
+ when 5
44
+ require 'rubygems'
45
+ when 6
46
+ raise
47
+ end
48
+ retry
49
+ end
50
+
51
+ # Load all of the known backends.
52
+ require 'ruwiki/utils'
53
+ require 'ruwiki/backend/flatfiles'
54
+ require 'ruwiki/utils/converter'
55
+
56
+ exit Ruwiki::Utils::Converter.run(ARGV)
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Ruwiki
4
+ # Copyright � 2002 - 2004, Digikata and HaloStatue
5
+ # Alan Chen (alan@digikata.com)
6
+ # Austin Ziegler (ruwiki@halostatue.ca)
7
+ #
8
+ # Licensed under the same terms as Ruby.
9
+ #
10
+ # This file may be renamed to change the URI for the wiki.
11
+ #
12
+ # $Id: ruwiki_service.rb,v 1.6 2004/11/26 12:18:46 austin Exp $
13
+ #++
14
+
15
+ # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
16
+ # and ../lib/).
17
+ # 2) Try to load Ruwiki from the directory structure of the running script
18
+ # (e.g., File.dirname($0)/lib and File.dirname($0)/../lib).
19
+ # 3) Try to load Ruwiki from the directory structure of the current file
20
+ # (e.g., File.dirname(__FILE__)/lib and File.dirname(__FILE__)/../lib).
21
+ # 4) Try to load Ruwiki from an unmodified $LOAD_PATH, e.g., site_ruby.
22
+ # 5) Try to load Ruwiki from Rubygems.
23
+ # 6) Fail hard.
24
+ load_state = 1
25
+
26
+ $LOAD_PATH.unshift "#{Dir.pwd}/lib", "#{Dir.pwd}/../lib"
27
+
28
+ begin
29
+ require 'ruwiki'
30
+ rescue LoadError
31
+ if (1..3).include?(load_state)
32
+ $LOAD_PATH.shift # Oh, what I'd give for $LOAD_PATH.shift(2)
33
+ $LOAD_PATH.shift
34
+ end
35
+
36
+ load_state += 1
37
+
38
+ case load_state
39
+ when 2
40
+ $LOAD_PATH.unshift "#{File.dirname($0)}/lib", "#{File.dirname($0)}/../lib"
41
+ when 3
42
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib", "#{File.dirname(__FILE__)}/../lib"
43
+ when 5
44
+ require 'rubygems'
45
+ when 6
46
+ raise
47
+ end
48
+ retry
49
+ end
50
+
51
+ require 'win32/service'
52
+ require 'ruwiki/utils/servletrunner'
53
+
54
+ class Ruwiki::Utils::Daemon < Win32::Daemon
55
+ LOCATION = File.dirname(File.expand_path(__FILE__))
56
+
57
+ def initialize
58
+ @logfile = File.open(File.join(LOCATION, "ruwiki_service.log"), "ab+")
59
+ rescue Exception => e
60
+ File.open(File.join(LOCATION, "temp.log"), "a+") do |f|
61
+ f.puts "Logfile error: #{e}"
62
+ f.puts "Backtrace:\n#{e.backtrace.join(', ')}"
63
+ end
64
+ exit
65
+ end
66
+
67
+ def service_main
68
+ ARGV.replace(["--config", File.join(LOCATION, Ruwiki::Config::CONFIG_NAME),
69
+ "--logfile", File.join(LOCATION, "ruwiki_servlet.log")])
70
+ Ruwiki::Utils::ServletRunner.run(ARGV, @logfile, @logfile, @logfile)
71
+ rescue Exception => e
72
+ file = LOCATION + '/temp.log'
73
+ File.open(file, "a+") do |f|
74
+ f.puts "Error: #{e}"
75
+ f.puts "Backtrace: #{e.backtrace.join(', ')}"
76
+ end
77
+ exit
78
+ end
79
+ end
80
+
81
+ daemon = Ruwiki::Utils::Daemon.new
82
+ daemon.mainloop
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Ruwiki
4
+ # Copyright � 2002 - 2004, Digikata and HaloStatue
5
+ # Alan Chen (alan@digikata.com)
6
+ # Austin Ziegler (ruwiki@halostatue.ca)
7
+ #
8
+ # Licensed under the same terms as Ruby.
9
+ #
10
+ # This file may be renamed to change the URI for the wiki.
11
+ #
12
+ # $Id: ruwiki_servlet,v 1.5 2004/11/28 02:26:57 austin Exp $
13
+ #++
14
+
15
+ # 1) Try to load Ruwiki from the local directory structure (e.g., ./lib/
16
+ # and ../lib/).
17
+ # 2) Try to load Ruwiki from the directory structure of the running script
18
+ # (e.g., File.dirname($0)/lib and File.dirname($0)/../lib).
19
+ # 3) Try to load Ruwiki from the directory structure of the current file
20
+ # (e.g., File.dirname(__FILE__)/lib and File.dirname(__FILE__)/../lib).
21
+ # 4) Try to load Ruwiki from an unmodified $LOAD_PATH, e.g., site_ruby.
22
+ # 5) Try to load Ruwiki from Rubygems.
23
+ # 6) Fail hard.
24
+ load_state = 1
25
+
26
+ $LOAD_PATH.unshift "#{Dir.pwd}/lib", "#{Dir.pwd}/../lib"
27
+
28
+ begin
29
+ require 'ruwiki'
30
+ rescue LoadError
31
+ if (1..3).include?(load_state)
32
+ $LOAD_PATH.shift # Oh, what I'd give for $LOAD_PATH.shift(2)
33
+ $LOAD_PATH.shift
34
+ end
35
+
36
+ load_state += 1
37
+
38
+ case load_state
39
+ when 2
40
+ $LOAD_PATH.unshift "#{File.dirname($0)}/lib", "#{File.dirname($0)}/../lib"
41
+ when 3
42
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/lib", "#{File.dirname(__FILE__)}/../lib"
43
+ when 5
44
+ require 'rubygems'
45
+ when 6
46
+ raise
47
+ end
48
+ retry
49
+ end
50
+
51
+ require 'ruwiki/utils/servletrunner'
52
+
53
+ exit Ruwiki::Utils::ServletRunner.run(ARGV)