Wiki2Go 1.14.1 → 1.14.3

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.
@@ -1 +1 @@
1
- admin:PtbdbFXq/1qM6
1
+ admin:PtbdbFXq/1qM6
@@ -6,7 +6,7 @@ require 'optparse'
6
6
 
7
7
  require 'rubygems'
8
8
  WIKI2GO_VERSION = '1.14'
9
- require_gem "Wiki2Go","=#{WIKI2GO_VERSION}"
9
+ require_gem "Wiki2Go","~>#{WIKI2GO_VERSION}"
10
10
 
11
11
  require 'Wiki2Go/PublicWikiConfig'
12
12
  require 'Wiki2Go/PrivateWikiConfig'
@@ -39,7 +39,7 @@ module Wiki2Go
39
39
  @server = 'localhost'
40
40
  @port = '80'
41
41
  @default_wiki = ''
42
- @directory = Dir.getwd
42
+ @directory = Dir.getwd
43
43
  @type = ''
44
44
  @source_dir = File.expand_path(File.dirname(__FILE__))
45
45
  end
@@ -86,6 +86,7 @@ module Wiki2Go
86
86
  if configuration.server.empty? or configuration.type.empty? then
87
87
  puts opts
88
88
  else
89
+ oldmask = File.umask(02)
89
90
  ensure_path_exists(configuration.directory)
90
91
  cd(configuration.directory) {
91
92
  case configuration.type
@@ -98,6 +99,7 @@ module Wiki2Go
98
99
  end
99
100
  }
100
101
  set_owner(configuration.directory,configuration.user)
102
+ File.umask(oldmask)
101
103
  puts "Installed."
102
104
  puts "Include #{configuration.directory}/config/site.conf in your Apache configuration"
103
105
  puts " and restart Apache to activate your wiki."
@@ -122,6 +124,7 @@ module Wiki2Go
122
124
  if configuration.type.empty? then
123
125
  puts opts
124
126
  else
127
+ oldmask = File.umask(02)
125
128
  cd(configuration.directory) {
126
129
  case configuration.type
127
130
  when 'private' then
@@ -133,6 +136,7 @@ module Wiki2Go
133
136
  end
134
137
  }
135
138
  set_owner(configuration.directory,configuration.user)
139
+ File.umask(oldmask)
136
140
  end
137
141
  end
138
142
 
@@ -151,10 +155,12 @@ module Wiki2Go
151
155
  end
152
156
  opts.parse(args)
153
157
 
158
+ oldmask = File.umask(02)
154
159
  cd(configuration.directory) {
155
160
  do_make_wiki(configuration)
156
161
  }
157
162
  set_owner(configuration.directory,configuration.user)
163
+ File.umask(oldmask)
158
164
  end
159
165
 
160
166
  private
@@ -168,8 +174,6 @@ module Wiki2Go
168
174
  do_make_wiki( configuration)
169
175
 
170
176
  make_public_apache_config( configuration)
171
-
172
- set_owner( configuration.directory, configuration.user)
173
177
  end
174
178
 
175
179
  def Install.do_make_readwrite_site( configuration)
@@ -181,8 +185,6 @@ module Wiki2Go
181
185
  do_make_wiki( configuration)
182
186
 
183
187
  make_readwrite_apache_config( configuration)
184
-
185
- set_owner( configuration.directory, configuration.user)
186
188
  end
187
189
 
188
190
  def Install.do_make_private_site(configuration)
@@ -195,8 +197,6 @@ module Wiki2Go
195
197
  do_make_wiki( configuration)
196
198
 
197
199
  make_apache_private_config( configuration)
198
-
199
- set_owner( configuration.directory, configuration.user)
200
200
  end
201
201
 
202
202
 
@@ -285,9 +285,10 @@ module Wiki2Go
285
285
  if !owner.group.nil? then
286
286
  group_id = Etc.getgrnam(owner.group).gid
287
287
  end
288
- Dir.glob('**/*').each do |file|
288
+ Dir.glob(File.join(dir,'**/*')).each do |file|
289
289
  if file[0] != '.' then
290
- puts "Changing ownership of #{file} to #{user_id}:#{group_id}"
290
+ mode = File.stat(file).mode | 0020
291
+ File.chmod(mode,file)
291
292
  File.chown(user_id,group_id,file)
292
293
  end
293
294
  end
@@ -300,9 +301,12 @@ module Wiki2Go
300
301
 
301
302
  #
302
303
  require 'rubygems'
303
- require_gem "Wiki2Go","=#{WIKI2GO_VERSION}"
304
+ require_gem "Wiki2Go","~>#{WIKI2GO_VERSION}"
304
305
  require "Wiki2Go/#{baseconfig}"
305
306
 
307
+ # Uncomment if you want to add 'dot' graphics to your page (see http://www.graphviz.org)
308
+ # require 'Wiki2Go/DotGraphics'
309
+
306
310
  class CgiOptions < #{baseconfig}
307
311
 
308
312
  def initialize
@@ -319,6 +323,10 @@ class CgiOptions < #{baseconfig}
319
323
  @user = '#{config.user.user}'
320
324
  # System group who has access to the files
321
325
  @group = '#{config.user.group}'
326
+
327
+ # Uncomment if you want to add 'dot' graphics to your page (see http://www.graphviz.org)
328
+ # The path must point to the 'dot' exexcutable
329
+ # add_processor('GRAPH',Wiki2Go::DotGraphics.new('/usr/bin/'))
322
330
  end
323
331
 
324
332
  end
@@ -34,7 +34,6 @@
34
34
  <li><%= formatter.admin_link("regenerate","Regenerate&nbsp;HTML")%></li>
35
35
  <li><%= formatter.admin_link("passwords","Passwords")%></li>
36
36
  <li><%= formatter.admin_link("greylist","Greylist")%></li>
37
- <li><%= formatter.admin_link("update","CVS&nbsp;Update")%></li>
38
37
  </ul>
39
38
  </TD>
40
39
  <TD width="100%" valign="top">$BODY$</TD>
@@ -22,6 +22,11 @@ class PrivateWikiConfig < Wiki2Go::Config
22
22
  @generate_html
23
23
  end
24
24
 
25
+ def static_web(web)
26
+ web.clone
27
+ end
28
+
29
+
25
30
  end
26
31
 
27
32
 
data/lib/Wiki2Go/Web.rb CHANGED
@@ -40,6 +40,10 @@ module Wiki2Go
40
40
  @title = nil
41
41
  end
42
42
 
43
+ def clone
44
+ return Web.new(@server,@port,@script_prefix,@verb,@name,@current_page,@request)
45
+ end
46
+
43
47
  def user
44
48
  @request.nil? ? 'unknown' : @request.user
45
49
  end
@@ -39,173 +39,6 @@ class WikiServlet < HTTPServlet::AbstractServlet
39
39
 
40
40
  private
41
41
 
42
- def perform_save(req,res,wikiweb)
43
-
44
- content = get_parameter(req,'text')
45
- name = get_parameter(req,'title') || wikiweb.current_page
46
-
47
- wiki = Wiki2Go::Wiki.new(@config)
48
- wiki.title = name
49
-
50
- redirect_to = wiki.save(wikiweb,content)
51
- res.body = "Redirect to #{redirect_to}"
52
- res['Content-Type'] = "text/html"
53
- res.set_redirect(WEBrick::HTTPStatus[300],redirect_to)
54
- end
55
-
56
- def perform_removespam(req,res,wikiweb)
57
-
58
- user = get_parameter(req,'user')
59
-
60
- wiki = Wiki2Go::Wiki.new(@config)
61
-
62
- if !user.nil? && !user.empty? then
63
- wiki.blacklist(user)
64
- end
65
-
66
- res.body = wiki.remove_spam(wikiweb)
67
- res['Content-Type'] = "text/html"
68
- end
69
-
70
- def perform_upload(req,res,wikiweb)
71
-
72
- uploaded_file = req.query['FILE']
73
- wiki = Wiki2Go::Wiki.new(@config)
74
-
75
- res.body = wiki.upload(wikiweb,uploaded_file.filename,uploaded_file.list[0])
76
- res['Content-Type'] = "text/html"
77
- end
78
-
79
- def perform_view(req,res,wikiweb)
80
- wiki = Wiki2Go::Wiki.new(@config)
81
-
82
- res.body = wiki.view(wikiweb)
83
- res['Content-Type'] = "text/html"
84
- end
85
-
86
- def perform_versions(req,res,wikiweb)
87
- wiki = Wiki2Go::Wiki.new(@config)
88
-
89
- res.body = wiki.versions(wikiweb)
90
- res['Content-Type'] = "text/html"
91
- end
92
-
93
- def perform_changes(req,res,wikiweb)
94
- wiki = Wiki2Go::Wiki.new(@config)
95
-
96
- res.body = wiki.changes(wikiweb)
97
- res['Content-Type'] = "text/html"
98
- end
99
-
100
- def perform_search(req,res,wikiweb)
101
- topic = get_parameter(req,'text')
102
-
103
- wiki = Wiki2Go::Wiki.new(@config)
104
-
105
- res.body = wiki.search(wikiweb,topic)
106
- res['Content-Type'] = "text/html"
107
- end
108
-
109
- def perform_redirect(req,res,wikiweb)
110
- redirect_to = get_parameter(req,'url')
111
-
112
- wiki = Wiki2Go::Wiki.new(@config)
113
-
114
- res.body = "Redirect to #{redirect_to}"
115
- res['Content-Type'] = "text/html"
116
- res.set_redirect(WEBrick::HTTPStatus[300],redirect_to)
117
- end
118
-
119
- def perform_generate_static(req,res,wikiweb)
120
- wiki = Wiki2Go::Wiki.new(@config)
121
-
122
- res.body = wiki.generate_html(wikiweb)
123
- res['Content-Type'] = "text/html"
124
- end
125
-
126
-
127
- def perform_edit(req,res,wikiweb)
128
- wiki = Wiki2Go::Wiki.new(@config)
129
-
130
- res.body = wiki.edit(wikiweb)
131
- res['Content-Type'] = "text/html"
132
- end
133
-
134
- def perform_stop(req,res,wikiweb)
135
- res.body = "<HTML>STOPPING...</HTML>"
136
- res['Content-Type'] = "text/html"
137
- @server.shutdown
138
- end
139
-
140
- def perform_admin(req,res,wikiweb)
141
- request = Web2Go::WebrickRequest.new(req)
142
- wiki = Wiki2Go::Wiki.new(@config)
143
- result = wiki.admin(request)
144
-
145
- res.body = result
146
- res['Content-Type'] = "text/html"
147
- end
148
-
149
- def perform_unknown_verb(req,res,wikiweb)
150
- res.body = "<HTML><BODY>Unknown command #{wikiweb.verb}</BODY></HTML>"
151
- res['Content-Type'] = "text/html"
152
- end
153
-
154
- private
155
-
156
- def get_parameter(req,name)
157
- form = WEBrick::HTTPUtils::parse_query(req.body)
158
- value = form[name]
159
- if value.nil? || value.empty? then
160
- form = WEBrick::HTTPUtils::parse_query(req.query_string)
161
- value = form[name]
162
- end
163
- value
164
- end
165
-
166
- def execute_command(req,res)
167
- if req.path =~ /\/([^\/\?]*)(\/|\?|$)/ then
168
- command = $1
169
- method = 'perform_' + command
170
- if self.private_methods.include?(method) then
171
- wikiweb = Wiki2Go::Web.page_url(req.host,req.port,req.path,command,@config.multi_wiki)
172
- find_user(req,wikiweb)
173
- return self.send(method,req,res,wikiweb)
174
- end
175
- end
176
- execute_default_command(req,res)
177
- end
178
-
179
- def execute_default_command(req,res)
180
- if req.path == "" or req.path == "/" then
181
- wikiweb = @config.default_wiki
182
- perform_view(req,res,wikiweb)
183
- else
184
- @file_servlet.do_GET(req,res)
185
- end
186
- end
187
-
188
- def execute_default_command(req,res)
189
- if req.path == "" or req.path == "/" then
190
- wikiweb = @config.default_wiki
191
- perform_view(req,res,wikiweb)
192
- else
193
- @file_servlet.do_GET(req,res)
194
- end
195
- end
196
-
197
- def find_user(req,wikiweb)
198
- user = ENV['USER'] || ENV['USERNAME']
199
- if user.nil? or user.length == 0 then
200
- user = req.peeraddr[2]
201
- if user.nil? or user.length == 0 then
202
- user = req.peeraddr[3]
203
- end
204
- end
205
-
206
- wikiweb.user = user
207
- wikiweb.secure = true
208
- end
209
42
  end
210
43
 
211
44
 
@@ -80,7 +80,10 @@ module Wiki2Go
80
80
 
81
81
  def format_line(line)
82
82
  @added_bullets = false
83
+ line = escape_wiki_markers(line)
83
84
  line = format_wiki_markup(line)
85
+ line = format_table(line)
86
+ line = remove_markers(line)
84
87
  if !@added_bullets then
85
88
  emit_bullets
86
89
  end
@@ -348,8 +351,6 @@ module Wiki2Go
348
351
  end
349
352
 
350
353
  def format_wiki_markup(line)
351
- line = escape_wiki_markers(line)
352
-
353
354
  if line =~ /^(.*)<(\S.*)\>(.*)$/ then
354
355
  before,match,after = $1,$2,$3
355
356
  line = append(format_wiki_markup(before),escape_url_markers(format_tag(match)),format_wiki_markup(after))
@@ -372,8 +373,6 @@ module Wiki2Go
372
373
  end
373
374
  line = format_bullets(line)
374
375
  line = format_markup(line)
375
- line = format_table(line)
376
- line = remove_markers(line)
377
376
  return line
378
377
  end
379
378
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.3
3
3
  specification_version: 1
4
4
  name: Wiki2Go
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.14.1
7
- date: 2005-06-08
6
+ version: 1.14.3
7
+ date: 2005-06-12
8
8
  summary: Wiki2Go is a Ruby Wiki
9
9
  require_paths:
10
10
  - lib