arrow 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1590 -0
- data/LICENSE +28 -0
- data/README +75 -0
- data/Rakefile +366 -0
- data/Rakefile.local +63 -0
- data/data/arrow/applets/TEMPLATE.rb.tpl +53 -0
- data/data/arrow/applets/args.rb +50 -0
- data/data/arrow/applets/config.rb +55 -0
- data/data/arrow/applets/error.rb +63 -0
- data/data/arrow/applets/files.rb +46 -0
- data/data/arrow/applets/inspect.rb +46 -0
- data/data/arrow/applets/nosuchapplet.rb +31 -0
- data/data/arrow/applets/status.rb +92 -0
- data/data/arrow/applets/test.rb +133 -0
- data/data/arrow/applets/tutorial/counter.rb +96 -0
- data/data/arrow/applets/tutorial/dingus.rb +67 -0
- data/data/arrow/applets/tutorial/hello.rb +34 -0
- data/data/arrow/applets/tutorial/hello2.rb +73 -0
- data/data/arrow/applets/tutorial/imgtext.rb +90 -0
- data/data/arrow/applets/tutorial/imgtext2.rb +286 -0
- data/data/arrow/applets/tutorial/index.rb +36 -0
- data/data/arrow/applets/tutorial/logo.rb +98 -0
- data/data/arrow/applets/tutorial/memcache.rb +61 -0
- data/data/arrow/applets/tutorial/missing.rb +37 -0
- data/data/arrow/applets/tutorial/protected.rb +100 -0
- data/data/arrow/applets/tutorial/redirector.rb +52 -0
- data/data/arrow/applets/tutorial/rndimages.rb +159 -0
- data/data/arrow/applets/tutorial/sharenotes.rb +83 -0
- data/data/arrow/applets/tutorial/subclassed-hello.rb +32 -0
- data/data/arrow/applets/tutorial/superhello.rb +72 -0
- data/data/arrow/applets/tutorial/timeclock.rb +78 -0
- data/data/arrow/applets/view-applet.rb +123 -0
- data/data/arrow/applets/view-template.rb +85 -0
- data/data/arrow/applets/wiki.rb +274 -0
- data/data/arrow/templates/TEMPLATE.tmpl.tpl +36 -0
- data/data/arrow/templates/applet-status.tmpl +153 -0
- data/data/arrow/templates/args-display.tmpl +120 -0
- data/data/arrow/templates/config/display-table.tmpl +36 -0
- data/data/arrow/templates/config/display.tmpl +36 -0
- data/data/arrow/templates/counter-deleted.tmpl +33 -0
- data/data/arrow/templates/counter.tmpl +59 -0
- data/data/arrow/templates/dingus.tmpl +55 -0
- data/data/arrow/templates/enumtable.tmpl +8 -0
- data/data/arrow/templates/error-display.tmpl +92 -0
- data/data/arrow/templates/filemap.tmpl +89 -0
- data/data/arrow/templates/hello-world-src.tmpl +34 -0
- data/data/arrow/templates/hello-world.tmpl +60 -0
- data/data/arrow/templates/imgtext/fontlist.tmpl +46 -0
- data/data/arrow/templates/imgtext/form.tmpl +70 -0
- data/data/arrow/templates/imgtext/reload-error.tmpl +40 -0
- data/data/arrow/templates/imgtext/reload.tmpl +55 -0
- data/data/arrow/templates/inspect/display.tmpl +80 -0
- data/data/arrow/templates/loginform.tmpl +64 -0
- data/data/arrow/templates/logout.tmpl +32 -0
- data/data/arrow/templates/memcache/display.tmpl +41 -0
- data/data/arrow/templates/navbar.incl +27 -0
- data/data/arrow/templates/nosuchapplet.tmpl +32 -0
- data/data/arrow/templates/printsource.tmpl +35 -0
- data/data/arrow/templates/protected.tmpl +36 -0
- data/data/arrow/templates/rndimages.tmpl +38 -0
- data/data/arrow/templates/service-response.tmpl +13 -0
- data/data/arrow/templates/sharenotes/display.tmpl +38 -0
- data/data/arrow/templates/status.tmpl +120 -0
- data/data/arrow/templates/templateviewer.tmpl +43 -0
- data/data/arrow/templates/test/harness.tmpl +57 -0
- data/data/arrow/templates/test/list.tmpl +48 -0
- data/data/arrow/templates/test/problem.tmpl +42 -0
- data/data/arrow/templates/tutorial/index.tmpl +37 -0
- data/data/arrow/templates/tutorial/missingapplet.tmpl +29 -0
- data/data/arrow/templates/view-applet-nosuch.tmpl +32 -0
- data/data/arrow/templates/view-applet.tmpl +40 -0
- data/data/arrow/templates/view-template.tmpl +83 -0
- data/data/arrow/templates/wiki/formerror.tmpl +47 -0
- data/data/arrow/templates/wiki/markup_help.incl +6 -0
- data/data/arrow/templates/wiki/new.tmpl +56 -0
- data/data/arrow/templates/wiki/new_system.tmpl +122 -0
- data/data/arrow/templates/wiki/sectionlist.tmpl +43 -0
- data/data/arrow/templates/wiki/show.tmpl +34 -0
- data/docs/manual/layouts/default.page +43 -0
- data/docs/manual/lib/api-filter.rb +81 -0
- data/docs/manual/lib/editorial-filter.rb +64 -0
- data/docs/manual/lib/examples-filter.rb +244 -0
- data/docs/manual/lib/links-filter.rb +117 -0
- data/lib/apache/fakerequest.rb +448 -0
- data/lib/apache/logger.rb +33 -0
- data/lib/arrow.rb +51 -0
- data/lib/arrow/acceptparam.rb +207 -0
- data/lib/arrow/applet.rb +725 -0
- data/lib/arrow/appletmixins.rb +218 -0
- data/lib/arrow/appletregistry.rb +590 -0
- data/lib/arrow/applettestcase.rb +503 -0
- data/lib/arrow/broker.rb +255 -0
- data/lib/arrow/cache.rb +176 -0
- data/lib/arrow/config-loaders/yaml.rb +75 -0
- data/lib/arrow/config.rb +615 -0
- data/lib/arrow/constants.rb +24 -0
- data/lib/arrow/cookie.rb +359 -0
- data/lib/arrow/cookieset.rb +108 -0
- data/lib/arrow/dispatcher.rb +368 -0
- data/lib/arrow/dispatcherloader.rb +50 -0
- data/lib/arrow/exceptions.rb +61 -0
- data/lib/arrow/fallbackhandler.rb +48 -0
- data/lib/arrow/formvalidator.rb +631 -0
- data/lib/arrow/htmltokenizer.rb +343 -0
- data/lib/arrow/logger.rb +488 -0
- data/lib/arrow/logger/apacheoutputter.rb +69 -0
- data/lib/arrow/logger/arrayoutputter.rb +63 -0
- data/lib/arrow/logger/coloroutputter.rb +111 -0
- data/lib/arrow/logger/fileoutputter.rb +96 -0
- data/lib/arrow/logger/htmloutputter.rb +54 -0
- data/lib/arrow/logger/outputter.rb +123 -0
- data/lib/arrow/mixins.rb +425 -0
- data/lib/arrow/monkeypatches.rb +94 -0
- data/lib/arrow/object.rb +117 -0
- data/lib/arrow/path.rb +196 -0
- data/lib/arrow/service.rb +447 -0
- data/lib/arrow/session.rb +289 -0
- data/lib/arrow/session/dbstore.rb +100 -0
- data/lib/arrow/session/filelock.rb +160 -0
- data/lib/arrow/session/filestore.rb +132 -0
- data/lib/arrow/session/id.rb +98 -0
- data/lib/arrow/session/lock.rb +253 -0
- data/lib/arrow/session/md5id.rb +42 -0
- data/lib/arrow/session/nulllock.rb +42 -0
- data/lib/arrow/session/posixlock.rb +166 -0
- data/lib/arrow/session/sha1id.rb +54 -0
- data/lib/arrow/session/store.rb +366 -0
- data/lib/arrow/session/usertrackid.rb +52 -0
- data/lib/arrow/spechelpers.rb +73 -0
- data/lib/arrow/template.rb +713 -0
- data/lib/arrow/template/attr.rb +31 -0
- data/lib/arrow/template/call.rb +31 -0
- data/lib/arrow/template/comment.rb +33 -0
- data/lib/arrow/template/container.rb +118 -0
- data/lib/arrow/template/else.rb +41 -0
- data/lib/arrow/template/elsif.rb +44 -0
- data/lib/arrow/template/escape.rb +53 -0
- data/lib/arrow/template/export.rb +87 -0
- data/lib/arrow/template/for.rb +145 -0
- data/lib/arrow/template/if.rb +78 -0
- data/lib/arrow/template/import.rb +119 -0
- data/lib/arrow/template/include.rb +206 -0
- data/lib/arrow/template/iterator.rb +208 -0
- data/lib/arrow/template/nodes.rb +734 -0
- data/lib/arrow/template/parser.rb +571 -0
- data/lib/arrow/template/prettyprint.rb +53 -0
- data/lib/arrow/template/render.rb +191 -0
- data/lib/arrow/template/selectlist.rb +94 -0
- data/lib/arrow/template/set.rb +87 -0
- data/lib/arrow/template/timedelta.rb +81 -0
- data/lib/arrow/template/unless.rb +78 -0
- data/lib/arrow/template/urlencode.rb +51 -0
- data/lib/arrow/template/yield.rb +139 -0
- data/lib/arrow/templatefactory.rb +125 -0
- data/lib/arrow/testcase.rb +567 -0
- data/lib/arrow/transaction.rb +608 -0
- data/rake/191_compat.rb +26 -0
- data/rake/dependencies.rb +76 -0
- data/rake/documentation.rb +114 -0
- data/rake/helpers.rb +502 -0
- data/rake/hg.rb +282 -0
- data/rake/manual.rb +787 -0
- data/rake/packaging.rb +129 -0
- data/rake/publishing.rb +278 -0
- data/rake/style.rb +62 -0
- data/rake/svn.rb +668 -0
- data/rake/testing.rb +187 -0
- data/rake/verifytask.rb +64 -0
- data/spec/arrow/acceptparam_spec.rb +157 -0
- data/spec/arrow/applet_spec.rb +575 -0
- data/spec/arrow/appletmixins_spec.rb +409 -0
- data/spec/arrow/appletregistry_spec.rb +294 -0
- data/spec/arrow/broker_spec.rb +153 -0
- data/spec/arrow/config_spec.rb +224 -0
- data/spec/arrow/cookieset_spec.rb +164 -0
- data/spec/arrow/dispatcher_spec.rb +137 -0
- data/spec/arrow/dispatcherloader_spec.rb +65 -0
- data/spec/arrow/formvalidator_spec.rb +781 -0
- data/spec/arrow/logger_spec.rb +346 -0
- data/spec/arrow/mixins_spec.rb +120 -0
- data/spec/arrow/service_spec.rb +645 -0
- data/spec/arrow/session_spec.rb +121 -0
- data/spec/arrow/template/iterator_spec.rb +222 -0
- data/spec/arrow/templatefactory_spec.rb +185 -0
- data/spec/arrow/transaction_spec.rb +319 -0
- data/spec/arrow_spec.rb +37 -0
- data/spec/lib/appletmatchers.rb +281 -0
- data/spec/lib/constants.rb +77 -0
- data/spec/lib/helpers.rb +41 -0
- data/spec/lib/matchers.rb +44 -0
- data/tests/cookie.tests.rb +310 -0
- data/tests/path.tests.rb +157 -0
- data/tests/session.tests.rb +111 -0
- data/tests/session_id.tests.rb +82 -0
- data/tests/session_lock.tests.rb +191 -0
- data/tests/session_store.tests.rb +53 -0
- data/tests/template.tests.rb +1360 -0
- metadata +339 -0
data/LICENSE
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Copyright (c) 2004-2010, Michael Granger
|
2
|
+
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
13
|
+
and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
* Neither the name of the author/s, nor the names of the project's
|
16
|
+
contributors may be used to endorse or promote products derived from this
|
17
|
+
software without specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
|
2
|
+
= Arrow
|
3
|
+
|
4
|
+
A web application framework for mod_ruby.
|
5
|
+
|
6
|
+
== Authors
|
7
|
+
|
8
|
+
* Michael Granger
|
9
|
+
* Dave McCorkhill
|
10
|
+
* Martin Chase
|
11
|
+
|
12
|
+
== Contributors
|
13
|
+
|
14
|
+
* Aaron Son
|
15
|
+
* Ben Bleything
|
16
|
+
* Kim Wallmark
|
17
|
+
* Mahlon E. Smith
|
18
|
+
|
19
|
+
== General Information
|
20
|
+
|
21
|
+
Arrow is a web application framework for mod_ruby. It was designed to make
|
22
|
+
development of web applications under Apache easier and more fun without
|
23
|
+
sacrificing the power of being able to access the native Apache API.
|
24
|
+
|
25
|
+
|
26
|
+
== Online Docs
|
27
|
+
|
28
|
+
We're working on a manual which will provide more comprehensive instructions
|
29
|
+
and an in-depth tutorial. You can view it at:
|
30
|
+
|
31
|
+
http://deveiate.org/code/Arrow-manual/
|
32
|
+
|
33
|
+
We'd be happy to hear your suggestions, bug reports, or complaints.
|
34
|
+
|
35
|
+
|
36
|
+
== Installation
|
37
|
+
|
38
|
+
=== Requirements
|
39
|
+
|
40
|
+
* *Apache* (2.2.x) - http://httpd.apache.org/
|
41
|
+
* *mod_ruby* (>= 1.3.0) - http://modruby.net/
|
42
|
+
|
43
|
+
=== (Non-Standard) Ruby Library Dependencies
|
44
|
+
|
45
|
+
If you use RubyGems, appropriate versions will be installed by the gem's
|
46
|
+
dependencies. Otherwise, you'll need to build and install these by hand:
|
47
|
+
|
48
|
+
* *ruby-cache* >= 0.3.0
|
49
|
+
* *formvalidator* >= 0.1.4
|
50
|
+
* *pluginfactory* >= 1.0.4
|
51
|
+
|
52
|
+
|
53
|
+
==== Installing From Source
|
54
|
+
|
55
|
+
If you wish to install Arrow as a conventional library from the source:
|
56
|
+
|
57
|
+
$ rake install
|
58
|
+
|
59
|
+
The install task will check for dependencies, install the libraries, and then offer some
|
60
|
+
advice about how to configure your server.
|
61
|
+
|
62
|
+
|
63
|
+
== Contact
|
64
|
+
|
65
|
+
* Project Page: http://deveiate.org/projects/Arrow
|
66
|
+
* IRC: irc://freenode.net/#arrow
|
67
|
+
|
68
|
+
|
69
|
+
== Legal
|
70
|
+
|
71
|
+
:include: LICENSE
|
72
|
+
|
73
|
+
---
|
74
|
+
|
75
|
+
See the LICENSE file included with the distribution for licensing details.
|
data/Rakefile
ADDED
@@ -0,0 +1,366 @@
|
|
1
|
+
#!rake -*- ruby -*-
|
2
|
+
#
|
3
|
+
# Arrow rakefile
|
4
|
+
#
|
5
|
+
# Based on various other Rakefiles, especially one by Ben Bleything
|
6
|
+
#
|
7
|
+
# Copyright (c) 2007-2010 The FaerieMUD Consortium
|
8
|
+
#
|
9
|
+
# Authors:
|
10
|
+
# * Michael Granger <ged@FaerieMUD.org>
|
11
|
+
#
|
12
|
+
|
13
|
+
BEGIN {
|
14
|
+
require 'rbconfig'
|
15
|
+
require 'pathname'
|
16
|
+
basedir = Pathname.new( __FILE__ ).dirname
|
17
|
+
|
18
|
+
libdir = basedir + "lib"
|
19
|
+
extdir = libdir + Config::CONFIG['sitearch']
|
20
|
+
|
21
|
+
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
22
|
+
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
|
23
|
+
}
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'readline'
|
27
|
+
include Readline
|
28
|
+
rescue LoadError
|
29
|
+
# Fall back to a plain prompt
|
30
|
+
def readline( text )
|
31
|
+
$stderr.print( text.chomp )
|
32
|
+
return $stdin.gets
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
begin
|
37
|
+
require 'rubygems'
|
38
|
+
rescue LoadError
|
39
|
+
module Gem
|
40
|
+
class Specification; end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
require 'rbconfig'
|
45
|
+
require 'rake'
|
46
|
+
require 'rake/testtask'
|
47
|
+
require 'rake/packagetask'
|
48
|
+
require 'rake/clean'
|
49
|
+
# require 'rake/191_compat.rb'
|
50
|
+
|
51
|
+
$dryrun = false
|
52
|
+
|
53
|
+
### Config constants
|
54
|
+
BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
|
55
|
+
BINDIR = BASEDIR + 'bin'
|
56
|
+
LIBDIR = BASEDIR + 'lib'
|
57
|
+
EXTDIR = BASEDIR + 'ext'
|
58
|
+
DOCSDIR = BASEDIR + 'docs'
|
59
|
+
PKGDIR = BASEDIR + 'pkg'
|
60
|
+
DATADIR = BASEDIR + 'data'
|
61
|
+
|
62
|
+
MANUALDIR = DOCSDIR + 'manual'
|
63
|
+
|
64
|
+
PROJECT_NAME = 'Arrow'
|
65
|
+
PKG_NAME = PROJECT_NAME.downcase
|
66
|
+
PKG_SUMMARY = 'A mod_ruby web application framework'
|
67
|
+
|
68
|
+
# Cruisecontrol stuff
|
69
|
+
CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
|
70
|
+
CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
|
71
|
+
|
72
|
+
VERSION_FILE = LIBDIR + 'arrow.rb'
|
73
|
+
if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
|
74
|
+
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
|
75
|
+
elsif VERSION_FILE.exist?
|
76
|
+
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
|
77
|
+
end
|
78
|
+
|
79
|
+
PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
|
80
|
+
|
81
|
+
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
|
82
|
+
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
|
83
|
+
|
84
|
+
# Universal VCS constants
|
85
|
+
DEFAULT_EDITOR = 'vi'
|
86
|
+
COMMIT_MSG_FILE = 'commit-msg.txt'
|
87
|
+
FILE_INDENT = " " * 12
|
88
|
+
LOG_INDENT = " " * 3
|
89
|
+
|
90
|
+
EXTCONF = EXTDIR + 'extconf.rb'
|
91
|
+
|
92
|
+
ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
|
93
|
+
|
94
|
+
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README* LICENSE] )
|
95
|
+
BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
|
96
|
+
LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
|
97
|
+
EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
|
98
|
+
DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
|
99
|
+
|
100
|
+
SPECDIR = BASEDIR + 'spec'
|
101
|
+
SPECLIBDIR = SPECDIR + 'lib'
|
102
|
+
SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
|
103
|
+
|
104
|
+
TESTDIR = BASEDIR + 'tests'
|
105
|
+
TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
|
106
|
+
|
107
|
+
RAKE_TASKDIR = BASEDIR + 'rake'
|
108
|
+
RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
|
109
|
+
PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
|
110
|
+
PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
|
111
|
+
|
112
|
+
RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
|
113
|
+
|
114
|
+
LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
|
115
|
+
|
116
|
+
EXTRA_PKGFILES = Rake::FileList.new
|
117
|
+
EXTRA_PKGFILES.include( "#{BASEDIR}/docs/manual/{layouts,lib,resources,source}/**" )
|
118
|
+
|
119
|
+
RELEASE_FILES = TEXT_FILES +
|
120
|
+
SPEC_FILES +
|
121
|
+
TEST_FILES +
|
122
|
+
BIN_FILES +
|
123
|
+
LIB_FILES +
|
124
|
+
EXT_FILES +
|
125
|
+
DATA_FILES +
|
126
|
+
RAKE_TASKLIBS +
|
127
|
+
EXTRA_PKGFILES
|
128
|
+
|
129
|
+
|
130
|
+
RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
|
131
|
+
|
132
|
+
RELEASE_ANNOUNCE_ADDRESSES = [
|
133
|
+
"Ruby-Talk List <ruby-talk@ruby-lang.org>",
|
134
|
+
"Mod Ruby List <modruby@modruby.net>",
|
135
|
+
]
|
136
|
+
|
137
|
+
COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
|
138
|
+
RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
|
139
|
+
RCOV_OPTS = [
|
140
|
+
'--exclude', RCOV_EXCLUDES,
|
141
|
+
'--xrefs',
|
142
|
+
'--save',
|
143
|
+
'--callsites',
|
144
|
+
#'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
|
145
|
+
]
|
146
|
+
|
147
|
+
|
148
|
+
### Load some task libraries that need to be loaded early
|
149
|
+
if !RAKE_TASKDIR.exist?
|
150
|
+
$stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
|
151
|
+
ans = readline( "for you? [y]" )
|
152
|
+
ans = 'y' if !ans.nil? && ans.empty?
|
153
|
+
|
154
|
+
if ans =~ /^y/i
|
155
|
+
$stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
|
156
|
+
system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
|
157
|
+
if ! $?.success?
|
158
|
+
fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
|
159
|
+
end
|
160
|
+
else
|
161
|
+
$stderr.puts "Then I'm afraid I can't continue. Best of luck."
|
162
|
+
fail "Rake tasklibs not present."
|
163
|
+
end
|
164
|
+
|
165
|
+
RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
|
166
|
+
end
|
167
|
+
|
168
|
+
require RAKE_TASKDIR + 'helpers.rb'
|
169
|
+
include RakefileHelpers
|
170
|
+
|
171
|
+
# Set the build ID if the mercurial executable is available
|
172
|
+
if hg = which( 'hg' )
|
173
|
+
id = `#{hg} id -n`.chomp
|
174
|
+
PKG_BUILD = "pre%03d" % [(id.chomp[ /^[[:xdigit:]]+/ ] || '1')]
|
175
|
+
else
|
176
|
+
PKG_BUILD = 'pre000'
|
177
|
+
end
|
178
|
+
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
|
179
|
+
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
180
|
+
|
181
|
+
# Documentation constants
|
182
|
+
API_DOCSDIR = DOCSDIR + 'api'
|
183
|
+
README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
|
184
|
+
RDOC_OPTIONS = [
|
185
|
+
'--tab-width=4',
|
186
|
+
'--show-hash',
|
187
|
+
'--include', BASEDIR.to_s,
|
188
|
+
"--main=#{README_FILE}",
|
189
|
+
"--title=#{PKG_NAME}",
|
190
|
+
]
|
191
|
+
YARD_OPTIONS = [
|
192
|
+
'--use-cache',
|
193
|
+
'--no-private',
|
194
|
+
'--protected',
|
195
|
+
'-r', README_FILE,
|
196
|
+
'--exclude', 'extconf\\.rb',
|
197
|
+
'--files', 'ChangeLog,LICENSE',
|
198
|
+
'--output-dir', API_DOCSDIR.to_s,
|
199
|
+
'--title', "#{PKG_NAME} #{PKG_VERSION}",
|
200
|
+
]
|
201
|
+
|
202
|
+
# Release constants
|
203
|
+
SMTP_HOST = "mail.faeriemud.org"
|
204
|
+
SMTP_PORT = 465 # SMTP + SSL
|
205
|
+
|
206
|
+
# Project constants
|
207
|
+
PROJECT_HOST = 'deveiate'
|
208
|
+
PROJECT_PUBDIR = '/usr/local/www/public/code'
|
209
|
+
PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
|
210
|
+
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
|
211
|
+
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
|
212
|
+
|
213
|
+
# Gem dependencies: gemname => version
|
214
|
+
DEPENDENCIES = {
|
215
|
+
'pluginfactory' => '>= 1.0.3',
|
216
|
+
'ruby-cache' => '>= 0.3.0',
|
217
|
+
'formvalidator' => '>= 0.1.4',
|
218
|
+
}
|
219
|
+
|
220
|
+
# Developer Gem dependencies: gemname => version
|
221
|
+
DEVELOPMENT_DEPENDENCIES = {
|
222
|
+
'rake' => '>= 0.8.7',
|
223
|
+
'rcodetools' => '>= 0.7.0.0',
|
224
|
+
'rcov' => '>= 0.8.1.2.0',
|
225
|
+
'rdoc' => '>= 2.4.3',
|
226
|
+
'RedCloth' => '>= 4.0.3',
|
227
|
+
'rspec' => '>= 1.2.6',
|
228
|
+
'ruby-termios' => '>= 0.9.6',
|
229
|
+
'text-format' => '>= 1.0.0',
|
230
|
+
'tmail' => '>= 1.2.3.1',
|
231
|
+
'diff-lcs' => '>= 1.1.2',
|
232
|
+
'json' => '>=1.1.3',
|
233
|
+
}
|
234
|
+
|
235
|
+
# Non-gem requirements: packagename => version
|
236
|
+
REQUIREMENTS = {
|
237
|
+
'mod_ruby' => '>= 1.3.0',
|
238
|
+
'Apache' => '>= 2.2.11',
|
239
|
+
}
|
240
|
+
|
241
|
+
# RubyGem specification
|
242
|
+
GEMSPEC = Gem::Specification.new do |gem|
|
243
|
+
gem.name = PKG_NAME.downcase
|
244
|
+
gem.version = PKG_VERSION
|
245
|
+
|
246
|
+
gem.summary = PKG_SUMMARY
|
247
|
+
gem.description = [
|
248
|
+
"Arrow is a web application framework for mod_ruby. It was designed to make",
|
249
|
+
"development of web applications under Apache easier and more fun without",
|
250
|
+
"sacrificing the power of being able to access the native Apache API.",
|
251
|
+
].join( "\n" )
|
252
|
+
gem.post_install_message = [
|
253
|
+
"You will need to install mod_ruby separately if you have not already done so.",
|
254
|
+
"",
|
255
|
+
" http://modruby.net/",
|
256
|
+
"",
|
257
|
+
"There is a collection of example applets and templates you can check out in the",
|
258
|
+
"data/ directory.",
|
259
|
+
].join( "\n" )
|
260
|
+
|
261
|
+
gem.authors = "Martin Chase, Michael Granger"
|
262
|
+
gem.email = ["stillflame@FaerieMUD.org", "ged@FaerieMUD.org"]
|
263
|
+
gem.homepage = 'http://deveiate.org/projects/Arrow/'
|
264
|
+
|
265
|
+
gem.has_rdoc = true
|
266
|
+
gem.rdoc_options = RDOC_OPTIONS
|
267
|
+
gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
|
268
|
+
|
269
|
+
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
|
270
|
+
gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
|
271
|
+
collect {|pn| File.basename(pn) }
|
272
|
+
gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
|
273
|
+
|
274
|
+
if EXTCONF.exist?
|
275
|
+
gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
|
276
|
+
end
|
277
|
+
|
278
|
+
gem.files = RELEASE_FILES
|
279
|
+
gem.test_files = SPEC_FILES
|
280
|
+
|
281
|
+
DEPENDENCIES.each do |name, version|
|
282
|
+
version = '>= 0' if version.length.zero?
|
283
|
+
gem.add_runtime_dependency( name, version )
|
284
|
+
end
|
285
|
+
|
286
|
+
REQUIREMENTS.each do |name, version|
|
287
|
+
gem.requirements << [ name, version ].compact.join(' ')
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
$trace = Rake.application.options.trace ? true : false
|
292
|
+
$dryrun = Rake.application.options.dryrun ? true : false
|
293
|
+
$include_dev_dependencies = false
|
294
|
+
|
295
|
+
# Load any remaining task libraries
|
296
|
+
RAKE_TASKLIBS.each do |tasklib|
|
297
|
+
next if tasklib.to_s =~ %r{/helpers\.rb$}
|
298
|
+
begin
|
299
|
+
trace " loading tasklib %s" % [ tasklib ]
|
300
|
+
import tasklib
|
301
|
+
rescue ScriptError => err
|
302
|
+
fail "Task library '%s' failed to load: %s: %s" %
|
303
|
+
[ tasklib, err.class.name, err.message ]
|
304
|
+
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
305
|
+
rescue => err
|
306
|
+
log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
|
307
|
+
[ tasklib, err.class.name, err.message ]
|
308
|
+
trace "Backtrace: \n " + err.backtrace.join( "\n " )
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# Load any project-specific rules defined in 'Rakefile.local' if it exists
|
313
|
+
import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
|
314
|
+
|
315
|
+
|
316
|
+
#####################################################################
|
317
|
+
### T A S K S
|
318
|
+
#####################################################################
|
319
|
+
|
320
|
+
### Default task
|
321
|
+
task :default => [:clean, :local, :spec, :apidocs, :package]
|
322
|
+
|
323
|
+
### Task the local Rakefile can append to -- no-op by default
|
324
|
+
task :local
|
325
|
+
|
326
|
+
### Task: clean
|
327
|
+
CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
|
328
|
+
CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
|
329
|
+
|
330
|
+
### Task: changelog
|
331
|
+
file 'ChangeLog' do |task|
|
332
|
+
log "Updating #{task.name}"
|
333
|
+
|
334
|
+
changelog = make_changelog()
|
335
|
+
File.open( task.name, 'w' ) do |fh|
|
336
|
+
fh.print( changelog )
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
|
341
|
+
### Task: cruise (Cruisecontrol task)
|
342
|
+
desc "Cruisecontrol build"
|
343
|
+
task :cruise => [:clean, 'spec:quiet', :package] do |task|
|
344
|
+
raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
|
345
|
+
artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
|
346
|
+
artifact_dir.mkpath
|
347
|
+
|
348
|
+
coverage = BASEDIR + 'coverage'
|
349
|
+
if coverage.exist? && coverage.directory?
|
350
|
+
$stderr.puts "Copying coverage stats..."
|
351
|
+
FileUtils.cp_r( 'coverage', artifact_dir )
|
352
|
+
end
|
353
|
+
|
354
|
+
$stderr.puts "Copying packages..."
|
355
|
+
FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
|
356
|
+
end
|
357
|
+
|
358
|
+
|
359
|
+
desc "Update the build system to the latest version"
|
360
|
+
task :update_build do
|
361
|
+
log "Updating the build system"
|
362
|
+
run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
|
363
|
+
log "Updating the Rakefile"
|
364
|
+
sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
|
365
|
+
end
|
366
|
+
|