Skip to content

Commit 2edc010

Browse files
committed
Release 1.1, introducing Ruby 1.9.3 support!
All tests pass, and the built documentation is identical in Ruby 1.8.7 and 1.9.3. However, a lot of tweaking took place, so use caution. Be prepared to encounter and report issues. If this is a problem, please use an earlier commit. * The exifr gem is no longer used, and internal code for measuring the size of other image types has been removed. We now depend on the dimensions gem for all image sizes. * Numerous regex matches that were really just ways of detecting whether a string starts or ends with a certain substring have been replaced by start_with? and end_with? * Uses of to_a on a single-line string as a silly way to ensure an array have been replaced by Array(). * Pathname now implements to_str explicitly, to make up for the fact that it was taken away in Ruby 1.9.2. Ideally I'd like to eliminate all cases of implicit Pathname-to-String coercion; then this can be removed. * Pathname.relative_uri_from attempts to work around a curious 1.9.x change of output from URI::Generic.route_from, on which it depends. Added a test for this edge case. * Vastly improved our message/exception reporting routines. The require is brought to top level. In our stdout diverter, implemented flush, as Ruby 1.9.3 expects it. Much better behavior when there's an exception; at last exceptions containing <...> expressions will be legible! (I wondered what that lone "#" meant, but I didn't grasp that it was my own darned fault.) * Altered one test to take account of changed structure of YAML library in Ruby 1.9.3; this is the only place in the code where I have to test for the RUBY_VERSION. Rename one badly named test. Rewrote some requires, as "." is no longer in $: in Ruby 1.9.3.
1 parent 611d787 commit 2edc010

File tree

15 files changed

+138
-87
lines changed

15 files changed

+138
-87
lines changed

README.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
RUBYFRONTIER
22
=======
33

4-
RubyFrontier is a TextMate bundle, implementing a template-based system of building Web pages and (especially) Web sites in a highly automated manner. It generates static Web pages; it isn't a Web application framework. It is excellent for heavily hyperlinked pages and for automatic generation of navigation structures such as breadcrumbs, next-prev links, etc. The system is modeled in the first instance after UserLand Frontier's `html` suite, which I documented in my [Frontier book](http://sbc.apeth.com/frontierDef/ch41.html). RubyFrontier is written in Ruby and you are expected to know Ruby and to be willing to read and to program in Ruby in order to customize and specify its behavior. It also makes some rudimentary use of [YAML][]. You can optionally employ any other cool tools you like; for example, most of my RubyFrontier sites use things like [kramdown][] and [SASS][].
4+
RubyFrontier is a TextMate bundle, implementing a template-based system of building Web pages and (especially) Web sites in a highly automated manner. It generates static Web pages; it isn't a Web application framework. Its purpose is to make Web sites a convenient writing tool, separating form from content (you concentrate on content, and RubyFrontier wraps up that content into Web page form when you build the site). RubyFrontier is excellent for heavily hyperlinked pages and for automatic generation of navigation structures such as breadcrumbs, next-prev links, etc. The system is modeled in the first instance after UserLand Frontier's `html` suite, which I documented in my [Frontier book](http://sbc.apeth.com/frontierDef/ch41.html). RubyFrontier is written in Ruby and you are expected to know Ruby and to be willing to read and to program in Ruby in order to customize and specify its behavior. It also makes some rudimentary use of [YAML][]. You can optionally employ any other cool tools you like; for example, most of my RubyFrontier sites use things like [kramdown][] and [SASS][].
55

6-
For more information and full documentation, read <http://www.apeth.com/RubyFrontierDocs/>.
6+
For more information and full documentation, read <http://www.apeth.com/RubyFrontierDocs/>. The documentation is itself a RubyFrontier-built site.
7+
8+
For another example site, see my [documentation for Script Debugger 5](http://www.apeth.com/sd5help/index.html).
79

810

911
GROUND OF BEING
1012
-----
1113

1214
RubyFrontier is *not* a GUI tool. It is *not* for naive users. It is a programming tool for power users, and it has a learning curve: extremely full documentation and a couple of sample demonstration sites are included (one of the sample sites *is* the documentation), but you have to learn to do things the RubyFrontier way. Knowing Frontier, though not required, will help (RubyFrontier was written specifically to allow me to migrate my Web sites out of Frontier without much alteration); there are some differences, but they will be readily grasped by any former Frontier user, and I believe RubyFrontier actually does a number of things better than Frontier did.
1315

14-
I have moved RubyFrontier from Sourceforge to GitHub, about the beginning of October 2011, in part because Sourceforge is horrible and getting worse by the day whereas GitHub is cool, but also because I want open source to mean open source. The chief purpose of RubyFrontier is as a tool for *me*, and for me, it works. If you don't agree, you don't have to use it. If you have a positive contribution to make, feel free to report, suggest, or fork and we can go from there.
15-
16-
In preparation for the move to GitHub I've been writing some unit tests, thus providing some basis for believing that RubyFrontier mostly does what it's supposed to do. Because of these unit tests, along with the relative maturity and proven track record of RubyFrontier (in my own life at least), I have declared the version number 1.0 at the time of the move to GitHub, marking a milestone in the life of the code.
16+
I moved RubyFrontier from Sourceforge to GitHub, about the beginning of October 2011, in part because Sourceforge is horrible and getting worse by the day whereas GitHub is cool, but also because I wanted open source to mean open source. The chief purpose of RubyFrontier is as a tool for *me*, and for me, it works. If you don't agree, you don't have to use it. If you have a positive contribution to make, feel free to [report][], suggest, or fork and we can go from there.
1717

1818

1919
HISTORY
2020
-----
2121

22-
For past history and version number, see the file "HISTORY" (inside the bundle).
22+
In preparation for the move to GitHub in October 2011 I wrote some unit tests, thus providing some basis for believing that RubyFrontier mostly does what it's supposed to do. Because of these unit tests, along with the relative maturity and proven track record of RubyFrontier (in my own life at least), I declared the version number 1.0 at the time of the move to GitHub, marking a milestone in the life of the code.
2323

24+
In September 2012 another milestone was reached: RubyFrontier started working under Ruby 1.9.3. See the next section for more about that.
2425

25-
FUTURE DIRECTIONS
26-
-----
26+
For past history and version number, see the file "HISTORY" (inside the bundle).
2727

28-
I have two chief goals for the long term:
2928

30-
* More and better unit tests. I've made a decent start, but in particular I need to get more specific about testing finer-grained parts and stages of the rendering engine.
29+
DEPENDENCIES
30+
-----
3131

32-
* Compatibility with Ruby 1.9.x. I'm far from certain that Ruby 1.9.x is an unqualified success, but it is reasonable that people who use it should eventually expect RubyFrontier to work with it. Obviously the unit tests are intended, among other things, to lay the groundwork for implementing such compatibility.
32+
You need a Mac and TextMate (presumably TextMate 1.5.x; I have not tested with TextMate 2). Windows / Linux users and TextMate detractors, this is not the droid you're looking for. I might eventually relax the dependency on TextMate, but for now, despite its flaws, TextMate does so much for me and for RubyFrontier that I have not bothered to consider any other milieu.
3333

34+
RubyFrontier was originally written under Ruby 1.8.6. I now use it under Ruby 1.8.7. In September 2012 I installed Ruby 1.9.3 and spent a couple of days testing and tweaking, and I am happy to say that RubyFrontier now appears to be working equally under Ruby 1.8.7 and 1.9.3. By "working equally" I mean that:
3435

35-
DEPENDENCIES
36-
-----
36+
1. All tests pass. You could argue that the tests are a little weak and don't hit certain edge cases or go very deep into the page/site-building mechanism, and that's true enough. But it's something. And...
3737

38-
You need a Mac and TextMate. Windows / Linux users and TextMate detractors, this is not the droid you're looking for. I might eventually relax the dependency on TextMate, but for now, despite its flaws, TextMate does so much for me and for RubyFrontier that I have not bothered to consider any other milieu.
38+
2. The documentation site (included in RubyFrontier) builds _identically_ under Ruby 1.8.7 and Ruby 1.9.3. I regard that as a highly encouraging sign.
3939

40-
RubyFrontier was originally written under Ruby 1.8.6. I now use it under Ruby 1.8.7, and that is the version of Ruby I currently support. I would not expect RubyFrontier to work under 1.9.x yet (that is an eventual goal, however; see above).
40+
Therefore I now permit use of RubyFrontier under Ruby 1.9.3. Please bear in mind for now that getting RubyFrontier to work under Ruby 1.9.3 required a lot of tweaking, and I took the opportunity to do some code clean-up. Therefore it is _possible_ (though not expected) that some new bugs may have been introduced. I urge you to try it and to [report][] any issues. If the current state of RubyFrontier worries you, stick with Ruby 1.8.7 and use commit 611d787958, the last commit before the plunge into Ruby 1.9.3.
4141

42-
Various parts of RubyFrontier, and the demonstration sites, use various libraries and gems, some of which you may not have installed. Many of these are initially "weak-linked", meaning that it is not a fatal error to lack them, but you'll probably want to install them anyway, as doing so can do no harm. For example, the part of RubyFrontier that deals with images uses the `exifr` gem to get the dimensions of TIFF images, but you do not need to install the `exifr` gem immediately - RubyFrontier will complain of its absence to you, but it will work just fine nevertheless as long as your Web sites have no TIFF images.
42+
Various parts of RubyFrontier, and the demonstration sites, use various libraries and gems, some of which you may not have installed. Many of these are initially "weak-linked", meaning that it is not a fatal error to lack them, but you'll probably want to install them anyway, as doing so can do no harm. For example, the part of RubyFrontier that deals with images uses the `dimensions` gem to get the dimensions of images, but you do not need to install the `dimensions` gem immediately - RubyFrontier will complain of its absence to you, but it will work just fine nevertheless as long as your Web sites have no images.
4343

4444

4545
INSTALLATION
@@ -53,7 +53,7 @@ What I personally do is put a symlink in _~/Library/Application Support/TextMate
5353
PREPARATION
5454
-----
5555

56-
You are expected (though not required) to have a _user.rb_ file outside the bundle. Whenever a RubyFrontier command runs, the _user.rb_ file is loaded after all of RubyFrontier's own code has loaded. Thus, _user.rb_ is your opportunity to add to or customize RubyFrontier's behavior globally (as opposed to the many customizations you can have in a particular Web site folder). For example, this is where you implement glossary entries and outline renderers that you wish to have available in all your sites. If you wanted, you could even open the PageMaker class and add or even rewrite methods, without touching the code in the bundle.
56+
You are permitted (though not required) to have a _user.rb_ file outside the bundle. Whenever a RubyFrontier command runs, the _user.rb_ file is loaded after all of RubyFrontier's own code has loaded. Thus, _user.rb_ is your opportunity to add to or customize RubyFrontier's behavior globally (as opposed to the many customizations you can have in a particular Web site folder, plus there is also a mechanism for keeping a _user.rb_ in an individual site folder). For example, this is where you implement glossary entries and outline renderers that you wish to have available in all your sites. If you wanted, you could even open the PageMaker class and add or even rewrite methods, without touching the code in the bundle.
5757

5858
To set the location of this _user.rb_ file, use the RubyFrontier > Locate User.rb File command. Your _user.rb_ does not actually have to be called "user.rb", but it should be a Ruby file.
5959

@@ -65,10 +65,14 @@ The docs are available on the Web:
6565

6666
> <http://www.apeth.com/RubyFrontierDocs/default.html>
6767
68-
However, the docs are also included in RubyFrontier, and they are themselves a RubyFrontier Web site, so they are a demonstration (and test) of RubyFrontier. Choose RubyFrontier > Build RubyFrontier Docs. (Alternatively, drill down in _RubyFrontier.tmbundle_ to _Support/bin/RubyFrontier/longestJourney/docs/RubyFrontierDocumentation/default.txt_. With the _default.txt_ file selected, choose RubyFrontier > Publish Site.) After a heart-stopping pause, the documentation Web site will be built in a new folder on your Desktop and the first page of the site will open in your browser. Read and enjoy.
68+
However, the docs are also included in RubyFrontier, and they are themselves a RubyFrontier Web site, so they are a demonstration (and test) of RubyFrontier. Choose RubyFrontier > Build RubyFrontier Docs. After a heart-stopping pause, the documentation Web site will be built in a new folder on your Desktop and the first page of the site will open in your browser. Read and enjoy.
6969

70-
A shortcut to view the source for the docs (so that you can study how the docs site is constructed) is RubyFrontier > Show RubyFrontier Docs Source.
70+
Alternatively, choose RubyFrontier > Show RubyFrontier Docs Source. This command is so that you can study how the docs site is constructed. You can then also build the docs by selecting the _default.txt_ file and then choosing RubyFrontier > Publish Site.
71+
72+
FUTURE DIRECTIONS
73+
-----
7174

75+
Now that RubyFrontier is apparently usable with Ruby 1.9.3, my chief goal is more and better unit tests, in order to keep making sure that RubyFrontier works equally in Ruby 1.8.7 and Ruby 1.9.3.
7276

7377
LICENSE
7478
-----
@@ -85,4 +89,5 @@ Matt Neuburg (<matt@tidbits.com>, <http://www.apeth.net/matt/>)
8589
[Haml]: http://haml-lang.com/
8690
[SASS]: http://sass-lang.com/
8791
[YAML]: http://yaml.org/
92+
[report]: https://github.com/mattneub/RubyFrontier/issues
8893

RubyFrontier.tmbundle/HISTORY

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VERSION
22
=======
33

4-
This is version 1.0.2.
4+
This is version 1.1. The version increment marks the beginning of usability under Ruby 1.9.3. WARNING: This took a lot of tweaking, and despite my best efforts, new bugs may have been introduced.
55

66
HISTORY
77
=======
@@ -42,3 +42,5 @@ In version 1.0.1, expanded the user.rb mechanism to allow inclusion of a #user.r
4242

4343
In version 1.0.2, introduced a mechanism to allow a `.txt` file to function as an outline (like a `.opml`) file, by using indentation and setting the `:treatasopml` directive to `true`. Documentation updated.
4444

45+
In version 1.1, support for Ruby 1.9.3 was added, along with some general code cleanup. Dependency on exifr removed, replaced by dependency on dimensions. Improved message/exception formatting.
46+

RubyFrontier.tmbundle/Support/bin/RubyFrontier/longestJourney.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# utilities: myrequire, myraise, Memoizable, and various modifications to existing classes
33
require 'longestJourneyUtilities.rb'
44

5-
myrequire "pathname", "yaml", "erb", "pp", "uri", "rubygems", "exifr", "enumerator", "kramdown", "haml", "sass", "nokogiri"
5+
myrequire "pathname", "yaml", "erb", "pp", "uri", "rubygems", "dimensions", "enumerator", "kramdown", "haml", "sass", "nokogiri"
66

77
=begin make 'load' and 'require' include folder next to, and with same name as, this file
88
that is where supplementary files go

RubyFrontier.tmbundle/Support/bin/RubyFrontier/longestJourney/docs/RubyFrontierDocumentation/#tools/truenext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def truenext()
1616
nomad = obj
1717
while true
1818
nomad = nomad.dirname
19-
if nomad.to_s =~ /folder$/i
19+
if nomad.to_s.downcase.end_with? "folder"
2020
daddy = nomad.basename.to_s[0..-7]
2121
if @adrPageTable[:autoglossary][daddy]
2222
daddyObj = @adrPageTable[:autoglossary][daddy][:adr]

RubyFrontier.tmbundle/Support/bin/RubyFrontier/longestJourney/docs/RubyFrontierDocumentation/defaultfolder/whyrf.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Why RubyFrontier?
44

5-
There are plenty of Web site frameworks and generators out there, from the massive [Dreamweaver](http://www.adobe.com/products/dreamweaver/) or [FrontPage](http://office.microsoft.com/en-us/frontpage/default.aspx) down to alternative Ruby-based systems such as [Webby](http://webby.rubyforge.org/) and [nanoc](http://nanoc.stoneship.org/) and [webgen](http://webgen.rubyforge.org/documentation/) and [jekyll](http://github.com/mojombo/jekyll) and many others, so who needs another one?
5+
There are plenty of Web site frameworks and generators out there, from the massive [Dreamweaver](http://www.adobe.com/products/dreamweaver/) or [FrontPage](http://office.microsoft.com/en-us/frontpage/default.aspx) down to alternative Ruby-based systems such as [Webby](http://webby.rubyforge.org/) and [nanoc](http://nanoc.stoneship.org/) and [webgen](http://webgen.rubyforge.org/documentation/) and [jekyll](http://github.com/mojombo/jekyll), [ZenWeb](https://github.com/seattlerb/zenweb) and many others, so who needs another one?
66

77
I do. RubyFrontier was written for *me*. It does what I want it to do. I had a particular problem and RubyFrontier solves it.
88

RubyFrontier.tmbundle/Support/bin/RubyFrontier/longestJourney/userland_class_methods.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def self.releaseRenderedPage(adrObject, flPreview = true, doTimings = true)
3838

3939
pm.saveOutAutoglossary # save out autoglossary if any
4040

41-
if flPreview && (File.extname(pm.adrPageTable[:fname]) =~ /\.htm/i) # supposed to be a test for browser displayability
41+
if flPreview && (File.extname(pm.adrPageTable[:fname]).downcase.start_with?(".htm")) # supposed to be a test for browser displayability
4242
if (apacheURL = pm.adrPageTable[:ftpsite][:apacheURL])
4343
f = pm.adrPageTable[:f].relative_path_from(Pathname(pm.adrPageTable[:ftpsite][:apacheSite]).expand_path)
4444
`open #{URI.escape(apacheURL + f)}`
@@ -86,7 +86,7 @@ def self.everyPageOfFolder(f)
8686
# distinguish from pagesInFolder which is shallow, only during rendering, only renderables, and uses #nextprevs order
8787
result = Array.new
8888
Pathname(f).find do |p|
89-
Find.prune if p.basename.to_s =~ /^[#.]/
89+
Find.prune if p.basename.to_s.start_with?("#", ".")
9090
result << p if (!p.directory? && p.simplename != "") # ignore invisibles
9191
end
9292
result

RubyFrontier.tmbundle/Support/bin/RubyFrontier/longestJourney/userland_pagemaker.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ def buildPageTableForDirectory(adrObjectDir) # never call this directly unless y
290290
found_ftpsite = false
291291
adrObjectDir.ascend do |dir|
292292
dir.each_entry do |f|
293-
if /^#/ =~ f
293+
if f.to_s.start_with?("#")
294294
dirf = dir + f
295295
case (directive = f.simplename.to_s.downcase) # special casing of certain directives
296296
when "#tools"
297297
# gather tools into tools hash, hashing pathnames under simple filenames
298298
# new feature (non-Frontier), .txt files go into snippets hash
299299
dirf.each_entry do |ff|
300-
unless /^\./ =~ (tool_simplename = ff.simplename.to_s.downcase)
300+
unless (tool_simplename = ff.simplename.to_s.downcase).start_with?(".")
301301
case ff.extname
302302
when ".rb"
303303
adrPageTable["tools"][tool_simplename] ||= dirf + ff
@@ -309,7 +309,7 @@ def buildPageTableForDirectory(adrObjectDir) # never call this directly unless y
309309
when "#images", "#stylesheets", "#javascripts"
310310
# gather contents into single hash, hashing pathnames under simple filenames
311311
dirf.each_entry do |ff|
312-
unless /^\./ =~ (ref_simplename = ff.simplename.to_s.downcase)
312+
unless (ref_simplename = ff.simplename.to_s.downcase).start_with?(".")
313313
adrPageTable[directive[1..-1]][ref_simplename] ||= dirf + ff
314314
end
315315
end
@@ -427,15 +427,15 @@ def incorporateDirective(k, v, yieldToExisting=false, adrPageTable=@adrPageTable
427427
if s =~ /^stylesheet./i
428428
adrPageTable[:linkstylesheets] << s[10..-1]
429429
elsif s.downcase == "linkstylesheets"
430-
adrPageTable[:linkstylesheets] += v.to_a
430+
adrPageTable[:linkstylesheets] += Array(v)
431431
elsif s.downcase == "linkstylesheetsnot"
432-
adrPageTable[:linkstylesheets] -= v.to_a
432+
adrPageTable[:linkstylesheets] -= Array(v)
433433
elsif s =~ /^javascript./i
434434
adrPageTable[:linkjavascripts] << s[10..-1]
435435
elsif s.downcase == "linkjavascripts"
436-
adrPageTable[:linkjavascripts] += v.to_a
436+
adrPageTable[:linkjavascripts] += Array(v)
437437
elsif s.downcase == "linkjavascriptsnot"
438-
adrPageTable[:linkjavascripts] -= v.to_a
438+
adrPageTable[:linkjavascripts] -= Array(v)
439439
else
440440
if yieldToExisting
441441
adrPageTable[k] ||= v
@@ -610,7 +610,7 @@ def pagesInFolder(folder, adrPageTable=@adrPageTable)
610610
else
611611
# if not, just use alphabetical order
612612
folder.children.each do |p|
613-
next if p.basename.to_s =~ /^[#.]/
613+
next if p.basename.to_s.start_with?("#", ".")
614614
arr << p.simplename.to_s if renderable?(p)
615615
end
616616
end

RubyFrontier.tmbundle/Support/bin/RubyFrontier/longestJourney/userland_standard_macros.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def bodytag(adrPageTable=@adrPageTable) # generate body tag, drawing attributes
173173
if s = adrPageTable.fetch2(oneatt.to_sym)
174174
if %w{alink bgcolor text link vlink}.include?(oneatt)
175175
# colors should be hex and start with #
176-
unless s =~ /^#/
176+
unless s.start_with?("#")
177177
if s.length == 6
178178
unless s =~ /[^0-9a-f]/i
179179
s = "#" + s

0 commit comments

Comments
 (0)