narf 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +8 -0
- data/lib/web/wiki.rb +6 -3
- data/lib/web/wiki.rb~ +24 -13
- data/narf.gemspec +1 -1
- data/narf.gemspec~ +1 -1
- data/scripts/makedist.rb~ +49 -0
- metadata +3 -6
- data/README~ +0 -124
- data/bug.rb +0 -9
- data/build.rb~ +0 -314
- data/narf-0.5.1.gem +0 -0
data/ChangeLog
CHANGED
@@ -1,4 +1,12 @@
|
|
1
1
|
------------------------------------------------------------------------
|
2
|
+
rev 65: patsplat | 2004-11-03 01:15:05 -0500 (Wed, 03 Nov 2004) | 1 line
|
3
|
+
|
4
|
+
Updated ChangeLog for 0.6.1
|
5
|
+
------------------------------------------------------------------------
|
6
|
+
rev 64: patsplat | 2004-11-03 01:03:41 -0500 (Wed, 03 Nov 2004) | 1 line
|
7
|
+
|
8
|
+
testing code made it too far
|
9
|
+
------------------------------------------------------------------------
|
2
10
|
rev 62: patsplat | 2004-11-03 00:39:47 -0500 (Wed, 03 Nov 2004) | 1 line
|
3
11
|
|
4
12
|
Updated ChangeLog for 0.6.0
|
data/lib/web/wiki.rb
CHANGED
@@ -77,7 +77,7 @@ module Web
|
|
77
77
|
# executing ruby for every single image. Make these files
|
78
78
|
# accessible online and tell NARF where to find them, and
|
79
79
|
# things should run more quickly.
|
80
|
-
#
|
80
|
+
#
|
81
81
|
# == Credits
|
82
82
|
# Web::Wiki must extend its thanks to these very, very useful projects:
|
83
83
|
#
|
@@ -229,15 +229,18 @@ module Web
|
|
229
229
|
rc = more_news
|
230
230
|
rc = rc.unshift(rcpage) unless rcpage.comment.empty?
|
231
231
|
rc.pop if rc.size > Page::max_revisions
|
232
|
+
|
233
|
+
yaml = rc.to_yaml
|
232
234
|
File.open( store_dir + "/more_news.yaml", "w" ) { |f|
|
233
|
-
|
235
|
+
f.write(yaml)
|
234
236
|
}
|
235
237
|
|
236
238
|
comment = page.comment
|
237
239
|
# clear out comment now that we've saved more news
|
238
240
|
page.comment = ""
|
241
|
+
yaml = page.to_yaml
|
239
242
|
File.open( store( page.name ), "w" ) { |f|
|
240
|
-
|
243
|
+
f.write(yaml)
|
241
244
|
}
|
242
245
|
end
|
243
246
|
|
data/lib/web/wiki.rb~
CHANGED
@@ -4,6 +4,7 @@ require 'web/wiki/page'
|
|
4
4
|
require 'yaml'
|
5
5
|
require 'ftools'
|
6
6
|
require 'strscan'
|
7
|
+
require 'ipaddr'
|
7
8
|
|
8
9
|
module Web
|
9
10
|
# == Purpose
|
@@ -76,7 +77,7 @@ module Web
|
|
76
77
|
# executing ruby for every single image. Make these files
|
77
78
|
# accessible online and tell NARF where to find them, and
|
78
79
|
# things should run more quickly.
|
79
|
-
#
|
80
|
+
#
|
80
81
|
# == Credits
|
81
82
|
# Web::Wiki must extend its thanks to these very, very useful projects:
|
82
83
|
#
|
@@ -107,9 +108,7 @@ module Web
|
|
107
108
|
@@wiki ||= Wiki.new
|
108
109
|
end
|
109
110
|
|
110
|
-
# This is a deadly method, only use on a test wiki.
|
111
111
|
def Wiki.wipe #:nodoc:
|
112
|
-
wiki.wipe
|
113
112
|
@@wiki = nil
|
114
113
|
end
|
115
114
|
|
@@ -242,8 +241,9 @@ module Web
|
|
242
241
|
}
|
243
242
|
end
|
244
243
|
|
244
|
+
|
245
245
|
def store_basedir
|
246
|
-
if (
|
246
|
+
if ( vandal? )
|
247
247
|
Wiki.pref( "tarpit_dir" )
|
248
248
|
else
|
249
249
|
Wiki.pref( "store_dir" )
|
@@ -268,17 +268,28 @@ module Web
|
|
268
268
|
store_basedir
|
269
269
|
end
|
270
270
|
end
|
271
|
+
|
272
|
+
def vandal?
|
273
|
+
vandal = false
|
274
|
+
vandals.each do |pattern|
|
275
|
+
if pattern =~ ENV["REMOTE_ADDR"]
|
276
|
+
vandal = true
|
277
|
+
break
|
278
|
+
end
|
279
|
+
end
|
280
|
+
vandal
|
281
|
+
end
|
271
282
|
|
272
283
|
def vandals
|
273
|
-
if File.exists?( Wiki.pref("vandals") || "" )
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
284
|
+
@vandals ||= if File.exists?( Wiki.pref("vandals") || "" )
|
285
|
+
File.open( Wiki.pref("vandals") ) { |f|
|
286
|
+
f.to_a
|
287
|
+
}.collect{ |line|
|
288
|
+
/^#{line.chomp.strip.gsub(/"/, '')}/
|
289
|
+
}
|
290
|
+
else
|
291
|
+
[ ]
|
292
|
+
end
|
282
293
|
end
|
283
294
|
|
284
295
|
def exit_handler
|
data/narf.gemspec
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
spec = Gem::Specification.new do |s|
|
4
4
|
#### Basic information.
|
5
5
|
s.name = 'narf'
|
6
|
-
s.version = "0.6.
|
6
|
+
s.version = "0.6.2"
|
7
7
|
s.summary = <<-EOF
|
8
8
|
NARF is a replacement for and derivative of the Ruby CGI library. It exists to trivialize web development .
|
9
9
|
EOF
|
data/narf.gemspec~
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
spec = Gem::Specification.new do |s|
|
4
4
|
#### Basic information.
|
5
5
|
s.name = 'narf'
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.6.1"
|
7
7
|
s.summary = <<-EOF
|
8
8
|
NARF is a replacement for and derivative of the Ruby CGI library. It exists to trivialize web development .
|
9
9
|
EOF
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
NARF_SVN_SERVER = "http://svn.narf-lib.org/svn/narf"
|
4
|
+
|
5
|
+
require 'ftools'
|
6
|
+
|
7
|
+
if ARGV.size != 3
|
8
|
+
puts "Usage: ruby scripts/makedist.rb username password 1.2.3"
|
9
|
+
puts ""
|
10
|
+
puts " * username and password are your narf svn credentials"
|
11
|
+
puts " * 1.2.3 is the narf release number"
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
15
|
+
username = ARGV[0]
|
16
|
+
password = ARGV[1]
|
17
|
+
version = ARGV[2]
|
18
|
+
|
19
|
+
versiontag = "VERSION_#{version.gsub(/\./,'_')}"
|
20
|
+
|
21
|
+
svn = "svn --username #{username} --password #{ password }"
|
22
|
+
|
23
|
+
system( "#{svn} log > ChangeLog")
|
24
|
+
system( "#{svn} commit -m \"Updated ChangeLog for #{version}\"" )
|
25
|
+
system( "#{svn} delete #{NARF_SVN_SERVER}/releases/#{versiontag} -m \"Deleted any existing release branch for #{version}\"" )
|
26
|
+
system( "#{svn} copy #{NARF_SVN_SERVER}/trunk/ #{NARF_SVN_SERVER}/releases/#{versiontag} -m \"Created release branch for #{version}\"" )
|
27
|
+
|
28
|
+
Dir.mkdir( "../dist" ) unless( File.exists? "../dist" )
|
29
|
+
system("rm -Rf ../dist/narf-#{version}")
|
30
|
+
Dir.chdir("../dist")
|
31
|
+
|
32
|
+
system("#{svn} export #{NARF_SVN_SERVER}/releases/#{versiontag} narf-#{version}" )
|
33
|
+
|
34
|
+
system("cd narf-#{version}; ruby build.rb rdoc");
|
35
|
+
system("tar cvzf narf-#{version}.tgz narf-#{version}")
|
36
|
+
system("ncftpput upload.sourceforge.net incoming narf-#{version}.tgz")
|
37
|
+
|
38
|
+
# old stuff
|
39
|
+
#system("cvs2cl.pl -T --hide-filenames")
|
40
|
+
#system("cvs commit -m \"Updated ChangeLog\"")
|
41
|
+
#system("cvs -d :ext:pinetops@cvs.narf-lib.sourceforge.net:/cvsroot/narf-lib rtag -FD now #{versiontag} cgi-install.rb")
|
42
|
+
#Dir.chdir("../dist")
|
43
|
+
#system("cvs -d :ext:pinetops@cvs.narf-lib.sourceforge.net:/cvsroot/narf-lib export -r #{versiontag} -d narf-#{version} cgi-install.rb ")
|
44
|
+
# end old stuff
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: narf
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.6.
|
7
|
-
date: 2004-11-
|
6
|
+
version: 0.6.2
|
7
|
+
date: 2004-11-11
|
8
8
|
summary: NARF is a replacement for and derivative of the Ruby CGI library. It exists to trivialize web development .
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -27,9 +27,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
27
27
|
platform: ruby
|
28
28
|
files:
|
29
29
|
- bin
|
30
|
-
- bug.rb
|
31
30
|
- build.rb
|
32
|
-
- build.rb~
|
33
31
|
- ChangeLog
|
34
32
|
- config.save
|
35
33
|
- doc
|
@@ -37,12 +35,10 @@ files:
|
|
37
35
|
- install.rb
|
38
36
|
- InstalledFiles
|
39
37
|
- lib
|
40
|
-
- narf-0.5.1.gem
|
41
38
|
- narf.gemspec
|
42
39
|
- narf.gemspec~
|
43
40
|
- pre-setup.rb
|
44
41
|
- README
|
45
|
-
- README~
|
46
42
|
- sapi
|
47
43
|
- scripts
|
48
44
|
- test
|
@@ -624,6 +620,7 @@ files:
|
|
624
620
|
- sapi/webrick/run_webrick.rb~
|
625
621
|
- scripts/dump.rb
|
626
622
|
- scripts/makedist.rb
|
623
|
+
- scripts/makedist.rb~
|
627
624
|
- scripts/upload.html
|
628
625
|
- scripts/uri
|
629
626
|
- scripts/uri.rb
|
data/README~
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
=== Purpose
|
2
|
-
|
3
|
-
NARF is a replacement for, and derivative of, the Ruby CGI
|
4
|
-
library. It exists one reason:
|
5
|
-
|
6
|
-
* To trivialize web development
|
7
|
-
|
8
|
-
We hope that these 3 lines of development will accomplish our task:
|
9
|
-
|
10
|
-
* To provide a clean API for writing Web applications.
|
11
|
-
|
12
|
-
* To make it very easy to write testable Web applications (using
|
13
|
-
Web::Testing), and provide a template system (Web::Narflates).
|
14
|
-
|
15
|
-
* To test the above goals by developing integrated, high quality,
|
16
|
-
configurable versions of common web apps in a simple and easy
|
17
|
-
to use manner. The heart of http://www.narf-lib.org, Web::Wiki
|
18
|
-
is an easy to use wiki. Not the only one, but it does make
|
19
|
-
us eat our own dogfood :-)
|
20
|
-
|
21
|
-
NARF does all of this as a regular CGI application. It also runs in-process under fastcgi, mod_ruby, and webrick. View these files for details:
|
22
|
-
|
23
|
-
* sapi/fastcgi/INSTALL.txt
|
24
|
-
* sapi/mod_ruby/INSTALL.txt
|
25
|
-
* sapi/webrick/INSTALL.txt
|
26
|
-
|
27
|
-
=== Installation
|
28
|
-
|
29
|
-
Run the installer for NARF:
|
30
|
-
|
31
|
-
ruby build.rb test (optional)
|
32
|
-
|
33
|
-
ruby install.rb config
|
34
|
-
ruby install.rb setup
|
35
|
-
ruby install.rb install
|
36
|
-
|
37
|
-
=== Dependencies
|
38
|
-
|
39
|
-
NARF requires the following packages on ruby 1.6. These packages are included in ruby 1.8:
|
40
|
-
|
41
|
-
testunit (unit testing framework):
|
42
|
-
http://testunit.talbott.ws/packages/testunit-0.1.6.tar.gz
|
43
|
-
|
44
|
-
strscan (string scanner library):
|
45
|
-
http://www.loveruby.net/archive/strscan/strscan-0.6.5.tar.gz
|
46
|
-
|
47
|
-
You can use raa-install (http://www.ruby-lang.org/raa/list.rhtml?id=729) for
|
48
|
-
this:
|
49
|
-
raa-install -i testunit
|
50
|
-
raa-install -i strscan
|
51
|
-
|
52
|
-
=== Hello World
|
53
|
-
|
54
|
-
require 'web'
|
55
|
-
Web << 'Hello World'
|
56
|
-
|
57
|
-
=== Testing an App
|
58
|
-
|
59
|
-
If you haven't noticed, NARF has a cgi style api. It's also has a testing api. Given these files:
|
60
|
-
|
61
|
-
script.rb
|
62
|
-
test.rb
|
63
|
-
|
64
|
-
where script.rb is:
|
65
|
-
|
66
|
-
#!/usr/bin/ruby
|
67
|
-
require 'web'
|
68
|
-
|
69
|
-
Web << "param is #{Web["param"]}"
|
70
|
-
|
71
|
-
and test.rb is:
|
72
|
-
|
73
|
-
require 'web'
|
74
|
-
require 'test/unit'
|
75
|
-
|
76
|
-
class MyAppTest < Test::Unit::TestCase
|
77
|
-
include Web::Testing
|
78
|
-
|
79
|
-
def test_prints_content
|
80
|
-
do_request "script.rb", "param" => "THIS!"
|
81
|
-
assert_content "param is THIS!"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
Do this to run tests:
|
86
|
-
|
87
|
-
ruby test.rb
|
88
|
-
|
89
|
-
See Web::Testing for more examples.
|
90
|
-
|
91
|
-
=== Websites
|
92
|
-
|
93
|
-
Home page:
|
94
|
-
http://www.narf-lib.org
|
95
|
-
|
96
|
-
Project info page, including downloads and CVS instructions:
|
97
|
-
http://www.sourceforge.net/projects/narf-lib
|
98
|
-
|
99
|
-
=== Credits
|
100
|
-
|
101
|
-
Narf was written by Tom Clarke and Patrick May, partly based on cgi.rb
|
102
|
-
written by Wakou Aoyama. It makes significant use of ruby-htmltools,
|
103
|
-
written by Ned Konz. Also, Keunwoo Lee patched Request.read_multipart
|
104
|
-
to be cleaner.
|
105
|
-
|
106
|
-
NARF contains code from the following projects, and we are in their debt:
|
107
|
-
|
108
|
-
ruby-htmltools::
|
109
|
-
This is a Ruby library for building trees representing HTML structure.
|
110
|
-
http://bike-nomad.com/ruby
|
111
|
-
sgml-parser::
|
112
|
-
The html-parser package is a variant language implementation of the
|
113
|
-
Python's SGML parser (sgmllib.py), HTML parser (htmllib.py) and
|
114
|
-
Formatter (formatter.py).
|
115
|
-
http://www.jin.gr.jp/%7Enahi/Ruby/html-parser/README.html
|
116
|
-
webunit::
|
117
|
-
WebUnit is Ruby API for testing html/cgi without browser, and is
|
118
|
-
idealy suited for automated unit testing of web sites when combined
|
119
|
-
with a Ruby unit test framework such as RubyUnit. It was designed
|
120
|
-
and implemented by Masaki Suketa.
|
121
|
-
http://www.xpenguin.biz/download/webunit/index-en.html
|
122
|
-
|
123
|
-
Thanks also go to http://www.sourceforge.net for hosting the
|
124
|
-
project's CVS and website
|
data/bug.rb
DELETED
data/build.rb~
DELETED
@@ -1,314 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# require 'stringio'
|
4
|
-
|
5
|
-
# GC.disable
|
6
|
-
require 'ftools'
|
7
|
-
require 'find'
|
8
|
-
|
9
|
-
def temp_dir
|
10
|
-
(ENV["TEMP"] || "/tmp").gsub(/\\+/, "/")
|
11
|
-
end
|
12
|
-
|
13
|
-
def make_temp( path )
|
14
|
-
File.join( temp_dir, path)
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
def File.rm_rf( path )
|
20
|
-
if File.exists? path
|
21
|
-
doomed = []
|
22
|
-
Find.find( path ) { |filename|
|
23
|
-
doomed.push filename
|
24
|
-
}
|
25
|
-
doomed.reverse.each{ |filename|
|
26
|
-
if File.directory? filename
|
27
|
-
Dir.rmdir( filename )
|
28
|
-
else
|
29
|
-
File.delete( filename )
|
30
|
-
end
|
31
|
-
}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
module Test
|
36
|
-
module Unit
|
37
|
-
class TestCase
|
38
|
-
@@subclasses = []
|
39
|
-
|
40
|
-
def TestCase.inherited(sub)
|
41
|
-
@@subclasses.push sub
|
42
|
-
end
|
43
|
-
|
44
|
-
def TestCase.all_suite
|
45
|
-
suite = Test::Unit::TestSuite.new
|
46
|
-
@@subclasses.each{ |sub|
|
47
|
-
suite << sub.suite # te
|
48
|
-
}
|
49
|
-
suite
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
class Target
|
56
|
-
@@targets = {}
|
57
|
-
def Target.run(name="")
|
58
|
-
if (keys.include? name)
|
59
|
-
@@targets[name].run
|
60
|
-
else
|
61
|
-
help_text
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def Target.keys
|
66
|
-
@@targets.keys.sort
|
67
|
-
end
|
68
|
-
|
69
|
-
def Target.first
|
70
|
-
keys.first
|
71
|
-
end
|
72
|
-
|
73
|
-
def Target.justify
|
74
|
-
justify = 0
|
75
|
-
|
76
|
-
keys.each { |key|
|
77
|
-
justify = key.length if (key.length > justify)
|
78
|
-
}
|
79
|
-
|
80
|
-
justify + 1
|
81
|
-
end
|
82
|
-
|
83
|
-
def Target.help_text
|
84
|
-
text = "Usage: ruby build.rb [ #{ keys.join( " | ") } ]" + $/
|
85
|
-
text += @@targets[keys.first].help_text( "Options: ", justify )
|
86
|
-
keys.slice(1...keys.length).each{ |key|
|
87
|
-
text += @@targets[key].help_text( " ", justify )
|
88
|
-
}
|
89
|
-
puts text
|
90
|
-
end
|
91
|
-
|
92
|
-
attr_reader :name, :description
|
93
|
-
def initialize( name, description, &run )
|
94
|
-
@name = name
|
95
|
-
@description = description
|
96
|
-
@run = run || Target.method(:help_text)
|
97
|
-
@@targets[name] = self
|
98
|
-
end
|
99
|
-
|
100
|
-
def run
|
101
|
-
$stderr.puts "Target: " + name + " | " + description
|
102
|
-
@run.call
|
103
|
-
end
|
104
|
-
|
105
|
-
def help_text( prefix, justify )
|
106
|
-
prefix + name.ljust(justify) + " -- " + description + $/
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
Target.new( "upload_doc", "upload doc" ) {
|
111
|
-
Target.run( "rdoc" )
|
112
|
-
`scp -r doc/rdoc/* patsplat@ssh.narf-lib.org:~/narf-lib.org/doc`
|
113
|
-
}
|
114
|
-
|
115
|
-
Target.new( "rdoc", "build rdoc" ) {
|
116
|
-
begin
|
117
|
-
require 'rdoc/rdoc'
|
118
|
-
|
119
|
-
rdoc = RDoc::RDoc.new
|
120
|
-
rdoc.document( [
|
121
|
-
# set the output directory
|
122
|
-
"-o",
|
123
|
-
"doc/rdoc/",
|
124
|
-
|
125
|
-
# set the main page
|
126
|
-
"--main",
|
127
|
-
"README",
|
128
|
-
|
129
|
-
# list the files to be excluded
|
130
|
-
"--exclude",
|
131
|
-
/htmltools|htmlparser|unit|writableio|tagparser|strscanparser|web\/action|assertinclude|buffer|formreader|forms|runner|simpledispatcher|traceoutput|linker|page|lib\/web\/sapi/,
|
132
|
-
|
133
|
-
# list the files / dirs to be parsed for documentation
|
134
|
-
"README",
|
135
|
-
"examples/examples.rdoc",
|
136
|
-
"lib/web.rb",
|
137
|
-
"lib/web",
|
138
|
-
"doc/apache_cgi.txt",
|
139
|
-
"doc/fastcgi.txt",
|
140
|
-
"doc/mod_ruby.txt",
|
141
|
-
"doc/webrick.txt"
|
142
|
-
|
143
|
-
] )
|
144
|
-
rescue LoadError => error
|
145
|
-
puts "Building the rdocs will require 'rdoc/rdoc'"
|
146
|
-
puts "visit http://rdoc.sourceforge.net/ to obtain this library"
|
147
|
-
end
|
148
|
-
}
|
149
|
-
|
150
|
-
Target.new( "test", "run narf unit tests" ) {
|
151
|
-
require 'test/unit'
|
152
|
-
require 'test/unit/ui/console/testrunner'
|
153
|
-
|
154
|
-
$:.replace(['lib'].concat($:))
|
155
|
-
|
156
|
-
require 'web'
|
157
|
-
|
158
|
-
Dir["test/*.rb"].each { |test|
|
159
|
-
require test
|
160
|
-
}
|
161
|
-
|
162
|
-
# buffered test runner is a custom made test runner
|
163
|
-
# that lives in the test dir
|
164
|
-
Test::Unit::UI::Console::TestRunner.new(Test::Unit::TestCase.all_suite
|
165
|
-
).start
|
166
|
-
}
|
167
|
-
|
168
|
-
Target.new( "testwiki", "test narf wiki" ) {
|
169
|
-
require 'test/unit'
|
170
|
-
require 'test/unit/ui/console/testrunner'
|
171
|
-
|
172
|
-
$:.replace(['./lib/'].concat($:))
|
173
|
-
|
174
|
-
require 'web'
|
175
|
-
require 'web/wiki'
|
176
|
-
|
177
|
-
def setup_wiki
|
178
|
-
File.rm_rf( Web::Wiki::store_dir )
|
179
|
-
end
|
180
|
-
|
181
|
-
alias :teardown_wiki :setup_wiki
|
182
|
-
|
183
|
-
Web::Wiki::set_pref(:store_dir => make_temp("test.pages/"),
|
184
|
-
:store_url => "../test.pages/",
|
185
|
-
:tarpit_dir => make_temp("tarpit/"),
|
186
|
-
:vandals => "vandals.test.txt",
|
187
|
-
:baseurl => "wiki.rb" )
|
188
|
-
Web.set_docroot( File.join(Dir.pwd,"examples") )
|
189
|
-
|
190
|
-
# a bunch of the illustration_page functions don't work on windows
|
191
|
-
#require 'test/wiki/test.illustration_page.rb'
|
192
|
-
Dir["test/wiki/*.rb"].each { |test|
|
193
|
-
require test
|
194
|
-
}
|
195
|
-
#require 'test/wiki/test.wiki.rb'
|
196
|
-
|
197
|
-
# buffered test runner is a custom made test runner
|
198
|
-
# that lives in the test dir
|
199
|
-
Test::Unit::UI::Console::TestRunner.new(Test::Unit::TestCase.all_suite).start
|
200
|
-
|
201
|
-
}
|
202
|
-
|
203
|
-
Target.new( "testwebunit", "test web unit" ) {
|
204
|
-
$: << "lib"
|
205
|
-
ENV['URLBASE'] = ARGV[1] || "http://www.hexane.org/webtest/"
|
206
|
-
|
207
|
-
require 'web/unit/runtest'
|
208
|
-
|
209
|
-
Web::Unit.runtest(Dir["test/webunit/test*.rb"])
|
210
|
-
}
|
211
|
-
|
212
|
-
Target.new( "testexamples", "test narf examples" ) {
|
213
|
-
require 'test/unit'
|
214
|
-
require 'test/unit/ui/console/testrunner'
|
215
|
-
|
216
|
-
$:.replace(['./lib/'].concat($:))
|
217
|
-
|
218
|
-
require 'web'
|
219
|
-
require 'web/wiki'
|
220
|
-
|
221
|
-
Web.set_docroot File.join(Dir.pwd,"examples")
|
222
|
-
|
223
|
-
Dir["examples/test/*.rb"].each { |test|
|
224
|
-
require test
|
225
|
-
}
|
226
|
-
|
227
|
-
# buffered test runner is a custom made test runner
|
228
|
-
# that lives in the test dir
|
229
|
-
Test::Unit::UI::Console::TestRunner.new(Test::Unit::TestCase.all_suite ).start
|
230
|
-
}
|
231
|
-
|
232
|
-
|
233
|
-
def install_dir
|
234
|
-
$:.find { |dir|
|
235
|
-
/site_ruby\/\d.\d\z/ =~ dir
|
236
|
-
} + "/"
|
237
|
-
end
|
238
|
-
|
239
|
-
FILES = [ "web",
|
240
|
-
"web.rb",
|
241
|
-
"web/action.rb",
|
242
|
-
"web/assertinclude.rb",
|
243
|
-
"web/buffer.rb",
|
244
|
-
"web/request.rb",
|
245
|
-
"web/session.rb",
|
246
|
-
"web/template.rb",
|
247
|
-
"web/writableio.rb",
|
248
|
-
"web/rhp.rb" ]
|
249
|
-
|
250
|
-
OLD_FILES = [ "web",
|
251
|
-
"narf.rb",
|
252
|
-
"narf/app.rb",
|
253
|
-
"narf/assertinclude.rb",
|
254
|
-
"narf/buffer.rb",
|
255
|
-
"narf/request.rb",
|
256
|
-
"narf/session.rb",
|
257
|
-
"narf/template.rb",
|
258
|
-
"narf/writableio.rb" ]
|
259
|
-
|
260
|
-
Target.new( "uninstall", "delete narf files from site_ruby" ){
|
261
|
-
|
262
|
-
file_list = (FILES.reverse | OLD_FILES.reverse ).collect{|file|
|
263
|
-
install_dir + file
|
264
|
-
}
|
265
|
-
|
266
|
-
file_list.push( "/usr/bin/rhp")
|
267
|
-
|
268
|
-
file_list.each{ |file|
|
269
|
-
if File.exists? file
|
270
|
-
if File.stat(file).directory?
|
271
|
-
Dir.delete file
|
272
|
-
else
|
273
|
-
File.delete file
|
274
|
-
end
|
275
|
-
end
|
276
|
-
}
|
277
|
-
}
|
278
|
-
|
279
|
-
Target.new( "compile_narf_runner", "" ) {
|
280
|
-
Dir.mkdir "bin" unless File.exists? "bin"
|
281
|
-
narf_c = File.open( 'sapi/apache_cgi/src/narf.c', 'r' ) { |f|
|
282
|
-
f.read
|
283
|
-
}
|
284
|
-
require 'rbconfig'
|
285
|
-
narf_c.gsub!( /(ruby)/, Config::CONFIG["bindir"] + "/ruby" )
|
286
|
-
File.open( 'sapi/apache_cgi/src/narf-path_adjusted.c', 'wb') { |f|
|
287
|
-
f.write(narf_c)
|
288
|
-
}
|
289
|
-
`gcc sapi/apache_cgi/src/narf-path_adjusted.c -o sapi/apache_cgi/bin/narf`
|
290
|
-
}
|
291
|
-
|
292
|
-
Target.new( "install", "install narf in site ruby" ){
|
293
|
-
|
294
|
-
Target.run( "uninstall" )
|
295
|
-
Target.run( "compile_rhp" )
|
296
|
-
|
297
|
-
FILES.each{ |file|
|
298
|
-
from, to = "lib/" + file, install_dir + file
|
299
|
-
|
300
|
-
if (File.stat(from).directory?)
|
301
|
-
unless File.exists? to
|
302
|
-
puts "Creating #{to}"
|
303
|
-
Dir.mkdir to
|
304
|
-
end
|
305
|
-
else
|
306
|
-
puts "#{ from } => #{ to }...\n"
|
307
|
-
File.copy( from, to )
|
308
|
-
end
|
309
|
-
}
|
310
|
-
|
311
|
-
File.copy( "rhp", "/usr/bin/rhp" )
|
312
|
-
}
|
313
|
-
|
314
|
-
Target.run( ARGV[0] ) if ($0 == __FILE__)
|
data/narf-0.5.1.gem
DELETED
Binary file
|