shoesgem 0.1424.0 → 0.1426.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -0
- data/shoes/CHANGELOG.txt +21 -21
- data/shoes/COPYING.txt +30 -30
- data/shoes/VERSION.txt +1 -1
- data/shoes/freetype6.dll +0 -0
- data/shoes/lib/shoes/cache.rb +54 -54
- data/shoes/lib/shoes/data.rb +39 -39
- data/shoes/lib/shoes/help.rb +421 -421
- data/shoes/lib/shoes/image.rb +25 -25
- data/shoes/lib/shoes/inspect.rb +128 -128
- data/shoes/lib/shoes/log.rb +48 -48
- data/shoes/lib/shoes/minitar.rb +986 -986
- data/shoes/lib/shoes/override.rb +38 -38
- data/shoes/lib/shoes/pack.rb +503 -503
- data/shoes/lib/shoes/search.rb +46 -46
- data/shoes/lib/shoes/setup.rb +329 -329
- data/shoes/lib/shoes/shy.rb +131 -131
- data/shoes/lib/shoes/shybuilder.rb +44 -44
- data/shoes/lib/shoes.rb +522 -522
- 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/nsis/base.nsi +644 -0
- data/shoes/nsis/installer-1.bmp +0 -0
- data/shoes/nsis/installer-2.bmp +0 -0
- data/shoes/nsis/setup.ico +0 -0
- data/shoes/nsis/shoes.exe.manifest +17 -0
- data/shoes/nsis/shoes.ico +0 -0
- data/shoes/nsis/shoes.nsi +644 -0
- data/shoes/nsis/stub-inject.c +59 -0
- data/shoes/nsis/stub.c +271 -0
- data/shoes/nsis/stub32.h +14 -0
- data/shoes/nsis/stub32.rc +16 -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 -63
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/builder.rb +216 -216
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/elements.rb +510 -510
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/htmlinfo.rb +691 -691
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/inspect.rb +103 -103
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/modules.rb +40 -40
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/parse.rb +38 -38
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tag.rb +202 -202
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/tags.rb +164 -164
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/traverse.rb +838 -838
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot/xchar.rb +94 -94
- data/shoes/ruby/gems/1.9.1/gems/hpricot-0.8.1/lib/hpricot.rb +26 -26
- 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 -135
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/add/rails.rb +58 -58
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/common.rb +354 -354
- 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 -13
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json/version.rb +9 -9
- data/shoes/ruby/gems/1.9.1/gems/json-shoes-1.1.3/lib/json.rb +8 -8
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/constants.rb +49 -49
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/database.rb +721 -721
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/api.rb +152 -152
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/dl/driver.rb +307 -307
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/native/driver.rb +219 -219
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/errors.rb +68 -68
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/pragmas.rb +271 -271
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/resultset.rb +180 -180
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/statement.rb +231 -231
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/translator.rb +109 -109
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/value.rb +57 -57
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/version.rb +16 -16
- data/shoes/ruby/gems/1.9.1/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3.rb +1 -1
- 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 -32
- data/shoes/ruby/gems/1.9.1/specifications/json-shoes-1.1.3.gemspec +34 -34
- data/shoes/ruby/gems/1.9.1/specifications/sqlite3-ruby-1.2.5-x86-mswin32.gemspec +46 -46
- data/shoes/ruby/lib/ftsearch/analysis/analyzer.rb +16 -16
- data/shoes/ruby/lib/ftsearch/analysis/simple_identifier_analyzer.rb +23 -23
- data/shoes/ruby/lib/ftsearch/analysis/whitespace_analyzer.rb +22 -22
- data/shoes/ruby/lib/ftsearch/document_map_reader.rb +106 -106
- data/shoes/ruby/lib/ftsearch/document_map_writer.rb +46 -46
- data/shoes/ruby/lib/ftsearch/field_infos.rb +46 -46
- data/shoes/ruby/lib/ftsearch/fragment_writer.rb +114 -114
- data/shoes/ruby/lib/ftsearch/fulltext_reader.rb +52 -52
- data/shoes/ruby/lib/ftsearch/fulltext_writer.rb +75 -75
- data/shoes/ruby/lib/ftsearch/suffix_array_reader.rb +275 -275
- data/shoes/ruby/lib/ftsearch/suffix_array_writer.rb +99 -99
- data/shoes/ruby/lib/ftsearch/util.rb +21 -21
- 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 +2 -2
- 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/rbconfig/datadir.rb +24 -24
- data/shoes/ruby/lib/rubygems/builder.rb +88 -88
- data/shoes/ruby/lib/rubygems/command.rb +406 -406
- data/shoes/ruby/lib/rubygems/command_manager.rb +146 -146
- data/shoes/ruby/lib/rubygems/commands/build_command.rb +53 -53
- data/shoes/ruby/lib/rubygems/commands/cert_command.rb +86 -86
- data/shoes/ruby/lib/rubygems/commands/check_command.rb +75 -75
- data/shoes/ruby/lib/rubygems/commands/cleanup_command.rb +91 -91
- data/shoes/ruby/lib/rubygems/commands/contents_command.rb +74 -74
- data/shoes/ruby/lib/rubygems/commands/dependency_command.rb +188 -188
- data/shoes/ruby/lib/rubygems/commands/environment_command.rb +128 -128
- data/shoes/ruby/lib/rubygems/commands/fetch_command.rb +62 -62
- data/shoes/ruby/lib/rubygems/commands/generate_index_command.rb +57 -57
- data/shoes/ruby/lib/rubygems/commands/help_command.rb +172 -172
- data/shoes/ruby/lib/rubygems/commands/install_command.rb +148 -148
- data/shoes/ruby/lib/rubygems/commands/list_command.rb +35 -35
- data/shoes/ruby/lib/rubygems/commands/lock_command.rb +110 -110
- data/shoes/ruby/lib/rubygems/commands/mirror_command.rb +111 -111
- data/shoes/ruby/lib/rubygems/commands/outdated_command.rb +33 -33
- data/shoes/ruby/lib/rubygems/commands/pristine_command.rb +93 -93
- data/shoes/ruby/lib/rubygems/commands/query_command.rb +233 -233
- data/shoes/ruby/lib/rubygems/commands/rdoc_command.rb +82 -82
- data/shoes/ruby/lib/rubygems/commands/search_command.rb +37 -37
- data/shoes/ruby/lib/rubygems/commands/server_command.rb +48 -48
- data/shoes/ruby/lib/rubygems/commands/sources_command.rb +152 -152
- data/shoes/ruby/lib/rubygems/commands/specification_command.rb +77 -77
- data/shoes/ruby/lib/rubygems/commands/stale_command.rb +27 -27
- data/shoes/ruby/lib/rubygems/commands/uninstall_command.rb +73 -73
- data/shoes/ruby/lib/rubygems/commands/unpack_command.rb +95 -95
- data/shoes/ruby/lib/rubygems/commands/update_command.rb +181 -181
- data/shoes/ruby/lib/rubygems/commands/which_command.rb +87 -87
- data/shoes/ruby/lib/rubygems/config_file.rb +266 -266
- data/shoes/ruby/lib/rubygems/custom_require.rb +46 -46
- data/shoes/ruby/lib/rubygems/defaults.rb +89 -89
- data/shoes/ruby/lib/rubygems/dependency.rb +119 -119
- data/shoes/ruby/lib/rubygems/dependency_installer.rb +258 -258
- data/shoes/ruby/lib/rubygems/dependency_list.rb +165 -165
- data/shoes/ruby/lib/rubygems/digest/digest_adapter.rb +39 -39
- data/shoes/ruby/lib/rubygems/digest/md5.rb +23 -23
- data/shoes/ruby/lib/rubygems/digest/sha1.rb +16 -16
- data/shoes/ruby/lib/rubygems/digest/sha2.rb +17 -17
- data/shoes/ruby/lib/rubygems/doc_manager.rb +214 -214
- data/shoes/ruby/lib/rubygems/exceptions.rb +84 -84
- data/shoes/ruby/lib/rubygems/ext/builder.rb +56 -56
- data/shoes/ruby/lib/rubygems/ext/configure_builder.rb +24 -24
- data/shoes/ruby/lib/rubygems/ext/ext_conf_builder.rb +23 -23
- data/shoes/ruby/lib/rubygems/ext/rake_builder.rb +27 -27
- data/shoes/ruby/lib/rubygems/ext.rb +18 -18
- data/shoes/ruby/lib/rubygems/format.rb +87 -87
- data/shoes/ruby/lib/rubygems/gem_openssl.rb +83 -83
- data/shoes/ruby/lib/rubygems/gem_path_searcher.rb +100 -100
- data/shoes/ruby/lib/rubygems/gem_runner.rb +58 -58
- data/shoes/ruby/lib/rubygems/indexer.rb +370 -370
- data/shoes/ruby/lib/rubygems/install_update_options.rb +113 -113
- data/shoes/ruby/lib/rubygems/installer.rb +578 -578
- data/shoes/ruby/lib/rubygems/local_remote_options.rb +134 -134
- data/shoes/ruby/lib/rubygems/old_format.rb +148 -148
- data/shoes/ruby/lib/rubygems/package/f_sync_dir.rb +24 -24
- data/shoes/ruby/lib/rubygems/package/tar_header.rb +245 -245
- data/shoes/ruby/lib/rubygems/package/tar_input.rb +219 -219
- data/shoes/ruby/lib/rubygems/package/tar_output.rb +143 -143
- data/shoes/ruby/lib/rubygems/package/tar_reader/entry.rb +99 -99
- data/shoes/ruby/lib/rubygems/package/tar_reader.rb +86 -86
- data/shoes/ruby/lib/rubygems/package/tar_writer.rb +180 -180
- data/shoes/ruby/lib/rubygems/package.rb +95 -95
- data/shoes/ruby/lib/rubygems/platform.rb +178 -178
- data/shoes/ruby/lib/rubygems/remote_fetcher.rb +344 -344
- data/shoes/ruby/lib/rubygems/require_paths_builder.rb +14 -14
- data/shoes/ruby/lib/rubygems/requirement.rb +163 -163
- data/shoes/ruby/lib/rubygems/rubygems_version.rb +6 -6
- data/shoes/ruby/lib/rubygems/security.rb +786 -786
- data/shoes/ruby/lib/rubygems/server.rb +629 -629
- data/shoes/ruby/lib/rubygems/source_index.rb +559 -559
- data/shoes/ruby/lib/rubygems/source_info_cache.rb +393 -393
- data/shoes/ruby/lib/rubygems/source_info_cache_entry.rb +56 -56
- data/shoes/ruby/lib/rubygems/spec_fetcher.rb +249 -249
- data/shoes/ruby/lib/rubygems/specification.rb +1262 -1262
- data/shoes/ruby/lib/rubygems/test_utilities.rb +131 -131
- data/shoes/ruby/lib/rubygems/timer.rb +25 -25
- data/shoes/ruby/lib/rubygems/uninstaller.rb +242 -242
- data/shoes/ruby/lib/rubygems/user_interaction.rb +360 -360
- data/shoes/ruby/lib/rubygems/validator.rb +208 -208
- data/shoes/ruby/lib/rubygems/version.rb +167 -167
- data/shoes/ruby/lib/rubygems/version_option.rb +48 -48
- data/shoes/ruby/lib/rubygems.rb +888 -888
- data/shoes/ruby/lib/ubygems.rb +10 -10
- data/shoes/samples/class-book.rb +43 -43
- data/shoes/samples/class-book.yaml +387 -387
- data/shoes/samples/expert-definr.rb +23 -23
- data/shoes/samples/expert-funnies.rb +51 -51
- data/shoes/samples/expert-irb.rb +112 -112
- data/shoes/samples/expert-minesweeper.rb +267 -267
- data/shoes/samples/expert-othello.rb +319 -319
- data/shoes/samples/expert-pong.rb +62 -62
- data/shoes/samples/expert-tankspank.rb +385 -385
- data/shoes/samples/good-arc.rb +37 -37
- data/shoes/samples/good-clock.rb +51 -51
- data/shoes/samples/good-follow.rb +26 -26
- data/shoes/samples/good-reminder.rb +174 -174
- data/shoes/samples/good-vjot.rb +56 -56
- data/shoes/samples/simple-accordion.rb +75 -75
- data/shoes/samples/simple-anim-shapes.rb +17 -17
- data/shoes/samples/simple-anim-text.rb +13 -13
- data/shoes/samples/simple-arc.rb +23 -23
- data/shoes/samples/simple-bounce.rb +24 -24
- data/shoes/samples/simple-calc.rb +70 -70
- data/shoes/samples/simple-control-sizes.rb +24 -24
- data/shoes/samples/simple-curve.rb +26 -26
- data/shoes/samples/simple-dialogs.rb +29 -29
- data/shoes/samples/simple-downloader.rb +27 -27
- data/shoes/samples/simple-draw.rb +13 -13
- data/shoes/samples/simple-editor.rb +28 -28
- data/shoes/samples/simple-form.rb +28 -28
- data/shoes/samples/simple-mask.rb +21 -21
- data/shoes/samples/simple-menu.rb +31 -31
- data/shoes/samples/simple-menu1.rb +35 -35
- data/shoes/samples/simple-rubygems.rb +29 -29
- data/shoes/samples/simple-slide.rb +45 -45
- data/shoes/samples/simple-sphere.rb +28 -28
- data/shoes/samples/simple-timer.rb +13 -13
- data/shoes/samples/simple-video.rb +13 -13
- data/shoes/shoes.exe +0 -0
- data/shoes/sqlite3.dll +0 -0
- data/shoes/static/code_highlighter.js +188 -188
- data/shoes/static/code_highlighter_ruby.js +26 -26
- data/shoes/static/manual-en.txt +2783 -2783
- data/shoes/static/manual-ja.txt +2780 -2780
- data/shoes/static/manual.css +167 -167
- data/shoes/static/stubs/blank.run +375 -375
- data/shoes/static/stubs/sh-install +48 -48
- data/shoes/zlib.dll +0 -0
- data/shoes/zlib1.dll +0 -0
- metadata +15 -5
- data/shoes/static/Thumbs.db +0 -0
@@ -1,1262 +1,1262 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
-
# All rights reserved.
|
4
|
-
# See LICENSE.txt for permissions.
|
5
|
-
#++
|
6
|
-
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubygems/version'
|
9
|
-
require 'rubygems/requirement'
|
10
|
-
require 'rubygems/platform'
|
11
|
-
|
12
|
-
# :stopdoc:
|
13
|
-
# Time::today has been deprecated in 0.9.5 and will be removed.
|
14
|
-
if RUBY_VERSION < '1.9' then
|
15
|
-
def Time.today
|
16
|
-
t = Time.now
|
17
|
-
t - ((t.to_f + t.gmt_offset) % 86400)
|
18
|
-
end unless defined? Time.today
|
19
|
-
end
|
20
|
-
|
21
|
-
class Date; end # for ruby_code if date.rb wasn't required
|
22
|
-
|
23
|
-
# :startdoc:
|
24
|
-
|
25
|
-
module Gem
|
26
|
-
|
27
|
-
##
|
28
|
-
# == Gem::Specification
|
29
|
-
#
|
30
|
-
# The Specification class contains the metadata for a Gem. Typically
|
31
|
-
# defined in a .gemspec file or a Rakefile, and looks like this:
|
32
|
-
#
|
33
|
-
# spec = Gem::Specification.new do |s|
|
34
|
-
# s.name = 'rfoo'
|
35
|
-
# s.version = '1.0'
|
36
|
-
# s.summary = 'Example gem specification'
|
37
|
-
# ...
|
38
|
-
# end
|
39
|
-
#
|
40
|
-
# There are many <em>gemspec attributes</em>, and the best place to learn
|
41
|
-
# about them in the "Gemspec Reference" linked from the RubyGems wiki.
|
42
|
-
|
43
|
-
class Specification
|
44
|
-
|
45
|
-
##
|
46
|
-
# Allows deinstallation of gems with legacy platforms.
|
47
|
-
|
48
|
-
attr_accessor :original_platform # :nodoc:
|
49
|
-
|
50
|
-
##
|
51
|
-
# The the version number of a specification that does not specify one
|
52
|
-
# (i.e. RubyGems 0.7 or earlier).
|
53
|
-
|
54
|
-
NONEXISTENT_SPECIFICATION_VERSION = -1
|
55
|
-
|
56
|
-
##
|
57
|
-
# The specification version applied to any new Specification instances
|
58
|
-
# created. This should be bumped whenever something in the spec format
|
59
|
-
# changes.
|
60
|
-
#--
|
61
|
-
# When updating this number, be sure to also update #to_ruby.
|
62
|
-
#
|
63
|
-
# NOTE RubyGems < 1.2 cannot load specification versions > 2.
|
64
|
-
|
65
|
-
CURRENT_SPECIFICATION_VERSION = 2
|
66
|
-
|
67
|
-
##
|
68
|
-
# An informal list of changes to the specification. The highest-valued
|
69
|
-
# key should be equal to the CURRENT_SPECIFICATION_VERSION.
|
70
|
-
|
71
|
-
SPECIFICATION_VERSION_HISTORY = {
|
72
|
-
-1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
|
73
|
-
1 => [
|
74
|
-
'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
|
75
|
-
'"test_file=x" is a shortcut for "test_files=[x]"'
|
76
|
-
],
|
77
|
-
2 => [
|
78
|
-
'Added "required_rubygems_version"',
|
79
|
-
'Now forward-compatible with future versions',
|
80
|
-
],
|
81
|
-
}
|
82
|
-
|
83
|
-
# :stopdoc:
|
84
|
-
MARSHAL_FIELDS = { -1 => 16, 1 => 16, 2 => 16 }
|
85
|
-
|
86
|
-
now = Time.at(Time.now.to_i)
|
87
|
-
TODAY = now - ((now.to_i + now.gmt_offset) % 86400)
|
88
|
-
# :startdoc:
|
89
|
-
|
90
|
-
##
|
91
|
-
# List of Specification instances.
|
92
|
-
|
93
|
-
@@list = []
|
94
|
-
|
95
|
-
##
|
96
|
-
# Optional block used to gather newly defined instances.
|
97
|
-
|
98
|
-
@@gather = nil
|
99
|
-
|
100
|
-
##
|
101
|
-
# List of attribute names: [:name, :version, ...]
|
102
|
-
@@required_attributes = []
|
103
|
-
|
104
|
-
##
|
105
|
-
# List of _all_ attributes and default values:
|
106
|
-
#
|
107
|
-
# [[:name, nil],
|
108
|
-
# [:bindir, 'bin'],
|
109
|
-
# ...]
|
110
|
-
|
111
|
-
@@attributes = []
|
112
|
-
|
113
|
-
@@nil_attributes = []
|
114
|
-
@@non_nil_attributes = [:@original_platform]
|
115
|
-
|
116
|
-
##
|
117
|
-
# List of array attributes
|
118
|
-
|
119
|
-
@@array_attributes = []
|
120
|
-
|
121
|
-
##
|
122
|
-
# Map of attribute names to default values.
|
123
|
-
|
124
|
-
@@default_value = {}
|
125
|
-
|
126
|
-
##
|
127
|
-
# Names of all specification attributes
|
128
|
-
|
129
|
-
def self.attribute_names
|
130
|
-
@@attributes.map { |name, default| name }
|
131
|
-
end
|
132
|
-
|
133
|
-
##
|
134
|
-
# Default values for specification attributes
|
135
|
-
|
136
|
-
def self.attribute_defaults
|
137
|
-
@@attributes.dup
|
138
|
-
end
|
139
|
-
|
140
|
-
##
|
141
|
-
# The default value for specification attribute +name+
|
142
|
-
|
143
|
-
def self.default_value(name)
|
144
|
-
@@default_value[name]
|
145
|
-
end
|
146
|
-
|
147
|
-
##
|
148
|
-
# Required specification attributes
|
149
|
-
|
150
|
-
def self.required_attributes
|
151
|
-
@@required_attributes.dup
|
152
|
-
end
|
153
|
-
|
154
|
-
##
|
155
|
-
# Is +name+ a required attribute?
|
156
|
-
|
157
|
-
def self.required_attribute?(name)
|
158
|
-
@@required_attributes.include? name.to_sym
|
159
|
-
end
|
160
|
-
|
161
|
-
##
|
162
|
-
# Specification attributes that are arrays (appendable and so-forth)
|
163
|
-
|
164
|
-
def self.array_attributes
|
165
|
-
@@array_attributes.dup
|
166
|
-
end
|
167
|
-
|
168
|
-
##
|
169
|
-
# A list of Specification instances that have been defined in this Ruby
|
170
|
-
# instance.
|
171
|
-
|
172
|
-
def self.list
|
173
|
-
@@list
|
174
|
-
end
|
175
|
-
|
176
|
-
##
|
177
|
-
# Specifies the +name+ and +default+ for a specification attribute, and
|
178
|
-
# creates a reader and writer method like Module#attr_accessor.
|
179
|
-
#
|
180
|
-
# The reader method returns the default if the value hasn't been set.
|
181
|
-
|
182
|
-
def self.attribute(name, default=nil)
|
183
|
-
ivar_name = "@#{name}".intern
|
184
|
-
if default.nil? then
|
185
|
-
@@nil_attributes << ivar_name
|
186
|
-
else
|
187
|
-
@@non_nil_attributes << [ivar_name, default]
|
188
|
-
end
|
189
|
-
|
190
|
-
@@attributes << [name, default]
|
191
|
-
@@default_value[name] = default
|
192
|
-
attr_accessor(name)
|
193
|
-
end
|
194
|
-
|
195
|
-
##
|
196
|
-
# Same as :attribute, but ensures that values assigned to the attribute
|
197
|
-
# are array values by applying :to_a to the value.
|
198
|
-
|
199
|
-
def self.array_attribute(name)
|
200
|
-
@@non_nil_attributes << ["@#{name}".intern, []]
|
201
|
-
|
202
|
-
@@array_attributes << name
|
203
|
-
@@attributes << [name, []]
|
204
|
-
@@default_value[name] = []
|
205
|
-
code = %{
|
206
|
-
def #{name}
|
207
|
-
@#{name} ||= []
|
208
|
-
end
|
209
|
-
def #{name}=(value)
|
210
|
-
@#{name} = Array(value)
|
211
|
-
end
|
212
|
-
}
|
213
|
-
|
214
|
-
module_eval code, __FILE__, __LINE__ - 9
|
215
|
-
end
|
216
|
-
|
217
|
-
##
|
218
|
-
# Same as attribute above, but also records this attribute as mandatory.
|
219
|
-
|
220
|
-
def self.required_attribute(*args)
|
221
|
-
@@required_attributes << args.first
|
222
|
-
attribute(*args)
|
223
|
-
end
|
224
|
-
|
225
|
-
##
|
226
|
-
# Sometimes we don't want the world to use a setter method for a
|
227
|
-
# particular attribute.
|
228
|
-
#
|
229
|
-
# +read_only+ makes it private so we can still use it internally.
|
230
|
-
|
231
|
-
def self.read_only(*names)
|
232
|
-
names.each do |name|
|
233
|
-
private "#{name}="
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
# Shortcut for creating several attributes at once (each with a default
|
238
|
-
# value of +nil+).
|
239
|
-
|
240
|
-
def self.attributes(*args)
|
241
|
-
args.each do |arg|
|
242
|
-
attribute(arg, nil)
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
##
|
247
|
-
# Some attributes require special behaviour when they are accessed. This
|
248
|
-
# allows for that.
|
249
|
-
|
250
|
-
def self.overwrite_accessor(name, &block)
|
251
|
-
remove_method name
|
252
|
-
define_method(name, &block)
|
253
|
-
end
|
254
|
-
|
255
|
-
##
|
256
|
-
# Defines a _singular_ version of an existing _plural_ attribute (i.e. one
|
257
|
-
# whose value is expected to be an array). This means just creating a
|
258
|
-
# helper method that takes a single value and appends it to the array.
|
259
|
-
# These are created for convenience, so that in a spec, one can write
|
260
|
-
#
|
261
|
-
# s.require_path = 'mylib'
|
262
|
-
#
|
263
|
-
# instead of:
|
264
|
-
#
|
265
|
-
# s.require_paths = ['mylib']
|
266
|
-
#
|
267
|
-
# That above convenience is available courtesy of:
|
268
|
-
#
|
269
|
-
# attribute_alias_singular :require_path, :require_paths
|
270
|
-
|
271
|
-
def self.attribute_alias_singular(singular, plural)
|
272
|
-
define_method("#{singular}=") { |val|
|
273
|
-
send("#{plural}=", [val])
|
274
|
-
}
|
275
|
-
define_method("#{singular}") {
|
276
|
-
val = send("#{plural}")
|
277
|
-
val.nil? ? nil : val.first
|
278
|
-
}
|
279
|
-
end
|
280
|
-
|
281
|
-
##
|
282
|
-
# Dump only crucial instance variables.
|
283
|
-
#--
|
284
|
-
# MAINTAIN ORDER!
|
285
|
-
|
286
|
-
def _dump(limit)
|
287
|
-
Marshal.dump [
|
288
|
-
@rubygems_version,
|
289
|
-
@specification_version,
|
290
|
-
@name,
|
291
|
-
@version,
|
292
|
-
(Time === @date ? @date : (require 'time'; Time.parse(@date.to_s))),
|
293
|
-
@summary,
|
294
|
-
@required_ruby_version,
|
295
|
-
@required_rubygems_version,
|
296
|
-
@original_platform,
|
297
|
-
@dependencies,
|
298
|
-
@rubyforge_project,
|
299
|
-
@email,
|
300
|
-
@authors,
|
301
|
-
@description,
|
302
|
-
@homepage,
|
303
|
-
@has_rdoc,
|
304
|
-
@new_platform,
|
305
|
-
]
|
306
|
-
end
|
307
|
-
|
308
|
-
##
|
309
|
-
# Load custom marshal format, re-initializing defaults as needed
|
310
|
-
|
311
|
-
def self._load(str)
|
312
|
-
array = Marshal.load str
|
313
|
-
|
314
|
-
spec = Gem::Specification.new
|
315
|
-
spec.instance_variable_set :@specification_version, array[1]
|
316
|
-
|
317
|
-
current_version = CURRENT_SPECIFICATION_VERSION
|
318
|
-
|
319
|
-
field_count = if spec.specification_version > current_version then
|
320
|
-
spec.instance_variable_set :@specification_version,
|
321
|
-
current_version
|
322
|
-
MARSHAL_FIELDS[current_version]
|
323
|
-
else
|
324
|
-
MARSHAL_FIELDS[spec.specification_version]
|
325
|
-
end
|
326
|
-
|
327
|
-
if array.size < field_count then
|
328
|
-
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
|
329
|
-
end
|
330
|
-
|
331
|
-
spec.instance_variable_set :@rubygems_version, array[0]
|
332
|
-
# spec version
|
333
|
-
spec.instance_variable_set :@name, array[2]
|
334
|
-
spec.instance_variable_set :@version, array[3]
|
335
|
-
spec.instance_variable_set :@date, array[4]
|
336
|
-
spec.instance_variable_set :@summary, array[5]
|
337
|
-
spec.instance_variable_set :@required_ruby_version, array[6]
|
338
|
-
spec.instance_variable_set :@required_rubygems_version, array[7]
|
339
|
-
spec.instance_variable_set :@original_platform, array[8]
|
340
|
-
spec.instance_variable_set :@dependencies, array[9]
|
341
|
-
spec.instance_variable_set :@rubyforge_project, array[10]
|
342
|
-
spec.instance_variable_set :@email, array[11]
|
343
|
-
spec.instance_variable_set :@authors, array[12]
|
344
|
-
spec.instance_variable_set :@description, array[13]
|
345
|
-
spec.instance_variable_set :@homepage, array[14]
|
346
|
-
spec.instance_variable_set :@has_rdoc, array[15]
|
347
|
-
spec.instance_variable_set :@new_platform, array[16]
|
348
|
-
spec.instance_variable_set :@platform, array[16].to_s
|
349
|
-
spec.instance_variable_set :@loaded, false
|
350
|
-
|
351
|
-
spec
|
352
|
-
end
|
353
|
-
|
354
|
-
##
|
355
|
-
# List of depedencies that will automatically be activated at runtime.
|
356
|
-
|
357
|
-
def runtime_dependencies
|
358
|
-
dependencies.select { |d| d.type == :runtime || d.type == nil }
|
359
|
-
end
|
360
|
-
|
361
|
-
##
|
362
|
-
# List of dependencies that are used for development
|
363
|
-
|
364
|
-
def development_dependencies
|
365
|
-
dependencies.select { |d| d.type == :development }
|
366
|
-
end
|
367
|
-
|
368
|
-
def test_suite_file # :nodoc:
|
369
|
-
warn 'test_suite_file deprecated, use test_files'
|
370
|
-
test_files.first
|
371
|
-
end
|
372
|
-
|
373
|
-
def test_suite_file=(val) # :nodoc:
|
374
|
-
warn 'test_suite_file= deprecated, use test_files='
|
375
|
-
@test_files = [] unless defined? @test_files
|
376
|
-
@test_files << val
|
377
|
-
end
|
378
|
-
|
379
|
-
##
|
380
|
-
# true when this gemspec has been loaded from a specifications directory.
|
381
|
-
# This attribute is not persisted.
|
382
|
-
|
383
|
-
attr_accessor :loaded
|
384
|
-
|
385
|
-
##
|
386
|
-
# Path this gemspec was loaded from. This attribute is not persisted.
|
387
|
-
|
388
|
-
attr_accessor :loaded_from
|
389
|
-
|
390
|
-
##
|
391
|
-
# Returns an array with bindir attached to each executable in the
|
392
|
-
# executables list
|
393
|
-
|
394
|
-
def add_bindir(executables)
|
395
|
-
return nil if executables.nil?
|
396
|
-
|
397
|
-
if @bindir then
|
398
|
-
Array(executables).map { |e| File.join(@bindir, e) }
|
399
|
-
else
|
400
|
-
executables
|
401
|
-
end
|
402
|
-
rescue
|
403
|
-
return nil
|
404
|
-
end
|
405
|
-
|
406
|
-
##
|
407
|
-
# Files in the Gem under one of the require_paths
|
408
|
-
|
409
|
-
def lib_files
|
410
|
-
@files.select do |file|
|
411
|
-
require_paths.any? do |path|
|
412
|
-
file.index(path) == 0
|
413
|
-
end
|
414
|
-
end
|
415
|
-
end
|
416
|
-
|
417
|
-
##
|
418
|
-
# True if this gem was loaded from disk
|
419
|
-
|
420
|
-
alias :loaded? :loaded
|
421
|
-
|
422
|
-
##
|
423
|
-
# True if this gem has files in test_files
|
424
|
-
|
425
|
-
def has_unit_tests?
|
426
|
-
not test_files.empty?
|
427
|
-
end
|
428
|
-
|
429
|
-
alias has_test_suite? has_unit_tests? # :nodoc: deprecated
|
430
|
-
|
431
|
-
##
|
432
|
-
# Specification constructor. Assigns the default values to the
|
433
|
-
# attributes, adds this spec to the list of loaded specs (see
|
434
|
-
# Specification.list), and yields itself for further initialization.
|
435
|
-
|
436
|
-
def initialize
|
437
|
-
@new_platform = nil
|
438
|
-
assign_defaults
|
439
|
-
@loaded = false
|
440
|
-
@loaded_from = nil
|
441
|
-
@@list << self
|
442
|
-
|
443
|
-
yield self if block_given?
|
444
|
-
|
445
|
-
@@gather.call(self) if @@gather
|
446
|
-
end
|
447
|
-
|
448
|
-
##
|
449
|
-
# Each attribute has a default value (possibly nil). Here, we initialize
|
450
|
-
# all attributes to their default value. This is done through the
|
451
|
-
# accessor methods, so special behaviours will be honored. Furthermore,
|
452
|
-
# we take a _copy_ of the default so each specification instance has its
|
453
|
-
# own empty arrays, etc.
|
454
|
-
|
455
|
-
def assign_defaults
|
456
|
-
@@nil_attributes.each do |name|
|
457
|
-
instance_variable_set name, nil
|
458
|
-
end
|
459
|
-
|
460
|
-
@@non_nil_attributes.each do |name, default|
|
461
|
-
value = case default
|
462
|
-
when Time, Numeric, Symbol, true, false, nil then default
|
463
|
-
else default.dup
|
464
|
-
end
|
465
|
-
|
466
|
-
instance_variable_set name, value
|
467
|
-
end
|
468
|
-
|
469
|
-
# HACK
|
470
|
-
instance_variable_set :@new_platform, Gem::Platform::RUBY
|
471
|
-
end
|
472
|
-
|
473
|
-
##
|
474
|
-
# Special loader for YAML files. When a Specification object is loaded
|
475
|
-
# from a YAML file, it bypasses the normal Ruby object initialization
|
476
|
-
# routine (#initialize). This method makes up for that and deals with
|
477
|
-
# gems of different ages.
|
478
|
-
#
|
479
|
-
# 'input' can be anything that YAML.load() accepts: String or IO.
|
480
|
-
|
481
|
-
def self.from_yaml(input)
|
482
|
-
input = normalize_yaml_input input
|
483
|
-
spec = YAML.load input
|
484
|
-
|
485
|
-
if spec && spec.class == FalseClass then
|
486
|
-
raise Gem::EndOfYAMLException
|
487
|
-
end
|
488
|
-
|
489
|
-
unless Gem::Specification === spec then
|
490
|
-
raise Gem::Exception, "YAML data doesn't evaluate to gem specification"
|
491
|
-
end
|
492
|
-
|
493
|
-
unless (spec.instance_variables.include? '@specification_version' or
|
494
|
-
spec.instance_variables.include? :@specification_version) and
|
495
|
-
spec.instance_variable_get :@specification_version
|
496
|
-
spec.instance_variable_set :@specification_version,
|
497
|
-
NONEXISTENT_SPECIFICATION_VERSION
|
498
|
-
end
|
499
|
-
|
500
|
-
spec
|
501
|
-
end
|
502
|
-
|
503
|
-
##
|
504
|
-
# Loads ruby format gemspec from +filename+
|
505
|
-
|
506
|
-
def self.load(filename)
|
507
|
-
gemspec = nil
|
508
|
-
fail "NESTED Specification.load calls not allowed!" if @@gather
|
509
|
-
@@gather = proc { |gs| gemspec = gs }
|
510
|
-
data = File.read(filename)
|
511
|
-
eval(data)
|
512
|
-
gemspec
|
513
|
-
ensure
|
514
|
-
@@gather = nil
|
515
|
-
end
|
516
|
-
|
517
|
-
##
|
518
|
-
# Make sure the YAML specification is properly formatted with dashes
|
519
|
-
|
520
|
-
def self.normalize_yaml_input(input)
|
521
|
-
result = input.respond_to?(:read) ? input.read : input
|
522
|
-
result = "--- " + result unless result =~ /^--- /
|
523
|
-
result
|
524
|
-
end
|
525
|
-
|
526
|
-
##
|
527
|
-
# Sets the rubygems_version to the current RubyGems version
|
528
|
-
|
529
|
-
def mark_version
|
530
|
-
@rubygems_version = RubyGemsVersion
|
531
|
-
end
|
532
|
-
|
533
|
-
##
|
534
|
-
# Ignore unknown attributes while loading
|
535
|
-
|
536
|
-
def method_missing(sym, *a, &b) # :nodoc:
|
537
|
-
if @specification_version > CURRENT_SPECIFICATION_VERSION and
|
538
|
-
sym.to_s =~ /=$/ then
|
539
|
-
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
|
540
|
-
else
|
541
|
-
super
|
542
|
-
end
|
543
|
-
end
|
544
|
-
|
545
|
-
##
|
546
|
-
# Adds a development dependency named +gem+ with +requirements+ to this
|
547
|
-
# Gem. For example:
|
548
|
-
#
|
549
|
-
# spec.add_development_dependency 'jabber4r', '> 0.1', '<= 0.5'
|
550
|
-
#
|
551
|
-
# Development dependencies aren't installed by default and aren't
|
552
|
-
# activated when a gem is required.
|
553
|
-
|
554
|
-
def add_development_dependency(gem, *requirements)
|
555
|
-
add_dependency_with_type(gem, :development, *requirements)
|
556
|
-
end
|
557
|
-
|
558
|
-
##
|
559
|
-
# Adds a runtime dependency named +gem+ with +requirements+ to this Gem.
|
560
|
-
# For example:
|
561
|
-
#
|
562
|
-
# spec.add_runtime_dependency 'jabber4r', '> 0.1', '<= 0.5'
|
563
|
-
|
564
|
-
def add_runtime_dependency(gem, *requirements)
|
565
|
-
add_dependency_with_type(gem, :runtime, *requirements)
|
566
|
-
end
|
567
|
-
|
568
|
-
##
|
569
|
-
# Adds a runtime dependency
|
570
|
-
|
571
|
-
alias add_dependency add_runtime_dependency
|
572
|
-
|
573
|
-
##
|
574
|
-
# Returns the full name (name-version) of this Gem. Platform information
|
575
|
-
# is included (name-version-platform) if it is specified and not the
|
576
|
-
# default Ruby platform.
|
577
|
-
|
578
|
-
def full_name
|
579
|
-
if platform == Gem::Platform::RUBY or platform.nil? then
|
580
|
-
"#{@name}-#{@version}"
|
581
|
-
else
|
582
|
-
"#{@name}-#{@version}-#{platform}"
|
583
|
-
end
|
584
|
-
end
|
585
|
-
|
586
|
-
##
|
587
|
-
# Returns the full name (name-version) of this gemspec using the original
|
588
|
-
# platform. For use with legacy gems.
|
589
|
-
|
590
|
-
def original_name # :nodoc:
|
591
|
-
if platform == Gem::Platform::RUBY or platform.nil? then
|
592
|
-
"#{@name}-#{@version}"
|
593
|
-
else
|
594
|
-
"#{@name}-#{@version}-#{@original_platform}"
|
595
|
-
end
|
596
|
-
end
|
597
|
-
|
598
|
-
##
|
599
|
-
# The full path to the gem (install path + full name).
|
600
|
-
|
601
|
-
def full_gem_path
|
602
|
-
path = File.join installation_path, 'gems', full_name
|
603
|
-
return path if File.directory? path
|
604
|
-
File.join installation_path, 'gems', original_name
|
605
|
-
end
|
606
|
-
|
607
|
-
##
|
608
|
-
# The default (generated) file name of the gem.
|
609
|
-
|
610
|
-
def file_name
|
611
|
-
full_name + ".gem"
|
612
|
-
end
|
613
|
-
|
614
|
-
##
|
615
|
-
# The directory that this gem was installed into.
|
616
|
-
|
617
|
-
def installation_path
|
618
|
-
path = File.dirname(@loaded_from).split(File::SEPARATOR)[0..-2]
|
619
|
-
path = path.join File::SEPARATOR
|
620
|
-
File.expand_path path
|
621
|
-
end
|
622
|
-
|
623
|
-
##
|
624
|
-
# Checks if this specification meets the requirement of +dependency+.
|
625
|
-
|
626
|
-
def satisfies_requirement?(dependency)
|
627
|
-
return @name == dependency.name &&
|
628
|
-
dependency.version_requirements.satisfied_by?(@version)
|
629
|
-
end
|
630
|
-
|
631
|
-
##
|
632
|
-
# Returns an object you can use to sort specifications in #sort_by.
|
633
|
-
|
634
|
-
def sort_obj
|
635
|
-
[@name, @version.to_ints, @new_platform == Gem::Platform::RUBY ? -1 : 1]
|
636
|
-
end
|
637
|
-
|
638
|
-
def <=>(other) # :nodoc:
|
639
|
-
sort_obj <=> other.sort_obj
|
640
|
-
end
|
641
|
-
|
642
|
-
##
|
643
|
-
# Tests specs for equality (across all attributes).
|
644
|
-
|
645
|
-
def ==(other) # :nodoc:
|
646
|
-
self.class === other && same_attributes?(other)
|
647
|
-
end
|
648
|
-
|
649
|
-
alias eql? == # :nodoc:
|
650
|
-
|
651
|
-
##
|
652
|
-
# True if this gem has the same attributes as +other+.
|
653
|
-
|
654
|
-
def same_attributes?(other)
|
655
|
-
@@attributes.each do |name, default|
|
656
|
-
return false unless self.send(name) == other.send(name)
|
657
|
-
end
|
658
|
-
true
|
659
|
-
end
|
660
|
-
|
661
|
-
private :same_attributes?
|
662
|
-
|
663
|
-
def hash # :nodoc:
|
664
|
-
@@attributes.inject(0) { |hash_code, (name, default_value)|
|
665
|
-
n = self.send(name).hash
|
666
|
-
hash_code + n
|
667
|
-
}
|
668
|
-
end
|
669
|
-
|
670
|
-
def to_yaml(opts = {}) # :nodoc:
|
671
|
-
mark_version
|
672
|
-
|
673
|
-
attributes = @@attributes.map { |name,| name.to_s }.sort
|
674
|
-
attributes = attributes - %w[name version platform]
|
675
|
-
|
676
|
-
yaml = YAML.quick_emit object_id, opts do |out|
|
677
|
-
out.map taguri, to_yaml_style do |map|
|
678
|
-
map.add 'name', @name
|
679
|
-
map.add 'version', @version
|
680
|
-
platform = case @original_platform
|
681
|
-
when nil, '' then
|
682
|
-
'ruby'
|
683
|
-
when String then
|
684
|
-
@original_platform
|
685
|
-
else
|
686
|
-
@original_platform.to_s
|
687
|
-
end
|
688
|
-
map.add 'platform', platform
|
689
|
-
|
690
|
-
attributes.each do |name|
|
691
|
-
map.add name, instance_variable_get("@#{name}")
|
692
|
-
end
|
693
|
-
end
|
694
|
-
end
|
695
|
-
end
|
696
|
-
|
697
|
-
def yaml_initialize(tag, vals) # :nodoc:
|
698
|
-
vals.each do |ivar, val|
|
699
|
-
instance_variable_set "@#{ivar}", val
|
700
|
-
end
|
701
|
-
|
702
|
-
@original_platform = @platform # for backwards compatibility
|
703
|
-
self.platform = Gem::Platform.new @platform
|
704
|
-
end
|
705
|
-
|
706
|
-
##
|
707
|
-
# Returns a Ruby code representation of this specification, such that it
|
708
|
-
# can be eval'ed and reconstruct the same specification later. Attributes
|
709
|
-
# that still have their default values are omitted.
|
710
|
-
|
711
|
-
def to_ruby
|
712
|
-
mark_version
|
713
|
-
result = []
|
714
|
-
result << "# -*- encoding: utf-8 -*-"
|
715
|
-
result << nil
|
716
|
-
result << "Gem::Specification.new do |s|"
|
717
|
-
|
718
|
-
result << " s.name = #{ruby_code name}"
|
719
|
-
result << " s.version = #{ruby_code version}"
|
720
|
-
unless platform.nil? or platform == Gem::Platform::RUBY then
|
721
|
-
result << " s.platform = #{ruby_code original_platform}"
|
722
|
-
end
|
723
|
-
result << ""
|
724
|
-
result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
|
725
|
-
|
726
|
-
handled = [
|
727
|
-
:dependencies,
|
728
|
-
:name,
|
729
|
-
:platform,
|
730
|
-
:required_rubygems_version,
|
731
|
-
:specification_version,
|
732
|
-
:version,
|
733
|
-
]
|
734
|
-
|
735
|
-
attributes = @@attributes.sort_by { |attr_name,| attr_name.to_s }
|
736
|
-
|
737
|
-
attributes.each do |attr_name, default|
|
738
|
-
next if handled.include? attr_name
|
739
|
-
current_value = self.send(attr_name)
|
740
|
-
if current_value != default or
|
741
|
-
self.class.required_attribute? attr_name then
|
742
|
-
result << " s.#{attr_name} = #{ruby_code current_value}"
|
743
|
-
end
|
744
|
-
end
|
745
|
-
|
746
|
-
result << nil
|
747
|
-
result << " if s.respond_to? :specification_version then"
|
748
|
-
result << " current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION"
|
749
|
-
result << " s.specification_version = #{specification_version}"
|
750
|
-
result << nil
|
751
|
-
|
752
|
-
result << " if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then"
|
753
|
-
|
754
|
-
unless dependencies.empty? then
|
755
|
-
dependencies.each do |dep|
|
756
|
-
version_reqs_param = dep.requirements_list.inspect
|
757
|
-
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
|
758
|
-
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{version_reqs_param})"
|
759
|
-
end
|
760
|
-
end
|
761
|
-
|
762
|
-
result << " else"
|
763
|
-
|
764
|
-
unless dependencies.empty? then
|
765
|
-
dependencies.each do |dep|
|
766
|
-
version_reqs_param = dep.requirements_list.inspect
|
767
|
-
result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
|
768
|
-
end
|
769
|
-
end
|
770
|
-
|
771
|
-
result << ' end'
|
772
|
-
|
773
|
-
result << " else"
|
774
|
-
dependencies.each do |dep|
|
775
|
-
version_reqs_param = dep.requirements_list.inspect
|
776
|
-
result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
|
777
|
-
end
|
778
|
-
result << " end"
|
779
|
-
|
780
|
-
result << "end"
|
781
|
-
result << nil
|
782
|
-
|
783
|
-
result.join "\n"
|
784
|
-
end
|
785
|
-
|
786
|
-
##
|
787
|
-
# Checks that the specification contains all required fields, and does a
|
788
|
-
# very basic sanity check.
|
789
|
-
#
|
790
|
-
# Raises InvalidSpecificationException if the spec does not pass the
|
791
|
-
# checks..
|
792
|
-
|
793
|
-
def validate
|
794
|
-
extend Gem::UserInteraction
|
795
|
-
normalize
|
796
|
-
|
797
|
-
if rubygems_version != RubyGemsVersion then
|
798
|
-
raise Gem::InvalidSpecificationException,
|
799
|
-
"expected RubyGems version #{RubyGemsVersion}, was #{rubygems_version}"
|
800
|
-
end
|
801
|
-
|
802
|
-
@@required_attributes.each do |symbol|
|
803
|
-
unless self.send symbol then
|
804
|
-
raise Gem::InvalidSpecificationException,
|
805
|
-
"missing value for attribute #{symbol}"
|
806
|
-
end
|
807
|
-
end
|
808
|
-
|
809
|
-
if require_paths.empty? then
|
810
|
-
raise Gem::InvalidSpecificationException,
|
811
|
-
"specification must have at least one require_path"
|
812
|
-
end
|
813
|
-
|
814
|
-
case platform
|
815
|
-
when Gem::Platform, Platform::RUBY then # ok
|
816
|
-
else
|
817
|
-
raise Gem::InvalidSpecificationException,
|
818
|
-
"invalid platform #{platform.inspect}, see Gem::Platform"
|
819
|
-
end
|
820
|
-
|
821
|
-
unless Array === authors and
|
822
|
-
authors.all? { |author| String === author } then
|
823
|
-
raise Gem::InvalidSpecificationException,
|
824
|
-
'authors must be Array of Strings'
|
825
|
-
end
|
826
|
-
|
827
|
-
# Warnings
|
828
|
-
|
829
|
-
%w[author email homepage rubyforge_project summary].each do |attribute|
|
830
|
-
value = self.send attribute
|
831
|
-
alert_warning "no #{attribute} specified" if value.nil? or value.empty?
|
832
|
-
end
|
833
|
-
|
834
|
-
alert_warning "RDoc will not be generated (has_rdoc == false)" unless
|
835
|
-
has_rdoc
|
836
|
-
|
837
|
-
alert_warning "deprecated autorequire specified" if autorequire
|
838
|
-
|
839
|
-
executables.each do |executable|
|
840
|
-
executable_path = File.join bindir, executable
|
841
|
-
shebang = File.read(executable_path, 2) == '#!'
|
842
|
-
|
843
|
-
alert_warning "#{executable_path} is missing #! line" unless shebang
|
844
|
-
end
|
845
|
-
|
846
|
-
true
|
847
|
-
end
|
848
|
-
|
849
|
-
##
|
850
|
-
# Normalize the list of files so that:
|
851
|
-
# * All file lists have redundancies removed.
|
852
|
-
# * Files referenced in the extra_rdoc_files are included in the package
|
853
|
-
# file list.
|
854
|
-
#
|
855
|
-
# Also, the summary and description are converted to a normal format.
|
856
|
-
|
857
|
-
def normalize
|
858
|
-
if defined?(@extra_rdoc_files) and @extra_rdoc_files then
|
859
|
-
@extra_rdoc_files.uniq!
|
860
|
-
@files ||= []
|
861
|
-
@files.concat(@extra_rdoc_files)
|
862
|
-
end
|
863
|
-
@files.uniq! if @files
|
864
|
-
end
|
865
|
-
|
866
|
-
##
|
867
|
-
# Return a list of all gems that have a dependency on this gemspec. The
|
868
|
-
# list is structured with entries that conform to:
|
869
|
-
#
|
870
|
-
# [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
|
871
|
-
|
872
|
-
def dependent_gems
|
873
|
-
out = []
|
874
|
-
Gem.source_index.each do |name,gem|
|
875
|
-
gem.dependencies.each do |dep|
|
876
|
-
if self.satisfies_requirement?(dep) then
|
877
|
-
sats = []
|
878
|
-
find_all_satisfiers(dep) do |sat|
|
879
|
-
sats << sat
|
880
|
-
end
|
881
|
-
out << [gem, dep, sats]
|
882
|
-
end
|
883
|
-
end
|
884
|
-
end
|
885
|
-
out
|
886
|
-
end
|
887
|
-
|
888
|
-
def to_s
|
889
|
-
"#<Gem::Specification name=#{@name} version=#{@version}>"
|
890
|
-
end
|
891
|
-
|
892
|
-
def add_dependency_with_type(dependency, type, *requirements)
|
893
|
-
requirements = if requirements.empty? then
|
894
|
-
Gem::Requirement.default
|
895
|
-
else
|
896
|
-
requirements.flatten
|
897
|
-
end
|
898
|
-
|
899
|
-
unless dependency.respond_to?(:name) &&
|
900
|
-
dependency.respond_to?(:version_requirements)
|
901
|
-
|
902
|
-
dependency = Dependency.new(dependency, requirements, type)
|
903
|
-
end
|
904
|
-
|
905
|
-
dependencies << dependency
|
906
|
-
end
|
907
|
-
|
908
|
-
private :add_dependency_with_type
|
909
|
-
|
910
|
-
def find_all_satisfiers(dep)
|
911
|
-
Gem.source_index.each do |name,gem|
|
912
|
-
if(gem.satisfies_requirement?(dep)) then
|
913
|
-
yield gem
|
914
|
-
end
|
915
|
-
end
|
916
|
-
end
|
917
|
-
|
918
|
-
private :find_all_satisfiers
|
919
|
-
|
920
|
-
##
|
921
|
-
# Return a string containing a Ruby code representation of the given
|
922
|
-
# object.
|
923
|
-
|
924
|
-
def ruby_code(obj)
|
925
|
-
case obj
|
926
|
-
when String then '%q{' + obj + '}'
|
927
|
-
when Array then obj.inspect
|
928
|
-
when Gem::Version then obj.to_s.inspect
|
929
|
-
when Date then '%q{' + obj.strftime('%Y-%m-%d') + '}'
|
930
|
-
when Time then '%q{' + obj.strftime('%Y-%m-%d') + '}'
|
931
|
-
when Numeric then obj.inspect
|
932
|
-
when true, false, nil then obj.inspect
|
933
|
-
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
|
934
|
-
when Gem::Requirement then "Gem::Requirement.new(#{obj.to_s.inspect})"
|
935
|
-
else raise Exception, "ruby_code case not handled: #{obj.class}"
|
936
|
-
end
|
937
|
-
end
|
938
|
-
|
939
|
-
private :ruby_code
|
940
|
-
|
941
|
-
# :section: Required gemspec attributes
|
942
|
-
|
943
|
-
##
|
944
|
-
# The version of RubyGems used to create this gem
|
945
|
-
|
946
|
-
required_attribute :rubygems_version, Gem::RubyGemsVersion
|
947
|
-
|
948
|
-
##
|
949
|
-
# The Gem::Specification version of this gemspec
|
950
|
-
|
951
|
-
required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION
|
952
|
-
|
953
|
-
##
|
954
|
-
# This gem's name
|
955
|
-
|
956
|
-
required_attribute :name
|
957
|
-
|
958
|
-
##
|
959
|
-
# This gem's version
|
960
|
-
|
961
|
-
required_attribute :version
|
962
|
-
|
963
|
-
##
|
964
|
-
# The date this gem was created
|
965
|
-
|
966
|
-
required_attribute :date, TODAY
|
967
|
-
|
968
|
-
##
|
969
|
-
# A short summary of this gem's description. Displayed in `gem list -d`.
|
970
|
-
|
971
|
-
required_attribute :summary
|
972
|
-
|
973
|
-
##
|
974
|
-
# Paths in the gem to add to $LOAD_PATH when this gem is activated
|
975
|
-
|
976
|
-
required_attribute :require_paths, ['lib']
|
977
|
-
|
978
|
-
# :section: Optional gemspec attributes
|
979
|
-
|
980
|
-
##
|
981
|
-
# A contact email for this gem
|
982
|
-
|
983
|
-
attribute :email
|
984
|
-
|
985
|
-
##
|
986
|
-
# The URL of this gem's home page
|
987
|
-
|
988
|
-
attribute :homepage
|
989
|
-
|
990
|
-
##
|
991
|
-
# The rubyforge project this gem lives under. i.e. RubyGems'
|
992
|
-
# rubyforge_project is "rubygems".
|
993
|
-
|
994
|
-
attribute :rubyforge_project
|
995
|
-
|
996
|
-
##
|
997
|
-
# A long description of this gem
|
998
|
-
|
999
|
-
attribute :description
|
1000
|
-
|
1001
|
-
##
|
1002
|
-
# Autorequire was used by old RubyGems to automatically require a file.
|
1003
|
-
# It no longer is supported.
|
1004
|
-
|
1005
|
-
attribute :autorequire
|
1006
|
-
|
1007
|
-
##
|
1008
|
-
# The default executable for this gem.
|
1009
|
-
|
1010
|
-
attribute :default_executable
|
1011
|
-
|
1012
|
-
##
|
1013
|
-
# The path in the gem for executable scripts
|
1014
|
-
|
1015
|
-
attribute :bindir, 'bin'
|
1016
|
-
|
1017
|
-
##
|
1018
|
-
# True if this gem is RDoc-compliant
|
1019
|
-
|
1020
|
-
attribute :has_rdoc, false
|
1021
|
-
|
1022
|
-
##
|
1023
|
-
# True if this gem supports RDoc
|
1024
|
-
|
1025
|
-
alias :has_rdoc? :has_rdoc
|
1026
|
-
|
1027
|
-
##
|
1028
|
-
# The ruby of version required by this gem
|
1029
|
-
|
1030
|
-
attribute :required_ruby_version, Gem::Requirement.default
|
1031
|
-
|
1032
|
-
##
|
1033
|
-
# The RubyGems version required by this gem
|
1034
|
-
|
1035
|
-
attribute :required_rubygems_version, Gem::Requirement.default
|
1036
|
-
|
1037
|
-
##
|
1038
|
-
# The platform this gem runs on. See Gem::Platform for details.
|
1039
|
-
|
1040
|
-
attribute :platform, Gem::Platform::RUBY
|
1041
|
-
|
1042
|
-
##
|
1043
|
-
# The key used to sign this gem. See Gem::Security for details.
|
1044
|
-
|
1045
|
-
attribute :signing_key, nil
|
1046
|
-
|
1047
|
-
##
|
1048
|
-
# The certificate chain used to sign this gem. See Gem::Security for
|
1049
|
-
# details.
|
1050
|
-
|
1051
|
-
attribute :cert_chain, []
|
1052
|
-
|
1053
|
-
##
|
1054
|
-
# A message that gets displayed after the gem is installed
|
1055
|
-
|
1056
|
-
attribute :post_install_message, nil
|
1057
|
-
|
1058
|
-
##
|
1059
|
-
# The list of authors who wrote this gem
|
1060
|
-
|
1061
|
-
array_attribute :authors
|
1062
|
-
|
1063
|
-
##
|
1064
|
-
# Files included in this gem
|
1065
|
-
|
1066
|
-
array_attribute :files
|
1067
|
-
|
1068
|
-
##
|
1069
|
-
# Test files included in this gem
|
1070
|
-
|
1071
|
-
array_attribute :test_files
|
1072
|
-
|
1073
|
-
##
|
1074
|
-
# An ARGV-style array of options to RDoc
|
1075
|
-
|
1076
|
-
array_attribute :rdoc_options
|
1077
|
-
|
1078
|
-
##
|
1079
|
-
# Extra files to add to RDoc
|
1080
|
-
|
1081
|
-
array_attribute :extra_rdoc_files
|
1082
|
-
|
1083
|
-
##
|
1084
|
-
# Executables included in the gem
|
1085
|
-
|
1086
|
-
array_attribute :executables
|
1087
|
-
|
1088
|
-
##
|
1089
|
-
# Extensions to build when installing the gem. See
|
1090
|
-
# Gem::Installer#build_extensions for valid values.
|
1091
|
-
|
1092
|
-
array_attribute :extensions
|
1093
|
-
|
1094
|
-
##
|
1095
|
-
# An array or things required by this gem. Not used by anything
|
1096
|
-
# presently.
|
1097
|
-
|
1098
|
-
array_attribute :requirements
|
1099
|
-
|
1100
|
-
##
|
1101
|
-
# A list of Gem::Dependency objects this gem depends on. Only appendable.
|
1102
|
-
|
1103
|
-
array_attribute :dependencies
|
1104
|
-
|
1105
|
-
read_only :dependencies
|
1106
|
-
|
1107
|
-
# :section: Aliased gemspec attributes
|
1108
|
-
|
1109
|
-
##
|
1110
|
-
# Singular accessor for executables
|
1111
|
-
|
1112
|
-
attribute_alias_singular :executable, :executables
|
1113
|
-
|
1114
|
-
##
|
1115
|
-
# Singular accessor for authors
|
1116
|
-
|
1117
|
-
attribute_alias_singular :author, :authors
|
1118
|
-
|
1119
|
-
##
|
1120
|
-
# Singular accessor for require_paths
|
1121
|
-
|
1122
|
-
attribute_alias_singular :require_path, :require_paths
|
1123
|
-
|
1124
|
-
##
|
1125
|
-
# Singular accessor for test_files
|
1126
|
-
|
1127
|
-
attribute_alias_singular :test_file, :test_files
|
1128
|
-
|
1129
|
-
overwrite_accessor :version= do |version|
|
1130
|
-
@version = Version.create(version)
|
1131
|
-
end
|
1132
|
-
|
1133
|
-
overwrite_accessor :platform do
|
1134
|
-
@new_platform
|
1135
|
-
end
|
1136
|
-
|
1137
|
-
overwrite_accessor :platform= do |platform|
|
1138
|
-
if @original_platform.nil? or
|
1139
|
-
@original_platform == Gem::Platform::RUBY then
|
1140
|
-
@original_platform = platform
|
1141
|
-
end
|
1142
|
-
|
1143
|
-
case platform
|
1144
|
-
when Gem::Platform::CURRENT then
|
1145
|
-
@new_platform = Gem::Platform.local
|
1146
|
-
@original_platform = @new_platform.to_s
|
1147
|
-
|
1148
|
-
when Gem::Platform then
|
1149
|
-
@new_platform = platform
|
1150
|
-
|
1151
|
-
# legacy constants
|
1152
|
-
when nil, Gem::Platform::RUBY then
|
1153
|
-
@new_platform = Gem::Platform::RUBY
|
1154
|
-
when 'mswin32' then # was Gem::Platform::WIN32
|
1155
|
-
@new_platform = Gem::Platform.new 'x86-mswin32'
|
1156
|
-
when 'i586-linux' then # was Gem::Platform::LINUX_586
|
1157
|
-
@new_platform = Gem::Platform.new 'x86-linux'
|
1158
|
-
when 'powerpc-darwin' then # was Gem::Platform::DARWIN
|
1159
|
-
@new_platform = Gem::Platform.new 'ppc-darwin'
|
1160
|
-
else
|
1161
|
-
@new_platform = Gem::Platform.new platform
|
1162
|
-
end
|
1163
|
-
|
1164
|
-
@platform = @new_platform.to_s
|
1165
|
-
|
1166
|
-
@new_platform
|
1167
|
-
end
|
1168
|
-
|
1169
|
-
overwrite_accessor :required_ruby_version= do |value|
|
1170
|
-
@required_ruby_version = Gem::Requirement.create(value)
|
1171
|
-
end
|
1172
|
-
|
1173
|
-
overwrite_accessor :required_rubygems_version= do |value|
|
1174
|
-
@required_rubygems_version = Gem::Requirement.create(value)
|
1175
|
-
end
|
1176
|
-
|
1177
|
-
overwrite_accessor :date= do |date|
|
1178
|
-
# We want to end up with a Time object with one-day resolution.
|
1179
|
-
# This is the cleanest, most-readable, faster-than-using-Date
|
1180
|
-
# way to do it.
|
1181
|
-
case date
|
1182
|
-
when String then
|
1183
|
-
@date = if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then
|
1184
|
-
Time.local($1.to_i, $2.to_i, $3.to_i)
|
1185
|
-
else
|
1186
|
-
require 'time'
|
1187
|
-
Time.parse date
|
1188
|
-
end
|
1189
|
-
when Time then
|
1190
|
-
@date = Time.local(date.year, date.month, date.day)
|
1191
|
-
when Date then
|
1192
|
-
@date = Time.local(date.year, date.month, date.day)
|
1193
|
-
else
|
1194
|
-
@date = TODAY
|
1195
|
-
end
|
1196
|
-
end
|
1197
|
-
|
1198
|
-
overwrite_accessor :date do
|
1199
|
-
self.date = nil if @date.nil? # HACK Sets the default value for date
|
1200
|
-
@date
|
1201
|
-
end
|
1202
|
-
|
1203
|
-
overwrite_accessor :summary= do |str|
|
1204
|
-
@summary = if str then
|
1205
|
-
str.strip.
|
1206
|
-
gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
|
1207
|
-
gsub(/\n[ \t]*/, " ")
|
1208
|
-
end
|
1209
|
-
end
|
1210
|
-
|
1211
|
-
overwrite_accessor :description= do |str|
|
1212
|
-
@description = if str then
|
1213
|
-
str.strip.
|
1214
|
-
gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
|
1215
|
-
gsub(/\n[ \t]*/, " ")
|
1216
|
-
end
|
1217
|
-
end
|
1218
|
-
|
1219
|
-
overwrite_accessor :default_executable do
|
1220
|
-
begin
|
1221
|
-
if defined?(@default_executable) and @default_executable
|
1222
|
-
result = @default_executable
|
1223
|
-
elsif @executables and @executables.size == 1
|
1224
|
-
result = Array(@executables).first
|
1225
|
-
else
|
1226
|
-
result = nil
|
1227
|
-
end
|
1228
|
-
result
|
1229
|
-
rescue
|
1230
|
-
nil
|
1231
|
-
end
|
1232
|
-
end
|
1233
|
-
|
1234
|
-
overwrite_accessor :test_files do
|
1235
|
-
# Handle the possibility that we have @test_suite_file but not
|
1236
|
-
# @test_files. This will happen when an old gem is loaded via
|
1237
|
-
# YAML.
|
1238
|
-
if defined? @test_suite_file then
|
1239
|
-
@test_files = [@test_suite_file].flatten
|
1240
|
-
@test_suite_file = nil
|
1241
|
-
end
|
1242
|
-
if defined?(@test_files) and @test_files then
|
1243
|
-
@test_files
|
1244
|
-
else
|
1245
|
-
@test_files = []
|
1246
|
-
end
|
1247
|
-
end
|
1248
|
-
|
1249
|
-
overwrite_accessor :files do
|
1250
|
-
result = []
|
1251
|
-
result.push(*@files) if defined?(@files)
|
1252
|
-
result.push(*@test_files) if defined?(@test_files)
|
1253
|
-
result.push(*(add_bindir(@executables)))
|
1254
|
-
result.push(*@extra_rdoc_files) if defined?(@extra_rdoc_files)
|
1255
|
-
result.push(*@extensions) if defined?(@extensions)
|
1256
|
-
result.uniq.compact
|
1257
|
-
end
|
1258
|
-
|
1259
|
-
end
|
1260
|
-
|
1261
|
-
end
|
1262
|
-
|
1
|
+
#--
|
2
|
+
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
3
|
+
# All rights reserved.
|
4
|
+
# See LICENSE.txt for permissions.
|
5
|
+
#++
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubygems/version'
|
9
|
+
require 'rubygems/requirement'
|
10
|
+
require 'rubygems/platform'
|
11
|
+
|
12
|
+
# :stopdoc:
|
13
|
+
# Time::today has been deprecated in 0.9.5 and will be removed.
|
14
|
+
if RUBY_VERSION < '1.9' then
|
15
|
+
def Time.today
|
16
|
+
t = Time.now
|
17
|
+
t - ((t.to_f + t.gmt_offset) % 86400)
|
18
|
+
end unless defined? Time.today
|
19
|
+
end
|
20
|
+
|
21
|
+
class Date; end # for ruby_code if date.rb wasn't required
|
22
|
+
|
23
|
+
# :startdoc:
|
24
|
+
|
25
|
+
module Gem
|
26
|
+
|
27
|
+
##
|
28
|
+
# == Gem::Specification
|
29
|
+
#
|
30
|
+
# The Specification class contains the metadata for a Gem. Typically
|
31
|
+
# defined in a .gemspec file or a Rakefile, and looks like this:
|
32
|
+
#
|
33
|
+
# spec = Gem::Specification.new do |s|
|
34
|
+
# s.name = 'rfoo'
|
35
|
+
# s.version = '1.0'
|
36
|
+
# s.summary = 'Example gem specification'
|
37
|
+
# ...
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# There are many <em>gemspec attributes</em>, and the best place to learn
|
41
|
+
# about them in the "Gemspec Reference" linked from the RubyGems wiki.
|
42
|
+
|
43
|
+
class Specification
|
44
|
+
|
45
|
+
##
|
46
|
+
# Allows deinstallation of gems with legacy platforms.
|
47
|
+
|
48
|
+
attr_accessor :original_platform # :nodoc:
|
49
|
+
|
50
|
+
##
|
51
|
+
# The the version number of a specification that does not specify one
|
52
|
+
# (i.e. RubyGems 0.7 or earlier).
|
53
|
+
|
54
|
+
NONEXISTENT_SPECIFICATION_VERSION = -1
|
55
|
+
|
56
|
+
##
|
57
|
+
# The specification version applied to any new Specification instances
|
58
|
+
# created. This should be bumped whenever something in the spec format
|
59
|
+
# changes.
|
60
|
+
#--
|
61
|
+
# When updating this number, be sure to also update #to_ruby.
|
62
|
+
#
|
63
|
+
# NOTE RubyGems < 1.2 cannot load specification versions > 2.
|
64
|
+
|
65
|
+
CURRENT_SPECIFICATION_VERSION = 2
|
66
|
+
|
67
|
+
##
|
68
|
+
# An informal list of changes to the specification. The highest-valued
|
69
|
+
# key should be equal to the CURRENT_SPECIFICATION_VERSION.
|
70
|
+
|
71
|
+
SPECIFICATION_VERSION_HISTORY = {
|
72
|
+
-1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
|
73
|
+
1 => [
|
74
|
+
'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
|
75
|
+
'"test_file=x" is a shortcut for "test_files=[x]"'
|
76
|
+
],
|
77
|
+
2 => [
|
78
|
+
'Added "required_rubygems_version"',
|
79
|
+
'Now forward-compatible with future versions',
|
80
|
+
],
|
81
|
+
}
|
82
|
+
|
83
|
+
# :stopdoc:
|
84
|
+
MARSHAL_FIELDS = { -1 => 16, 1 => 16, 2 => 16 }
|
85
|
+
|
86
|
+
now = Time.at(Time.now.to_i)
|
87
|
+
TODAY = now - ((now.to_i + now.gmt_offset) % 86400)
|
88
|
+
# :startdoc:
|
89
|
+
|
90
|
+
##
|
91
|
+
# List of Specification instances.
|
92
|
+
|
93
|
+
@@list = []
|
94
|
+
|
95
|
+
##
|
96
|
+
# Optional block used to gather newly defined instances.
|
97
|
+
|
98
|
+
@@gather = nil
|
99
|
+
|
100
|
+
##
|
101
|
+
# List of attribute names: [:name, :version, ...]
|
102
|
+
@@required_attributes = []
|
103
|
+
|
104
|
+
##
|
105
|
+
# List of _all_ attributes and default values:
|
106
|
+
#
|
107
|
+
# [[:name, nil],
|
108
|
+
# [:bindir, 'bin'],
|
109
|
+
# ...]
|
110
|
+
|
111
|
+
@@attributes = []
|
112
|
+
|
113
|
+
@@nil_attributes = []
|
114
|
+
@@non_nil_attributes = [:@original_platform]
|
115
|
+
|
116
|
+
##
|
117
|
+
# List of array attributes
|
118
|
+
|
119
|
+
@@array_attributes = []
|
120
|
+
|
121
|
+
##
|
122
|
+
# Map of attribute names to default values.
|
123
|
+
|
124
|
+
@@default_value = {}
|
125
|
+
|
126
|
+
##
|
127
|
+
# Names of all specification attributes
|
128
|
+
|
129
|
+
def self.attribute_names
|
130
|
+
@@attributes.map { |name, default| name }
|
131
|
+
end
|
132
|
+
|
133
|
+
##
|
134
|
+
# Default values for specification attributes
|
135
|
+
|
136
|
+
def self.attribute_defaults
|
137
|
+
@@attributes.dup
|
138
|
+
end
|
139
|
+
|
140
|
+
##
|
141
|
+
# The default value for specification attribute +name+
|
142
|
+
|
143
|
+
def self.default_value(name)
|
144
|
+
@@default_value[name]
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# Required specification attributes
|
149
|
+
|
150
|
+
def self.required_attributes
|
151
|
+
@@required_attributes.dup
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# Is +name+ a required attribute?
|
156
|
+
|
157
|
+
def self.required_attribute?(name)
|
158
|
+
@@required_attributes.include? name.to_sym
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# Specification attributes that are arrays (appendable and so-forth)
|
163
|
+
|
164
|
+
def self.array_attributes
|
165
|
+
@@array_attributes.dup
|
166
|
+
end
|
167
|
+
|
168
|
+
##
|
169
|
+
# A list of Specification instances that have been defined in this Ruby
|
170
|
+
# instance.
|
171
|
+
|
172
|
+
def self.list
|
173
|
+
@@list
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# Specifies the +name+ and +default+ for a specification attribute, and
|
178
|
+
# creates a reader and writer method like Module#attr_accessor.
|
179
|
+
#
|
180
|
+
# The reader method returns the default if the value hasn't been set.
|
181
|
+
|
182
|
+
def self.attribute(name, default=nil)
|
183
|
+
ivar_name = "@#{name}".intern
|
184
|
+
if default.nil? then
|
185
|
+
@@nil_attributes << ivar_name
|
186
|
+
else
|
187
|
+
@@non_nil_attributes << [ivar_name, default]
|
188
|
+
end
|
189
|
+
|
190
|
+
@@attributes << [name, default]
|
191
|
+
@@default_value[name] = default
|
192
|
+
attr_accessor(name)
|
193
|
+
end
|
194
|
+
|
195
|
+
##
|
196
|
+
# Same as :attribute, but ensures that values assigned to the attribute
|
197
|
+
# are array values by applying :to_a to the value.
|
198
|
+
|
199
|
+
def self.array_attribute(name)
|
200
|
+
@@non_nil_attributes << ["@#{name}".intern, []]
|
201
|
+
|
202
|
+
@@array_attributes << name
|
203
|
+
@@attributes << [name, []]
|
204
|
+
@@default_value[name] = []
|
205
|
+
code = %{
|
206
|
+
def #{name}
|
207
|
+
@#{name} ||= []
|
208
|
+
end
|
209
|
+
def #{name}=(value)
|
210
|
+
@#{name} = Array(value)
|
211
|
+
end
|
212
|
+
}
|
213
|
+
|
214
|
+
module_eval code, __FILE__, __LINE__ - 9
|
215
|
+
end
|
216
|
+
|
217
|
+
##
|
218
|
+
# Same as attribute above, but also records this attribute as mandatory.
|
219
|
+
|
220
|
+
def self.required_attribute(*args)
|
221
|
+
@@required_attributes << args.first
|
222
|
+
attribute(*args)
|
223
|
+
end
|
224
|
+
|
225
|
+
##
|
226
|
+
# Sometimes we don't want the world to use a setter method for a
|
227
|
+
# particular attribute.
|
228
|
+
#
|
229
|
+
# +read_only+ makes it private so we can still use it internally.
|
230
|
+
|
231
|
+
def self.read_only(*names)
|
232
|
+
names.each do |name|
|
233
|
+
private "#{name}="
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
# Shortcut for creating several attributes at once (each with a default
|
238
|
+
# value of +nil+).
|
239
|
+
|
240
|
+
def self.attributes(*args)
|
241
|
+
args.each do |arg|
|
242
|
+
attribute(arg, nil)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
##
|
247
|
+
# Some attributes require special behaviour when they are accessed. This
|
248
|
+
# allows for that.
|
249
|
+
|
250
|
+
def self.overwrite_accessor(name, &block)
|
251
|
+
remove_method name
|
252
|
+
define_method(name, &block)
|
253
|
+
end
|
254
|
+
|
255
|
+
##
|
256
|
+
# Defines a _singular_ version of an existing _plural_ attribute (i.e. one
|
257
|
+
# whose value is expected to be an array). This means just creating a
|
258
|
+
# helper method that takes a single value and appends it to the array.
|
259
|
+
# These are created for convenience, so that in a spec, one can write
|
260
|
+
#
|
261
|
+
# s.require_path = 'mylib'
|
262
|
+
#
|
263
|
+
# instead of:
|
264
|
+
#
|
265
|
+
# s.require_paths = ['mylib']
|
266
|
+
#
|
267
|
+
# That above convenience is available courtesy of:
|
268
|
+
#
|
269
|
+
# attribute_alias_singular :require_path, :require_paths
|
270
|
+
|
271
|
+
def self.attribute_alias_singular(singular, plural)
|
272
|
+
define_method("#{singular}=") { |val|
|
273
|
+
send("#{plural}=", [val])
|
274
|
+
}
|
275
|
+
define_method("#{singular}") {
|
276
|
+
val = send("#{plural}")
|
277
|
+
val.nil? ? nil : val.first
|
278
|
+
}
|
279
|
+
end
|
280
|
+
|
281
|
+
##
|
282
|
+
# Dump only crucial instance variables.
|
283
|
+
#--
|
284
|
+
# MAINTAIN ORDER!
|
285
|
+
|
286
|
+
def _dump(limit)
|
287
|
+
Marshal.dump [
|
288
|
+
@rubygems_version,
|
289
|
+
@specification_version,
|
290
|
+
@name,
|
291
|
+
@version,
|
292
|
+
(Time === @date ? @date : (require 'time'; Time.parse(@date.to_s))),
|
293
|
+
@summary,
|
294
|
+
@required_ruby_version,
|
295
|
+
@required_rubygems_version,
|
296
|
+
@original_platform,
|
297
|
+
@dependencies,
|
298
|
+
@rubyforge_project,
|
299
|
+
@email,
|
300
|
+
@authors,
|
301
|
+
@description,
|
302
|
+
@homepage,
|
303
|
+
@has_rdoc,
|
304
|
+
@new_platform,
|
305
|
+
]
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# Load custom marshal format, re-initializing defaults as needed
|
310
|
+
|
311
|
+
def self._load(str)
|
312
|
+
array = Marshal.load str
|
313
|
+
|
314
|
+
spec = Gem::Specification.new
|
315
|
+
spec.instance_variable_set :@specification_version, array[1]
|
316
|
+
|
317
|
+
current_version = CURRENT_SPECIFICATION_VERSION
|
318
|
+
|
319
|
+
field_count = if spec.specification_version > current_version then
|
320
|
+
spec.instance_variable_set :@specification_version,
|
321
|
+
current_version
|
322
|
+
MARSHAL_FIELDS[current_version]
|
323
|
+
else
|
324
|
+
MARSHAL_FIELDS[spec.specification_version]
|
325
|
+
end
|
326
|
+
|
327
|
+
if array.size < field_count then
|
328
|
+
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
|
329
|
+
end
|
330
|
+
|
331
|
+
spec.instance_variable_set :@rubygems_version, array[0]
|
332
|
+
# spec version
|
333
|
+
spec.instance_variable_set :@name, array[2]
|
334
|
+
spec.instance_variable_set :@version, array[3]
|
335
|
+
spec.instance_variable_set :@date, array[4]
|
336
|
+
spec.instance_variable_set :@summary, array[5]
|
337
|
+
spec.instance_variable_set :@required_ruby_version, array[6]
|
338
|
+
spec.instance_variable_set :@required_rubygems_version, array[7]
|
339
|
+
spec.instance_variable_set :@original_platform, array[8]
|
340
|
+
spec.instance_variable_set :@dependencies, array[9]
|
341
|
+
spec.instance_variable_set :@rubyforge_project, array[10]
|
342
|
+
spec.instance_variable_set :@email, array[11]
|
343
|
+
spec.instance_variable_set :@authors, array[12]
|
344
|
+
spec.instance_variable_set :@description, array[13]
|
345
|
+
spec.instance_variable_set :@homepage, array[14]
|
346
|
+
spec.instance_variable_set :@has_rdoc, array[15]
|
347
|
+
spec.instance_variable_set :@new_platform, array[16]
|
348
|
+
spec.instance_variable_set :@platform, array[16].to_s
|
349
|
+
spec.instance_variable_set :@loaded, false
|
350
|
+
|
351
|
+
spec
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# List of depedencies that will automatically be activated at runtime.
|
356
|
+
|
357
|
+
def runtime_dependencies
|
358
|
+
dependencies.select { |d| d.type == :runtime || d.type == nil }
|
359
|
+
end
|
360
|
+
|
361
|
+
##
|
362
|
+
# List of dependencies that are used for development
|
363
|
+
|
364
|
+
def development_dependencies
|
365
|
+
dependencies.select { |d| d.type == :development }
|
366
|
+
end
|
367
|
+
|
368
|
+
def test_suite_file # :nodoc:
|
369
|
+
warn 'test_suite_file deprecated, use test_files'
|
370
|
+
test_files.first
|
371
|
+
end
|
372
|
+
|
373
|
+
def test_suite_file=(val) # :nodoc:
|
374
|
+
warn 'test_suite_file= deprecated, use test_files='
|
375
|
+
@test_files = [] unless defined? @test_files
|
376
|
+
@test_files << val
|
377
|
+
end
|
378
|
+
|
379
|
+
##
|
380
|
+
# true when this gemspec has been loaded from a specifications directory.
|
381
|
+
# This attribute is not persisted.
|
382
|
+
|
383
|
+
attr_accessor :loaded
|
384
|
+
|
385
|
+
##
|
386
|
+
# Path this gemspec was loaded from. This attribute is not persisted.
|
387
|
+
|
388
|
+
attr_accessor :loaded_from
|
389
|
+
|
390
|
+
##
|
391
|
+
# Returns an array with bindir attached to each executable in the
|
392
|
+
# executables list
|
393
|
+
|
394
|
+
def add_bindir(executables)
|
395
|
+
return nil if executables.nil?
|
396
|
+
|
397
|
+
if @bindir then
|
398
|
+
Array(executables).map { |e| File.join(@bindir, e) }
|
399
|
+
else
|
400
|
+
executables
|
401
|
+
end
|
402
|
+
rescue
|
403
|
+
return nil
|
404
|
+
end
|
405
|
+
|
406
|
+
##
|
407
|
+
# Files in the Gem under one of the require_paths
|
408
|
+
|
409
|
+
def lib_files
|
410
|
+
@files.select do |file|
|
411
|
+
require_paths.any? do |path|
|
412
|
+
file.index(path) == 0
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
##
|
418
|
+
# True if this gem was loaded from disk
|
419
|
+
|
420
|
+
alias :loaded? :loaded
|
421
|
+
|
422
|
+
##
|
423
|
+
# True if this gem has files in test_files
|
424
|
+
|
425
|
+
def has_unit_tests?
|
426
|
+
not test_files.empty?
|
427
|
+
end
|
428
|
+
|
429
|
+
alias has_test_suite? has_unit_tests? # :nodoc: deprecated
|
430
|
+
|
431
|
+
##
|
432
|
+
# Specification constructor. Assigns the default values to the
|
433
|
+
# attributes, adds this spec to the list of loaded specs (see
|
434
|
+
# Specification.list), and yields itself for further initialization.
|
435
|
+
|
436
|
+
def initialize
|
437
|
+
@new_platform = nil
|
438
|
+
assign_defaults
|
439
|
+
@loaded = false
|
440
|
+
@loaded_from = nil
|
441
|
+
@@list << self
|
442
|
+
|
443
|
+
yield self if block_given?
|
444
|
+
|
445
|
+
@@gather.call(self) if @@gather
|
446
|
+
end
|
447
|
+
|
448
|
+
##
|
449
|
+
# Each attribute has a default value (possibly nil). Here, we initialize
|
450
|
+
# all attributes to their default value. This is done through the
|
451
|
+
# accessor methods, so special behaviours will be honored. Furthermore,
|
452
|
+
# we take a _copy_ of the default so each specification instance has its
|
453
|
+
# own empty arrays, etc.
|
454
|
+
|
455
|
+
def assign_defaults
|
456
|
+
@@nil_attributes.each do |name|
|
457
|
+
instance_variable_set name, nil
|
458
|
+
end
|
459
|
+
|
460
|
+
@@non_nil_attributes.each do |name, default|
|
461
|
+
value = case default
|
462
|
+
when Time, Numeric, Symbol, true, false, nil then default
|
463
|
+
else default.dup
|
464
|
+
end
|
465
|
+
|
466
|
+
instance_variable_set name, value
|
467
|
+
end
|
468
|
+
|
469
|
+
# HACK
|
470
|
+
instance_variable_set :@new_platform, Gem::Platform::RUBY
|
471
|
+
end
|
472
|
+
|
473
|
+
##
|
474
|
+
# Special loader for YAML files. When a Specification object is loaded
|
475
|
+
# from a YAML file, it bypasses the normal Ruby object initialization
|
476
|
+
# routine (#initialize). This method makes up for that and deals with
|
477
|
+
# gems of different ages.
|
478
|
+
#
|
479
|
+
# 'input' can be anything that YAML.load() accepts: String or IO.
|
480
|
+
|
481
|
+
def self.from_yaml(input)
|
482
|
+
input = normalize_yaml_input input
|
483
|
+
spec = YAML.load input
|
484
|
+
|
485
|
+
if spec && spec.class == FalseClass then
|
486
|
+
raise Gem::EndOfYAMLException
|
487
|
+
end
|
488
|
+
|
489
|
+
unless Gem::Specification === spec then
|
490
|
+
raise Gem::Exception, "YAML data doesn't evaluate to gem specification"
|
491
|
+
end
|
492
|
+
|
493
|
+
unless (spec.instance_variables.include? '@specification_version' or
|
494
|
+
spec.instance_variables.include? :@specification_version) and
|
495
|
+
spec.instance_variable_get :@specification_version
|
496
|
+
spec.instance_variable_set :@specification_version,
|
497
|
+
NONEXISTENT_SPECIFICATION_VERSION
|
498
|
+
end
|
499
|
+
|
500
|
+
spec
|
501
|
+
end
|
502
|
+
|
503
|
+
##
|
504
|
+
# Loads ruby format gemspec from +filename+
|
505
|
+
|
506
|
+
def self.load(filename)
|
507
|
+
gemspec = nil
|
508
|
+
fail "NESTED Specification.load calls not allowed!" if @@gather
|
509
|
+
@@gather = proc { |gs| gemspec = gs }
|
510
|
+
data = File.read(filename)
|
511
|
+
eval(data)
|
512
|
+
gemspec
|
513
|
+
ensure
|
514
|
+
@@gather = nil
|
515
|
+
end
|
516
|
+
|
517
|
+
##
|
518
|
+
# Make sure the YAML specification is properly formatted with dashes
|
519
|
+
|
520
|
+
def self.normalize_yaml_input(input)
|
521
|
+
result = input.respond_to?(:read) ? input.read : input
|
522
|
+
result = "--- " + result unless result =~ /^--- /
|
523
|
+
result
|
524
|
+
end
|
525
|
+
|
526
|
+
##
|
527
|
+
# Sets the rubygems_version to the current RubyGems version
|
528
|
+
|
529
|
+
def mark_version
|
530
|
+
@rubygems_version = RubyGemsVersion
|
531
|
+
end
|
532
|
+
|
533
|
+
##
|
534
|
+
# Ignore unknown attributes while loading
|
535
|
+
|
536
|
+
def method_missing(sym, *a, &b) # :nodoc:
|
537
|
+
if @specification_version > CURRENT_SPECIFICATION_VERSION and
|
538
|
+
sym.to_s =~ /=$/ then
|
539
|
+
warn "ignoring #{sym} loading #{full_name}" if $DEBUG
|
540
|
+
else
|
541
|
+
super
|
542
|
+
end
|
543
|
+
end
|
544
|
+
|
545
|
+
##
|
546
|
+
# Adds a development dependency named +gem+ with +requirements+ to this
|
547
|
+
# Gem. For example:
|
548
|
+
#
|
549
|
+
# spec.add_development_dependency 'jabber4r', '> 0.1', '<= 0.5'
|
550
|
+
#
|
551
|
+
# Development dependencies aren't installed by default and aren't
|
552
|
+
# activated when a gem is required.
|
553
|
+
|
554
|
+
def add_development_dependency(gem, *requirements)
|
555
|
+
add_dependency_with_type(gem, :development, *requirements)
|
556
|
+
end
|
557
|
+
|
558
|
+
##
|
559
|
+
# Adds a runtime dependency named +gem+ with +requirements+ to this Gem.
|
560
|
+
# For example:
|
561
|
+
#
|
562
|
+
# spec.add_runtime_dependency 'jabber4r', '> 0.1', '<= 0.5'
|
563
|
+
|
564
|
+
def add_runtime_dependency(gem, *requirements)
|
565
|
+
add_dependency_with_type(gem, :runtime, *requirements)
|
566
|
+
end
|
567
|
+
|
568
|
+
##
|
569
|
+
# Adds a runtime dependency
|
570
|
+
|
571
|
+
alias add_dependency add_runtime_dependency
|
572
|
+
|
573
|
+
##
|
574
|
+
# Returns the full name (name-version) of this Gem. Platform information
|
575
|
+
# is included (name-version-platform) if it is specified and not the
|
576
|
+
# default Ruby platform.
|
577
|
+
|
578
|
+
def full_name
|
579
|
+
if platform == Gem::Platform::RUBY or platform.nil? then
|
580
|
+
"#{@name}-#{@version}"
|
581
|
+
else
|
582
|
+
"#{@name}-#{@version}-#{platform}"
|
583
|
+
end
|
584
|
+
end
|
585
|
+
|
586
|
+
##
|
587
|
+
# Returns the full name (name-version) of this gemspec using the original
|
588
|
+
# platform. For use with legacy gems.
|
589
|
+
|
590
|
+
def original_name # :nodoc:
|
591
|
+
if platform == Gem::Platform::RUBY or platform.nil? then
|
592
|
+
"#{@name}-#{@version}"
|
593
|
+
else
|
594
|
+
"#{@name}-#{@version}-#{@original_platform}"
|
595
|
+
end
|
596
|
+
end
|
597
|
+
|
598
|
+
##
|
599
|
+
# The full path to the gem (install path + full name).
|
600
|
+
|
601
|
+
def full_gem_path
|
602
|
+
path = File.join installation_path, 'gems', full_name
|
603
|
+
return path if File.directory? path
|
604
|
+
File.join installation_path, 'gems', original_name
|
605
|
+
end
|
606
|
+
|
607
|
+
##
|
608
|
+
# The default (generated) file name of the gem.
|
609
|
+
|
610
|
+
def file_name
|
611
|
+
full_name + ".gem"
|
612
|
+
end
|
613
|
+
|
614
|
+
##
|
615
|
+
# The directory that this gem was installed into.
|
616
|
+
|
617
|
+
def installation_path
|
618
|
+
path = File.dirname(@loaded_from).split(File::SEPARATOR)[0..-2]
|
619
|
+
path = path.join File::SEPARATOR
|
620
|
+
File.expand_path path
|
621
|
+
end
|
622
|
+
|
623
|
+
##
|
624
|
+
# Checks if this specification meets the requirement of +dependency+.
|
625
|
+
|
626
|
+
def satisfies_requirement?(dependency)
|
627
|
+
return @name == dependency.name &&
|
628
|
+
dependency.version_requirements.satisfied_by?(@version)
|
629
|
+
end
|
630
|
+
|
631
|
+
##
|
632
|
+
# Returns an object you can use to sort specifications in #sort_by.
|
633
|
+
|
634
|
+
def sort_obj
|
635
|
+
[@name, @version.to_ints, @new_platform == Gem::Platform::RUBY ? -1 : 1]
|
636
|
+
end
|
637
|
+
|
638
|
+
def <=>(other) # :nodoc:
|
639
|
+
sort_obj <=> other.sort_obj
|
640
|
+
end
|
641
|
+
|
642
|
+
##
|
643
|
+
# Tests specs for equality (across all attributes).
|
644
|
+
|
645
|
+
def ==(other) # :nodoc:
|
646
|
+
self.class === other && same_attributes?(other)
|
647
|
+
end
|
648
|
+
|
649
|
+
alias eql? == # :nodoc:
|
650
|
+
|
651
|
+
##
|
652
|
+
# True if this gem has the same attributes as +other+.
|
653
|
+
|
654
|
+
def same_attributes?(other)
|
655
|
+
@@attributes.each do |name, default|
|
656
|
+
return false unless self.send(name) == other.send(name)
|
657
|
+
end
|
658
|
+
true
|
659
|
+
end
|
660
|
+
|
661
|
+
private :same_attributes?
|
662
|
+
|
663
|
+
def hash # :nodoc:
|
664
|
+
@@attributes.inject(0) { |hash_code, (name, default_value)|
|
665
|
+
n = self.send(name).hash
|
666
|
+
hash_code + n
|
667
|
+
}
|
668
|
+
end
|
669
|
+
|
670
|
+
def to_yaml(opts = {}) # :nodoc:
|
671
|
+
mark_version
|
672
|
+
|
673
|
+
attributes = @@attributes.map { |name,| name.to_s }.sort
|
674
|
+
attributes = attributes - %w[name version platform]
|
675
|
+
|
676
|
+
yaml = YAML.quick_emit object_id, opts do |out|
|
677
|
+
out.map taguri, to_yaml_style do |map|
|
678
|
+
map.add 'name', @name
|
679
|
+
map.add 'version', @version
|
680
|
+
platform = case @original_platform
|
681
|
+
when nil, '' then
|
682
|
+
'ruby'
|
683
|
+
when String then
|
684
|
+
@original_platform
|
685
|
+
else
|
686
|
+
@original_platform.to_s
|
687
|
+
end
|
688
|
+
map.add 'platform', platform
|
689
|
+
|
690
|
+
attributes.each do |name|
|
691
|
+
map.add name, instance_variable_get("@#{name}")
|
692
|
+
end
|
693
|
+
end
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
def yaml_initialize(tag, vals) # :nodoc:
|
698
|
+
vals.each do |ivar, val|
|
699
|
+
instance_variable_set "@#{ivar}", val
|
700
|
+
end
|
701
|
+
|
702
|
+
@original_platform = @platform # for backwards compatibility
|
703
|
+
self.platform = Gem::Platform.new @platform
|
704
|
+
end
|
705
|
+
|
706
|
+
##
|
707
|
+
# Returns a Ruby code representation of this specification, such that it
|
708
|
+
# can be eval'ed and reconstruct the same specification later. Attributes
|
709
|
+
# that still have their default values are omitted.
|
710
|
+
|
711
|
+
def to_ruby
|
712
|
+
mark_version
|
713
|
+
result = []
|
714
|
+
result << "# -*- encoding: utf-8 -*-"
|
715
|
+
result << nil
|
716
|
+
result << "Gem::Specification.new do |s|"
|
717
|
+
|
718
|
+
result << " s.name = #{ruby_code name}"
|
719
|
+
result << " s.version = #{ruby_code version}"
|
720
|
+
unless platform.nil? or platform == Gem::Platform::RUBY then
|
721
|
+
result << " s.platform = #{ruby_code original_platform}"
|
722
|
+
end
|
723
|
+
result << ""
|
724
|
+
result << " s.required_rubygems_version = #{ruby_code required_rubygems_version} if s.respond_to? :required_rubygems_version="
|
725
|
+
|
726
|
+
handled = [
|
727
|
+
:dependencies,
|
728
|
+
:name,
|
729
|
+
:platform,
|
730
|
+
:required_rubygems_version,
|
731
|
+
:specification_version,
|
732
|
+
:version,
|
733
|
+
]
|
734
|
+
|
735
|
+
attributes = @@attributes.sort_by { |attr_name,| attr_name.to_s }
|
736
|
+
|
737
|
+
attributes.each do |attr_name, default|
|
738
|
+
next if handled.include? attr_name
|
739
|
+
current_value = self.send(attr_name)
|
740
|
+
if current_value != default or
|
741
|
+
self.class.required_attribute? attr_name then
|
742
|
+
result << " s.#{attr_name} = #{ruby_code current_value}"
|
743
|
+
end
|
744
|
+
end
|
745
|
+
|
746
|
+
result << nil
|
747
|
+
result << " if s.respond_to? :specification_version then"
|
748
|
+
result << " current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION"
|
749
|
+
result << " s.specification_version = #{specification_version}"
|
750
|
+
result << nil
|
751
|
+
|
752
|
+
result << " if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then"
|
753
|
+
|
754
|
+
unless dependencies.empty? then
|
755
|
+
dependencies.each do |dep|
|
756
|
+
version_reqs_param = dep.requirements_list.inspect
|
757
|
+
dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK
|
758
|
+
result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{version_reqs_param})"
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
result << " else"
|
763
|
+
|
764
|
+
unless dependencies.empty? then
|
765
|
+
dependencies.each do |dep|
|
766
|
+
version_reqs_param = dep.requirements_list.inspect
|
767
|
+
result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
|
768
|
+
end
|
769
|
+
end
|
770
|
+
|
771
|
+
result << ' end'
|
772
|
+
|
773
|
+
result << " else"
|
774
|
+
dependencies.each do |dep|
|
775
|
+
version_reqs_param = dep.requirements_list.inspect
|
776
|
+
result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})"
|
777
|
+
end
|
778
|
+
result << " end"
|
779
|
+
|
780
|
+
result << "end"
|
781
|
+
result << nil
|
782
|
+
|
783
|
+
result.join "\n"
|
784
|
+
end
|
785
|
+
|
786
|
+
##
|
787
|
+
# Checks that the specification contains all required fields, and does a
|
788
|
+
# very basic sanity check.
|
789
|
+
#
|
790
|
+
# Raises InvalidSpecificationException if the spec does not pass the
|
791
|
+
# checks..
|
792
|
+
|
793
|
+
def validate
|
794
|
+
extend Gem::UserInteraction
|
795
|
+
normalize
|
796
|
+
|
797
|
+
if rubygems_version != RubyGemsVersion then
|
798
|
+
raise Gem::InvalidSpecificationException,
|
799
|
+
"expected RubyGems version #{RubyGemsVersion}, was #{rubygems_version}"
|
800
|
+
end
|
801
|
+
|
802
|
+
@@required_attributes.each do |symbol|
|
803
|
+
unless self.send symbol then
|
804
|
+
raise Gem::InvalidSpecificationException,
|
805
|
+
"missing value for attribute #{symbol}"
|
806
|
+
end
|
807
|
+
end
|
808
|
+
|
809
|
+
if require_paths.empty? then
|
810
|
+
raise Gem::InvalidSpecificationException,
|
811
|
+
"specification must have at least one require_path"
|
812
|
+
end
|
813
|
+
|
814
|
+
case platform
|
815
|
+
when Gem::Platform, Platform::RUBY then # ok
|
816
|
+
else
|
817
|
+
raise Gem::InvalidSpecificationException,
|
818
|
+
"invalid platform #{platform.inspect}, see Gem::Platform"
|
819
|
+
end
|
820
|
+
|
821
|
+
unless Array === authors and
|
822
|
+
authors.all? { |author| String === author } then
|
823
|
+
raise Gem::InvalidSpecificationException,
|
824
|
+
'authors must be Array of Strings'
|
825
|
+
end
|
826
|
+
|
827
|
+
# Warnings
|
828
|
+
|
829
|
+
%w[author email homepage rubyforge_project summary].each do |attribute|
|
830
|
+
value = self.send attribute
|
831
|
+
alert_warning "no #{attribute} specified" if value.nil? or value.empty?
|
832
|
+
end
|
833
|
+
|
834
|
+
alert_warning "RDoc will not be generated (has_rdoc == false)" unless
|
835
|
+
has_rdoc
|
836
|
+
|
837
|
+
alert_warning "deprecated autorequire specified" if autorequire
|
838
|
+
|
839
|
+
executables.each do |executable|
|
840
|
+
executable_path = File.join bindir, executable
|
841
|
+
shebang = File.read(executable_path, 2) == '#!'
|
842
|
+
|
843
|
+
alert_warning "#{executable_path} is missing #! line" unless shebang
|
844
|
+
end
|
845
|
+
|
846
|
+
true
|
847
|
+
end
|
848
|
+
|
849
|
+
##
|
850
|
+
# Normalize the list of files so that:
|
851
|
+
# * All file lists have redundancies removed.
|
852
|
+
# * Files referenced in the extra_rdoc_files are included in the package
|
853
|
+
# file list.
|
854
|
+
#
|
855
|
+
# Also, the summary and description are converted to a normal format.
|
856
|
+
|
857
|
+
def normalize
|
858
|
+
if defined?(@extra_rdoc_files) and @extra_rdoc_files then
|
859
|
+
@extra_rdoc_files.uniq!
|
860
|
+
@files ||= []
|
861
|
+
@files.concat(@extra_rdoc_files)
|
862
|
+
end
|
863
|
+
@files.uniq! if @files
|
864
|
+
end
|
865
|
+
|
866
|
+
##
|
867
|
+
# Return a list of all gems that have a dependency on this gemspec. The
|
868
|
+
# list is structured with entries that conform to:
|
869
|
+
#
|
870
|
+
# [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
|
871
|
+
|
872
|
+
def dependent_gems
|
873
|
+
out = []
|
874
|
+
Gem.source_index.each do |name,gem|
|
875
|
+
gem.dependencies.each do |dep|
|
876
|
+
if self.satisfies_requirement?(dep) then
|
877
|
+
sats = []
|
878
|
+
find_all_satisfiers(dep) do |sat|
|
879
|
+
sats << sat
|
880
|
+
end
|
881
|
+
out << [gem, dep, sats]
|
882
|
+
end
|
883
|
+
end
|
884
|
+
end
|
885
|
+
out
|
886
|
+
end
|
887
|
+
|
888
|
+
def to_s
|
889
|
+
"#<Gem::Specification name=#{@name} version=#{@version}>"
|
890
|
+
end
|
891
|
+
|
892
|
+
def add_dependency_with_type(dependency, type, *requirements)
|
893
|
+
requirements = if requirements.empty? then
|
894
|
+
Gem::Requirement.default
|
895
|
+
else
|
896
|
+
requirements.flatten
|
897
|
+
end
|
898
|
+
|
899
|
+
unless dependency.respond_to?(:name) &&
|
900
|
+
dependency.respond_to?(:version_requirements)
|
901
|
+
|
902
|
+
dependency = Dependency.new(dependency, requirements, type)
|
903
|
+
end
|
904
|
+
|
905
|
+
dependencies << dependency
|
906
|
+
end
|
907
|
+
|
908
|
+
private :add_dependency_with_type
|
909
|
+
|
910
|
+
def find_all_satisfiers(dep)
|
911
|
+
Gem.source_index.each do |name,gem|
|
912
|
+
if(gem.satisfies_requirement?(dep)) then
|
913
|
+
yield gem
|
914
|
+
end
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
private :find_all_satisfiers
|
919
|
+
|
920
|
+
##
|
921
|
+
# Return a string containing a Ruby code representation of the given
|
922
|
+
# object.
|
923
|
+
|
924
|
+
def ruby_code(obj)
|
925
|
+
case obj
|
926
|
+
when String then '%q{' + obj + '}'
|
927
|
+
when Array then obj.inspect
|
928
|
+
when Gem::Version then obj.to_s.inspect
|
929
|
+
when Date then '%q{' + obj.strftime('%Y-%m-%d') + '}'
|
930
|
+
when Time then '%q{' + obj.strftime('%Y-%m-%d') + '}'
|
931
|
+
when Numeric then obj.inspect
|
932
|
+
when true, false, nil then obj.inspect
|
933
|
+
when Gem::Platform then "Gem::Platform.new(#{obj.to_a.inspect})"
|
934
|
+
when Gem::Requirement then "Gem::Requirement.new(#{obj.to_s.inspect})"
|
935
|
+
else raise Exception, "ruby_code case not handled: #{obj.class}"
|
936
|
+
end
|
937
|
+
end
|
938
|
+
|
939
|
+
private :ruby_code
|
940
|
+
|
941
|
+
# :section: Required gemspec attributes
|
942
|
+
|
943
|
+
##
|
944
|
+
# The version of RubyGems used to create this gem
|
945
|
+
|
946
|
+
required_attribute :rubygems_version, Gem::RubyGemsVersion
|
947
|
+
|
948
|
+
##
|
949
|
+
# The Gem::Specification version of this gemspec
|
950
|
+
|
951
|
+
required_attribute :specification_version, CURRENT_SPECIFICATION_VERSION
|
952
|
+
|
953
|
+
##
|
954
|
+
# This gem's name
|
955
|
+
|
956
|
+
required_attribute :name
|
957
|
+
|
958
|
+
##
|
959
|
+
# This gem's version
|
960
|
+
|
961
|
+
required_attribute :version
|
962
|
+
|
963
|
+
##
|
964
|
+
# The date this gem was created
|
965
|
+
|
966
|
+
required_attribute :date, TODAY
|
967
|
+
|
968
|
+
##
|
969
|
+
# A short summary of this gem's description. Displayed in `gem list -d`.
|
970
|
+
|
971
|
+
required_attribute :summary
|
972
|
+
|
973
|
+
##
|
974
|
+
# Paths in the gem to add to $LOAD_PATH when this gem is activated
|
975
|
+
|
976
|
+
required_attribute :require_paths, ['lib']
|
977
|
+
|
978
|
+
# :section: Optional gemspec attributes
|
979
|
+
|
980
|
+
##
|
981
|
+
# A contact email for this gem
|
982
|
+
|
983
|
+
attribute :email
|
984
|
+
|
985
|
+
##
|
986
|
+
# The URL of this gem's home page
|
987
|
+
|
988
|
+
attribute :homepage
|
989
|
+
|
990
|
+
##
|
991
|
+
# The rubyforge project this gem lives under. i.e. RubyGems'
|
992
|
+
# rubyforge_project is "rubygems".
|
993
|
+
|
994
|
+
attribute :rubyforge_project
|
995
|
+
|
996
|
+
##
|
997
|
+
# A long description of this gem
|
998
|
+
|
999
|
+
attribute :description
|
1000
|
+
|
1001
|
+
##
|
1002
|
+
# Autorequire was used by old RubyGems to automatically require a file.
|
1003
|
+
# It no longer is supported.
|
1004
|
+
|
1005
|
+
attribute :autorequire
|
1006
|
+
|
1007
|
+
##
|
1008
|
+
# The default executable for this gem.
|
1009
|
+
|
1010
|
+
attribute :default_executable
|
1011
|
+
|
1012
|
+
##
|
1013
|
+
# The path in the gem for executable scripts
|
1014
|
+
|
1015
|
+
attribute :bindir, 'bin'
|
1016
|
+
|
1017
|
+
##
|
1018
|
+
# True if this gem is RDoc-compliant
|
1019
|
+
|
1020
|
+
attribute :has_rdoc, false
|
1021
|
+
|
1022
|
+
##
|
1023
|
+
# True if this gem supports RDoc
|
1024
|
+
|
1025
|
+
alias :has_rdoc? :has_rdoc
|
1026
|
+
|
1027
|
+
##
|
1028
|
+
# The ruby of version required by this gem
|
1029
|
+
|
1030
|
+
attribute :required_ruby_version, Gem::Requirement.default
|
1031
|
+
|
1032
|
+
##
|
1033
|
+
# The RubyGems version required by this gem
|
1034
|
+
|
1035
|
+
attribute :required_rubygems_version, Gem::Requirement.default
|
1036
|
+
|
1037
|
+
##
|
1038
|
+
# The platform this gem runs on. See Gem::Platform for details.
|
1039
|
+
|
1040
|
+
attribute :platform, Gem::Platform::RUBY
|
1041
|
+
|
1042
|
+
##
|
1043
|
+
# The key used to sign this gem. See Gem::Security for details.
|
1044
|
+
|
1045
|
+
attribute :signing_key, nil
|
1046
|
+
|
1047
|
+
##
|
1048
|
+
# The certificate chain used to sign this gem. See Gem::Security for
|
1049
|
+
# details.
|
1050
|
+
|
1051
|
+
attribute :cert_chain, []
|
1052
|
+
|
1053
|
+
##
|
1054
|
+
# A message that gets displayed after the gem is installed
|
1055
|
+
|
1056
|
+
attribute :post_install_message, nil
|
1057
|
+
|
1058
|
+
##
|
1059
|
+
# The list of authors who wrote this gem
|
1060
|
+
|
1061
|
+
array_attribute :authors
|
1062
|
+
|
1063
|
+
##
|
1064
|
+
# Files included in this gem
|
1065
|
+
|
1066
|
+
array_attribute :files
|
1067
|
+
|
1068
|
+
##
|
1069
|
+
# Test files included in this gem
|
1070
|
+
|
1071
|
+
array_attribute :test_files
|
1072
|
+
|
1073
|
+
##
|
1074
|
+
# An ARGV-style array of options to RDoc
|
1075
|
+
|
1076
|
+
array_attribute :rdoc_options
|
1077
|
+
|
1078
|
+
##
|
1079
|
+
# Extra files to add to RDoc
|
1080
|
+
|
1081
|
+
array_attribute :extra_rdoc_files
|
1082
|
+
|
1083
|
+
##
|
1084
|
+
# Executables included in the gem
|
1085
|
+
|
1086
|
+
array_attribute :executables
|
1087
|
+
|
1088
|
+
##
|
1089
|
+
# Extensions to build when installing the gem. See
|
1090
|
+
# Gem::Installer#build_extensions for valid values.
|
1091
|
+
|
1092
|
+
array_attribute :extensions
|
1093
|
+
|
1094
|
+
##
|
1095
|
+
# An array or things required by this gem. Not used by anything
|
1096
|
+
# presently.
|
1097
|
+
|
1098
|
+
array_attribute :requirements
|
1099
|
+
|
1100
|
+
##
|
1101
|
+
# A list of Gem::Dependency objects this gem depends on. Only appendable.
|
1102
|
+
|
1103
|
+
array_attribute :dependencies
|
1104
|
+
|
1105
|
+
read_only :dependencies
|
1106
|
+
|
1107
|
+
# :section: Aliased gemspec attributes
|
1108
|
+
|
1109
|
+
##
|
1110
|
+
# Singular accessor for executables
|
1111
|
+
|
1112
|
+
attribute_alias_singular :executable, :executables
|
1113
|
+
|
1114
|
+
##
|
1115
|
+
# Singular accessor for authors
|
1116
|
+
|
1117
|
+
attribute_alias_singular :author, :authors
|
1118
|
+
|
1119
|
+
##
|
1120
|
+
# Singular accessor for require_paths
|
1121
|
+
|
1122
|
+
attribute_alias_singular :require_path, :require_paths
|
1123
|
+
|
1124
|
+
##
|
1125
|
+
# Singular accessor for test_files
|
1126
|
+
|
1127
|
+
attribute_alias_singular :test_file, :test_files
|
1128
|
+
|
1129
|
+
overwrite_accessor :version= do |version|
|
1130
|
+
@version = Version.create(version)
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
overwrite_accessor :platform do
|
1134
|
+
@new_platform
|
1135
|
+
end
|
1136
|
+
|
1137
|
+
overwrite_accessor :platform= do |platform|
|
1138
|
+
if @original_platform.nil? or
|
1139
|
+
@original_platform == Gem::Platform::RUBY then
|
1140
|
+
@original_platform = platform
|
1141
|
+
end
|
1142
|
+
|
1143
|
+
case platform
|
1144
|
+
when Gem::Platform::CURRENT then
|
1145
|
+
@new_platform = Gem::Platform.local
|
1146
|
+
@original_platform = @new_platform.to_s
|
1147
|
+
|
1148
|
+
when Gem::Platform then
|
1149
|
+
@new_platform = platform
|
1150
|
+
|
1151
|
+
# legacy constants
|
1152
|
+
when nil, Gem::Platform::RUBY then
|
1153
|
+
@new_platform = Gem::Platform::RUBY
|
1154
|
+
when 'mswin32' then # was Gem::Platform::WIN32
|
1155
|
+
@new_platform = Gem::Platform.new 'x86-mswin32'
|
1156
|
+
when 'i586-linux' then # was Gem::Platform::LINUX_586
|
1157
|
+
@new_platform = Gem::Platform.new 'x86-linux'
|
1158
|
+
when 'powerpc-darwin' then # was Gem::Platform::DARWIN
|
1159
|
+
@new_platform = Gem::Platform.new 'ppc-darwin'
|
1160
|
+
else
|
1161
|
+
@new_platform = Gem::Platform.new platform
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
@platform = @new_platform.to_s
|
1165
|
+
|
1166
|
+
@new_platform
|
1167
|
+
end
|
1168
|
+
|
1169
|
+
overwrite_accessor :required_ruby_version= do |value|
|
1170
|
+
@required_ruby_version = Gem::Requirement.create(value)
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
overwrite_accessor :required_rubygems_version= do |value|
|
1174
|
+
@required_rubygems_version = Gem::Requirement.create(value)
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
overwrite_accessor :date= do |date|
|
1178
|
+
# We want to end up with a Time object with one-day resolution.
|
1179
|
+
# This is the cleanest, most-readable, faster-than-using-Date
|
1180
|
+
# way to do it.
|
1181
|
+
case date
|
1182
|
+
when String then
|
1183
|
+
@date = if /\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then
|
1184
|
+
Time.local($1.to_i, $2.to_i, $3.to_i)
|
1185
|
+
else
|
1186
|
+
require 'time'
|
1187
|
+
Time.parse date
|
1188
|
+
end
|
1189
|
+
when Time then
|
1190
|
+
@date = Time.local(date.year, date.month, date.day)
|
1191
|
+
when Date then
|
1192
|
+
@date = Time.local(date.year, date.month, date.day)
|
1193
|
+
else
|
1194
|
+
@date = TODAY
|
1195
|
+
end
|
1196
|
+
end
|
1197
|
+
|
1198
|
+
overwrite_accessor :date do
|
1199
|
+
self.date = nil if @date.nil? # HACK Sets the default value for date
|
1200
|
+
@date
|
1201
|
+
end
|
1202
|
+
|
1203
|
+
overwrite_accessor :summary= do |str|
|
1204
|
+
@summary = if str then
|
1205
|
+
str.strip.
|
1206
|
+
gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
|
1207
|
+
gsub(/\n[ \t]*/, " ")
|
1208
|
+
end
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
overwrite_accessor :description= do |str|
|
1212
|
+
@description = if str then
|
1213
|
+
str.strip.
|
1214
|
+
gsub(/(\w-)\n[ \t]*(\w)/, '\1\2').
|
1215
|
+
gsub(/\n[ \t]*/, " ")
|
1216
|
+
end
|
1217
|
+
end
|
1218
|
+
|
1219
|
+
overwrite_accessor :default_executable do
|
1220
|
+
begin
|
1221
|
+
if defined?(@default_executable) and @default_executable
|
1222
|
+
result = @default_executable
|
1223
|
+
elsif @executables and @executables.size == 1
|
1224
|
+
result = Array(@executables).first
|
1225
|
+
else
|
1226
|
+
result = nil
|
1227
|
+
end
|
1228
|
+
result
|
1229
|
+
rescue
|
1230
|
+
nil
|
1231
|
+
end
|
1232
|
+
end
|
1233
|
+
|
1234
|
+
overwrite_accessor :test_files do
|
1235
|
+
# Handle the possibility that we have @test_suite_file but not
|
1236
|
+
# @test_files. This will happen when an old gem is loaded via
|
1237
|
+
# YAML.
|
1238
|
+
if defined? @test_suite_file then
|
1239
|
+
@test_files = [@test_suite_file].flatten
|
1240
|
+
@test_suite_file = nil
|
1241
|
+
end
|
1242
|
+
if defined?(@test_files) and @test_files then
|
1243
|
+
@test_files
|
1244
|
+
else
|
1245
|
+
@test_files = []
|
1246
|
+
end
|
1247
|
+
end
|
1248
|
+
|
1249
|
+
overwrite_accessor :files do
|
1250
|
+
result = []
|
1251
|
+
result.push(*@files) if defined?(@files)
|
1252
|
+
result.push(*@test_files) if defined?(@test_files)
|
1253
|
+
result.push(*(add_bindir(@executables)))
|
1254
|
+
result.push(*@extra_rdoc_files) if defined?(@extra_rdoc_files)
|
1255
|
+
result.push(*@extensions) if defined?(@extensions)
|
1256
|
+
result.uniq.compact
|
1257
|
+
end
|
1258
|
+
|
1259
|
+
end
|
1260
|
+
|
1261
|
+
end
|
1262
|
+
|