shoesgem 0.1424.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +30 -0
- data/README.rdoc +31 -0
- data/lib/shoes.rb +4 -0
- data/shoes/CHANGELOG.txt +21 -0
- data/shoes/COPYING.txt +30 -0
- data/shoes/README.txt +117 -0
- data/shoes/VERSION.txt +1 -0
- data/shoes/fonts/Coolvetica.ttf +0 -0
- data/shoes/fonts/Lacuna.ttf +0 -0
- data/shoes/freetype6.dll +0 -0
- data/shoes/lib/shoes/cache.rb +54 -0
- data/shoes/lib/shoes/data.rb +39 -0
- data/shoes/lib/shoes/help.rb +421 -0
- data/shoes/lib/shoes/image.rb +25 -0
- data/shoes/lib/shoes/inspect.rb +128 -0
- data/shoes/lib/shoes/log.rb +48 -0
- data/shoes/lib/shoes/minitar.rb +986 -0
- data/shoes/lib/shoes/override.rb +38 -0
- data/shoes/lib/shoes/pack.rb +503 -0
- data/shoes/lib/shoes/search.rb +46 -0
- data/shoes/lib/shoes/setup.rb +329 -0
- data/shoes/lib/shoes/shy.rb +131 -0
- data/shoes/lib/shoes/shybuilder.rb +44 -0
- data/shoes/lib/shoes.rb +522 -0
- data/shoes/libcairo-2.dll +0 -0
- data/shoes/libeay32.dll +0 -0
- data/shoes/libexpat-1.dll +0 -0
- data/shoes/libfontconfig-1.dll +0 -0
- data/shoes/libgio-2.0-0.dll +0 -0
- data/shoes/libglib-2.0-0.dll +0 -0
- data/shoes/libgmodule-2.0-0.dll +0 -0
- data/shoes/libgobject-2.0-0.dll +0 -0
- data/shoes/libgthread-2.0-0.dll +0 -0
- data/shoes/libiconv2.dll +0 -0
- data/shoes/libjpeg-8.dll +0 -0
- data/shoes/libpango-1.0-0.dll +0 -0
- data/shoes/libpangocairo-1.0-0.dll +0 -0
- data/shoes/libpangoft2-1.0-0.dll +0 -0
- data/shoes/libpangowin32-1.0-0.dll +0 -0
- data/shoes/libpng14-14.dll +0 -0
- data/shoes/libportaudio-2.dll +0 -0
- data/shoes/libshoes.dll +0 -0
- data/shoes/libssl32.dll +0 -0
- data/shoes/libungif4.dll +0 -0
- data/shoes/msvcrt-ruby191.dll +0 -0
- data/shoes/readline5.dll +0 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/fast_xs.so +0 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/blankslate.rb +63 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/builder.rb +216 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/elements.rb +510 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/htmlinfo.rb +691 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/inspect.rb +103 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/modules.rb +40 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb +38 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tag.rb +202 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tags.rb +164 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/traverse.rb +838 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/xchar.rb +94 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot.rb +26 -0
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot_scan.so +0 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/core.rb +135 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/rails.rb +58 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/common.rb +354 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/generator.so +0 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext/parser.so +0 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/ext.rb +13 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/version.rb +9 -0
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json.rb +8 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/constants.rb +49 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/database.rb +721 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/api.rb +152 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/driver.rb +307 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/native/driver.rb +219 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/errors.rb +68 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/pragmas.rb +271 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/resultset.rb +180 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/statement.rb +231 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/translator.rb +109 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/value.rb +57 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/version.rb +16 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3.rb +1 -0
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3_api.so +0 -0
- data/shoes/ruby/gems/1.9.1/specifications/hpricot-0.8.1.gemspec +32 -0
- data/shoes/ruby/gems/1.9.1/specifications/json-shoes-1.1.3.gemspec +34 -0
- data/shoes/ruby/gems/1.9.1/specifications/sqlite3-ruby-1.2.5-x86-mswin32.gemspec +46 -0
- data/shoes/ruby/lib/English.rb +155 -0
- data/shoes/ruby/lib/Win32API.rb +28 -0
- data/shoes/ruby/lib/abbrev.rb +103 -0
- data/shoes/ruby/lib/base64.rb +91 -0
- data/shoes/ruby/lib/benchmark.rb +573 -0
- data/shoes/ruby/lib/bigdecimal/jacobian.rb +85 -0
- data/shoes/ruby/lib/bigdecimal/ludcmp.rb +86 -0
- data/shoes/ruby/lib/bigdecimal/math.rb +237 -0
- data/shoes/ruby/lib/bigdecimal/newton.rb +77 -0
- data/shoes/ruby/lib/bigdecimal/util.rb +53 -0
- data/shoes/ruby/lib/cgi/cookie.rb +144 -0
- data/shoes/ruby/lib/cgi/core.rb +786 -0
- data/shoes/ruby/lib/cgi/html.rb +1021 -0
- data/shoes/ruby/lib/cgi/session/pstore.rb +111 -0
- data/shoes/ruby/lib/cgi/session.rb +537 -0
- data/shoes/ruby/lib/cgi/util.rb +181 -0
- data/shoes/ruby/lib/cgi.rb +274 -0
- data/shoes/ruby/lib/cmath.rb +233 -0
- data/shoes/ruby/lib/complex.rb +24 -0
- data/shoes/ruby/lib/csv.rb +2320 -0
- data/shoes/ruby/lib/date/format.rb +1313 -0
- data/shoes/ruby/lib/date.rb +1834 -0
- data/shoes/ruby/lib/debug.rb +907 -0
- data/shoes/ruby/lib/delegate.rb +311 -0
- data/shoes/ruby/lib/digest/hmac.rb +274 -0
- data/shoes/ruby/lib/digest/sha2.rb +74 -0
- data/shoes/ruby/lib/digest.rb +50 -0
- data/shoes/ruby/lib/dl/callback.rb +69 -0
- data/shoes/ruby/lib/dl/cparser.rb +109 -0
- data/shoes/ruby/lib/dl/func.rb +153 -0
- data/shoes/ruby/lib/dl/import.rb +215 -0
- data/shoes/ruby/lib/dl/pack.rb +173 -0
- data/shoes/ruby/lib/dl/stack.rb +146 -0
- data/shoes/ruby/lib/dl/struct.rb +213 -0
- data/shoes/ruby/lib/dl/types.rb +40 -0
- data/shoes/ruby/lib/dl/value.rb +112 -0
- data/shoes/ruby/lib/drb/acl.rb +146 -0
- data/shoes/ruby/lib/drb/drb.rb +1778 -0
- data/shoes/ruby/lib/drb/eq.rb +16 -0
- data/shoes/ruby/lib/drb/extserv.rb +71 -0
- data/shoes/ruby/lib/drb/extservm.rb +85 -0
- data/shoes/ruby/lib/drb/gw.rb +122 -0
- data/shoes/ruby/lib/drb/invokemethod.rb +34 -0
- data/shoes/ruby/lib/drb/observer.rb +22 -0
- data/shoes/ruby/lib/drb/ssl.rb +190 -0
- data/shoes/ruby/lib/drb/timeridconv.rb +91 -0
- data/shoes/ruby/lib/drb/unix.rb +108 -0
- data/shoes/ruby/lib/drb.rb +2 -0
- data/shoes/ruby/lib/e2mmap.rb +172 -0
- data/shoes/ruby/lib/erb.rb +902 -0
- data/shoes/ruby/lib/fileutils.rb +1592 -0
- data/shoes/ruby/lib/find.rb +81 -0
- data/shoes/ruby/lib/forwardable.rb +270 -0
- data/shoes/ruby/lib/ftsearch/analysis/analyzer.rb +16 -0
- data/shoes/ruby/lib/ftsearch/analysis/simple_identifier_analyzer.rb +23 -0
- data/shoes/ruby/lib/ftsearch/analysis/whitespace_analyzer.rb +22 -0
- data/shoes/ruby/lib/ftsearch/document_map_reader.rb +106 -0
- data/shoes/ruby/lib/ftsearch/document_map_writer.rb +46 -0
- data/shoes/ruby/lib/ftsearch/field_infos.rb +46 -0
- data/shoes/ruby/lib/ftsearch/fragment_writer.rb +114 -0
- data/shoes/ruby/lib/ftsearch/fulltext_reader.rb +52 -0
- data/shoes/ruby/lib/ftsearch/fulltext_writer.rb +75 -0
- data/shoes/ruby/lib/ftsearch/suffix_array_reader.rb +275 -0
- data/shoes/ruby/lib/ftsearch/suffix_array_writer.rb +99 -0
- data/shoes/ruby/lib/ftsearch/util.rb +21 -0
- data/shoes/ruby/lib/getoptlong.rb +610 -0
- data/shoes/ruby/lib/gserver.rb +253 -0
- data/shoes/ruby/lib/i386-mingw32/bigdecimal.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/binject.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/bloops.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/continuation.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/coverage.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/curses.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/digest/bubblebabble.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/digest/md5.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/digest/rmd160.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/digest/sha1.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/digest/sha2.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/digest.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/dl.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/big5.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/cp949.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/emacs_mule.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/encdb.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/euc_jp.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/euc_kr.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/euc_tw.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/gb18030.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/gb2312.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/gbk.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_1.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_10.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_11.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_13.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_14.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_15.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_16.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_2.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_3.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_4.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_5.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_6.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_7.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_8.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/iso_8859_9.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/koi8_r.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/koi8_u.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/shift_jis.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/big5.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/chinese.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/escape.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/gb18030.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/gbk.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/iso2022.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_euc.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/japanese_sjis.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/korean.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/single_byte.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/transdb.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/trans/utf_16_32.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/utf_16be.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/utf_16le.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/utf_32be.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/utf_32le.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/enc/windows_1251.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/etc.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/fcntl.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/fiber.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/ftsearchrt.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/gdbm.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/iconv.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/io/wait.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/json/ext/generator.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/json/ext/parser.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/mathn/complex.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/mathn/rational.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/nkf.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/openssl.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/racc/cparse.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/rbconfig.rb +196 -0
- data/shoes/ruby/lib/i386-mingw32/readline.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/ripper.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/sdbm.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/socket.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/stringio.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/strscan.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/syck.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/win32ole.so +0 -0
- data/shoes/ruby/lib/i386-mingw32/zlib.so +0 -0
- data/shoes/ruby/lib/io/nonblock.rb +23 -0
- data/shoes/ruby/lib/ipaddr.rb +813 -0
- data/shoes/ruby/lib/irb/cmd/chws.rb +32 -0
- data/shoes/ruby/lib/irb/cmd/fork.rb +38 -0
- data/shoes/ruby/lib/irb/cmd/help.rb +36 -0
- data/shoes/ruby/lib/irb/cmd/load.rb +66 -0
- data/shoes/ruby/lib/irb/cmd/nop.rb +38 -0
- data/shoes/ruby/lib/irb/cmd/pushws.rb +38 -0
- data/shoes/ruby/lib/irb/cmd/subirb.rb +42 -0
- data/shoes/ruby/lib/irb/completion.rb +207 -0
- data/shoes/ruby/lib/irb/context.rb +255 -0
- data/shoes/ruby/lib/irb/ext/change-ws.rb +61 -0
- data/shoes/ruby/lib/irb/ext/history.rb +109 -0
- data/shoes/ruby/lib/irb/ext/loader.rb +119 -0
- data/shoes/ruby/lib/irb/ext/math-mode.rb +36 -0
- data/shoes/ruby/lib/irb/ext/multi-irb.rb +240 -0
- data/shoes/ruby/lib/irb/ext/save-history.rb +100 -0
- data/shoes/ruby/lib/irb/ext/tracer.rb +60 -0
- data/shoes/ruby/lib/irb/ext/use-loader.rb +64 -0
- data/shoes/ruby/lib/irb/ext/workspaces.rb +55 -0
- data/shoes/ruby/lib/irb/extend-command.rb +272 -0
- data/shoes/ruby/lib/irb/frame.rb +66 -0
- data/shoes/ruby/lib/irb/help.rb +35 -0
- data/shoes/ruby/lib/irb/init.rb +288 -0
- data/shoes/ruby/lib/irb/input-method.rb +142 -0
- data/shoes/ruby/lib/irb/lc/error.rb +29 -0
- data/shoes/ruby/lib/irb/lc/help-message +38 -0
- data/shoes/ruby/lib/irb/lc/ja/encoding_aliases.rb +8 -0
- data/shoes/ruby/lib/irb/lc/ja/error.rb +27 -0
- data/shoes/ruby/lib/irb/lc/ja/help-message +39 -0
- data/shoes/ruby/lib/irb/locale.rb +195 -0
- data/shoes/ruby/lib/irb/magic-file.rb +36 -0
- data/shoes/ruby/lib/irb/notifier.rb +144 -0
- data/shoes/ruby/lib/irb/output-method.rb +69 -0
- data/shoes/ruby/lib/irb/ruby-lex.rb +1188 -0
- data/shoes/ruby/lib/irb/ruby-token.rb +270 -0
- data/shoes/ruby/lib/irb/slex.rb +282 -0
- data/shoes/ruby/lib/irb/src_encoding.rb +4 -0
- data/shoes/ruby/lib/irb/version.rb +15 -0
- data/shoes/ruby/lib/irb/workspace.rb +108 -0
- data/shoes/ruby/lib/irb/ws-for-case-2.rb +14 -0
- data/shoes/ruby/lib/irb/xmp.rb +97 -0
- data/shoes/ruby/lib/irb.rb +354 -0
- data/shoes/ruby/lib/json/add/core.rb +135 -0
- data/shoes/ruby/lib/json/add/rails.rb +58 -0
- data/shoes/ruby/lib/json/common.rb +354 -0
- data/shoes/ruby/lib/json/editor.rb +1371 -0
- data/shoes/ruby/lib/json/ext.rb +15 -0
- data/shoes/ruby/lib/json/version.rb +9 -0
- data/shoes/ruby/lib/json.rb +297 -0
- data/shoes/ruby/lib/kconv.rb +282 -0
- data/shoes/ruby/lib/logger.rb +732 -0
- data/shoes/ruby/lib/mathn.rb +206 -0
- data/shoes/ruby/lib/matrix.rb +1381 -0
- data/shoes/ruby/lib/minitest/autorun.rb +9 -0
- data/shoes/ruby/lib/minitest/mock.rb +37 -0
- data/shoes/ruby/lib/minitest/spec.rb +89 -0
- data/shoes/ruby/lib/minitest/unit.rb +497 -0
- data/shoes/ruby/lib/mkmf.rb +1958 -0
- data/shoes/ruby/lib/monitor.rb +265 -0
- data/shoes/ruby/lib/mutex_m.rb +91 -0
- data/shoes/ruby/lib/net/ftp.rb +981 -0
- data/shoes/ruby/lib/net/http.rb +2399 -0
- data/shoes/ruby/lib/net/https.rb +136 -0
- data/shoes/ruby/lib/net/imap.rb +3500 -0
- data/shoes/ruby/lib/net/pop.rb +1000 -0
- data/shoes/ruby/lib/net/protocol.rb +382 -0
- data/shoes/ruby/lib/net/smtp.rb +1014 -0
- data/shoes/ruby/lib/net/telnet.rb +759 -0
- data/shoes/ruby/lib/observer.rb +193 -0
- data/shoes/ruby/lib/open-uri.rb +832 -0
- data/shoes/ruby/lib/open3.rb +98 -0
- data/shoes/ruby/lib/openssl/bn.rb +35 -0
- data/shoes/ruby/lib/openssl/buffering.rb +242 -0
- data/shoes/ruby/lib/openssl/cipher.rb +65 -0
- data/shoes/ruby/lib/openssl/digest.rb +61 -0
- data/shoes/ruby/lib/openssl/ssl.rb +178 -0
- data/shoes/ruby/lib/openssl/x509.rb +155 -0
- data/shoes/ruby/lib/openssl.rb +24 -0
- data/shoes/ruby/lib/optparse/date.rb +17 -0
- data/shoes/ruby/lib/optparse/shellwords.rb +6 -0
- data/shoes/ruby/lib/optparse/time.rb +10 -0
- data/shoes/ruby/lib/optparse/uri.rb +6 -0
- data/shoes/ruby/lib/optparse/version.rb +70 -0
- data/shoes/ruby/lib/optparse.rb +1810 -0
- data/shoes/ruby/lib/ostruct.rb +145 -0
- data/shoes/ruby/lib/pathname.rb +1099 -0
- data/shoes/ruby/lib/pp.rb +532 -0
- data/shoes/ruby/lib/prettyprint.rb +896 -0
- data/shoes/ruby/lib/prime.rb +471 -0
- data/shoes/ruby/lib/profile.rb +10 -0
- data/shoes/ruby/lib/profiler.rb +59 -0
- data/shoes/ruby/lib/pstore.rb +543 -0
- data/shoes/ruby/lib/racc/parser.rb +441 -0
- data/shoes/ruby/lib/rake/classic_namespace.rb +8 -0
- data/shoes/ruby/lib/rake/clean.rb +33 -0
- data/shoes/ruby/lib/rake/gempackagetask.rb +97 -0
- data/shoes/ruby/lib/rake/loaders/makefile.rb +35 -0
- data/shoes/ruby/lib/rake/packagetask.rb +185 -0
- data/shoes/ruby/lib/rake/rake_test_loader.rb +5 -0
- data/shoes/ruby/lib/rake/rdoctask.rb +147 -0
- data/shoes/ruby/lib/rake/runtest.rb +23 -0
- data/shoes/ruby/lib/rake/tasklib.rb +23 -0
- data/shoes/ruby/lib/rake/testtask.rb +161 -0
- data/shoes/ruby/lib/rake/win32.rb +34 -0
- data/shoes/ruby/lib/rake.rb +2465 -0
- data/shoes/ruby/lib/rational.rb +19 -0
- data/shoes/ruby/lib/rbconfig/datadir.rb +24 -0
- data/shoes/ruby/lib/rdoc/code_objects.rb +1061 -0
- data/shoes/ruby/lib/rdoc/diagram.rb +340 -0
- data/shoes/ruby/lib/rdoc/dot.rb +249 -0
- data/shoes/ruby/lib/rdoc/generator/chm/chm.rb +100 -0
- data/shoes/ruby/lib/rdoc/generator/chm.rb +113 -0
- data/shoes/ruby/lib/rdoc/generator/html/common.rb +24 -0
- data/shoes/ruby/lib/rdoc/generator/html/frameless.rb +92 -0
- data/shoes/ruby/lib/rdoc/generator/html/hefss.rb +150 -0
- data/shoes/ruby/lib/rdoc/generator/html/html.rb +769 -0
- data/shoes/ruby/lib/rdoc/generator/html/kilmer.rb +151 -0
- data/shoes/ruby/lib/rdoc/generator/html/kilmerfactory.rb +427 -0
- data/shoes/ruby/lib/rdoc/generator/html/one_page_html.rb +122 -0
- data/shoes/ruby/lib/rdoc/generator/html.rb +445 -0
- data/shoes/ruby/lib/rdoc/generator/ri.rb +226 -0
- data/shoes/ruby/lib/rdoc/generator/texinfo/class.texinfo.erb +44 -0
- data/shoes/ruby/lib/rdoc/generator/texinfo/file.texinfo.erb +6 -0
- data/shoes/ruby/lib/rdoc/generator/texinfo/method.texinfo.erb +6 -0
- data/shoes/ruby/lib/rdoc/generator/texinfo/texinfo.erb +28 -0
- data/shoes/ruby/lib/rdoc/generator/texinfo.rb +81 -0
- data/shoes/ruby/lib/rdoc/generator/xml/rdf.rb +113 -0
- data/shoes/ruby/lib/rdoc/generator/xml/xml.rb +123 -0
- data/shoes/ruby/lib/rdoc/generator/xml.rb +117 -0
- data/shoes/ruby/lib/rdoc/generator.rb +1082 -0
- data/shoes/ruby/lib/rdoc/known_classes.rb +68 -0
- data/shoes/ruby/lib/rdoc/markup/attribute_manager.rb +265 -0
- data/shoes/ruby/lib/rdoc/markup/formatter.rb +14 -0
- data/shoes/ruby/lib/rdoc/markup/fragments.rb +337 -0
- data/shoes/ruby/lib/rdoc/markup/inline.rb +101 -0
- data/shoes/ruby/lib/rdoc/markup/lines.rb +152 -0
- data/shoes/ruby/lib/rdoc/markup/preprocess.rb +75 -0
- data/shoes/ruby/lib/rdoc/markup/to_flow.rb +185 -0
- data/shoes/ruby/lib/rdoc/markup/to_html.rb +403 -0
- data/shoes/ruby/lib/rdoc/markup/to_html_crossref.rb +148 -0
- data/shoes/ruby/lib/rdoc/markup/to_latex.rb +328 -0
- data/shoes/ruby/lib/rdoc/markup/to_test.rb +50 -0
- data/shoes/ruby/lib/rdoc/markup/to_texinfo.rb +69 -0
- data/shoes/ruby/lib/rdoc/markup.rb +378 -0
- data/shoes/ruby/lib/rdoc/options.rb +638 -0
- data/shoes/ruby/lib/rdoc/parser/c.rb +661 -0
- data/shoes/ruby/lib/rdoc/parser/f95.rb +1835 -0
- data/shoes/ruby/lib/rdoc/parser/perl.rb +165 -0
- data/shoes/ruby/lib/rdoc/parser/ruby.rb +2829 -0
- data/shoes/ruby/lib/rdoc/parser/simple.rb +38 -0
- data/shoes/ruby/lib/rdoc/parser.rb +142 -0
- data/shoes/ruby/lib/rdoc/rdoc.rb +293 -0
- data/shoes/ruby/lib/rdoc/ri/cache.rb +187 -0
- data/shoes/ruby/lib/rdoc/ri/descriptions.rb +156 -0
- data/shoes/ruby/lib/rdoc/ri/display.rb +392 -0
- data/shoes/ruby/lib/rdoc/ri/driver.rb +669 -0
- data/shoes/ruby/lib/rdoc/ri/formatter.rb +616 -0
- data/shoes/ruby/lib/rdoc/ri/paths.rb +99 -0
- data/shoes/ruby/lib/rdoc/ri/reader.rb +106 -0
- data/shoes/ruby/lib/rdoc/ri/util.rb +79 -0
- data/shoes/ruby/lib/rdoc/ri/writer.rb +68 -0
- data/shoes/ruby/lib/rdoc/ri.rb +8 -0
- data/shoes/ruby/lib/rdoc/stats.rb +115 -0
- data/shoes/ruby/lib/rdoc/template.rb +64 -0
- data/shoes/ruby/lib/rdoc/tokenstream.rb +33 -0
- data/shoes/ruby/lib/rdoc.rb +395 -0
- data/shoes/ruby/lib/resolv-replace.rb +63 -0
- data/shoes/ruby/lib/resolv.rb +2262 -0
- data/shoes/ruby/lib/rexml/attlistdecl.rb +62 -0
- data/shoes/ruby/lib/rexml/attribute.rb +188 -0
- data/shoes/ruby/lib/rexml/cdata.rb +67 -0
- data/shoes/ruby/lib/rexml/child.rb +96 -0
- data/shoes/ruby/lib/rexml/comment.rb +80 -0
- data/shoes/ruby/lib/rexml/doctype.rb +270 -0
- data/shoes/ruby/lib/rexml/document.rb +231 -0
- data/shoes/ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
- data/shoes/ruby/lib/rexml/dtd/dtd.rb +51 -0
- data/shoes/ruby/lib/rexml/dtd/elementdecl.rb +17 -0
- data/shoes/ruby/lib/rexml/dtd/entitydecl.rb +56 -0
- data/shoes/ruby/lib/rexml/dtd/notationdecl.rb +39 -0
- data/shoes/ruby/lib/rexml/element.rb +1246 -0
- data/shoes/ruby/lib/rexml/encoding.rb +71 -0
- data/shoes/ruby/lib/rexml/encodings/CP-1252.rb +103 -0
- data/shoes/ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
- data/shoes/ruby/lib/rexml/encodings/ICONV.rb +22 -0
- data/shoes/ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
- data/shoes/ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
- data/shoes/ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
- data/shoes/ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
- data/shoes/ruby/lib/rexml/encodings/UNILE.rb +34 -0
- data/shoes/ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
- data/shoes/ruby/lib/rexml/encodings/UTF-16.rb +35 -0
- data/shoes/ruby/lib/rexml/encodings/UTF-8.rb +18 -0
- data/shoes/ruby/lib/rexml/entity.rb +166 -0
- data/shoes/ruby/lib/rexml/formatters/default.rb +109 -0
- data/shoes/ruby/lib/rexml/formatters/pretty.rb +139 -0
- data/shoes/ruby/lib/rexml/formatters/transitive.rb +58 -0
- data/shoes/ruby/lib/rexml/functions.rb +388 -0
- data/shoes/ruby/lib/rexml/instruction.rb +70 -0
- data/shoes/ruby/lib/rexml/light/node.rb +196 -0
- data/shoes/ruby/lib/rexml/namespace.rb +47 -0
- data/shoes/ruby/lib/rexml/node.rb +75 -0
- data/shoes/ruby/lib/rexml/output.rb +24 -0
- data/shoes/ruby/lib/rexml/parent.rb +166 -0
- data/shoes/ruby/lib/rexml/parseexception.rb +51 -0
- data/shoes/ruby/lib/rexml/parsers/baseparser.rb +530 -0
- data/shoes/ruby/lib/rexml/parsers/lightparser.rb +58 -0
- data/shoes/ruby/lib/rexml/parsers/pullparser.rb +196 -0
- data/shoes/ruby/lib/rexml/parsers/sax2parser.rb +247 -0
- data/shoes/ruby/lib/rexml/parsers/streamparser.rb +46 -0
- data/shoes/ruby/lib/rexml/parsers/treeparser.rb +100 -0
- data/shoes/ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
- data/shoes/ruby/lib/rexml/parsers/xpathparser.rb +698 -0
- data/shoes/ruby/lib/rexml/quickpath.rb +263 -0
- data/shoes/ruby/lib/rexml/rexml.rb +31 -0
- data/shoes/ruby/lib/rexml/sax2listener.rb +97 -0
- data/shoes/ruby/lib/rexml/source.rb +258 -0
- data/shoes/ruby/lib/rexml/streamlistener.rb +92 -0
- data/shoes/ruby/lib/rexml/syncenumerator.rb +32 -0
- data/shoes/ruby/lib/rexml/text.rb +404 -0
- data/shoes/ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
- data/shoes/ruby/lib/rexml/validation/relaxng.rb +559 -0
- data/shoes/ruby/lib/rexml/validation/validation.rb +155 -0
- data/shoes/ruby/lib/rexml/validation/validationexception.rb +9 -0
- data/shoes/ruby/lib/rexml/xmldecl.rb +119 -0
- data/shoes/ruby/lib/rexml/xmltokens.rb +18 -0
- data/shoes/ruby/lib/rexml/xpath.rb +77 -0
- data/shoes/ruby/lib/rexml/xpath_parser.rb +792 -0
- data/shoes/ruby/lib/rinda/rinda.rb +283 -0
- data/shoes/ruby/lib/rinda/ring.rb +271 -0
- data/shoes/ruby/lib/rinda/tuplespace.rb +642 -0
- data/shoes/ruby/lib/ripper/core.rb +70 -0
- data/shoes/ruby/lib/ripper/filter.rb +70 -0
- data/shoes/ruby/lib/ripper/lexer.rb +179 -0
- data/shoes/ruby/lib/ripper/sexp.rb +99 -0
- data/shoes/ruby/lib/ripper.rb +4 -0
- data/shoes/ruby/lib/rss/0.9.rb +427 -0
- data/shoes/ruby/lib/rss/1.0.rb +452 -0
- data/shoes/ruby/lib/rss/2.0.rb +111 -0
- data/shoes/ruby/lib/rss/atom.rb +748 -0
- data/shoes/ruby/lib/rss/content/1.0.rb +10 -0
- data/shoes/ruby/lib/rss/content/2.0.rb +12 -0
- data/shoes/ruby/lib/rss/content.rb +31 -0
- data/shoes/ruby/lib/rss/converter.rb +170 -0
- data/shoes/ruby/lib/rss/dublincore/1.0.rb +13 -0
- data/shoes/ruby/lib/rss/dublincore/2.0.rb +13 -0
- data/shoes/ruby/lib/rss/dublincore/atom.rb +17 -0
- data/shoes/ruby/lib/rss/dublincore.rb +161 -0
- data/shoes/ruby/lib/rss/image.rb +193 -0
- data/shoes/ruby/lib/rss/itunes.rb +410 -0
- data/shoes/ruby/lib/rss/maker/0.9.rb +467 -0
- data/shoes/ruby/lib/rss/maker/1.0.rb +434 -0
- data/shoes/ruby/lib/rss/maker/2.0.rb +223 -0
- data/shoes/ruby/lib/rss/maker/atom.rb +172 -0
- data/shoes/ruby/lib/rss/maker/base.rb +880 -0
- data/shoes/ruby/lib/rss/maker/content.rb +21 -0
- data/shoes/ruby/lib/rss/maker/dublincore.rb +124 -0
- data/shoes/ruby/lib/rss/maker/entry.rb +163 -0
- data/shoes/ruby/lib/rss/maker/feed.rb +430 -0
- data/shoes/ruby/lib/rss/maker/image.rb +111 -0
- data/shoes/ruby/lib/rss/maker/itunes.rb +242 -0
- data/shoes/ruby/lib/rss/maker/slash.rb +33 -0
- data/shoes/ruby/lib/rss/maker/syndication.rb +18 -0
- data/shoes/ruby/lib/rss/maker/taxonomy.rb +118 -0
- data/shoes/ruby/lib/rss/maker/trackback.rb +61 -0
- data/shoes/ruby/lib/rss/maker.rb +44 -0
- data/shoes/ruby/lib/rss/parser.rb +568 -0
- data/shoes/ruby/lib/rss/rexmlparser.rb +54 -0
- data/shoes/ruby/lib/rss/rss.rb +1313 -0
- data/shoes/ruby/lib/rss/slash.rb +49 -0
- data/shoes/ruby/lib/rss/syndication.rb +67 -0
- data/shoes/ruby/lib/rss/taxonomy.rb +145 -0
- data/shoes/ruby/lib/rss/trackback.rb +288 -0
- data/shoes/ruby/lib/rss/utils.rb +111 -0
- data/shoes/ruby/lib/rss/xml-stylesheet.rb +105 -0
- data/shoes/ruby/lib/rss/xml.rb +71 -0
- data/shoes/ruby/lib/rss/xmlparser.rb +93 -0
- data/shoes/ruby/lib/rss/xmlscanner.rb +121 -0
- data/shoes/ruby/lib/rss.rb +19 -0
- data/shoes/ruby/lib/rubygems/builder.rb +88 -0
- data/shoes/ruby/lib/rubygems/command.rb +406 -0
- data/shoes/ruby/lib/rubygems/command_manager.rb +146 -0
- data/shoes/ruby/lib/rubygems/commands/build_command.rb +53 -0
- data/shoes/ruby/lib/rubygems/commands/cert_command.rb +86 -0
- data/shoes/ruby/lib/rubygems/commands/check_command.rb +75 -0
- data/shoes/ruby/lib/rubygems/commands/cleanup_command.rb +91 -0
- data/shoes/ruby/lib/rubygems/commands/contents_command.rb +74 -0
- data/shoes/ruby/lib/rubygems/commands/dependency_command.rb +188 -0
- data/shoes/ruby/lib/rubygems/commands/environment_command.rb +128 -0
- data/shoes/ruby/lib/rubygems/commands/fetch_command.rb +62 -0
- data/shoes/ruby/lib/rubygems/commands/generate_index_command.rb +57 -0
- data/shoes/ruby/lib/rubygems/commands/help_command.rb +172 -0
- data/shoes/ruby/lib/rubygems/commands/install_command.rb +148 -0
- data/shoes/ruby/lib/rubygems/commands/list_command.rb +35 -0
- data/shoes/ruby/lib/rubygems/commands/lock_command.rb +110 -0
- data/shoes/ruby/lib/rubygems/commands/mirror_command.rb +111 -0
- data/shoes/ruby/lib/rubygems/commands/outdated_command.rb +33 -0
- data/shoes/ruby/lib/rubygems/commands/pristine_command.rb +93 -0
- data/shoes/ruby/lib/rubygems/commands/query_command.rb +233 -0
- data/shoes/ruby/lib/rubygems/commands/rdoc_command.rb +82 -0
- data/shoes/ruby/lib/rubygems/commands/search_command.rb +37 -0
- data/shoes/ruby/lib/rubygems/commands/server_command.rb +48 -0
- data/shoes/ruby/lib/rubygems/commands/sources_command.rb +152 -0
- data/shoes/ruby/lib/rubygems/commands/specification_command.rb +77 -0
- data/shoes/ruby/lib/rubygems/commands/stale_command.rb +27 -0
- data/shoes/ruby/lib/rubygems/commands/uninstall_command.rb +73 -0
- data/shoes/ruby/lib/rubygems/commands/unpack_command.rb +95 -0
- data/shoes/ruby/lib/rubygems/commands/update_command.rb +181 -0
- data/shoes/ruby/lib/rubygems/commands/which_command.rb +87 -0
- data/shoes/ruby/lib/rubygems/config_file.rb +266 -0
- data/shoes/ruby/lib/rubygems/custom_require.rb +46 -0
- data/shoes/ruby/lib/rubygems/defaults.rb +89 -0
- data/shoes/ruby/lib/rubygems/dependency.rb +119 -0
- data/shoes/ruby/lib/rubygems/dependency_installer.rb +258 -0
- data/shoes/ruby/lib/rubygems/dependency_list.rb +165 -0
- data/shoes/ruby/lib/rubygems/digest/digest_adapter.rb +40 -0
- data/shoes/ruby/lib/rubygems/digest/md5.rb +23 -0
- data/shoes/ruby/lib/rubygems/digest/sha1.rb +17 -0
- data/shoes/ruby/lib/rubygems/digest/sha2.rb +17 -0
- data/shoes/ruby/lib/rubygems/doc_manager.rb +214 -0
- data/shoes/ruby/lib/rubygems/exceptions.rb +84 -0
- data/shoes/ruby/lib/rubygems/ext/builder.rb +56 -0
- data/shoes/ruby/lib/rubygems/ext/configure_builder.rb +24 -0
- data/shoes/ruby/lib/rubygems/ext/ext_conf_builder.rb +23 -0
- data/shoes/ruby/lib/rubygems/ext/rake_builder.rb +27 -0
- data/shoes/ruby/lib/rubygems/ext.rb +18 -0
- data/shoes/ruby/lib/rubygems/format.rb +87 -0
- data/shoes/ruby/lib/rubygems/gem_openssl.rb +83 -0
- data/shoes/ruby/lib/rubygems/gem_path_searcher.rb +100 -0
- data/shoes/ruby/lib/rubygems/gem_runner.rb +58 -0
- data/shoes/ruby/lib/rubygems/indexer/abstract_index_builder.rb +88 -0
- data/shoes/ruby/lib/rubygems/indexer/latest_index_builder.rb +35 -0
- data/shoes/ruby/lib/rubygems/indexer/marshal_index_builder.rb +17 -0
- data/shoes/ruby/lib/rubygems/indexer/master_index_builder.rb +54 -0
- data/shoes/ruby/lib/rubygems/indexer/quick_index_builder.rb +50 -0
- data/shoes/ruby/lib/rubygems/indexer.rb +370 -0
- data/shoes/ruby/lib/rubygems/install_update_options.rb +113 -0
- data/shoes/ruby/lib/rubygems/installer.rb +578 -0
- data/shoes/ruby/lib/rubygems/local_remote_options.rb +134 -0
- data/shoes/ruby/lib/rubygems/old_format.rb +148 -0
- data/shoes/ruby/lib/rubygems/package/f_sync_dir.rb +24 -0
- data/shoes/ruby/lib/rubygems/package/tar_header.rb +245 -0
- data/shoes/ruby/lib/rubygems/package/tar_input.rb +219 -0
- data/shoes/ruby/lib/rubygems/package/tar_output.rb +143 -0
- data/shoes/ruby/lib/rubygems/package/tar_reader/entry.rb +99 -0
- data/shoes/ruby/lib/rubygems/package/tar_reader.rb +86 -0
- data/shoes/ruby/lib/rubygems/package/tar_writer.rb +180 -0
- data/shoes/ruby/lib/rubygems/package.rb +95 -0
- data/shoes/ruby/lib/rubygems/platform.rb +178 -0
- data/shoes/ruby/lib/rubygems/remote_fetcher.rb +344 -0
- data/shoes/ruby/lib/rubygems/require_paths_builder.rb +15 -0
- data/shoes/ruby/lib/rubygems/requirement.rb +163 -0
- data/shoes/ruby/lib/rubygems/rubygems_version.rb +6 -0
- data/shoes/ruby/lib/rubygems/security.rb +786 -0
- data/shoes/ruby/lib/rubygems/server.rb +629 -0
- data/shoes/ruby/lib/rubygems/source_index.rb +559 -0
- data/shoes/ruby/lib/rubygems/source_info_cache.rb +393 -0
- data/shoes/ruby/lib/rubygems/source_info_cache_entry.rb +56 -0
- data/shoes/ruby/lib/rubygems/spec_fetcher.rb +249 -0
- data/shoes/ruby/lib/rubygems/specification.rb +1262 -0
- data/shoes/ruby/lib/rubygems/test_utilities.rb +131 -0
- data/shoes/ruby/lib/rubygems/timer.rb +25 -0
- data/shoes/ruby/lib/rubygems/uninstaller.rb +242 -0
- data/shoes/ruby/lib/rubygems/user_interaction.rb +360 -0
- data/shoes/ruby/lib/rubygems/validator.rb +208 -0
- data/shoes/ruby/lib/rubygems/version.rb +167 -0
- data/shoes/ruby/lib/rubygems/version_option.rb +48 -0
- data/shoes/ruby/lib/rubygems.rb +888 -0
- data/shoes/ruby/lib/scanf.rb +703 -0
- data/shoes/ruby/lib/securerandom.rb +182 -0
- data/shoes/ruby/lib/set.rb +1274 -0
- data/shoes/ruby/lib/shell/builtin-command.rb +160 -0
- data/shoes/ruby/lib/shell/command-processor.rb +593 -0
- data/shoes/ruby/lib/shell/error.rb +25 -0
- data/shoes/ruby/lib/shell/filter.rb +109 -0
- data/shoes/ruby/lib/shell/process-controller.rb +319 -0
- data/shoes/ruby/lib/shell/system-command.rb +159 -0
- data/shoes/ruby/lib/shell/version.rb +15 -0
- data/shoes/ruby/lib/shell.rb +300 -0
- data/shoes/ruby/lib/shellwords.rb +156 -0
- data/shoes/ruby/lib/singleton.rb +313 -0
- data/shoes/ruby/lib/sync.rb +307 -0
- data/shoes/ruby/lib/tempfile.rb +218 -0
- data/shoes/ruby/lib/test/unit/assertions.rb +122 -0
- data/shoes/ruby/lib/test/unit/testcase.rb +12 -0
- data/shoes/ruby/lib/test/unit.rb +66 -0
- data/shoes/ruby/lib/thread.rb +367 -0
- data/shoes/ruby/lib/thwait.rb +168 -0
- data/shoes/ruby/lib/time.rb +869 -0
- data/shoes/ruby/lib/timeout.rb +108 -0
- data/shoes/ruby/lib/tmpdir.rb +138 -0
- data/shoes/ruby/lib/tracer.rb +166 -0
- data/shoes/ruby/lib/tsort.rb +290 -0
- data/shoes/ruby/lib/ubygems.rb +10 -0
- data/shoes/ruby/lib/un.rb +304 -0
- data/shoes/ruby/lib/uri/common.rb +727 -0
- data/shoes/ruby/lib/uri/ftp.rb +198 -0
- data/shoes/ruby/lib/uri/generic.rb +1128 -0
- data/shoes/ruby/lib/uri/http.rb +100 -0
- data/shoes/ruby/lib/uri/https.rb +20 -0
- data/shoes/ruby/lib/uri/ldap.rb +190 -0
- data/shoes/ruby/lib/uri/ldaps.rb +12 -0
- data/shoes/ruby/lib/uri/mailto.rb +266 -0
- data/shoes/ruby/lib/uri.rb +29 -0
- data/shoes/ruby/lib/weakref.rb +80 -0
- data/shoes/ruby/lib/webrick/accesslog.rb +75 -0
- data/shoes/ruby/lib/webrick/cgi.rb +260 -0
- data/shoes/ruby/lib/webrick/compat.rb +15 -0
- data/shoes/ruby/lib/webrick/config.rb +100 -0
- data/shoes/ruby/lib/webrick/cookie.rb +110 -0
- data/shoes/ruby/lib/webrick/htmlutils.rb +25 -0
- data/shoes/ruby/lib/webrick/httpauth/authenticator.rb +79 -0
- data/shoes/ruby/lib/webrick/httpauth/basicauth.rb +65 -0
- data/shoes/ruby/lib/webrick/httpauth/digestauth.rb +344 -0
- data/shoes/ruby/lib/webrick/httpauth/htdigest.rb +91 -0
- data/shoes/ruby/lib/webrick/httpauth/htgroup.rb +61 -0
- data/shoes/ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
- data/shoes/ruby/lib/webrick/httpauth/userdb.rb +29 -0
- data/shoes/ruby/lib/webrick/httpauth.rb +45 -0
- data/shoes/ruby/lib/webrick/httpproxy.rb +288 -0
- data/shoes/ruby/lib/webrick/httprequest.rb +402 -0
- data/shoes/ruby/lib/webrick/httpresponse.rb +326 -0
- data/shoes/ruby/lib/webrick/https.rb +63 -0
- data/shoes/ruby/lib/webrick/httpserver.rb +217 -0
- data/shoes/ruby/lib/webrick/httpservlet/abstract.rb +70 -0
- data/shoes/ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/shoes/ruby/lib/webrick/httpservlet/cgihandler.rb +110 -0
- data/shoes/ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
- data/shoes/ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
- data/shoes/ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
- data/shoes/ruby/lib/webrick/httpservlet.rb +22 -0
- data/shoes/ruby/lib/webrick/httpstatus.rb +132 -0
- data/shoes/ruby/lib/webrick/httputils.rb +392 -0
- data/shoes/ruby/lib/webrick/httpversion.rb +49 -0
- data/shoes/ruby/lib/webrick/log.rb +88 -0
- data/shoes/ruby/lib/webrick/server.rb +210 -0
- data/shoes/ruby/lib/webrick/ssl.rb +126 -0
- data/shoes/ruby/lib/webrick/utils.rb +175 -0
- data/shoes/ruby/lib/webrick/version.rb +13 -0
- data/shoes/ruby/lib/webrick.rb +29 -0
- data/shoes/ruby/lib/win32/registry.rb +832 -0
- data/shoes/ruby/lib/win32/resolv.rb +370 -0
- data/shoes/ruby/lib/win32/sspi.rb +330 -0
- data/shoes/ruby/lib/win32ole/property.rb +16 -0
- data/shoes/ruby/lib/xmlrpc/base64.rb +81 -0
- data/shoes/ruby/lib/xmlrpc/client.rb +625 -0
- data/shoes/ruby/lib/xmlrpc/config.rb +40 -0
- data/shoes/ruby/lib/xmlrpc/create.rb +290 -0
- data/shoes/ruby/lib/xmlrpc/datetime.rb +142 -0
- data/shoes/ruby/lib/xmlrpc/httpserver.rb +178 -0
- data/shoes/ruby/lib/xmlrpc/marshal.rb +76 -0
- data/shoes/ruby/lib/xmlrpc/parser.rb +813 -0
- data/shoes/ruby/lib/xmlrpc/server.rb +778 -0
- data/shoes/ruby/lib/xmlrpc/utils.rb +165 -0
- data/shoes/ruby/lib/yaml/baseemitter.rb +242 -0
- data/shoes/ruby/lib/yaml/basenode.rb +216 -0
- data/shoes/ruby/lib/yaml/constants.rb +45 -0
- data/shoes/ruby/lib/yaml/dbm.rb +111 -0
- data/shoes/ruby/lib/yaml/encoding.rb +33 -0
- data/shoes/ruby/lib/yaml/error.rb +34 -0
- data/shoes/ruby/lib/yaml/loader.rb +14 -0
- data/shoes/ruby/lib/yaml/rubytypes.rb +446 -0
- data/shoes/ruby/lib/yaml/store.rb +43 -0
- data/shoes/ruby/lib/yaml/stream.rb +40 -0
- data/shoes/ruby/lib/yaml/stringio.rb +83 -0
- data/shoes/ruby/lib/yaml/syck.rb +19 -0
- data/shoes/ruby/lib/yaml/tag.rb +91 -0
- data/shoes/ruby/lib/yaml/types.rb +192 -0
- data/shoes/ruby/lib/yaml/yamlnode.rb +54 -0
- data/shoes/ruby/lib/yaml/ypath.rb +52 -0
- data/shoes/ruby/lib/yaml.rb +440 -0
- data/shoes/samples/class-book.rb +43 -0
- data/shoes/samples/class-book.yaml +387 -0
- data/shoes/samples/expert-definr.rb +23 -0
- data/shoes/samples/expert-funnies.rb +51 -0
- data/shoes/samples/expert-irb.rb +112 -0
- data/shoes/samples/expert-minesweeper.rb +267 -0
- data/shoes/samples/expert-othello.rb +319 -0
- data/shoes/samples/expert-pong.rb +62 -0
- data/shoes/samples/expert-tankspank.rb +385 -0
- data/shoes/samples/good-arc.rb +37 -0
- data/shoes/samples/good-clock.rb +51 -0
- data/shoes/samples/good-follow.rb +26 -0
- data/shoes/samples/good-reminder.rb +174 -0
- data/shoes/samples/good-vjot.rb +56 -0
- data/shoes/samples/simple-accordion.rb +75 -0
- data/shoes/samples/simple-anim-shapes.rb +17 -0
- data/shoes/samples/simple-anim-text.rb +13 -0
- data/shoes/samples/simple-arc.rb +23 -0
- data/shoes/samples/simple-bounce.rb +24 -0
- data/shoes/samples/simple-calc.rb +70 -0
- data/shoes/samples/simple-control-sizes.rb +24 -0
- data/shoes/samples/simple-curve.rb +26 -0
- data/shoes/samples/simple-dialogs.rb +29 -0
- data/shoes/samples/simple-downloader.rb +27 -0
- data/shoes/samples/simple-draw.rb +13 -0
- data/shoes/samples/simple-editor.rb +28 -0
- data/shoes/samples/simple-form.rb +28 -0
- data/shoes/samples/simple-form.shy +0 -0
- data/shoes/samples/simple-mask.rb +21 -0
- data/shoes/samples/simple-menu.rb +31 -0
- data/shoes/samples/simple-menu1.rb +35 -0
- data/shoes/samples/simple-rubygems.rb +29 -0
- data/shoes/samples/simple-slide.rb +45 -0
- data/shoes/samples/simple-sphere.rb +28 -0
- data/shoes/samples/simple-timer.rb +13 -0
- data/shoes/samples/simple-video.rb +13 -0
- data/shoes/shoes +21 -0
- data/shoes/shoes.exe +0 -0
- data/shoes/shoes.exe.manifest +17 -0
- data/shoes/sqlite3.dll +0 -0
- data/shoes/static/Shoes.icns +0 -0
- data/shoes/static/Thumbs.db +0 -0
- data/shoes/static/app-icon.png +0 -0
- data/shoes/static/avatar.png +0 -0
- data/shoes/static/code_highlighter.js +188 -0
- data/shoes/static/code_highlighter_ruby.js +26 -0
- data/shoes/static/icon-debug.png +0 -0
- data/shoes/static/icon-error.png +0 -0
- data/shoes/static/icon-info.png +0 -0
- data/shoes/static/icon-warn.png +0 -0
- data/shoes/static/listbox_button1.png +0 -0
- data/shoes/static/listbox_button2.png +0 -0
- data/shoes/static/man-app.png +0 -0
- data/shoes/static/man-builds.png +0 -0
- data/shoes/static/man-editor-notepad.png +0 -0
- data/shoes/static/man-editor-osx.png +0 -0
- data/shoes/static/man-ele-background.png +0 -0
- data/shoes/static/man-ele-border.png +0 -0
- data/shoes/static/man-ele-button.png +0 -0
- data/shoes/static/man-ele-check.png +0 -0
- data/shoes/static/man-ele-editbox.png +0 -0
- data/shoes/static/man-ele-editline.png +0 -0
- data/shoes/static/man-ele-image.png +0 -0
- data/shoes/static/man-ele-listbox.png +0 -0
- data/shoes/static/man-ele-progress.png +0 -0
- data/shoes/static/man-ele-radio.png +0 -0
- data/shoes/static/man-ele-shape.png +0 -0
- data/shoes/static/man-ele-textblock.png +0 -0
- data/shoes/static/man-ele-video.png +0 -0
- data/shoes/static/man-intro-dmg.png +0 -0
- data/shoes/static/man-intro-exe.png +0 -0
- data/shoes/static/man-look-tiger.png +0 -0
- data/shoes/static/man-look-ubuntu.png +0 -0
- data/shoes/static/man-look-vista.png +0 -0
- data/shoes/static/man-run-osx.png +0 -0
- data/shoes/static/man-run-vista.png +0 -0
- data/shoes/static/man-run-xp.png +0 -0
- data/shoes/static/man-shot1.png +0 -0
- data/shoes/static/manual-en.txt +2783 -0
- data/shoes/static/manual-ja.txt +2780 -0
- data/shoes/static/manual.css +167 -0
- data/shoes/static/menu-corner1.png +0 -0
- data/shoes/static/menu-corner2.png +0 -0
- data/shoes/static/menu-gray.png +0 -0
- data/shoes/static/menu-left.png +0 -0
- data/shoes/static/menu-right.png +0 -0
- data/shoes/static/menu-top.png +0 -0
- data/shoes/static/shoes-dmg.jpg +0 -0
- data/shoes/static/shoes-icon-blue.png +0 -0
- data/shoes/static/shoes-icon.png +0 -0
- data/shoes/static/shoes-manual-apps.gif +0 -0
- data/shoes/static/stripe.png +0 -0
- data/shoes/static/stubs/blank.exe +0 -0
- data/shoes/static/stubs/blank.hfz +0 -0
- data/shoes/static/stubs/blank.run +375 -0
- data/shoes/static/stubs/cocoa-install +0 -0
- data/shoes/static/stubs/sh-install +48 -0
- data/shoes/static/tutor-back.png +0 -0
- data/shoes/zlib.dll +0 -0
- data/shoes/zlib1.dll +0 -0
- metadata +887 -0
@@ -0,0 +1,2465 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#--
|
4
|
+
|
5
|
+
# Copyright (c) 2003, 2004, 2005, 2006, 2007 Jim Weirich
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to
|
9
|
+
# deal in the Software without restriction, including without limitation the
|
10
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
11
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
23
|
+
# IN THE SOFTWARE.
|
24
|
+
#++
|
25
|
+
#
|
26
|
+
# = Rake -- Ruby Make
|
27
|
+
#
|
28
|
+
# This is the main file for the Rake application. Normally it is referenced
|
29
|
+
# as a library via a require statement, but it can be distributed
|
30
|
+
# independently as an application.
|
31
|
+
|
32
|
+
RAKEVERSION = '0.8.3'
|
33
|
+
|
34
|
+
require 'rbconfig'
|
35
|
+
require 'fileutils'
|
36
|
+
require 'singleton'
|
37
|
+
require 'monitor'
|
38
|
+
require 'optparse'
|
39
|
+
require 'ostruct'
|
40
|
+
|
41
|
+
require 'rake/win32'
|
42
|
+
|
43
|
+
######################################################################
|
44
|
+
# Rake extensions to Module.
|
45
|
+
#
|
46
|
+
class Module
|
47
|
+
# Check for an existing method in the current class before extending. IF
|
48
|
+
# the method already exists, then a warning is printed and the extension is
|
49
|
+
# not added. Otherwise the block is yielded and any definitions in the
|
50
|
+
# block will take effect.
|
51
|
+
#
|
52
|
+
# Usage:
|
53
|
+
#
|
54
|
+
# class String
|
55
|
+
# rake_extension("xyz") do
|
56
|
+
# def xyz
|
57
|
+
# ...
|
58
|
+
# end
|
59
|
+
# end
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
def rake_extension(method)
|
63
|
+
if method_defined?(method)
|
64
|
+
$stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists"
|
65
|
+
else
|
66
|
+
yield
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end # module Module
|
70
|
+
|
71
|
+
|
72
|
+
######################################################################
|
73
|
+
# User defined methods to be added to String.
|
74
|
+
#
|
75
|
+
class String
|
76
|
+
rake_extension("ext") do
|
77
|
+
# Replace the file extension with +newext+. If there is no extenson on
|
78
|
+
# the string, append the new extension to the end. If the new extension
|
79
|
+
# is not given, or is the empty string, remove any existing extension.
|
80
|
+
#
|
81
|
+
# +ext+ is a user added method for the String class.
|
82
|
+
def ext(newext='')
|
83
|
+
return self.dup if ['.', '..'].include? self
|
84
|
+
if newext != ''
|
85
|
+
newext = (newext =~ /^\./) ? newext : ("." + newext)
|
86
|
+
end
|
87
|
+
self.chomp(File.extname(self)) << newext
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
rake_extension("pathmap") do
|
92
|
+
# Explode a path into individual components. Used by +pathmap+.
|
93
|
+
def pathmap_explode
|
94
|
+
head, tail = File.split(self)
|
95
|
+
return [self] if head == self
|
96
|
+
return [tail] if head == '.' || tail == '/'
|
97
|
+
return [head, tail] if head == '/'
|
98
|
+
return head.pathmap_explode + [tail]
|
99
|
+
end
|
100
|
+
protected :pathmap_explode
|
101
|
+
|
102
|
+
# Extract a partial path from the path. Include +n+ directories from the
|
103
|
+
# front end (left hand side) if +n+ is positive. Include |+n+|
|
104
|
+
# directories from the back end (right hand side) if +n+ is negative.
|
105
|
+
def pathmap_partial(n)
|
106
|
+
dirs = File.dirname(self).pathmap_explode
|
107
|
+
partial_dirs =
|
108
|
+
if n > 0
|
109
|
+
dirs[0...n]
|
110
|
+
elsif n < 0
|
111
|
+
dirs.reverse[0...-n].reverse
|
112
|
+
else
|
113
|
+
"."
|
114
|
+
end
|
115
|
+
File.join(partial_dirs)
|
116
|
+
end
|
117
|
+
protected :pathmap_partial
|
118
|
+
|
119
|
+
# Preform the pathmap replacement operations on the given path. The
|
120
|
+
# patterns take the form 'pat1,rep1;pat2,rep2...'.
|
121
|
+
def pathmap_replace(patterns, &block)
|
122
|
+
result = self
|
123
|
+
patterns.split(';').each do |pair|
|
124
|
+
pattern, replacement = pair.split(',')
|
125
|
+
pattern = Regexp.new(pattern)
|
126
|
+
if replacement == '*' && block_given?
|
127
|
+
result = result.sub(pattern, &block)
|
128
|
+
elsif replacement
|
129
|
+
result = result.sub(pattern, replacement)
|
130
|
+
else
|
131
|
+
result = result.sub(pattern, '')
|
132
|
+
end
|
133
|
+
end
|
134
|
+
result
|
135
|
+
end
|
136
|
+
protected :pathmap_replace
|
137
|
+
|
138
|
+
# Map the path according to the given specification. The specification
|
139
|
+
# controls the details of the mapping. The following special patterns are
|
140
|
+
# recognized:
|
141
|
+
#
|
142
|
+
# * <b>%p</b> -- The complete path.
|
143
|
+
# * <b>%f</b> -- The base file name of the path, with its file extension,
|
144
|
+
# but without any directories.
|
145
|
+
# * <b>%n</b> -- The file name of the path without its file extension.
|
146
|
+
# * <b>%d</b> -- The directory list of the path.
|
147
|
+
# * <b>%x</b> -- The file extension of the path. An empty string if there
|
148
|
+
# is no extension.
|
149
|
+
# * <b>%X</b> -- Everything *but* the file extension.
|
150
|
+
# * <b>%s</b> -- The alternate file separater if defined, otherwise use
|
151
|
+
# the standard file separator.
|
152
|
+
# * <b>%%</b> -- A percent sign.
|
153
|
+
#
|
154
|
+
# The %d specifier can also have a numeric prefix (e.g. '%2d'). If the
|
155
|
+
# number is positive, only return (up to) +n+ directories in the path,
|
156
|
+
# starting from the left hand side. If +n+ is negative, return (up to)
|
157
|
+
# |+n+| directories from the right hand side of the path.
|
158
|
+
#
|
159
|
+
# Examples:
|
160
|
+
#
|
161
|
+
# 'a/b/c/d/file.txt'.pathmap("%2d") => 'a/b'
|
162
|
+
# 'a/b/c/d/file.txt'.pathmap("%-2d") => 'c/d'
|
163
|
+
#
|
164
|
+
# Also the %d, %p, %f, %n, %x, and %X operators can take a
|
165
|
+
# pattern/replacement argument to perform simple string substititions on a
|
166
|
+
# particular part of the path. The pattern and replacement are speparated
|
167
|
+
# by a comma and are enclosed by curly braces. The replacement spec comes
|
168
|
+
# after the % character but before the operator letter. (e.g.
|
169
|
+
# "%{old,new}d"). Muliple replacement specs should be separated by
|
170
|
+
# semi-colons (e.g. "%{old,new;src,bin}d").
|
171
|
+
#
|
172
|
+
# Regular expressions may be used for the pattern, and back refs may be
|
173
|
+
# used in the replacement text. Curly braces, commas and semi-colons are
|
174
|
+
# excluded from both the pattern and replacement text (let's keep parsing
|
175
|
+
# reasonable).
|
176
|
+
#
|
177
|
+
# For example:
|
178
|
+
#
|
179
|
+
# "src/org/onestepback/proj/A.java".pathmap("%{^src,bin}X.class")
|
180
|
+
#
|
181
|
+
# returns:
|
182
|
+
#
|
183
|
+
# "bin/org/onestepback/proj/A.class"
|
184
|
+
#
|
185
|
+
# If the replacement text is '*', then a block may be provided to perform
|
186
|
+
# some arbitrary calculation for the replacement.
|
187
|
+
#
|
188
|
+
# For example:
|
189
|
+
#
|
190
|
+
# "/path/to/file.TXT".pathmap("%X%{.*,*}x") { |ext|
|
191
|
+
# ext.downcase
|
192
|
+
# }
|
193
|
+
#
|
194
|
+
# Returns:
|
195
|
+
#
|
196
|
+
# "/path/to/file.txt"
|
197
|
+
#
|
198
|
+
def pathmap(spec=nil, &block)
|
199
|
+
return self if spec.nil?
|
200
|
+
result = ''
|
201
|
+
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
|
202
|
+
case frag
|
203
|
+
when '%f'
|
204
|
+
result << File.basename(self)
|
205
|
+
when '%n'
|
206
|
+
result << File.basename(self, '.*')
|
207
|
+
when '%d'
|
208
|
+
result << File.dirname(self)
|
209
|
+
when '%x'
|
210
|
+
result << File.extname(self)
|
211
|
+
when '%X'
|
212
|
+
result << self.ext
|
213
|
+
when '%p'
|
214
|
+
result << self
|
215
|
+
when '%s'
|
216
|
+
result << (File::ALT_SEPARATOR || File::SEPARATOR)
|
217
|
+
when '%-'
|
218
|
+
# do nothing
|
219
|
+
when '%%'
|
220
|
+
result << "%"
|
221
|
+
when /%(-?\d+)d/
|
222
|
+
result << pathmap_partial($1.to_i)
|
223
|
+
when /^%\{([^}]*)\}(\d*[dpfnxX])/
|
224
|
+
patterns, operator = $1, $2
|
225
|
+
result << pathmap('%' + operator).pathmap_replace(patterns, &block)
|
226
|
+
when /^%/
|
227
|
+
fail ArgumentError, "Unknown pathmap specifier #{frag} in '#{spec}'"
|
228
|
+
else
|
229
|
+
result << frag
|
230
|
+
end
|
231
|
+
end
|
232
|
+
result
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end # class String
|
236
|
+
|
237
|
+
##############################################################################
|
238
|
+
module Rake
|
239
|
+
|
240
|
+
# Errors -----------------------------------------------------------
|
241
|
+
|
242
|
+
# Error indicating an ill-formed task declaration.
|
243
|
+
class TaskArgumentError < ArgumentError
|
244
|
+
end
|
245
|
+
|
246
|
+
# Error indicating a recursion overflow error in task selection.
|
247
|
+
class RuleRecursionOverflowError < StandardError
|
248
|
+
def initialize(*args)
|
249
|
+
super
|
250
|
+
@targets = []
|
251
|
+
end
|
252
|
+
|
253
|
+
def add_target(target)
|
254
|
+
@targets << target
|
255
|
+
end
|
256
|
+
|
257
|
+
def message
|
258
|
+
super + ": [" + @targets.reverse.join(' => ') + "]"
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
# --------------------------------------------------------------------------
|
263
|
+
# Rake module singleton methods.
|
264
|
+
#
|
265
|
+
class << self
|
266
|
+
# Current Rake Application
|
267
|
+
def application
|
268
|
+
@application ||= Rake::Application.new
|
269
|
+
end
|
270
|
+
|
271
|
+
# Set the current Rake application object.
|
272
|
+
def application=(app)
|
273
|
+
@application = app
|
274
|
+
end
|
275
|
+
|
276
|
+
# Return the original directory where the Rake application was started.
|
277
|
+
def original_dir
|
278
|
+
application.original_dir
|
279
|
+
end
|
280
|
+
|
281
|
+
end
|
282
|
+
|
283
|
+
# ##########################################################################
|
284
|
+
# Mixin for creating easily cloned objects.
|
285
|
+
#
|
286
|
+
module Cloneable
|
287
|
+
# Clone an object by making a new object and setting all the instance
|
288
|
+
# variables to the same values.
|
289
|
+
def dup
|
290
|
+
sibling = self.class.new
|
291
|
+
instance_variables.each do |ivar|
|
292
|
+
value = self.instance_variable_get(ivar)
|
293
|
+
new_value = value.clone rescue value
|
294
|
+
sibling.instance_variable_set(ivar, new_value)
|
295
|
+
end
|
296
|
+
sibling.taint if tainted?
|
297
|
+
sibling
|
298
|
+
end
|
299
|
+
|
300
|
+
def clone
|
301
|
+
sibling = dup
|
302
|
+
sibling.freeze if frozen?
|
303
|
+
sibling
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
####################################################################
|
308
|
+
# TaskAguments manage the arguments passed to a task.
|
309
|
+
#
|
310
|
+
class TaskArguments
|
311
|
+
include Enumerable
|
312
|
+
|
313
|
+
attr_reader :names
|
314
|
+
|
315
|
+
# Create a TaskArgument object with a list of named arguments
|
316
|
+
# (given by :names) and a set of associated values (given by
|
317
|
+
# :values). :parent is the parent argument object.
|
318
|
+
def initialize(names, values, parent=nil)
|
319
|
+
@names = names
|
320
|
+
@parent = parent
|
321
|
+
@hash = {}
|
322
|
+
names.each_with_index { |name, i|
|
323
|
+
@hash[name.to_sym] = values[i] unless values[i].nil?
|
324
|
+
}
|
325
|
+
end
|
326
|
+
|
327
|
+
# Create a new argument scope using the prerequisite argument
|
328
|
+
# names.
|
329
|
+
def new_scope(names)
|
330
|
+
values = names.collect { |n| self[n] }
|
331
|
+
self.class.new(names, values, self)
|
332
|
+
end
|
333
|
+
|
334
|
+
# Find an argument value by name or index.
|
335
|
+
def [](index)
|
336
|
+
lookup(index.to_sym)
|
337
|
+
end
|
338
|
+
|
339
|
+
# Specify a hash of default values for task arguments. Use the
|
340
|
+
# defaults only if there is no specific value for the given
|
341
|
+
# argument.
|
342
|
+
def with_defaults(defaults)
|
343
|
+
@hash = defaults.merge(@hash)
|
344
|
+
end
|
345
|
+
|
346
|
+
def each(&block)
|
347
|
+
@hash.each(&block)
|
348
|
+
end
|
349
|
+
|
350
|
+
def method_missing(sym, *args, &block)
|
351
|
+
lookup(sym.to_sym)
|
352
|
+
end
|
353
|
+
|
354
|
+
def to_hash
|
355
|
+
@hash
|
356
|
+
end
|
357
|
+
|
358
|
+
def to_s
|
359
|
+
@hash.inspect
|
360
|
+
end
|
361
|
+
|
362
|
+
def inspect
|
363
|
+
to_s
|
364
|
+
end
|
365
|
+
|
366
|
+
protected
|
367
|
+
|
368
|
+
def lookup(name)
|
369
|
+
if @hash.has_key?(name)
|
370
|
+
@hash[name]
|
371
|
+
elsif ENV.has_key?(name.to_s)
|
372
|
+
ENV[name.to_s]
|
373
|
+
elsif ENV.has_key?(name.to_s.upcase)
|
374
|
+
ENV[name.to_s.upcase]
|
375
|
+
elsif @parent
|
376
|
+
@parent.lookup(name)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
EMPTY_TASK_ARGS = TaskArguments.new([], [])
|
382
|
+
|
383
|
+
####################################################################
|
384
|
+
# InvocationChain tracks the chain of task invocations to detect
|
385
|
+
# circular dependencies.
|
386
|
+
class InvocationChain
|
387
|
+
def initialize(value, tail)
|
388
|
+
@value = value
|
389
|
+
@tail = tail
|
390
|
+
end
|
391
|
+
|
392
|
+
def member?(obj)
|
393
|
+
@value == obj || @tail.member?(obj)
|
394
|
+
end
|
395
|
+
|
396
|
+
def append(value)
|
397
|
+
if member?(value)
|
398
|
+
fail RuntimeError, "Circular dependency detected: #{to_s} => #{value}"
|
399
|
+
end
|
400
|
+
self.class.new(value, self)
|
401
|
+
end
|
402
|
+
|
403
|
+
def to_s
|
404
|
+
"#{prefix}#{@value}"
|
405
|
+
end
|
406
|
+
|
407
|
+
def self.append(value, chain)
|
408
|
+
chain.append(value)
|
409
|
+
end
|
410
|
+
|
411
|
+
private
|
412
|
+
|
413
|
+
def prefix
|
414
|
+
"#{@tail.to_s} => "
|
415
|
+
end
|
416
|
+
|
417
|
+
class EmptyInvocationChain
|
418
|
+
def member?(obj)
|
419
|
+
false
|
420
|
+
end
|
421
|
+
def append(value)
|
422
|
+
InvocationChain.new(value, self)
|
423
|
+
end
|
424
|
+
def to_s
|
425
|
+
"TOP"
|
426
|
+
end
|
427
|
+
end
|
428
|
+
|
429
|
+
EMPTY = EmptyInvocationChain.new
|
430
|
+
|
431
|
+
end # class InvocationChain
|
432
|
+
|
433
|
+
end # module Rake
|
434
|
+
|
435
|
+
module Rake
|
436
|
+
|
437
|
+
# #########################################################################
|
438
|
+
# A Task is the basic unit of work in a Rakefile. Tasks have associated
|
439
|
+
# actions (possibly more than one) and a list of prerequisites. When
|
440
|
+
# invoked, a task will first ensure that all of its prerequisites have an
|
441
|
+
# opportunity to run and then it will execute its own actions.
|
442
|
+
#
|
443
|
+
# Tasks are not usually created directly using the new method, but rather
|
444
|
+
# use the +file+ and +task+ convenience methods.
|
445
|
+
#
|
446
|
+
class Task
|
447
|
+
# List of prerequisites for a task.
|
448
|
+
attr_reader :prerequisites
|
449
|
+
|
450
|
+
# List of actions attached to a task.
|
451
|
+
attr_reader :actions
|
452
|
+
|
453
|
+
# Application owning this task.
|
454
|
+
attr_accessor :application
|
455
|
+
|
456
|
+
# Comment for this task. Restricted to a single line of no more than 50
|
457
|
+
# characters.
|
458
|
+
attr_reader :comment
|
459
|
+
|
460
|
+
# Full text of the (possibly multi-line) comment.
|
461
|
+
attr_reader :full_comment
|
462
|
+
|
463
|
+
# Array of nested namespaces names used for task lookup by this task.
|
464
|
+
attr_reader :scope
|
465
|
+
|
466
|
+
# Return task name
|
467
|
+
def to_s
|
468
|
+
name
|
469
|
+
end
|
470
|
+
|
471
|
+
def inspect
|
472
|
+
"<#{self.class} #{name} => [#{prerequisites.join(', ')}]>"
|
473
|
+
end
|
474
|
+
|
475
|
+
# List of sources for task.
|
476
|
+
attr_writer :sources
|
477
|
+
def sources
|
478
|
+
@sources ||= []
|
479
|
+
end
|
480
|
+
|
481
|
+
# First source from a rule (nil if no sources)
|
482
|
+
def source
|
483
|
+
@sources.first if defined?(@sources)
|
484
|
+
end
|
485
|
+
|
486
|
+
# Create a task named +task_name+ with no actions or prerequisites. Use
|
487
|
+
# +enhance+ to add actions and prerequisites.
|
488
|
+
def initialize(task_name, app)
|
489
|
+
@name = task_name.to_s
|
490
|
+
@prerequisites = []
|
491
|
+
@actions = []
|
492
|
+
@already_invoked = false
|
493
|
+
@full_comment = nil
|
494
|
+
@comment = nil
|
495
|
+
@lock = Monitor.new
|
496
|
+
@application = app
|
497
|
+
@scope = app.current_scope
|
498
|
+
@arg_names = nil
|
499
|
+
end
|
500
|
+
|
501
|
+
# Enhance a task with prerequisites or actions. Returns self.
|
502
|
+
def enhance(deps=nil, &block)
|
503
|
+
@prerequisites |= deps if deps
|
504
|
+
@actions << block if block_given?
|
505
|
+
self
|
506
|
+
end
|
507
|
+
|
508
|
+
# Name of the task, including any namespace qualifiers.
|
509
|
+
def name
|
510
|
+
@name.to_s
|
511
|
+
end
|
512
|
+
|
513
|
+
# Name of task with argument list description.
|
514
|
+
def name_with_args # :nodoc:
|
515
|
+
if arg_description
|
516
|
+
"#{name}#{arg_description}"
|
517
|
+
else
|
518
|
+
name
|
519
|
+
end
|
520
|
+
end
|
521
|
+
|
522
|
+
# Argument description (nil if none).
|
523
|
+
def arg_description # :nodoc:
|
524
|
+
@arg_names ? "[#{(arg_names || []).join(',')}]" : nil
|
525
|
+
end
|
526
|
+
|
527
|
+
# Name of arguments for this task.
|
528
|
+
def arg_names
|
529
|
+
@arg_names || []
|
530
|
+
end
|
531
|
+
|
532
|
+
# Reenable the task, allowing its tasks to be executed if the task
|
533
|
+
# is invoked again.
|
534
|
+
def reenable
|
535
|
+
@already_invoked = false
|
536
|
+
end
|
537
|
+
|
538
|
+
# Clear the existing prerequisites and actions of a rake task.
|
539
|
+
def clear
|
540
|
+
clear_prerequisites
|
541
|
+
clear_actions
|
542
|
+
self
|
543
|
+
end
|
544
|
+
|
545
|
+
# Clear the existing prerequisites of a rake task.
|
546
|
+
def clear_prerequisites
|
547
|
+
prerequisites.clear
|
548
|
+
self
|
549
|
+
end
|
550
|
+
|
551
|
+
# Clear the existing actions on a rake task.
|
552
|
+
def clear_actions
|
553
|
+
actions.clear
|
554
|
+
self
|
555
|
+
end
|
556
|
+
|
557
|
+
# Invoke the task if it is needed. Prerequites are invoked first.
|
558
|
+
def invoke(*args)
|
559
|
+
task_args = TaskArguments.new(arg_names, args)
|
560
|
+
invoke_with_call_chain(task_args, InvocationChain::EMPTY)
|
561
|
+
end
|
562
|
+
|
563
|
+
# Same as invoke, but explicitly pass a call chain to detect
|
564
|
+
# circular dependencies.
|
565
|
+
def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
|
566
|
+
new_chain = InvocationChain.append(self, invocation_chain)
|
567
|
+
@lock.synchronize do
|
568
|
+
if application.options.trace
|
569
|
+
puts "** Invoke #{name} #{format_trace_flags}"
|
570
|
+
end
|
571
|
+
return if @already_invoked
|
572
|
+
@already_invoked = true
|
573
|
+
invoke_prerequisites(task_args, new_chain)
|
574
|
+
execute(task_args) if needed?
|
575
|
+
end
|
576
|
+
end
|
577
|
+
protected :invoke_with_call_chain
|
578
|
+
|
579
|
+
# Invoke all the prerequisites of a task.
|
580
|
+
def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
|
581
|
+
@prerequisites.each { |n|
|
582
|
+
prereq = application[n, @scope]
|
583
|
+
prereq_args = task_args.new_scope(prereq.arg_names)
|
584
|
+
prereq.invoke_with_call_chain(prereq_args, invocation_chain)
|
585
|
+
}
|
586
|
+
end
|
587
|
+
|
588
|
+
# Format the trace flags for display.
|
589
|
+
def format_trace_flags
|
590
|
+
flags = []
|
591
|
+
flags << "first_time" unless @already_invoked
|
592
|
+
flags << "not_needed" unless needed?
|
593
|
+
flags.empty? ? "" : "(" + flags.join(", ") + ")"
|
594
|
+
end
|
595
|
+
private :format_trace_flags
|
596
|
+
|
597
|
+
# Execute the actions associated with this task.
|
598
|
+
def execute(args=nil)
|
599
|
+
args ||= EMPTY_TASK_ARGS
|
600
|
+
if application.options.dryrun
|
601
|
+
puts "** Execute (dry run) #{name}"
|
602
|
+
return
|
603
|
+
end
|
604
|
+
if application.options.trace
|
605
|
+
puts "** Execute #{name}"
|
606
|
+
end
|
607
|
+
application.enhance_with_matching_rule(name) if @actions.empty?
|
608
|
+
@actions.each do |act|
|
609
|
+
case act.arity
|
610
|
+
when 1
|
611
|
+
act.call(self)
|
612
|
+
else
|
613
|
+
act.call(self, args)
|
614
|
+
end
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
# Is this task needed?
|
619
|
+
def needed?
|
620
|
+
true
|
621
|
+
end
|
622
|
+
|
623
|
+
# Timestamp for this task. Basic tasks return the current time for their
|
624
|
+
# time stamp. Other tasks can be more sophisticated.
|
625
|
+
def timestamp
|
626
|
+
@prerequisites.collect { |p| application[p].timestamp }.max || Time.now
|
627
|
+
end
|
628
|
+
|
629
|
+
# Add a description to the task. The description can consist of an option
|
630
|
+
# argument list (enclosed brackets) and an optional comment.
|
631
|
+
def add_description(description)
|
632
|
+
return if ! description
|
633
|
+
comment = description.strip
|
634
|
+
add_comment(comment) if comment && ! comment.empty?
|
635
|
+
end
|
636
|
+
|
637
|
+
# Writing to the comment attribute is the same as adding a description.
|
638
|
+
def comment=(description)
|
639
|
+
add_description(description)
|
640
|
+
end
|
641
|
+
|
642
|
+
# Add a comment to the task. If a comment alread exists, separate
|
643
|
+
# the new comment with " / ".
|
644
|
+
def add_comment(comment)
|
645
|
+
if @full_comment
|
646
|
+
@full_comment << " / "
|
647
|
+
else
|
648
|
+
@full_comment = ''
|
649
|
+
end
|
650
|
+
@full_comment << comment
|
651
|
+
if @full_comment =~ /\A([^.]+?\.)( |$)/
|
652
|
+
@comment = $1
|
653
|
+
else
|
654
|
+
@comment = @full_comment
|
655
|
+
end
|
656
|
+
end
|
657
|
+
private :add_comment
|
658
|
+
|
659
|
+
# Set the names of the arguments for this task. +args+ should be
|
660
|
+
# an array of symbols, one for each argument name.
|
661
|
+
def set_arg_names(args)
|
662
|
+
@arg_names = args.map { |a| a.to_sym }
|
663
|
+
end
|
664
|
+
|
665
|
+
# Return a string describing the internal state of a task. Useful for
|
666
|
+
# debugging.
|
667
|
+
def investigation
|
668
|
+
result = "------------------------------\n"
|
669
|
+
result << "Investigating #{name}\n"
|
670
|
+
result << "class: #{self.class}\n"
|
671
|
+
result << "task needed: #{needed?}\n"
|
672
|
+
result << "timestamp: #{timestamp}\n"
|
673
|
+
result << "pre-requisites: \n"
|
674
|
+
prereqs = @prerequisites.collect {|name| application[name]}
|
675
|
+
prereqs.sort! {|a,b| a.timestamp <=> b.timestamp}
|
676
|
+
prereqs.each do |p|
|
677
|
+
result << "--#{p.name} (#{p.timestamp})\n"
|
678
|
+
end
|
679
|
+
latest_prereq = @prerequisites.collect{|n| application[n].timestamp}.max
|
680
|
+
result << "latest-prerequisite time: #{latest_prereq}\n"
|
681
|
+
result << "................................\n\n"
|
682
|
+
return result
|
683
|
+
end
|
684
|
+
|
685
|
+
# ----------------------------------------------------------------
|
686
|
+
# Rake Module Methods
|
687
|
+
#
|
688
|
+
class << self
|
689
|
+
|
690
|
+
# Clear the task list. This cause rake to immediately forget all the
|
691
|
+
# tasks that have been assigned. (Normally used in the unit tests.)
|
692
|
+
def clear
|
693
|
+
Rake.application.clear
|
694
|
+
end
|
695
|
+
|
696
|
+
# List of all defined tasks.
|
697
|
+
def tasks
|
698
|
+
Rake.application.tasks
|
699
|
+
end
|
700
|
+
|
701
|
+
# Return a task with the given name. If the task is not currently
|
702
|
+
# known, try to synthesize one from the defined rules. If no rules are
|
703
|
+
# found, but an existing file matches the task name, assume it is a file
|
704
|
+
# task with no dependencies or actions.
|
705
|
+
def [](task_name)
|
706
|
+
Rake.application[task_name]
|
707
|
+
end
|
708
|
+
|
709
|
+
# TRUE if the task name is already defined.
|
710
|
+
def task_defined?(task_name)
|
711
|
+
Rake.application.lookup(task_name) != nil
|
712
|
+
end
|
713
|
+
|
714
|
+
# Define a task given +args+ and an option block. If a rule with the
|
715
|
+
# given name already exists, the prerequisites and actions are added to
|
716
|
+
# the existing task. Returns the defined task.
|
717
|
+
def define_task(*args, &block)
|
718
|
+
Rake.application.define_task(self, *args, &block)
|
719
|
+
end
|
720
|
+
|
721
|
+
# Define a rule for synthesizing tasks.
|
722
|
+
def create_rule(*args, &block)
|
723
|
+
Rake.application.create_rule(*args, &block)
|
724
|
+
end
|
725
|
+
|
726
|
+
# Apply the scope to the task name according to the rules for
|
727
|
+
# this kind of task. Generic tasks will accept the scope as
|
728
|
+
# part of the name.
|
729
|
+
def scope_name(scope, task_name)
|
730
|
+
(scope + [task_name]).join(':')
|
731
|
+
end
|
732
|
+
|
733
|
+
end # class << Rake::Task
|
734
|
+
end # class Rake::Task
|
735
|
+
|
736
|
+
|
737
|
+
# #########################################################################
|
738
|
+
# A FileTask is a task that includes time based dependencies. If any of a
|
739
|
+
# FileTask's prerequisites have a timestamp that is later than the file
|
740
|
+
# represented by this task, then the file must be rebuilt (using the
|
741
|
+
# supplied actions).
|
742
|
+
#
|
743
|
+
class FileTask < Task
|
744
|
+
|
745
|
+
# Is this file task needed? Yes if it doesn't exist, or if its time stamp
|
746
|
+
# is out of date.
|
747
|
+
def needed?
|
748
|
+
return true unless File.exist?(name)
|
749
|
+
return true if out_of_date?(timestamp)
|
750
|
+
false
|
751
|
+
end
|
752
|
+
|
753
|
+
# Time stamp for file task.
|
754
|
+
def timestamp
|
755
|
+
if File.exist?(name)
|
756
|
+
File.mtime(name.to_s)
|
757
|
+
else
|
758
|
+
Rake::EARLY
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
private
|
763
|
+
|
764
|
+
# Are there any prerequisites with a later time than the given time stamp?
|
765
|
+
def out_of_date?(stamp)
|
766
|
+
@prerequisites.any? { |n| application[n].timestamp > stamp}
|
767
|
+
end
|
768
|
+
|
769
|
+
# ----------------------------------------------------------------
|
770
|
+
# Task class methods.
|
771
|
+
#
|
772
|
+
class << self
|
773
|
+
# Apply the scope to the task name according to the rules for this kind
|
774
|
+
# of task. File based tasks ignore the scope when creating the name.
|
775
|
+
def scope_name(scope, task_name)
|
776
|
+
task_name
|
777
|
+
end
|
778
|
+
end
|
779
|
+
end # class Rake::FileTask
|
780
|
+
|
781
|
+
# #########################################################################
|
782
|
+
# A FileCreationTask is a file task that when used as a dependency will be
|
783
|
+
# needed if and only if the file has not been created. Once created, it is
|
784
|
+
# not re-triggered if any of its dependencies are newer, nor does trigger
|
785
|
+
# any rebuilds of tasks that depend on it whenever it is updated.
|
786
|
+
#
|
787
|
+
class FileCreationTask < FileTask
|
788
|
+
# Is this file task needed? Yes if it doesn't exist.
|
789
|
+
def needed?
|
790
|
+
! File.exist?(name)
|
791
|
+
end
|
792
|
+
|
793
|
+
# Time stamp for file creation task. This time stamp is earlier
|
794
|
+
# than any other time stamp.
|
795
|
+
def timestamp
|
796
|
+
Rake::EARLY
|
797
|
+
end
|
798
|
+
end
|
799
|
+
|
800
|
+
# #########################################################################
|
801
|
+
# Same as a regular task, but the immediate prerequisites are done in
|
802
|
+
# parallel using Ruby threads.
|
803
|
+
#
|
804
|
+
class MultiTask < Task
|
805
|
+
private
|
806
|
+
def invoke_prerequisites(args, invocation_chain)
|
807
|
+
threads = @prerequisites.collect { |p|
|
808
|
+
Thread.new(p) { |r| application[r].invoke_with_call_chain(args, invocation_chain) }
|
809
|
+
}
|
810
|
+
threads.each { |t| t.join }
|
811
|
+
end
|
812
|
+
end
|
813
|
+
end # module Rake
|
814
|
+
|
815
|
+
# ###########################################################################
|
816
|
+
# Task Definition Functions ...
|
817
|
+
|
818
|
+
# Declare a basic task.
|
819
|
+
#
|
820
|
+
# Example:
|
821
|
+
# task :clobber => [:clean] do
|
822
|
+
# rm_rf "html"
|
823
|
+
# end
|
824
|
+
#
|
825
|
+
def task(*args, &block)
|
826
|
+
Rake::Task.define_task(*args, &block)
|
827
|
+
end
|
828
|
+
|
829
|
+
|
830
|
+
# Declare a file task.
|
831
|
+
#
|
832
|
+
# Example:
|
833
|
+
# file "config.cfg" => ["config.template"] do
|
834
|
+
# open("config.cfg", "w") do |outfile|
|
835
|
+
# open("config.template") do |infile|
|
836
|
+
# while line = infile.gets
|
837
|
+
# outfile.puts line
|
838
|
+
# end
|
839
|
+
# end
|
840
|
+
# end
|
841
|
+
# end
|
842
|
+
#
|
843
|
+
def file(*args, &block)
|
844
|
+
Rake::FileTask.define_task(*args, &block)
|
845
|
+
end
|
846
|
+
|
847
|
+
# Declare a file creation task.
|
848
|
+
# (Mainly used for the directory command).
|
849
|
+
def file_create(args, &block)
|
850
|
+
Rake::FileCreationTask.define_task(args, &block)
|
851
|
+
end
|
852
|
+
|
853
|
+
# Declare a set of files tasks to create the given directories on demand.
|
854
|
+
#
|
855
|
+
# Example:
|
856
|
+
# directory "testdata/doc"
|
857
|
+
#
|
858
|
+
def directory(dir)
|
859
|
+
Rake.each_dir_parent(dir) do |d|
|
860
|
+
file_create d do |t|
|
861
|
+
mkdir_p t.name if ! File.exist?(t.name)
|
862
|
+
end
|
863
|
+
end
|
864
|
+
end
|
865
|
+
|
866
|
+
# Declare a task that performs its prerequisites in parallel. Multitasks does
|
867
|
+
# *not* guarantee that its prerequisites will execute in any given order
|
868
|
+
# (which is obvious when you think about it)
|
869
|
+
#
|
870
|
+
# Example:
|
871
|
+
# multitask :deploy => [:deploy_gem, :deploy_rdoc]
|
872
|
+
#
|
873
|
+
def multitask(args, &block)
|
874
|
+
Rake::MultiTask.define_task(args, &block)
|
875
|
+
end
|
876
|
+
|
877
|
+
# Create a new rake namespace and use it for evaluating the given block.
|
878
|
+
# Returns a NameSpace object that can be used to lookup tasks defined in the
|
879
|
+
# namespace.
|
880
|
+
#
|
881
|
+
# E.g.
|
882
|
+
#
|
883
|
+
# ns = namespace "nested" do
|
884
|
+
# task :run
|
885
|
+
# end
|
886
|
+
# task_run = ns[:run] # find :run in the given namespace.
|
887
|
+
#
|
888
|
+
def namespace(name=nil, &block)
|
889
|
+
Rake.application.in_namespace(name, &block)
|
890
|
+
end
|
891
|
+
|
892
|
+
# Declare a rule for auto-tasks.
|
893
|
+
#
|
894
|
+
# Example:
|
895
|
+
# rule '.o' => '.c' do |t|
|
896
|
+
# sh %{cc -o #{t.name} #{t.source}}
|
897
|
+
# end
|
898
|
+
#
|
899
|
+
def rule(*args, &block)
|
900
|
+
Rake::Task.create_rule(*args, &block)
|
901
|
+
end
|
902
|
+
|
903
|
+
# Describe the next rake task.
|
904
|
+
#
|
905
|
+
# Example:
|
906
|
+
# desc "Run the Unit Tests"
|
907
|
+
# task :test => [:build]
|
908
|
+
# runtests
|
909
|
+
# end
|
910
|
+
#
|
911
|
+
def desc(description)
|
912
|
+
Rake.application.last_description = description
|
913
|
+
end
|
914
|
+
|
915
|
+
# Import the partial Rakefiles +fn+. Imported files are loaded _after_ the
|
916
|
+
# current file is completely loaded. This allows the import statement to
|
917
|
+
# appear anywhere in the importing file, and yet allowing the imported files
|
918
|
+
# to depend on objects defined in the importing file.
|
919
|
+
#
|
920
|
+
# A common use of the import statement is to include files containing
|
921
|
+
# dependency declarations.
|
922
|
+
#
|
923
|
+
# See also the --rakelibdir command line option.
|
924
|
+
#
|
925
|
+
# Example:
|
926
|
+
# import ".depend", "my_rules"
|
927
|
+
#
|
928
|
+
def import(*fns)
|
929
|
+
fns.each do |fn|
|
930
|
+
Rake.application.add_import(fn)
|
931
|
+
end
|
932
|
+
end
|
933
|
+
|
934
|
+
# ###########################################################################
|
935
|
+
# This a FileUtils extension that defines several additional commands to be
|
936
|
+
# added to the FileUtils utility functions.
|
937
|
+
#
|
938
|
+
module FileUtils
|
939
|
+
RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).
|
940
|
+
sub(/.*\s.*/m, '"\&"')
|
941
|
+
|
942
|
+
OPT_TABLE['sh'] = %w(noop verbose)
|
943
|
+
OPT_TABLE['ruby'] = %w(noop verbose)
|
944
|
+
|
945
|
+
# Run the system command +cmd+. If multiple arguments are given the command
|
946
|
+
# is not run with the shell (same semantics as Kernel::exec and
|
947
|
+
# Kernel::system).
|
948
|
+
#
|
949
|
+
# Example:
|
950
|
+
# sh %{ls -ltr}
|
951
|
+
#
|
952
|
+
# sh 'ls', 'file with spaces'
|
953
|
+
#
|
954
|
+
# # check exit status after command runs
|
955
|
+
# sh %{grep pattern file} do |ok, res|
|
956
|
+
# if ! ok
|
957
|
+
# puts "pattern not found (status = #{res.exitstatus})"
|
958
|
+
# end
|
959
|
+
# end
|
960
|
+
#
|
961
|
+
def sh(*cmd, &block)
|
962
|
+
options = (Hash === cmd.last) ? cmd.pop : {}
|
963
|
+
unless block_given?
|
964
|
+
show_command = cmd.join(" ")
|
965
|
+
show_command = show_command[0,42] + "..."
|
966
|
+
# TODO code application logic heref show_command.length > 45
|
967
|
+
block = lambda { |ok, status|
|
968
|
+
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
|
969
|
+
}
|
970
|
+
end
|
971
|
+
if RakeFileUtils.verbose_flag == :default
|
972
|
+
options[:verbose] = false
|
973
|
+
else
|
974
|
+
options[:verbose] ||= RakeFileUtils.verbose_flag
|
975
|
+
end
|
976
|
+
options[:noop] ||= RakeFileUtils.nowrite_flag
|
977
|
+
rake_check_options options, :noop, :verbose
|
978
|
+
rake_output_message cmd.join(" ") if options[:verbose]
|
979
|
+
unless options[:noop]
|
980
|
+
res = rake_system(*cmd)
|
981
|
+
block.call(res, $?)
|
982
|
+
end
|
983
|
+
end
|
984
|
+
|
985
|
+
def rake_system(*cmd)
|
986
|
+
system(*cmd)
|
987
|
+
end
|
988
|
+
private :rake_system
|
989
|
+
|
990
|
+
# Run a Ruby interpreter with the given arguments.
|
991
|
+
#
|
992
|
+
# Example:
|
993
|
+
# ruby %{-pe '$_.upcase!' <README}
|
994
|
+
#
|
995
|
+
def ruby(*args,&block)
|
996
|
+
options = (Hash === args.last) ? args.pop : {}
|
997
|
+
if args.length > 1 then
|
998
|
+
sh(*([RUBY] + args + [options]), &block)
|
999
|
+
else
|
1000
|
+
sh("#{RUBY} #{args.first}", options, &block)
|
1001
|
+
end
|
1002
|
+
end
|
1003
|
+
|
1004
|
+
LN_SUPPORTED = [true]
|
1005
|
+
|
1006
|
+
# Attempt to do a normal file link, but fall back to a copy if the link
|
1007
|
+
# fails.
|
1008
|
+
def safe_ln(*args)
|
1009
|
+
unless LN_SUPPORTED[0]
|
1010
|
+
cp(*args)
|
1011
|
+
else
|
1012
|
+
begin
|
1013
|
+
ln(*args)
|
1014
|
+
rescue StandardError, NotImplementedError => ex
|
1015
|
+
LN_SUPPORTED[0] = false
|
1016
|
+
cp(*args)
|
1017
|
+
end
|
1018
|
+
end
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
# Split a file path into individual directory names.
|
1022
|
+
#
|
1023
|
+
# Example:
|
1024
|
+
# split_all("a/b/c") => ['a', 'b', 'c']
|
1025
|
+
#
|
1026
|
+
def split_all(path)
|
1027
|
+
head, tail = File.split(path)
|
1028
|
+
return [tail] if head == '.' || tail == '/'
|
1029
|
+
return [head, tail] if head == '/'
|
1030
|
+
return split_all(head) + [tail]
|
1031
|
+
end
|
1032
|
+
end
|
1033
|
+
|
1034
|
+
# ###########################################################################
|
1035
|
+
# RakeFileUtils provides a custom version of the FileUtils methods that
|
1036
|
+
# respond to the <tt>verbose</tt> and <tt>nowrite</tt> commands.
|
1037
|
+
#
|
1038
|
+
module RakeFileUtils
|
1039
|
+
include FileUtils
|
1040
|
+
|
1041
|
+
class << self
|
1042
|
+
attr_accessor :verbose_flag, :nowrite_flag
|
1043
|
+
end
|
1044
|
+
RakeFileUtils.verbose_flag = :default
|
1045
|
+
RakeFileUtils.nowrite_flag = false
|
1046
|
+
|
1047
|
+
$fileutils_verbose = true
|
1048
|
+
$fileutils_nowrite = false
|
1049
|
+
|
1050
|
+
FileUtils::OPT_TABLE.each do |name, opts|
|
1051
|
+
default_options = []
|
1052
|
+
if opts.include?(:verbose) || opts.include?("verbose")
|
1053
|
+
default_options << ':verbose => RakeFileUtils.verbose_flag'
|
1054
|
+
end
|
1055
|
+
if opts.include?(:noop) || opts.include?("noop")
|
1056
|
+
default_options << ':noop => RakeFileUtils.nowrite_flag'
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
next if default_options.empty?
|
1060
|
+
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
1061
|
+
def #{name}( *args, &block )
|
1062
|
+
super(
|
1063
|
+
*rake_merge_option(args,
|
1064
|
+
#{default_options.join(', ')}
|
1065
|
+
), &block)
|
1066
|
+
end
|
1067
|
+
EOS
|
1068
|
+
end
|
1069
|
+
|
1070
|
+
# Get/set the verbose flag controlling output from the FileUtils utilities.
|
1071
|
+
# If verbose is true, then the utility method is echoed to standard output.
|
1072
|
+
#
|
1073
|
+
# Examples:
|
1074
|
+
# verbose # return the current value of the verbose flag
|
1075
|
+
# verbose(v) # set the verbose flag to _v_.
|
1076
|
+
# verbose(v) { code } # Execute code with the verbose flag set temporarily to _v_.
|
1077
|
+
# # Return to the original value when code is done.
|
1078
|
+
def verbose(value=nil)
|
1079
|
+
oldvalue = RakeFileUtils.verbose_flag
|
1080
|
+
RakeFileUtils.verbose_flag = value unless value.nil?
|
1081
|
+
if block_given?
|
1082
|
+
begin
|
1083
|
+
yield
|
1084
|
+
ensure
|
1085
|
+
RakeFileUtils.verbose_flag = oldvalue
|
1086
|
+
end
|
1087
|
+
end
|
1088
|
+
RakeFileUtils.verbose_flag
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
# Get/set the nowrite flag controlling output from the FileUtils utilities.
|
1092
|
+
# If verbose is true, then the utility method is echoed to standard output.
|
1093
|
+
#
|
1094
|
+
# Examples:
|
1095
|
+
# nowrite # return the current value of the nowrite flag
|
1096
|
+
# nowrite(v) # set the nowrite flag to _v_.
|
1097
|
+
# nowrite(v) { code } # Execute code with the nowrite flag set temporarily to _v_.
|
1098
|
+
# # Return to the original value when code is done.
|
1099
|
+
def nowrite(value=nil)
|
1100
|
+
oldvalue = RakeFileUtils.nowrite_flag
|
1101
|
+
RakeFileUtils.nowrite_flag = value unless value.nil?
|
1102
|
+
if block_given?
|
1103
|
+
begin
|
1104
|
+
yield
|
1105
|
+
ensure
|
1106
|
+
RakeFileUtils.nowrite_flag = oldvalue
|
1107
|
+
end
|
1108
|
+
end
|
1109
|
+
oldvalue
|
1110
|
+
end
|
1111
|
+
|
1112
|
+
# Use this function to prevent protentially destructive ruby code from
|
1113
|
+
# running when the :nowrite flag is set.
|
1114
|
+
#
|
1115
|
+
# Example:
|
1116
|
+
#
|
1117
|
+
# when_writing("Building Project") do
|
1118
|
+
# project.build
|
1119
|
+
# end
|
1120
|
+
#
|
1121
|
+
# The following code will build the project under normal conditions. If the
|
1122
|
+
# nowrite(true) flag is set, then the example will print:
|
1123
|
+
# DRYRUN: Building Project
|
1124
|
+
# instead of actually building the project.
|
1125
|
+
#
|
1126
|
+
def when_writing(msg=nil)
|
1127
|
+
if RakeFileUtils.nowrite_flag
|
1128
|
+
puts "DRYRUN: #{msg}" if msg
|
1129
|
+
else
|
1130
|
+
yield
|
1131
|
+
end
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
# Merge the given options with the default values.
|
1135
|
+
def rake_merge_option(args, defaults)
|
1136
|
+
if Hash === args.last
|
1137
|
+
defaults.update(args.last)
|
1138
|
+
args.pop
|
1139
|
+
end
|
1140
|
+
args.push defaults
|
1141
|
+
args
|
1142
|
+
end
|
1143
|
+
private :rake_merge_option
|
1144
|
+
|
1145
|
+
# Send the message to the default rake output (which is $stderr).
|
1146
|
+
def rake_output_message(message)
|
1147
|
+
$stderr.puts(message)
|
1148
|
+
end
|
1149
|
+
private :rake_output_message
|
1150
|
+
|
1151
|
+
# Check that the options do not contain options not listed in +optdecl+. An
|
1152
|
+
# ArgumentError exception is thrown if non-declared options are found.
|
1153
|
+
def rake_check_options(options, *optdecl)
|
1154
|
+
h = options.dup
|
1155
|
+
optdecl.each do |name|
|
1156
|
+
h.delete name
|
1157
|
+
end
|
1158
|
+
raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless h.empty?
|
1159
|
+
end
|
1160
|
+
private :rake_check_options
|
1161
|
+
|
1162
|
+
extend self
|
1163
|
+
end
|
1164
|
+
|
1165
|
+
# ###########################################################################
|
1166
|
+
# Include the FileUtils file manipulation functions in the top level module,
|
1167
|
+
# but mark them private so that they don't unintentionally define methods on
|
1168
|
+
# other objects.
|
1169
|
+
|
1170
|
+
include RakeFileUtils
|
1171
|
+
private(*FileUtils.instance_methods(false))
|
1172
|
+
private(*RakeFileUtils.instance_methods(false))
|
1173
|
+
|
1174
|
+
######################################################################
|
1175
|
+
module Rake
|
1176
|
+
|
1177
|
+
# #########################################################################
|
1178
|
+
# A FileList is essentially an array with a few helper methods defined to
|
1179
|
+
# make file manipulation a bit easier.
|
1180
|
+
#
|
1181
|
+
# FileLists are lazy. When given a list of glob patterns for possible files
|
1182
|
+
# to be included in the file list, instead of searching the file structures
|
1183
|
+
# to find the files, a FileList holds the pattern for latter use.
|
1184
|
+
#
|
1185
|
+
# This allows us to define a number of FileList to match any number of
|
1186
|
+
# files, but only search out the actual files when then FileList itself is
|
1187
|
+
# actually used. The key is that the first time an element of the
|
1188
|
+
# FileList/Array is requested, the pending patterns are resolved into a real
|
1189
|
+
# list of file names.
|
1190
|
+
#
|
1191
|
+
class FileList
|
1192
|
+
|
1193
|
+
include Cloneable
|
1194
|
+
|
1195
|
+
# == Method Delegation
|
1196
|
+
#
|
1197
|
+
# The lazy evaluation magic of FileLists happens by implementing all the
|
1198
|
+
# array specific methods to call +resolve+ before delegating the heavy
|
1199
|
+
# lifting to an embedded array object (@items).
|
1200
|
+
#
|
1201
|
+
# In addition, there are two kinds of delegation calls. The regular kind
|
1202
|
+
# delegates to the @items array and returns the result directly. Well,
|
1203
|
+
# almost directly. It checks if the returned value is the @items object
|
1204
|
+
# itself, and if so will return the FileList object instead.
|
1205
|
+
#
|
1206
|
+
# The second kind of delegation call is used in methods that normally
|
1207
|
+
# return a new Array object. We want to capture the return value of these
|
1208
|
+
# methods and wrap them in a new FileList object. We enumerate these
|
1209
|
+
# methods in the +SPECIAL_RETURN+ list below.
|
1210
|
+
|
1211
|
+
# List of array methods (that are not in +Object+) that need to be
|
1212
|
+
# delegated.
|
1213
|
+
ARRAY_METHODS = (Array.instance_methods - Object.instance_methods).map { |n| n.to_s }
|
1214
|
+
|
1215
|
+
# List of additional methods that must be delegated.
|
1216
|
+
MUST_DEFINE = %w[to_a inspect]
|
1217
|
+
|
1218
|
+
# List of methods that should not be delegated here (we define special
|
1219
|
+
# versions of them explicitly below).
|
1220
|
+
MUST_NOT_DEFINE = %w[to_a to_ary partition *]
|
1221
|
+
|
1222
|
+
# List of delegated methods that return new array values which need
|
1223
|
+
# wrapping.
|
1224
|
+
SPECIAL_RETURN = %w[
|
1225
|
+
map collect sort sort_by select find_all reject grep
|
1226
|
+
compact flatten uniq values_at
|
1227
|
+
+ - & |
|
1228
|
+
]
|
1229
|
+
|
1230
|
+
DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).collect{ |s| s.to_s }.sort.uniq
|
1231
|
+
|
1232
|
+
# Now do the delegation.
|
1233
|
+
DELEGATING_METHODS.each_with_index do |sym, i|
|
1234
|
+
if SPECIAL_RETURN.include?(sym)
|
1235
|
+
ln = __LINE__+1
|
1236
|
+
class_eval %{
|
1237
|
+
def #{sym}(*args, &block)
|
1238
|
+
resolve
|
1239
|
+
result = @items.send(:#{sym}, *args, &block)
|
1240
|
+
FileList.new.import(result)
|
1241
|
+
end
|
1242
|
+
}, __FILE__, ln
|
1243
|
+
else
|
1244
|
+
ln = __LINE__+1
|
1245
|
+
class_eval %{
|
1246
|
+
def #{sym}(*args, &block)
|
1247
|
+
resolve
|
1248
|
+
result = @items.send(:#{sym}, *args, &block)
|
1249
|
+
result.object_id == @items.object_id ? self : result
|
1250
|
+
end
|
1251
|
+
}, __FILE__, ln
|
1252
|
+
end
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
# Create a file list from the globbable patterns given. If you wish to
|
1256
|
+
# perform multiple includes or excludes at object build time, use the
|
1257
|
+
# "yield self" pattern.
|
1258
|
+
#
|
1259
|
+
# Example:
|
1260
|
+
# file_list = FileList.new('lib/**/*.rb', 'test/test*.rb')
|
1261
|
+
#
|
1262
|
+
# pkg_files = FileList.new('lib/**/*') do |fl|
|
1263
|
+
# fl.exclude(/\bCVS\b/)
|
1264
|
+
# end
|
1265
|
+
#
|
1266
|
+
def initialize(*patterns)
|
1267
|
+
@pending_add = []
|
1268
|
+
@pending = false
|
1269
|
+
@exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup
|
1270
|
+
@exclude_procs = DEFAULT_IGNORE_PROCS.dup
|
1271
|
+
@exclude_re = nil
|
1272
|
+
@items = []
|
1273
|
+
patterns.each { |pattern| include(pattern) }
|
1274
|
+
yield self if block_given?
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
# Add file names defined by glob patterns to the file list. If an array
|
1278
|
+
# is given, add each element of the array.
|
1279
|
+
#
|
1280
|
+
# Example:
|
1281
|
+
# file_list.include("*.java", "*.cfg")
|
1282
|
+
# file_list.include %w( math.c lib.h *.o )
|
1283
|
+
#
|
1284
|
+
def include(*filenames)
|
1285
|
+
# TODO: check for pending
|
1286
|
+
filenames.each do |fn|
|
1287
|
+
if fn.respond_to? :to_ary
|
1288
|
+
include(*fn.to_ary)
|
1289
|
+
else
|
1290
|
+
@pending_add << fn
|
1291
|
+
end
|
1292
|
+
end
|
1293
|
+
@pending = true
|
1294
|
+
self
|
1295
|
+
end
|
1296
|
+
alias :add :include
|
1297
|
+
|
1298
|
+
# Register a list of file name patterns that should be excluded from the
|
1299
|
+
# list. Patterns may be regular expressions, glob patterns or regular
|
1300
|
+
# strings. In addition, a block given to exclude will remove entries that
|
1301
|
+
# return true when given to the block.
|
1302
|
+
#
|
1303
|
+
# Note that glob patterns are expanded against the file system. If a file
|
1304
|
+
# is explicitly added to a file list, but does not exist in the file
|
1305
|
+
# system, then an glob pattern in the exclude list will not exclude the
|
1306
|
+
# file.
|
1307
|
+
#
|
1308
|
+
# Examples:
|
1309
|
+
# FileList['a.c', 'b.c'].exclude("a.c") => ['b.c']
|
1310
|
+
# FileList['a.c', 'b.c'].exclude(/^a/) => ['b.c']
|
1311
|
+
#
|
1312
|
+
# If "a.c" is a file, then ...
|
1313
|
+
# FileList['a.c', 'b.c'].exclude("a.*") => ['b.c']
|
1314
|
+
#
|
1315
|
+
# If "a.c" is not a file, then ...
|
1316
|
+
# FileList['a.c', 'b.c'].exclude("a.*") => ['a.c', 'b.c']
|
1317
|
+
#
|
1318
|
+
def exclude(*patterns, &block)
|
1319
|
+
patterns.each do |pat|
|
1320
|
+
@exclude_patterns << pat
|
1321
|
+
end
|
1322
|
+
if block_given?
|
1323
|
+
@exclude_procs << block
|
1324
|
+
end
|
1325
|
+
resolve_exclude if ! @pending
|
1326
|
+
self
|
1327
|
+
end
|
1328
|
+
|
1329
|
+
|
1330
|
+
# Clear all the exclude patterns so that we exclude nothing.
|
1331
|
+
def clear_exclude
|
1332
|
+
@exclude_patterns = []
|
1333
|
+
@exclude_procs = []
|
1334
|
+
calculate_exclude_regexp if ! @pending
|
1335
|
+
self
|
1336
|
+
end
|
1337
|
+
|
1338
|
+
# Define equality.
|
1339
|
+
def ==(array)
|
1340
|
+
to_ary == array
|
1341
|
+
end
|
1342
|
+
|
1343
|
+
# Return the internal array object.
|
1344
|
+
def to_a
|
1345
|
+
resolve
|
1346
|
+
@items
|
1347
|
+
end
|
1348
|
+
|
1349
|
+
# Return the internal array object.
|
1350
|
+
def to_ary
|
1351
|
+
to_a
|
1352
|
+
end
|
1353
|
+
|
1354
|
+
# Lie about our class.
|
1355
|
+
def is_a?(klass)
|
1356
|
+
klass == Array || super(klass)
|
1357
|
+
end
|
1358
|
+
alias kind_of? is_a?
|
1359
|
+
|
1360
|
+
# Redefine * to return either a string or a new file list.
|
1361
|
+
def *(other)
|
1362
|
+
result = @items * other
|
1363
|
+
case result
|
1364
|
+
when Array
|
1365
|
+
FileList.new.import(result)
|
1366
|
+
else
|
1367
|
+
result
|
1368
|
+
end
|
1369
|
+
end
|
1370
|
+
|
1371
|
+
# Resolve all the pending adds now.
|
1372
|
+
def resolve
|
1373
|
+
if @pending
|
1374
|
+
@pending = false
|
1375
|
+
@pending_add.each do |fn| resolve_add(fn) end
|
1376
|
+
@pending_add = []
|
1377
|
+
resolve_exclude
|
1378
|
+
end
|
1379
|
+
self
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
def calculate_exclude_regexp
|
1383
|
+
ignores = []
|
1384
|
+
@exclude_patterns.each do |pat|
|
1385
|
+
case pat
|
1386
|
+
when Regexp
|
1387
|
+
ignores << pat
|
1388
|
+
when /[*?]/
|
1389
|
+
Dir[pat].each do |p| ignores << p end
|
1390
|
+
else
|
1391
|
+
ignores << Regexp.quote(pat)
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
if ignores.empty?
|
1395
|
+
@exclude_re = /^$/
|
1396
|
+
else
|
1397
|
+
re_str = ignores.collect { |p| "(" + p.to_s + ")" }.join("|")
|
1398
|
+
@exclude_re = Regexp.new(re_str)
|
1399
|
+
end
|
1400
|
+
end
|
1401
|
+
|
1402
|
+
def resolve_add(fn)
|
1403
|
+
case fn
|
1404
|
+
when %r{[*?\[\{]}
|
1405
|
+
add_matching(fn)
|
1406
|
+
else
|
1407
|
+
self << fn
|
1408
|
+
end
|
1409
|
+
end
|
1410
|
+
private :resolve_add
|
1411
|
+
|
1412
|
+
def resolve_exclude
|
1413
|
+
calculate_exclude_regexp
|
1414
|
+
reject! { |fn| exclude?(fn) }
|
1415
|
+
self
|
1416
|
+
end
|
1417
|
+
private :resolve_exclude
|
1418
|
+
|
1419
|
+
# Return a new FileList with the results of running +sub+ against each
|
1420
|
+
# element of the oringal list.
|
1421
|
+
#
|
1422
|
+
# Example:
|
1423
|
+
# FileList['a.c', 'b.c'].sub(/\.c$/, '.o') => ['a.o', 'b.o']
|
1424
|
+
#
|
1425
|
+
def sub(pat, rep)
|
1426
|
+
inject(FileList.new) { |res, fn| res << fn.sub(pat,rep) }
|
1427
|
+
end
|
1428
|
+
|
1429
|
+
# Return a new FileList with the results of running +gsub+ against each
|
1430
|
+
# element of the original list.
|
1431
|
+
#
|
1432
|
+
# Example:
|
1433
|
+
# FileList['lib/test/file', 'x/y'].gsub(/\//, "\\")
|
1434
|
+
# => ['lib\\test\\file', 'x\\y']
|
1435
|
+
#
|
1436
|
+
def gsub(pat, rep)
|
1437
|
+
inject(FileList.new) { |res, fn| res << fn.gsub(pat,rep) }
|
1438
|
+
end
|
1439
|
+
|
1440
|
+
# Same as +sub+ except that the oringal file list is modified.
|
1441
|
+
def sub!(pat, rep)
|
1442
|
+
each_with_index { |fn, i| self[i] = fn.sub(pat,rep) }
|
1443
|
+
self
|
1444
|
+
end
|
1445
|
+
|
1446
|
+
# Same as +gsub+ except that the original file list is modified.
|
1447
|
+
def gsub!(pat, rep)
|
1448
|
+
each_with_index { |fn, i| self[i] = fn.gsub(pat,rep) }
|
1449
|
+
self
|
1450
|
+
end
|
1451
|
+
|
1452
|
+
# Apply the pathmap spec to each of the included file names, returning a
|
1453
|
+
# new file list with the modified paths. (See String#pathmap for
|
1454
|
+
# details.)
|
1455
|
+
def pathmap(spec=nil)
|
1456
|
+
collect { |fn| fn.pathmap(spec) }
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
# Return a new array with <tt>String#ext</tt> method applied to each
|
1460
|
+
# member of the array.
|
1461
|
+
#
|
1462
|
+
# This method is a shortcut for:
|
1463
|
+
#
|
1464
|
+
# array.collect { |item| item.ext(newext) }
|
1465
|
+
#
|
1466
|
+
# +ext+ is a user added method for the Array class.
|
1467
|
+
def ext(newext='')
|
1468
|
+
collect { |fn| fn.ext(newext) }
|
1469
|
+
end
|
1470
|
+
|
1471
|
+
|
1472
|
+
# Grep each of the files in the filelist using the given pattern. If a
|
1473
|
+
# block is given, call the block on each matching line, passing the file
|
1474
|
+
# name, line number, and the matching line of text. If no block is given,
|
1475
|
+
# a standard emac style file:linenumber:line message will be printed to
|
1476
|
+
# standard out.
|
1477
|
+
def egrep(pattern, *opt)
|
1478
|
+
each do |fn|
|
1479
|
+
open(fn, "rb", *opt) do |inf|
|
1480
|
+
count = 0
|
1481
|
+
inf.each do |line|
|
1482
|
+
count += 1
|
1483
|
+
if pattern.match(line)
|
1484
|
+
if block_given?
|
1485
|
+
yield fn, count, line
|
1486
|
+
else
|
1487
|
+
puts "#{fn}:#{count}:#{line}"
|
1488
|
+
end
|
1489
|
+
end
|
1490
|
+
end
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
end
|
1494
|
+
|
1495
|
+
# Return a new file list that only contains file names from the current
|
1496
|
+
# file list that exist on the file system.
|
1497
|
+
def existing
|
1498
|
+
select { |fn| File.exist?(fn) }
|
1499
|
+
end
|
1500
|
+
|
1501
|
+
# Modify the current file list so that it contains only file name that
|
1502
|
+
# exist on the file system.
|
1503
|
+
def existing!
|
1504
|
+
resolve
|
1505
|
+
@items = @items.select { |fn| File.exist?(fn) }
|
1506
|
+
self
|
1507
|
+
end
|
1508
|
+
|
1509
|
+
# FileList version of partition. Needed because the nested arrays should
|
1510
|
+
# be FileLists in this version.
|
1511
|
+
def partition(&block) # :nodoc:
|
1512
|
+
resolve
|
1513
|
+
result = @items.partition(&block)
|
1514
|
+
[
|
1515
|
+
FileList.new.import(result[0]),
|
1516
|
+
FileList.new.import(result[1]),
|
1517
|
+
]
|
1518
|
+
end
|
1519
|
+
|
1520
|
+
# Convert a FileList to a string by joining all elements with a space.
|
1521
|
+
def to_s
|
1522
|
+
resolve
|
1523
|
+
self.join(' ')
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
# Add matching glob patterns.
|
1527
|
+
def add_matching(pattern)
|
1528
|
+
Dir[pattern].each do |fn|
|
1529
|
+
self << fn unless exclude?(fn)
|
1530
|
+
end
|
1531
|
+
end
|
1532
|
+
private :add_matching
|
1533
|
+
|
1534
|
+
# Should the given file name be excluded?
|
1535
|
+
def exclude?(fn)
|
1536
|
+
calculate_exclude_regexp unless @exclude_re
|
1537
|
+
fn =~ @exclude_re || @exclude_procs.any? { |p| p.call(fn) }
|
1538
|
+
end
|
1539
|
+
|
1540
|
+
DEFAULT_IGNORE_PATTERNS = [
|
1541
|
+
/(^|[\/\\])CVS([\/\\]|$)/,
|
1542
|
+
/(^|[\/\\])\.svn([\/\\]|$)/,
|
1543
|
+
/\.bak$/,
|
1544
|
+
/~$/
|
1545
|
+
]
|
1546
|
+
DEFAULT_IGNORE_PROCS = [
|
1547
|
+
proc { |fn| fn =~ /(^|[\/\\])core$/ && ! File.directory?(fn) }
|
1548
|
+
]
|
1549
|
+
# @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup
|
1550
|
+
|
1551
|
+
def import(array)
|
1552
|
+
@items = array
|
1553
|
+
self
|
1554
|
+
end
|
1555
|
+
|
1556
|
+
class << self
|
1557
|
+
# Create a new file list including the files listed. Similar to:
|
1558
|
+
#
|
1559
|
+
# FileList.new(*args)
|
1560
|
+
def [](*args)
|
1561
|
+
new(*args)
|
1562
|
+
end
|
1563
|
+
end
|
1564
|
+
end # FileList
|
1565
|
+
end
|
1566
|
+
|
1567
|
+
module Rake
|
1568
|
+
class << self
|
1569
|
+
|
1570
|
+
# Yield each file or directory component.
|
1571
|
+
def each_dir_parent(dir) # :nodoc:
|
1572
|
+
old_length = nil
|
1573
|
+
while dir != '.' && dir.length != old_length
|
1574
|
+
yield(dir)
|
1575
|
+
old_length = dir.length
|
1576
|
+
dir = File.dirname(dir)
|
1577
|
+
end
|
1578
|
+
end
|
1579
|
+
end
|
1580
|
+
end # module Rake
|
1581
|
+
|
1582
|
+
# Alias FileList to be available at the top level.
|
1583
|
+
FileList = Rake::FileList
|
1584
|
+
|
1585
|
+
# ###########################################################################
|
1586
|
+
module Rake
|
1587
|
+
|
1588
|
+
# Default Rakefile loader used by +import+.
|
1589
|
+
class DefaultLoader
|
1590
|
+
def load(fn)
|
1591
|
+
Kernel.load(File.expand_path(fn))
|
1592
|
+
end
|
1593
|
+
end
|
1594
|
+
|
1595
|
+
# EarlyTime is a fake timestamp that occurs _before_ any other time value.
|
1596
|
+
class EarlyTime
|
1597
|
+
include Comparable
|
1598
|
+
include Singleton
|
1599
|
+
|
1600
|
+
def <=>(other)
|
1601
|
+
-1
|
1602
|
+
end
|
1603
|
+
|
1604
|
+
def to_s
|
1605
|
+
"<EARLY TIME>"
|
1606
|
+
end
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
EARLY = EarlyTime.instance
|
1610
|
+
end # module Rake
|
1611
|
+
|
1612
|
+
# ###########################################################################
|
1613
|
+
# Extensions to time to allow comparisons with an early time class.
|
1614
|
+
#
|
1615
|
+
class Time
|
1616
|
+
alias rake_original_time_compare :<=>
|
1617
|
+
def <=>(other)
|
1618
|
+
if Rake::EarlyTime === other
|
1619
|
+
- other.<=>(self)
|
1620
|
+
else
|
1621
|
+
rake_original_time_compare(other)
|
1622
|
+
end
|
1623
|
+
end
|
1624
|
+
end # class Time
|
1625
|
+
|
1626
|
+
module Rake
|
1627
|
+
|
1628
|
+
####################################################################
|
1629
|
+
# The NameSpace class will lookup task names in the the scope
|
1630
|
+
# defined by a +namespace+ command.
|
1631
|
+
#
|
1632
|
+
class NameSpace
|
1633
|
+
|
1634
|
+
# Create a namespace lookup object using the given task manager
|
1635
|
+
# and the list of scopes.
|
1636
|
+
def initialize(task_manager, scope_list)
|
1637
|
+
@task_manager = task_manager
|
1638
|
+
@scope = scope_list.dup
|
1639
|
+
end
|
1640
|
+
|
1641
|
+
# Lookup a task named +name+ in the namespace.
|
1642
|
+
def [](name)
|
1643
|
+
@task_manager.lookup(name, @scope)
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
# Return the list of tasks defined in this namespace.
|
1647
|
+
def tasks
|
1648
|
+
@task_manager.tasks
|
1649
|
+
end
|
1650
|
+
end # NameSpace
|
1651
|
+
|
1652
|
+
|
1653
|
+
####################################################################
|
1654
|
+
# The TaskManager module is a mixin for managing tasks.
|
1655
|
+
module TaskManager
|
1656
|
+
# Track the last comment made in the Rakefile.
|
1657
|
+
attr_accessor :last_description
|
1658
|
+
alias :last_comment :last_description # Backwards compatibility
|
1659
|
+
|
1660
|
+
def initialize
|
1661
|
+
super
|
1662
|
+
@tasks = Hash.new
|
1663
|
+
@rules = Array.new
|
1664
|
+
@scope = Array.new
|
1665
|
+
@last_description = nil
|
1666
|
+
end
|
1667
|
+
|
1668
|
+
def create_rule(*args, &block)
|
1669
|
+
pattern, arg_names, deps = resolve_args(args)
|
1670
|
+
pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
|
1671
|
+
@rules << [pattern, deps, block]
|
1672
|
+
end
|
1673
|
+
|
1674
|
+
def define_task(task_class, *args, &block)
|
1675
|
+
task_name, arg_names, deps = resolve_args(args)
|
1676
|
+
task_name = task_class.scope_name(@scope, task_name)
|
1677
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
1678
|
+
deps = deps.collect {|d| d.to_s }
|
1679
|
+
task = intern(task_class, task_name)
|
1680
|
+
task.set_arg_names(arg_names) unless arg_names.empty?
|
1681
|
+
task.add_description(@last_description)
|
1682
|
+
@last_description = nil
|
1683
|
+
task.enhance(deps, &block)
|
1684
|
+
task
|
1685
|
+
end
|
1686
|
+
|
1687
|
+
# Lookup a task. Return an existing task if found, otherwise
|
1688
|
+
# create a task of the current type.
|
1689
|
+
def intern(task_class, task_name)
|
1690
|
+
@tasks[task_name.to_s] ||= task_class.new(task_name, self)
|
1691
|
+
end
|
1692
|
+
|
1693
|
+
# Find a matching task for +task_name+.
|
1694
|
+
def [](task_name, scopes=nil)
|
1695
|
+
task_name = task_name.to_s
|
1696
|
+
self.lookup(task_name, scopes) or
|
1697
|
+
enhance_with_matching_rule(task_name) or
|
1698
|
+
synthesize_file_task(task_name) or
|
1699
|
+
fail "Don't know how to build task '#{task_name}'"
|
1700
|
+
end
|
1701
|
+
|
1702
|
+
def synthesize_file_task(task_name)
|
1703
|
+
return nil unless File.exist?(task_name)
|
1704
|
+
define_task(Rake::FileTask, task_name)
|
1705
|
+
end
|
1706
|
+
|
1707
|
+
# Resolve the arguments for a task/rule. Returns a triplet of
|
1708
|
+
# [task_name, arg_name_list, prerequisites].
|
1709
|
+
def resolve_args(args)
|
1710
|
+
if args.last.is_a?(Hash)
|
1711
|
+
deps = args.pop
|
1712
|
+
resolve_args_with_dependencies(args, deps)
|
1713
|
+
else
|
1714
|
+
resolve_args_without_dependencies(args)
|
1715
|
+
end
|
1716
|
+
end
|
1717
|
+
|
1718
|
+
# Resolve task arguments for a task or rule when there are no
|
1719
|
+
# dependencies declared.
|
1720
|
+
#
|
1721
|
+
# The patterns recognized by this argument resolving function are:
|
1722
|
+
#
|
1723
|
+
# task :t
|
1724
|
+
# task :t, [:a]
|
1725
|
+
# task :t, :a (deprecated)
|
1726
|
+
#
|
1727
|
+
def resolve_args_without_dependencies(args)
|
1728
|
+
task_name = args.shift
|
1729
|
+
if args.size == 1 && args.first.respond_to?(:to_ary)
|
1730
|
+
arg_names = args.first.to_ary
|
1731
|
+
else
|
1732
|
+
arg_names = args
|
1733
|
+
end
|
1734
|
+
[task_name, arg_names, []]
|
1735
|
+
end
|
1736
|
+
private :resolve_args_without_dependencies
|
1737
|
+
|
1738
|
+
# Resolve task arguments for a task or rule when there are
|
1739
|
+
# dependencies declared.
|
1740
|
+
#
|
1741
|
+
# The patterns recognized by this argument resolving function are:
|
1742
|
+
#
|
1743
|
+
# task :t => [:d]
|
1744
|
+
# task :t, [a] => [:d]
|
1745
|
+
# task :t, :needs => [:d] (deprecated)
|
1746
|
+
# task :t, :a, :needs => [:d] (deprecated)
|
1747
|
+
#
|
1748
|
+
def resolve_args_with_dependencies(args, hash) # :nodoc:
|
1749
|
+
fail "Task Argument Error" if hash.size != 1
|
1750
|
+
key, value = hash.map { |k, v| [k,v] }.first
|
1751
|
+
if args.empty?
|
1752
|
+
task_name = key
|
1753
|
+
arg_names = []
|
1754
|
+
deps = value
|
1755
|
+
elsif key == :needs
|
1756
|
+
task_name = args.shift
|
1757
|
+
arg_names = args
|
1758
|
+
deps = value
|
1759
|
+
else
|
1760
|
+
task_name = args.shift
|
1761
|
+
arg_names = key
|
1762
|
+
deps = value
|
1763
|
+
end
|
1764
|
+
deps = [deps] unless deps.respond_to?(:to_ary)
|
1765
|
+
[task_name, arg_names, deps]
|
1766
|
+
end
|
1767
|
+
private :resolve_args_with_dependencies
|
1768
|
+
|
1769
|
+
# If a rule can be found that matches the task name, enhance the
|
1770
|
+
# task with the prerequisites and actions from the rule. Set the
|
1771
|
+
# source attribute of the task appropriately for the rule. Return
|
1772
|
+
# the enhanced task or nil of no rule was found.
|
1773
|
+
def enhance_with_matching_rule(task_name, level=0)
|
1774
|
+
fail Rake::RuleRecursionOverflowError,
|
1775
|
+
"Rule Recursion Too Deep" if level >= 16
|
1776
|
+
@rules.each do |pattern, extensions, block|
|
1777
|
+
if md = pattern.match(task_name)
|
1778
|
+
task = attempt_rule(task_name, extensions, block, level)
|
1779
|
+
return task if task
|
1780
|
+
end
|
1781
|
+
end
|
1782
|
+
nil
|
1783
|
+
rescue Rake::RuleRecursionOverflowError => ex
|
1784
|
+
ex.add_target(task_name)
|
1785
|
+
fail ex
|
1786
|
+
end
|
1787
|
+
|
1788
|
+
# List of all defined tasks in this application.
|
1789
|
+
def tasks
|
1790
|
+
@tasks.values.sort_by { |t| t.name }
|
1791
|
+
end
|
1792
|
+
|
1793
|
+
# Clear all tasks in this application.
|
1794
|
+
def clear
|
1795
|
+
@tasks.clear
|
1796
|
+
@rules.clear
|
1797
|
+
end
|
1798
|
+
|
1799
|
+
# Lookup a task, using scope and the scope hints in the task name.
|
1800
|
+
# This method performs straight lookups without trying to
|
1801
|
+
# synthesize file tasks or rules. Special scope names (e.g. '^')
|
1802
|
+
# are recognized. If no scope argument is supplied, use the
|
1803
|
+
# current scope. Return nil if the task cannot be found.
|
1804
|
+
def lookup(task_name, initial_scope=nil)
|
1805
|
+
initial_scope ||= @scope
|
1806
|
+
task_name = task_name.to_s
|
1807
|
+
if task_name =~ /^rake:/
|
1808
|
+
scopes = []
|
1809
|
+
task_name = task_name.sub(/^rake:/, '')
|
1810
|
+
elsif task_name =~ /^(\^+)/
|
1811
|
+
scopes = initial_scope[0, initial_scope.size - $1.size]
|
1812
|
+
task_name = task_name.sub(/^(\^+)/, '')
|
1813
|
+
else
|
1814
|
+
scopes = initial_scope
|
1815
|
+
end
|
1816
|
+
lookup_in_scope(task_name, scopes)
|
1817
|
+
end
|
1818
|
+
|
1819
|
+
# Lookup the task name
|
1820
|
+
def lookup_in_scope(name, scope)
|
1821
|
+
n = scope.size
|
1822
|
+
while n >= 0
|
1823
|
+
tn = (scope[0,n] + [name]).join(':')
|
1824
|
+
task = @tasks[tn]
|
1825
|
+
return task if task
|
1826
|
+
n -= 1
|
1827
|
+
end
|
1828
|
+
nil
|
1829
|
+
end
|
1830
|
+
private :lookup_in_scope
|
1831
|
+
|
1832
|
+
# Return the list of scope names currently active in the task
|
1833
|
+
# manager.
|
1834
|
+
def current_scope
|
1835
|
+
@scope.dup
|
1836
|
+
end
|
1837
|
+
|
1838
|
+
# Evaluate the block in a nested namespace named +name+. Create
|
1839
|
+
# an anonymous namespace if +name+ is nil.
|
1840
|
+
def in_namespace(name)
|
1841
|
+
name ||= generate_name
|
1842
|
+
@scope.push(name)
|
1843
|
+
ns = NameSpace.new(self, @scope)
|
1844
|
+
yield(ns)
|
1845
|
+
ns
|
1846
|
+
ensure
|
1847
|
+
@scope.pop
|
1848
|
+
end
|
1849
|
+
|
1850
|
+
private
|
1851
|
+
|
1852
|
+
# Generate an anonymous namespace name.
|
1853
|
+
def generate_name
|
1854
|
+
@seed ||= 0
|
1855
|
+
@seed += 1
|
1856
|
+
"_anon_#{@seed}"
|
1857
|
+
end
|
1858
|
+
|
1859
|
+
def trace_rule(level, message)
|
1860
|
+
puts "#{" "*level}#{message}" if Rake.application.options.trace_rules
|
1861
|
+
end
|
1862
|
+
|
1863
|
+
# Attempt to create a rule given the list of prerequisites.
|
1864
|
+
def attempt_rule(task_name, extensions, block, level)
|
1865
|
+
sources = make_sources(task_name, extensions)
|
1866
|
+
prereqs = sources.collect { |source|
|
1867
|
+
trace_rule level, "Attempting Rule #{task_name} => #{source}"
|
1868
|
+
if File.exist?(source) || Rake::Task.task_defined?(source)
|
1869
|
+
trace_rule level, "(#{task_name} => #{source} ... EXIST)"
|
1870
|
+
source
|
1871
|
+
elsif parent = enhance_with_matching_rule(source, level+1)
|
1872
|
+
trace_rule level, "(#{task_name} => #{source} ... ENHANCE)"
|
1873
|
+
parent.name
|
1874
|
+
else
|
1875
|
+
trace_rule level, "(#{task_name} => #{source} ... FAIL)"
|
1876
|
+
return nil
|
1877
|
+
end
|
1878
|
+
}
|
1879
|
+
task = FileTask.define_task({task_name => prereqs}, &block)
|
1880
|
+
task.sources = prereqs
|
1881
|
+
task
|
1882
|
+
end
|
1883
|
+
|
1884
|
+
# Make a list of sources from the list of file name extensions /
|
1885
|
+
# translation procs.
|
1886
|
+
def make_sources(task_name, extensions)
|
1887
|
+
extensions.collect { |ext|
|
1888
|
+
case ext
|
1889
|
+
when /%/
|
1890
|
+
task_name.pathmap(ext)
|
1891
|
+
when %r{/}
|
1892
|
+
ext
|
1893
|
+
when /^\./
|
1894
|
+
task_name.ext(ext)
|
1895
|
+
when String
|
1896
|
+
ext
|
1897
|
+
when Proc
|
1898
|
+
if ext.arity == 1
|
1899
|
+
ext.call(task_name)
|
1900
|
+
else
|
1901
|
+
ext.call
|
1902
|
+
end
|
1903
|
+
else
|
1904
|
+
fail "Don't know how to handle rule dependent: #{ext.inspect}"
|
1905
|
+
end
|
1906
|
+
}.flatten
|
1907
|
+
end
|
1908
|
+
|
1909
|
+
end # TaskManager
|
1910
|
+
|
1911
|
+
######################################################################
|
1912
|
+
# Rake main application object. When invoking +rake+ from the
|
1913
|
+
# command line, a Rake::Application object is created and run.
|
1914
|
+
#
|
1915
|
+
class Application
|
1916
|
+
include TaskManager
|
1917
|
+
|
1918
|
+
# The name of the application (typically 'rake')
|
1919
|
+
attr_reader :name
|
1920
|
+
|
1921
|
+
# The original directory where rake was invoked.
|
1922
|
+
attr_reader :original_dir
|
1923
|
+
|
1924
|
+
# Name of the actual rakefile used.
|
1925
|
+
attr_reader :rakefile
|
1926
|
+
|
1927
|
+
# List of the top level task names (task names from the command line).
|
1928
|
+
attr_reader :top_level_tasks
|
1929
|
+
|
1930
|
+
DEFAULT_RAKEFILES = ['rakefile', 'Rakefile', 'rakefile.rb', 'Rakefile.rb'].freeze
|
1931
|
+
|
1932
|
+
# Initialize a Rake::Application object.
|
1933
|
+
def initialize
|
1934
|
+
super
|
1935
|
+
@name = 'rake'
|
1936
|
+
@rakefiles = DEFAULT_RAKEFILES.dup
|
1937
|
+
@rakefile = nil
|
1938
|
+
@pending_imports = []
|
1939
|
+
@imported = []
|
1940
|
+
@loaders = {}
|
1941
|
+
@default_loader = Rake::DefaultLoader.new
|
1942
|
+
@original_dir = Dir.pwd
|
1943
|
+
@top_level_tasks = []
|
1944
|
+
add_loader('rb', DefaultLoader.new)
|
1945
|
+
add_loader('rf', DefaultLoader.new)
|
1946
|
+
add_loader('rake', DefaultLoader.new)
|
1947
|
+
@tty_output = STDOUT.tty?
|
1948
|
+
end
|
1949
|
+
|
1950
|
+
# Run the Rake application. The run method performs the following three steps:
|
1951
|
+
#
|
1952
|
+
# * Initialize the command line options (+init+).
|
1953
|
+
# * Define the tasks (+load_rakefile+).
|
1954
|
+
# * Run the top level tasks (+run_tasks+).
|
1955
|
+
#
|
1956
|
+
# If you wish to build a custom rake command, you should call +init+ on your
|
1957
|
+
# application. The define any tasks. Finally, call +top_level+ to run your top
|
1958
|
+
# level tasks.
|
1959
|
+
def run
|
1960
|
+
standard_exception_handling do
|
1961
|
+
init
|
1962
|
+
load_rakefile
|
1963
|
+
top_level
|
1964
|
+
end
|
1965
|
+
end
|
1966
|
+
|
1967
|
+
# Initialize the command line parameters and app name.
|
1968
|
+
def init(app_name='rake')
|
1969
|
+
standard_exception_handling do
|
1970
|
+
@name = app_name
|
1971
|
+
collect_tasks handle_options
|
1972
|
+
end
|
1973
|
+
end
|
1974
|
+
|
1975
|
+
# Find the rakefile and then load it and any pending imports.
|
1976
|
+
def load_rakefile
|
1977
|
+
standard_exception_handling do
|
1978
|
+
raw_load_rakefile
|
1979
|
+
end
|
1980
|
+
end
|
1981
|
+
|
1982
|
+
# Run the top level tasks of a Rake application.
|
1983
|
+
def top_level
|
1984
|
+
standard_exception_handling do
|
1985
|
+
if options.show_tasks
|
1986
|
+
display_tasks_and_comments
|
1987
|
+
elsif options.show_prereqs
|
1988
|
+
display_prerequisites
|
1989
|
+
else
|
1990
|
+
top_level_tasks.each { |task_name| invoke_task(task_name) }
|
1991
|
+
end
|
1992
|
+
end
|
1993
|
+
end
|
1994
|
+
|
1995
|
+
# Add a loader to handle imported files ending in the extension
|
1996
|
+
# +ext+.
|
1997
|
+
def add_loader(ext, loader)
|
1998
|
+
ext = ".#{ext}" unless ext =~ /^\./
|
1999
|
+
@loaders[ext] = loader
|
2000
|
+
end
|
2001
|
+
|
2002
|
+
# Application options from the command line
|
2003
|
+
def options
|
2004
|
+
@options ||= OpenStruct.new
|
2005
|
+
end
|
2006
|
+
|
2007
|
+
# private ----------------------------------------------------------------
|
2008
|
+
|
2009
|
+
def invoke_task(task_string)
|
2010
|
+
name, args = parse_task_string(task_string)
|
2011
|
+
t = self[name]
|
2012
|
+
t.invoke(*args)
|
2013
|
+
end
|
2014
|
+
|
2015
|
+
def parse_task_string(string)
|
2016
|
+
if string =~ /^([^\[]+)(\[(.*)\])$/
|
2017
|
+
name = $1
|
2018
|
+
args = $3.split(/\s*,\s*/)
|
2019
|
+
else
|
2020
|
+
name = string
|
2021
|
+
args = []
|
2022
|
+
end
|
2023
|
+
[name, args]
|
2024
|
+
end
|
2025
|
+
|
2026
|
+
# Provide standard execption handling for the given block.
|
2027
|
+
def standard_exception_handling
|
2028
|
+
begin
|
2029
|
+
yield
|
2030
|
+
rescue SystemExit => ex
|
2031
|
+
# Exit silently with current status
|
2032
|
+
raise
|
2033
|
+
rescue OptionParser::InvalidOption => ex
|
2034
|
+
# Exit silently
|
2035
|
+
exit(false)
|
2036
|
+
rescue Exception => ex
|
2037
|
+
# Exit with error message
|
2038
|
+
$stderr.puts "rake aborted!"
|
2039
|
+
$stderr.puts ex.message
|
2040
|
+
if options.trace
|
2041
|
+
$stderr.puts ex.backtrace.join("\n")
|
2042
|
+
else
|
2043
|
+
$stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
|
2044
|
+
$stderr.puts "(See full trace by running task with --trace)"
|
2045
|
+
end
|
2046
|
+
exit(false)
|
2047
|
+
end
|
2048
|
+
end
|
2049
|
+
|
2050
|
+
# True if one of the files in RAKEFILES is in the current directory.
|
2051
|
+
# If a match is found, it is copied into @rakefile.
|
2052
|
+
def have_rakefile
|
2053
|
+
@rakefiles.each do |fn|
|
2054
|
+
if File.exist?(fn) || fn == ''
|
2055
|
+
return fn
|
2056
|
+
end
|
2057
|
+
end
|
2058
|
+
return nil
|
2059
|
+
end
|
2060
|
+
|
2061
|
+
# True if we are outputting to TTY, false otherwise
|
2062
|
+
def tty_output?
|
2063
|
+
@tty_output
|
2064
|
+
end
|
2065
|
+
|
2066
|
+
# Override the detected TTY output state (mostly for testing)
|
2067
|
+
def tty_output=( tty_output_state )
|
2068
|
+
@tty_output = tty_output_state
|
2069
|
+
end
|
2070
|
+
|
2071
|
+
# We will truncate output if we are outputting to a TTY or if we've been
|
2072
|
+
# given an explicit column width to honor
|
2073
|
+
def truncate_output?
|
2074
|
+
tty_output? || ENV['RAKE_COLUMNS']
|
2075
|
+
end
|
2076
|
+
|
2077
|
+
# Display the tasks and dependencies.
|
2078
|
+
def display_tasks_and_comments
|
2079
|
+
displayable_tasks = tasks.select { |t|
|
2080
|
+
t.comment && t.name =~ options.show_task_pattern
|
2081
|
+
}
|
2082
|
+
if options.full_description
|
2083
|
+
displayable_tasks.each do |t|
|
2084
|
+
puts "rake #{t.name_with_args}"
|
2085
|
+
t.full_comment.split("\n").each do |line|
|
2086
|
+
puts " #{line}"
|
2087
|
+
end
|
2088
|
+
puts
|
2089
|
+
end
|
2090
|
+
else
|
2091
|
+
width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
|
2092
|
+
max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
|
2093
|
+
displayable_tasks.each do |t|
|
2094
|
+
printf "#{name} %-#{width}s # %s\n",
|
2095
|
+
t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment
|
2096
|
+
end
|
2097
|
+
end
|
2098
|
+
end
|
2099
|
+
|
2100
|
+
def terminal_width
|
2101
|
+
if ENV['RAKE_COLUMNS']
|
2102
|
+
result = ENV['RAKE_COLUMNS'].to_i
|
2103
|
+
else
|
2104
|
+
result = unix? ? dynamic_width : 80
|
2105
|
+
end
|
2106
|
+
(result < 10) ? 80 : result
|
2107
|
+
rescue
|
2108
|
+
80
|
2109
|
+
end
|
2110
|
+
|
2111
|
+
# Calculate the dynamic width of the
|
2112
|
+
def dynamic_width
|
2113
|
+
@dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput)
|
2114
|
+
end
|
2115
|
+
|
2116
|
+
def dynamic_width_stty
|
2117
|
+
%x{stty size 2>/dev/null}.split[1].to_i
|
2118
|
+
end
|
2119
|
+
|
2120
|
+
def dynamic_width_tput
|
2121
|
+
%x{tput cols 2>/dev/null}.to_i
|
2122
|
+
end
|
2123
|
+
|
2124
|
+
def unix?
|
2125
|
+
RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
|
2126
|
+
end
|
2127
|
+
|
2128
|
+
def windows?
|
2129
|
+
Win32.windows?
|
2130
|
+
end
|
2131
|
+
|
2132
|
+
def truncate(string, width)
|
2133
|
+
if string.length <= width
|
2134
|
+
string
|
2135
|
+
else
|
2136
|
+
( string[0, width-3] || "" ) + "..."
|
2137
|
+
end
|
2138
|
+
end
|
2139
|
+
|
2140
|
+
# Display the tasks and prerequisites
|
2141
|
+
def display_prerequisites
|
2142
|
+
tasks.each do |t|
|
2143
|
+
puts "rake #{t.name}"
|
2144
|
+
t.prerequisites.each { |pre| puts " #{pre}" }
|
2145
|
+
end
|
2146
|
+
end
|
2147
|
+
|
2148
|
+
# A list of all the standard options used in rake, suitable for
|
2149
|
+
# passing to OptionParser.
|
2150
|
+
def standard_rake_options
|
2151
|
+
[
|
2152
|
+
['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
|
2153
|
+
lambda { |value|
|
2154
|
+
require 'rake/classic_namespace'
|
2155
|
+
options.classic_namespace = true
|
2156
|
+
}
|
2157
|
+
],
|
2158
|
+
['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
|
2159
|
+
lambda { |value|
|
2160
|
+
options.show_tasks = true
|
2161
|
+
options.full_description = true
|
2162
|
+
options.show_task_pattern = Regexp.new(value || '')
|
2163
|
+
}
|
2164
|
+
],
|
2165
|
+
['--dry-run', '-n', "Do a dry run without executing actions.",
|
2166
|
+
lambda { |value|
|
2167
|
+
verbose(true)
|
2168
|
+
nowrite(true)
|
2169
|
+
options.dryrun = true
|
2170
|
+
options.trace = true
|
2171
|
+
}
|
2172
|
+
],
|
2173
|
+
['--execute', '-e CODE', "Execute some Ruby code and exit.",
|
2174
|
+
lambda { |value|
|
2175
|
+
eval(value)
|
2176
|
+
exit
|
2177
|
+
}
|
2178
|
+
],
|
2179
|
+
['--execute-print', '-p CODE', "Execute some Ruby code, print the result, then exit.",
|
2180
|
+
lambda { |value|
|
2181
|
+
puts eval(value)
|
2182
|
+
exit
|
2183
|
+
}
|
2184
|
+
],
|
2185
|
+
['--execute-continue', '-E CODE',
|
2186
|
+
"Execute some Ruby code, then continue with normal task processing.",
|
2187
|
+
lambda { |value| eval(value) }
|
2188
|
+
],
|
2189
|
+
['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
|
2190
|
+
lambda { |value| $:.push(value) }
|
2191
|
+
],
|
2192
|
+
['--prereqs', '-P', "Display the tasks and dependencies, then exit.",
|
2193
|
+
lambda { |value| options.show_prereqs = true }
|
2194
|
+
],
|
2195
|
+
['--quiet', '-q', "Do not log messages to standard output.",
|
2196
|
+
lambda { |value| verbose(false) }
|
2197
|
+
],
|
2198
|
+
['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
|
2199
|
+
lambda { |value|
|
2200
|
+
value ||= ''
|
2201
|
+
@rakefiles.clear
|
2202
|
+
@rakefiles << value
|
2203
|
+
}
|
2204
|
+
],
|
2205
|
+
['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
|
2206
|
+
"Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
|
2207
|
+
lambda { |value| options.rakelib = value.split(':') }
|
2208
|
+
],
|
2209
|
+
['--require', '-r MODULE', "Require MODULE before executing rakefile.",
|
2210
|
+
lambda { |value|
|
2211
|
+
begin
|
2212
|
+
require value
|
2213
|
+
rescue LoadError => ex
|
2214
|
+
begin
|
2215
|
+
rake_require value
|
2216
|
+
rescue LoadError => ex2
|
2217
|
+
raise ex
|
2218
|
+
end
|
2219
|
+
end
|
2220
|
+
}
|
2221
|
+
],
|
2222
|
+
['--rules', "Trace the rules resolution.",
|
2223
|
+
lambda { |value| options.trace_rules = true }
|
2224
|
+
],
|
2225
|
+
['--no-search', '--nosearch', '-N', "Do not search parent directories for the Rakefile.",
|
2226
|
+
lambda { |value| options.nosearch = true }
|
2227
|
+
],
|
2228
|
+
['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
|
2229
|
+
lambda { |value|
|
2230
|
+
verbose(false)
|
2231
|
+
options.silent = true
|
2232
|
+
}
|
2233
|
+
],
|
2234
|
+
['--system', '-g',
|
2235
|
+
"Using system wide (global) rakefiles (usually '~/.rake/*.rake').",
|
2236
|
+
lambda { |value| options.load_system = true }
|
2237
|
+
],
|
2238
|
+
['--no-system', '--nosystem', '-G',
|
2239
|
+
"Use standard project Rakefile search paths, ignore system wide rakefiles.",
|
2240
|
+
lambda { |value| options.ignore_system = true }
|
2241
|
+
],
|
2242
|
+
['--tasks', '-T [PATTERN]', "Display the tasks (matching optional PATTERN) with descriptions, then exit.",
|
2243
|
+
lambda { |value|
|
2244
|
+
options.show_tasks = true
|
2245
|
+
options.show_task_pattern = Regexp.new(value || '')
|
2246
|
+
options.full_description = false
|
2247
|
+
}
|
2248
|
+
],
|
2249
|
+
['--trace', '-t', "Turn on invoke/execute tracing, enable full backtrace.",
|
2250
|
+
lambda { |value|
|
2251
|
+
options.trace = true
|
2252
|
+
verbose(true)
|
2253
|
+
}
|
2254
|
+
],
|
2255
|
+
['--verbose', '-v', "Log message to standard output (default).",
|
2256
|
+
lambda { |value| verbose(true) }
|
2257
|
+
],
|
2258
|
+
['--version', '-V', "Display the program version.",
|
2259
|
+
lambda { |value|
|
2260
|
+
puts "rake, version #{RAKEVERSION}"
|
2261
|
+
exit
|
2262
|
+
}
|
2263
|
+
]
|
2264
|
+
]
|
2265
|
+
end
|
2266
|
+
|
2267
|
+
# Read and handle the command line options.
|
2268
|
+
def handle_options
|
2269
|
+
options.rakelib = ['rakelib']
|
2270
|
+
|
2271
|
+
opts = OptionParser.new
|
2272
|
+
opts.banner = "rake [-f rakefile] {options} targets..."
|
2273
|
+
opts.separator ""
|
2274
|
+
opts.separator "Options are ..."
|
2275
|
+
|
2276
|
+
opts.on_tail("-h", "--help", "-H", "Display this help message.") do
|
2277
|
+
puts opts
|
2278
|
+
exit
|
2279
|
+
end
|
2280
|
+
|
2281
|
+
standard_rake_options.each { |args| opts.on(*args) }
|
2282
|
+
parsed_argv = opts.parse(ARGV)
|
2283
|
+
|
2284
|
+
# If class namespaces are requested, set the global options
|
2285
|
+
# according to the values in the options structure.
|
2286
|
+
if options.classic_namespace
|
2287
|
+
$show_tasks = options.show_tasks
|
2288
|
+
$show_prereqs = options.show_prereqs
|
2289
|
+
$trace = options.trace
|
2290
|
+
$dryrun = options.dryrun
|
2291
|
+
$silent = options.silent
|
2292
|
+
end
|
2293
|
+
parsed_argv
|
2294
|
+
end
|
2295
|
+
|
2296
|
+
# Similar to the regular Ruby +require+ command, but will check
|
2297
|
+
# for *.rake files in addition to *.rb files.
|
2298
|
+
def rake_require(file_name, paths=$LOAD_PATH, loaded=$")
|
2299
|
+
return false if loaded.include?(file_name)
|
2300
|
+
paths.each do |path|
|
2301
|
+
fn = file_name + ".rake"
|
2302
|
+
full_path = File.join(path, fn)
|
2303
|
+
if File.exist?(full_path)
|
2304
|
+
load full_path
|
2305
|
+
loaded << fn
|
2306
|
+
return true
|
2307
|
+
end
|
2308
|
+
end
|
2309
|
+
fail LoadError, "Can't find #{file_name}"
|
2310
|
+
end
|
2311
|
+
|
2312
|
+
def find_rakefile_location
|
2313
|
+
here = Dir.pwd
|
2314
|
+
while ! (fn = have_rakefile)
|
2315
|
+
Dir.chdir("..")
|
2316
|
+
if Dir.pwd == here || options.nosearch
|
2317
|
+
return nil
|
2318
|
+
end
|
2319
|
+
here = Dir.pwd
|
2320
|
+
end
|
2321
|
+
[fn, here]
|
2322
|
+
ensure
|
2323
|
+
Dir.chdir(Rake.original_dir)
|
2324
|
+
end
|
2325
|
+
|
2326
|
+
def raw_load_rakefile # :nodoc:
|
2327
|
+
rakefile, location = find_rakefile_location
|
2328
|
+
if (! options.ignore_system) &&
|
2329
|
+
(options.load_system || rakefile.nil?) &&
|
2330
|
+
system_dir && File.directory?(system_dir)
|
2331
|
+
puts "(in #{Dir.pwd})" unless options.silent
|
2332
|
+
glob("#{system_dir}/*.rake") do |name|
|
2333
|
+
add_import name
|
2334
|
+
end
|
2335
|
+
else
|
2336
|
+
fail "No Rakefile found (looking for: #{@rakefiles.join(', ')})" if
|
2337
|
+
rakefile.nil?
|
2338
|
+
@rakefile = rakefile
|
2339
|
+
Dir.chdir(location)
|
2340
|
+
puts "(in #{Dir.pwd})" unless options.silent
|
2341
|
+
$rakefile = @rakefile if options.classic_namespace
|
2342
|
+
load File.expand_path(@rakefile) if @rakefile && @rakefile != ''
|
2343
|
+
options.rakelib.each do |rlib|
|
2344
|
+
glob("#{rlib}/*.rake") do |name|
|
2345
|
+
add_import name
|
2346
|
+
end
|
2347
|
+
end
|
2348
|
+
end
|
2349
|
+
load_imports
|
2350
|
+
end
|
2351
|
+
|
2352
|
+
def glob(path, &block)
|
2353
|
+
Dir[path.gsub("\\", '/')].each(&block)
|
2354
|
+
end
|
2355
|
+
private :glob
|
2356
|
+
|
2357
|
+
# The directory path containing the system wide rakefiles.
|
2358
|
+
def system_dir
|
2359
|
+
@system_dir ||=
|
2360
|
+
begin
|
2361
|
+
if ENV['RAKE_SYSTEM']
|
2362
|
+
ENV['RAKE_SYSTEM']
|
2363
|
+
else
|
2364
|
+
standard_system_dir
|
2365
|
+
end
|
2366
|
+
end
|
2367
|
+
end
|
2368
|
+
|
2369
|
+
# The standard directory containing system wide rake files.
|
2370
|
+
if Win32.windows?
|
2371
|
+
def standard_system_dir #:nodoc:
|
2372
|
+
Win32.win32_system_dir
|
2373
|
+
end
|
2374
|
+
else
|
2375
|
+
def standard_system_dir #:nodoc:
|
2376
|
+
File.expand_path('.rake', '~')
|
2377
|
+
end
|
2378
|
+
end
|
2379
|
+
private :standard_system_dir
|
2380
|
+
|
2381
|
+
# Collect the list of tasks on the command line. If no tasks are
|
2382
|
+
# given, return a list containing only the default task.
|
2383
|
+
# Environmental assignments are processed at this time as well.
|
2384
|
+
def collect_tasks(argv)
|
2385
|
+
@top_level_tasks = []
|
2386
|
+
argv.each do |arg|
|
2387
|
+
if arg =~ /^(\w+)=(.*)$/
|
2388
|
+
ENV[$1] = $2
|
2389
|
+
else
|
2390
|
+
@top_level_tasks << arg unless arg =~ /^-/
|
2391
|
+
end
|
2392
|
+
end
|
2393
|
+
@top_level_tasks.push("default") if @top_level_tasks.size == 0
|
2394
|
+
end
|
2395
|
+
|
2396
|
+
# Add a file to the list of files to be imported.
|
2397
|
+
def add_import(fn)
|
2398
|
+
@pending_imports << fn
|
2399
|
+
end
|
2400
|
+
|
2401
|
+
# Load the pending list of imported files.
|
2402
|
+
def load_imports
|
2403
|
+
while fn = @pending_imports.shift
|
2404
|
+
next if @imported.member?(fn)
|
2405
|
+
if fn_task = lookup(fn)
|
2406
|
+
fn_task.invoke
|
2407
|
+
end
|
2408
|
+
ext = File.extname(fn)
|
2409
|
+
loader = @loaders[ext] || @default_loader
|
2410
|
+
loader.load(fn)
|
2411
|
+
@imported << fn
|
2412
|
+
end
|
2413
|
+
end
|
2414
|
+
|
2415
|
+
# Warn about deprecated use of top level constant names.
|
2416
|
+
def const_warning(const_name)
|
2417
|
+
@const_warning ||= false
|
2418
|
+
if ! @const_warning
|
2419
|
+
$stderr.puts %{WARNING: Deprecated reference to top-level constant '#{const_name}' } +
|
2420
|
+
%{found at: #{rakefile_location}} # '
|
2421
|
+
$stderr.puts %{ Use --classic-namespace on rake command}
|
2422
|
+
$stderr.puts %{ or 'require "rake/classic_namespace"' in Rakefile}
|
2423
|
+
end
|
2424
|
+
@const_warning = true
|
2425
|
+
end
|
2426
|
+
|
2427
|
+
def rakefile_location
|
2428
|
+
begin
|
2429
|
+
fail
|
2430
|
+
rescue RuntimeError => ex
|
2431
|
+
ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || ""
|
2432
|
+
end
|
2433
|
+
end
|
2434
|
+
end
|
2435
|
+
end
|
2436
|
+
|
2437
|
+
|
2438
|
+
class Module
|
2439
|
+
# Rename the original handler to make it available.
|
2440
|
+
alias :rake_original_const_missing :const_missing
|
2441
|
+
|
2442
|
+
# Check for deprecated uses of top level (i.e. in Object) uses of
|
2443
|
+
# Rake class names. If someone tries to reference the constant
|
2444
|
+
# name, display a warning and return the proper object. Using the
|
2445
|
+
# --classic-namespace command line option will define these
|
2446
|
+
# constants in Object and avoid this handler.
|
2447
|
+
def const_missing(const_name)
|
2448
|
+
case const_name
|
2449
|
+
when :Task
|
2450
|
+
Rake.application.const_warning(const_name)
|
2451
|
+
Rake::Task
|
2452
|
+
when :FileTask
|
2453
|
+
Rake.application.const_warning(const_name)
|
2454
|
+
Rake::FileTask
|
2455
|
+
when :FileCreationTask
|
2456
|
+
Rake.application.const_warning(const_name)
|
2457
|
+
Rake::FileCreationTask
|
2458
|
+
when :RakeApp
|
2459
|
+
Rake.application.const_warning(const_name)
|
2460
|
+
Rake::Application
|
2461
|
+
else
|
2462
|
+
rake_original_const_missing(const_name)
|
2463
|
+
end
|
2464
|
+
end
|
2465
|
+
end
|