Wiki2Go 1.16.0 → 1.16.1
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.
- data/lib/Wiki2Go/Install/make_repository.rb +38 -16
- data/test/TestRepositoryMaker.rb +18 -4
- metadata +5 -3
@@ -3,19 +3,36 @@ require 'fileutils'
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'etc'
|
5
5
|
require 'logger'
|
6
|
+
require 'tempfile'
|
6
7
|
|
7
8
|
require 'rubygems'
|
8
|
-
require_gem 'rscm'
|
9
|
+
require_gem 'rscm','~>0.3.0'
|
9
10
|
require 'rscm/logging'
|
10
11
|
require 'rscm/better'
|
11
12
|
|
12
|
-
#Patch the RSCM 0.3 module
|
13
|
-
|
14
13
|
module RSCM
|
15
14
|
class Better
|
16
15
|
def Better.use_logger(logger)
|
17
16
|
@@logger = logger
|
18
17
|
end
|
18
|
+
|
19
|
+
def self.popen(cmd, mode="r", expected_exit=0, &proc)
|
20
|
+
@@logger.info "Executing command in '#{Dir.getwd}': '#{cmd}'" if @@logger
|
21
|
+
out = Tempfile.new('cvsout')
|
22
|
+
out.close
|
23
|
+
ret = IO.popen(cmd + " 2>> #{out.path}", mode) do |io|
|
24
|
+
proc.call(io)
|
25
|
+
end
|
26
|
+
log = IO::readlines(out.path).join($/).strip
|
27
|
+
if !log.nil? && log.length > 0 then
|
28
|
+
@@logger.warn(log) if @@logger
|
29
|
+
end
|
30
|
+
out.close!
|
31
|
+
exit_code = $? >> 8
|
32
|
+
raise "Command\n'#{cmd}'\nfailed with code #{exit_code} in\n#{Dir.pwd}\nExpected exit code: #{expected_exit}" if exit_code != expected_exit
|
33
|
+
ret
|
34
|
+
end
|
35
|
+
|
19
36
|
end
|
20
37
|
|
21
38
|
class Cvs
|
@@ -37,7 +54,7 @@ module RSCM
|
|
37
54
|
prefix = File.basename(@checkout_dir)
|
38
55
|
path_regex = /^([U|P|C]) #{prefix}\/(.*)/
|
39
56
|
# This is a workaround for the fact that -d . doesn't work - must be an existing sub folder.
|
40
|
-
mkdir_p(@checkout_dir) unless File.exist?(@checkout_dir)
|
57
|
+
FileUtils::mkdir_p(@checkout_dir) unless File.exist?(@checkout_dir)
|
41
58
|
target_dir = File.basename(@checkout_dir)
|
42
59
|
run_checkout_command_dir = File.dirname(@checkout_dir)
|
43
60
|
# -D is sticky, but subsequent updates will reset stickiness with -A
|
@@ -52,16 +69,17 @@ module RSCM
|
|
52
69
|
end
|
53
70
|
checked_out_files
|
54
71
|
end
|
55
|
-
|
56
|
-
# def command_line(cmd, password=nil, simulate=false)
|
57
|
-
# cvs_options = simulate ? "-n" : ""
|
58
|
-
# dev_null = WIN32 ? "nul" : "/dev/null"
|
59
|
-
# "cvs -f \"-d#{root_with_password(password)}\" #{cvs_options} -q #{cmd} 2> c:\\temp\\out.log"
|
60
|
-
# end
|
61
72
|
|
73
|
+
def command_line(cmd, password=nil, simulate=false)
|
74
|
+
cvs_options = simulate ? "-n" : ""
|
75
|
+
dev_null = WIN32 ? "nul" : "/dev/null"
|
76
|
+
cmd = "cvs -f \"-d#{root_with_password(password)}\" #{cvs_options} -q #{cmd}"
|
77
|
+
cmd
|
78
|
+
end
|
62
79
|
end
|
63
80
|
end
|
64
81
|
|
82
|
+
|
65
83
|
module Wiki2Go
|
66
84
|
class RepositoryMaker
|
67
85
|
|
@@ -215,11 +233,6 @@ module Wiki2Go
|
|
215
233
|
# output << "Add #{name} in #{dir} ? => #{checkin}"
|
216
234
|
checkin
|
217
235
|
}
|
218
|
-
added_files += add_contents_of(modulename,File.join(wikidir,'site'),'html') { |dir,name|
|
219
|
-
checkin = ((name == 'rss.xml' || (name =~ /^\./)) ? false : true)
|
220
|
-
output << "Add #{name} in #{dir} ? => #{checkin}"
|
221
|
-
checkin
|
222
|
-
}
|
223
236
|
|
224
237
|
sitedir = File.join(wikidir,'site')
|
225
238
|
if File.exists?(sitedir) then
|
@@ -231,6 +244,14 @@ module Wiki2Go
|
|
231
244
|
end
|
232
245
|
end
|
233
246
|
|
247
|
+
added_files += add_contents_of(modulename,File.join(wikidir,'site'),'html') { |dir,name|
|
248
|
+
checkin = ((name == 'rss.xml' || (name =~ /^\./)) ? false : true)
|
249
|
+
# output << "Add #{name} in #{dir} ? => #{checkin}"
|
250
|
+
checkin
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
234
255
|
added_files += add_contents_of(modulename,wikidir,'config') { |dir,name|
|
235
256
|
checkin = ((name == 'chonqed_blacklist.txt' || (name =~ /^\./)) ? false : true)
|
236
257
|
# output << "Add #{name} in #{dir} ? => #{checkin}"
|
@@ -298,7 +319,7 @@ module Wiki2Go
|
|
298
319
|
end
|
299
320
|
return added
|
300
321
|
end
|
301
|
-
|
322
|
+
|
302
323
|
def dir_in_repository?(dir)
|
303
324
|
repository = RSCM::Cvs.new
|
304
325
|
repository.checkout_dir = dir
|
@@ -308,6 +329,7 @@ module Wiki2Go
|
|
308
329
|
|
309
330
|
def add_contents_of(modulename,dir,subdir,&proc)
|
310
331
|
return [] if !File.exists?(dir)
|
332
|
+
@logger.debug("add_contents of dir '#{dir}', subdir '#{subdir}'")
|
311
333
|
|
312
334
|
cvs = RSCM::Cvs.new(@dir,modulename)
|
313
335
|
cvs.checkout_dir = dir
|
data/test/TestRepositoryMaker.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
$:.unshift File.expand_path(File.join(File.dirname(__FILE__),'..','lib'))
|
4
4
|
|
5
5
|
require 'Wiki2Go/Install/make_repository.rb'
|
6
|
+
require 'Wiki2Go/Install/make_site.rb'
|
6
7
|
|
7
8
|
require 'test/unit'
|
8
9
|
require 'fileutils'
|
@@ -79,12 +80,25 @@ class TestRepositoryMaker < Test::Unit::TestCase
|
|
79
80
|
assert_equal 0,clashed.length
|
80
81
|
puts maker.add_wiki(site,'test','Commit update')
|
81
82
|
|
82
|
-
|
83
|
-
|
83
|
+
|
84
|
+
updated,clashed = maker.update(site2,'test')
|
84
85
|
assert_equal 0,updated.length
|
85
86
|
assert_equal 1,clashed.length
|
86
|
-
# puts maker.add_wiki(site2,'test','Commit second update')
|
87
|
-
|
87
|
+
# puts maker.add_wiki(site2,'test','Commit second update')
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_initial_commit_of_site
|
92
|
+
wiki_dir = work_directory('public_cvs_site')
|
93
|
+
args = ['-s', 'wiki2go.nayima.be' , '-w' , 'Wiki2Go' , '-t' , 'public', '-d' , wiki_dir]
|
94
|
+
Wiki2Go::Install.make_site(args)
|
95
|
+
|
96
|
+
repository = work_directory('repository3')
|
97
|
+
maker = Wiki2Go::RepositoryMaker.new(repository)
|
98
|
+
maker.make_empty_repository ENV['USER'],ENV['USER']
|
99
|
+
maker.add_module('test_commit_wiki',ENV['USER'],ENV['USER'])
|
100
|
+
|
101
|
+
maker.add_wiki(wiki_dir,'test_commit_wiki','No Comment')
|
88
102
|
end
|
89
103
|
|
90
104
|
private
|
metadata
CHANGED
@@ -3,15 +3,17 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: Wiki2Go
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.16.
|
7
|
-
date: 2005-09-
|
6
|
+
version: 1.16.1
|
7
|
+
date: 2005-09-04 00:00:00 +02:00
|
8
8
|
summary: Wiki2Go is a Ruby Wiki
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: pvc@nayima.be
|
12
12
|
homepage: http://wiki2go.rubyforge.org
|
13
13
|
rubyforge_project: wiki2go
|
14
|
-
description: Wiki2Go is a Ruby Wiki
|
14
|
+
description: "Wiki2Go is a Ruby Wiki with the usual features plus anti-wikispam tools, graph
|
15
|
+
drawing and ruby code formatting extensions and can optionally be backed by a
|
16
|
+
CVS repository"
|
15
17
|
autorequire: Wiki2Go
|
16
18
|
default_executable:
|
17
19
|
bindir: bin
|