x2c 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +103 -0
- data/x2c/config.rb +59 -0
- data/x2c/core/args.rb +36 -0
- data/x2c/core/client.rb +61 -0
- data/x2c/core/collection.rb +136 -0
- data/x2c/core/configure.rb +43 -0
- data/x2c/core/meta.rb +77 -0
- data/x2c/core/prompt.rb +59 -0
- data/x2c/core/resulteval.rb +133 -0
- data/x2c/doc.rb +243 -0
- data/x2c/doc/Array/cdesc-Array.yaml +21 -0
- data/x2c/doc/Array/format-i.yaml +10 -0
- data/x2c/doc/Array/inspect-i.yaml +10 -0
- data/x2c/doc/Array/to_s-i.yaml +10 -0
- data/x2c/doc/Fixnum/cdesc-Fixnum.yaml +20 -0
- data/x2c/doc/Fixnum/hour-i.yaml +12 -0
- data/x2c/doc/Fixnum/min-i.yaml +12 -0
- data/x2c/doc/Fixnum/sec-i.yaml +12 -0
- data/x2c/doc/Hash/cdesc-Hash.yaml +21 -0
- data/x2c/doc/Hash/format-i.yaml +10 -0
- data/x2c/doc/Hash/inspect-i.yaml +10 -0
- data/x2c/doc/Hash/to_s-i.yaml +10 -0
- data/x2c/doc/Help/cdesc-Help.yaml +30 -0
- data/x2c/doc/Help/help-c.yaml +10 -0
- data/x2c/doc/Help/help_hacks-c.yaml +10 -0
- data/x2c/doc/Help/ignore-c.yaml +10 -0
- data/x2c/doc/Help/irb_help-c.yaml +10 -0
- data/x2c/doc/Help/match%3f-c.yaml +10 -0
- data/x2c/doc/Help/trace_help-c.yaml +10 -0
- data/x2c/doc/IRB/ExtendCommandBundle/cdesc-ExtendCommandBundle.yaml +15 -0
- data/x2c/doc/IRB/Prompt/%5b%5d-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/cdesc-Prompt.yaml +36 -0
- data/x2c/doc/IRB/Prompt/config-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/main%3d-i.yaml +12 -0
- data/x2c/doc/IRB/Prompt/new-c.yaml +10 -0
- data/x2c/doc/IRB/Prompt/pop-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/push-i.yaml +10 -0
- data/x2c/doc/IRB/Prompt/set-i.yaml +11 -0
- data/x2c/doc/IRB/Prompt/start-i.yaml +10 -0
- data/x2c/doc/IRB/cdesc-IRB.yaml +15 -0
- data/x2c/doc/Kernel/cdesc-Kernel.yaml +16 -0
- data/x2c/doc/Kernel/xmms-i.yaml +12 -0
- data/x2c/doc/NilClass/cdesc-NilClass.yaml +16 -0
- data/x2c/doc/NilClass/inspect-i.yaml +10 -0
- data/x2c/doc/Object/cdesc-Object.yaml +18 -0
- data/x2c/doc/Object/format-i.yaml +10 -0
- data/x2c/doc/Object/to_d-i.yaml +12 -0
- data/x2c/doc/Prompting/activate-i.yaml +12 -0
- data/x2c/doc/Prompting/back-i.yaml +12 -0
- data/x2c/doc/Prompting/cdesc-Prompting.yaml +45 -0
- data/x2c/doc/Prompting/gointo-i.yaml +12 -0
- data/x2c/doc/Prompting/inspect-i.yaml +12 -0
- data/x2c/doc/Prompting/intersect-i.yaml +12 -0
- data/x2c/doc/Prompting/last%3d-i.yaml +12 -0
- data/x2c/doc/Prompting/last-i.yaml +12 -0
- data/x2c/doc/Prompting/lost-i.yaml +12 -0
- data/x2c/doc/Prompting/makelast-i.yaml +12 -0
- data/x2c/doc/Prompting/pop-i.yaml +12 -0
- data/x2c/doc/Prompting/push-i.yaml +12 -0
- data/x2c/doc/Prompting/stack-i.yaml +12 -0
- data/x2c/doc/Prompting/to_s-i.yaml +12 -0
- data/x2c/doc/Prompting/union-i.yaml +12 -0
- data/x2c/doc/String/cdesc-String.yaml +18 -0
- data/x2c/doc/String/format-i.yaml +10 -0
- data/x2c/doc/String/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Browse/%5b%5d-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/cd-i.yaml +17 -0
- data/x2c/doc/Xmms/Browse/cdesc-Browse.yaml +34 -0
- data/x2c/doc/Xmms/Browse/dirs-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/files-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Browse/get-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/list-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/mlib_add-i.yaml +12 -0
- data/x2c/doc/Xmms/Browse/open-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Chains/cdesc-Chains.yaml +39 -0
- data/x2c/doc/Xmms/Client/Chains/info-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Chains/remove-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Chains/song-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Config/cdesc-Config.yaml +18 -0
- data/x2c/doc/Xmms/Client/Config/config-i.yaml +18 -0
- data/x2c/doc/Xmms/Client/Daemon/cdesc-Daemon.yaml +27 -0
- data/x2c/doc/Xmms/Client/Daemon/connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/Daemon/dead_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Daemon/post_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Daemon/pre_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Daemon/start_daemon-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/IPlayback/cdesc-IPlayback.yaml +22 -0
- data/x2c/doc/Xmms/Client/IPlayback/pause-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/IPlayback/play-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/IPlayback/skip-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/ListNames/cdesc-ListNames.yaml +20 -0
- data/x2c/doc/Xmms/Client/ListNames/setup_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/ListNames/setup_lists-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Mlib/browse-i.yaml +14 -0
- data/x2c/doc/Xmms/Client/Mlib/cdesc-Mlib.yaml +20 -0
- data/x2c/doc/Xmms/Client/Mlib/rehash-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Remember/cdesc-Remember.yaml +25 -0
- data/x2c/doc/Xmms/Client/Remember/gointo-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Remember/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/Remember/push-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Remember/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/Search/cdesc-Search.yaml +17 -0
- data/x2c/doc/Xmms/Client/Shortcut/cdesc-Shortcut.yaml +22 -0
- data/x2c/doc/Xmms/Client/Shortcut/now-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Shortcut/seek-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Shortcut/volume-i.yaml +14 -0
- data/x2c/doc/Xmms/Client/Vote/cdesc-Vote.yaml +24 -0
- data/x2c/doc/Xmms/Client/Vote/rating-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Vote/remove_rating%21-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Vote/undo_voting-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/Vote/vote-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/__connect-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/async_start-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/bindata_add-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/bindata_retrieve-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/c-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/cdesc-Client.yaml +169 -0
- data/x2c/doc/Xmms/Client/coll_find-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_get-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_idlist_from_playlist_file-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_query_ids-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_query_info-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_remove-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_rename-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/coll_save-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configure-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_get-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_register-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/configval_set-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/continue-i.yaml +11 -0
- data/x2c/doc/Xmms/Client/format-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/handled_connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/help-i.yaml +16 -0
- data/x2c/doc/Xmms/Client/main-c.yaml +12 -0
- data/x2c/doc/Xmms/Client/main_stats-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/medialib_add_entry-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_entry_property_remove-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_entry_property_set-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_entry_remove-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_get_id-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_get_info-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_path_import-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_rehash-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/medialib_select-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/new-c.yaml +12 -0
- data/x2c/doc/Xmms/Client/on_disconnect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/playback_pause-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_ms-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_ms_rel-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_samples-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_seek_samples_rel-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_start-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_stop-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_tickle-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_volume_get-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playback_volume_set-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playbacklist-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/playlist-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playlist_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playlist_set_next-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/playlist_set_next_rel-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/plugin_list-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/post_connect-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/pre_connect-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/quit-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/setup-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/showprompt-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/shutdown-i.yaml +12 -0
- data/x2c/doc/Xmms/Client/welcome-i.yaml +10 -0
- data/x2c/doc/Xmms/Client/xform_media_browse-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/%26-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%5b%5d%3d-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%5b%5d-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%7c-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/%7e-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Attributes/add-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Attributes/cdesc-Attributes.yaml +25 -0
- data/x2c/doc/Xmms/Collection/Attributes/field-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Attributes/field_string-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Attributes/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Chains/cdesc-Chains.yaml +39 -0
- data/x2c/doc/Xmms/Collection/Chains/list-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/load-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/load_form_file-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/play-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/playlist-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Chains/save-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/FormQuery/cdesc-FormQuery.yaml +22 -0
- data/x2c/doc/Xmms/Collection/FormQuery/method_missing-i.yaml +14 -0
- data/x2c/doc/Xmms/Collection/Info/cdesc-Info.yaml +32 -0
- data/x2c/doc/Xmms/Collection/Info/info-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Info/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Operands/cdesc-Operands.yaml +18 -0
- data/x2c/doc/Xmms/Collection/Operands/empty%3f-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/%3c%3d-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/%3e%3d-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/%7e-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/_-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Query/cdesc-Query.yaml +32 -0
- data/x2c/doc/Xmms/Collection/Query/exist%3f-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/Query/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Query/has-i.yaml +13 -0
- data/x2c/doc/Xmms/Collection/Query/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/acceptable-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/awesome-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/cdesc-Vote.yaml +32 -0
- data/x2c/doc/Xmms/Collection/Vote/good-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/nice-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/notsucking-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/Vote/unvoted-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/and-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/attribute-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/cdesc-Collection.yaml +140 -0
- data/x2c/doc/Xmms/Collection/complement-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/default-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/format-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/idlis-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/idlist%3d-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/intersect-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/load-c.yaml +10 -0
- data/x2c/doc/Xmms/Collection/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Collection/new_constructor-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/new_list-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/new_pshuffle-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/new_selection-c.yaml +12 -0
- data/x2c/doc/Xmms/Collection/not-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/operand-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/or-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/parent-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/pshuffle-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/queue-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/tree_inject-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/tree_walk-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/typ-i.yaml +10 -0
- data/x2c/doc/Xmms/Collection/union-i.yaml +12 -0
- data/x2c/doc/Xmms/Collection/universe-c.yaml +12 -0
- data/x2c/doc/Xmms/Config/%5b%5d%3d-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/%5b%5d-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/cdesc-Config.yaml +47 -0
- data/x2c/doc/Xmms/Config/configs-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/join-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/keys-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/method_missing-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/methods-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Config/parent-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/respond_to%3f-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/subs-i.yaml +10 -0
- data/x2c/doc/Xmms/Config/subtrees-i.yaml +10 -0
- data/x2c/doc/Xmms/Duration/cdesc-Duration.yaml +25 -0
- data/x2c/doc/Xmms/Duration/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Duration/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Duration/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Format/cdesc-Format.yaml +22 -0
- data/x2c/doc/Xmms/Format/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Format/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Format/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Info/cdesc-Info.yaml +32 -0
- data/x2c/doc/Xmms/Info/count-i.yaml +12 -0
- data/x2c/doc/Xmms/Info/format-i.yaml +12 -0
- data/x2c/doc/Xmms/Info/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/Info/method_missing-i.yaml +10 -0
- data/x2c/doc/Xmms/Info/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Info/search-i.yaml +12 -0
- data/x2c/doc/Xmms/Info/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Media/cdesc-Media.yaml +31 -0
- data/x2c/doc/Xmms/Media/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Media/media-i.yaml +12 -0
- data/x2c/doc/Xmms/Media/mlib_add-i.yaml +12 -0
- data/x2c/doc/Xmms/Media/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Media/parent-i.yaml +12 -0
- data/x2c/doc/Xmms/Options/%5b%5d%3d-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/%5b%5d-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/cdesc-Options.yaml +24 -0
- data/x2c/doc/Xmms/Options/get_argv-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/help-c.yaml +10 -0
- data/x2c/doc/Xmms/Options/opts-c.yaml +10 -0
- data/x2c/doc/Xmms/Playlist/Chains/cdesc-Chains.yaml +18 -0
- data/x2c/doc/Xmms/Playlist/Chains/play-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/add-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/cdesc-Shortcut.yaml +24 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/insert-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/move-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/Shortcut/remove_entries-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/add_collection-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/add_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/cdesc-Playlist.yaml +56 -0
- data/x2c/doc/Xmms/Playlist/clear-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/collection-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/current_pos-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/entries-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Playlist/insert_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/load-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/name-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/new-c.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/playlist_move_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/radd-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/remove-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/remove_entry-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/shuffle-i.yaml +12 -0
- data/x2c/doc/Xmms/Playlist/sort-i.yaml +12 -0
- data/x2c/doc/Xmms/PropDict/Mlib/cdesc-Mlib.yaml +30 -0
- data/x2c/doc/Xmms/PropDict/Mlib/method_missing-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/Mlib/methods-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/Mlib/rehash-i.yaml +12 -0
- data/x2c/doc/Xmms/PropDict/Mlib/remove%21-i.yaml +12 -0
- data/x2c/doc/Xmms/PropDict/Mlib/respond_to%3f-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/cdesc-PropDict.yaml +27 -0
- data/x2c/doc/Xmms/PropDict/format-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/id-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/inspect-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/to_h-i.yaml +10 -0
- data/x2c/doc/Xmms/PropDict/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/Remember/cdesc-Remember.yaml +18 -0
- data/x2c/doc/Xmms/Result/cdesc-Result.yaml +20 -0
- data/x2c/doc/Xmms/Result/val-i.yaml +12 -0
- data/x2c/doc/Xmms/Song/cdesc-Song.yaml +29 -0
- data/x2c/doc/Xmms/Song/format-c.yaml +12 -0
- data/x2c/doc/Xmms/Song/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Song/info-i.yaml +10 -0
- data/x2c/doc/Xmms/Song/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/Chains/cdesc-Chains.yaml +29 -0
- data/x2c/doc/Xmms/Songlist/Chains/idlist-i.yaml +12 -0
- data/x2c/doc/Xmms/Songlist/Chains/queue-i.yaml +12 -0
- data/x2c/doc/Xmms/Songlist/cdesc-Songlist.yaml +37 -0
- data/x2c/doc/Xmms/Songlist/collection-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/format-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/format_hash-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/info_hash-i.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/new-c.yaml +10 -0
- data/x2c/doc/Xmms/Songlist/songs-i.yaml +12 -0
- data/x2c/doc/Xmms/Songlist/to_s-i.yaml +10 -0
- data/x2c/doc/Xmms/cdesc-Xmms.yaml +18 -0
- data/x2c/doc/Xmms/save_call-c.yaml +12 -0
- data/x2c/doc/created.rid +1 -0
- data/x2c/plug/async.rb +50 -0
- data/x2c/plug/chains.rb +148 -0
- data/x2c/plug/config.rb +90 -0
- data/x2c/plug/daemon.rb +72 -0
- data/x2c/plug/format.rb +251 -0
- data/x2c/plug/help.rb +240 -0
- data/x2c/plug/info.rb +86 -0
- data/x2c/plug/iplayback.rb +49 -0
- data/x2c/plug/listnames.rb +43 -0
- data/x2c/plug/mlib.rb +128 -0
- data/x2c/plug/query.rb +51 -0
- data/x2c/plug/remember.rb +124 -0
- data/x2c/plug/shortcuts.rb +108 -0
- data/x2c/plug/tutorial.rb +134 -0
- data/x2c/plug/vote.rb +77 -0
- data/x2c/x2c +36 -0
- data/x2c/x2c.rb +16 -0
- metadata +453 -0
data/README
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
= x2c - the interactive ruby compiler
|
2
|
+
|
3
|
+
The client itself is an irb shell executing commands on the client object, which
|
4
|
+
has been extended to get a powerful and easy interface to playback, playlists
|
5
|
+
and collections. As it is all ruby, you can easily extend its functionality,
|
6
|
+
create new aliases or functions, or create you own client on top of it.
|
7
|
+
|
8
|
+
== First Steps
|
9
|
+
=== Installation
|
10
|
+
If you want use the gem (to keep you system clean or things like that), just
|
11
|
+
build it out of the gemspec and install it:
|
12
|
+
gem build x2c.gemspec
|
13
|
+
sudo gem install x2c-0.1.gem
|
14
|
+
But you also can simply copy the x2c folder somewhere on your disc and run ./x2c
|
15
|
+
directly or symlink to it.
|
16
|
+
|
17
|
+
=== Usage
|
18
|
+
If you start x2c, you will be confronted with a short tutorial helping you with
|
19
|
+
the first steps in x2c. After you finisched the tutorial and seted up the
|
20
|
+
config, you can use x2c normally. You can get descriptions about functions and
|
21
|
+
modules with the help command.
|
22
|
+
|
23
|
+
== the design
|
24
|
+
|
25
|
+
x2c creates a new xmms client objects, and starts a new irb workspace with the
|
26
|
+
client as its main object. Both client and workspace are extended to have some
|
27
|
+
extra functionalities.
|
28
|
+
|
29
|
+
So all you do is calling functions with arguments on the xmms client. Therefore
|
30
|
+
you must type valid ruby syntax, but it allows you to get all the power of ruby.
|
31
|
+
There are 3 main objects inside the xmms client lib and inside my client:
|
32
|
+
* the client itself: where all the function calls go. It is the interface to
|
33
|
+
daemon, you can git information about the medialib and change playback with it.
|
34
|
+
* playlists: they are play ;) and song are removed, moved or inserted
|
35
|
+
* collections: powerful way to express media queries
|
36
|
+
* theres also another thing called Songlist, which is used to pass around song
|
37
|
+
ids
|
38
|
+
|
39
|
+
== the interface
|
40
|
+
|
41
|
+
All output is formated to give you information about the objects you process and
|
42
|
+
the state you are inside
|
43
|
+
|
44
|
+
=== understanding the output
|
45
|
+
|
46
|
+
==== the commandline
|
47
|
+
|
48
|
+
The commandline will show the playback status, e.g. '>>' for PLAY, '||' for PAUSE and
|
49
|
+
'[]' for STOP, and the song currently played followed by a Symbol to show you what
|
50
|
+
mode you are in, dependent of the command what irb expects you to do.
|
51
|
+
|
52
|
+
In addition to that, the async module will put out '->' followed by the new Song,
|
53
|
+
whenever the current Song changes.
|
54
|
+
|
55
|
+
==== results
|
56
|
+
|
57
|
+
The results of your commands will be put after a '=>'. As that results will be
|
58
|
+
often used for further processing, there is a variable that holds useful
|
59
|
+
results. All results considered useful are marked with a trailing '`' , so
|
60
|
+
whenever you see a '`' in front of a output, the last variable is set. You can
|
61
|
+
explicitly make a result last, if you append .makelast to your command.
|
62
|
+
Furthermore you can push results to the stack to pop them later. Just used
|
63
|
+
(command).push to push the result, or just push to push the last result. You
|
64
|
+
also can restore the prelast result with the lost command.
|
65
|
+
|
66
|
+
Results will be printed after the => in a readable way:
|
67
|
+
* collections will show the hole tree of operations: first the operations and
|
68
|
+
its options are printed, followed by its operands in the next line. Operations
|
69
|
+
are shown as symbols, '%' for pshuffle ':' for idlist, ']' for a queue, '>>'
|
70
|
+
for a reference, '!' for complement, '&' for intersection, '|' for union, '='
|
71
|
+
for a field equals value collection, '~' for a Match, '>' and '<' for
|
72
|
+
comparing and 'E' for existents of an attribute.
|
73
|
+
* playlists show the collection on which they are based on and the list of songs.
|
74
|
+
The current song will be marked with a '>'
|
75
|
+
* Songlists just how there Songs
|
76
|
+
* Arrays and Hashes show all of their members
|
77
|
+
|
78
|
+
=== functions calls and message passing
|
79
|
+
==== Message passing
|
80
|
+
|
81
|
+
All classes have gained additional functions, and messages are often passed to
|
82
|
+
other classes. The client object for example will forward messages to
|
83
|
+
Collections or the playlist and the last result object. Playlists itself will
|
84
|
+
pass unknown functions to its current Collections. Collections will try to make
|
85
|
+
itself a playlist when needed. Songlists and id-Arrays will try to be the same,
|
86
|
+
just that Songlists have some extra functionality and a nicer output.
|
87
|
+
|
88
|
+
==== Functions
|
89
|
+
The help command uses the autogenreate rdoc to give you help about all the
|
90
|
+
functions and objects. just uses the help command to get all the information.
|
91
|
+
help
|
92
|
+
help{Client}
|
93
|
+
help{Client::<Inculded Module>}
|
94
|
+
help{<command>}
|
95
|
+
help{Collection::<Inculded Module>}
|
96
|
+
...
|
97
|
+
|
98
|
+
=== Client Configuration
|
99
|
+
You can configure the client with the .config/xmms2/x2c/config.rb file. You
|
100
|
+
first have to copy the default configuration with the setup command. Afterwords
|
101
|
+
you can use the configure command to edit the file.
|
102
|
+
|
103
|
+
PS: feel free to ask me or say what you like/dislike.
|
data/x2c/config.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
module Xmms
|
2
|
+
# output things nicely
|
3
|
+
require 'plug/format.rb'
|
4
|
+
# nice interface to genrated docs
|
5
|
+
require 'plug/help.rb'
|
6
|
+
# make Xmms::Client more usable
|
7
|
+
require 'plug/shortcuts.rb'
|
8
|
+
# better playback functions (pause will unpause when pause),
|
9
|
+
# play can load music, skip will skip n track and tickle
|
10
|
+
require 'plug/iplayback'
|
11
|
+
# easy collection creation
|
12
|
+
require 'plug/query.rb'
|
13
|
+
# make classes interact with each other
|
14
|
+
require 'plug/chains.rb'
|
15
|
+
# stack and last functions
|
16
|
+
require 'plug/remember.rb'
|
17
|
+
# we need async module to display playback events
|
18
|
+
require 'plug/async.rb'
|
19
|
+
# shortcuts to load collections
|
20
|
+
require 'plug/listnames.rb'
|
21
|
+
# info gathering for collections
|
22
|
+
require 'plug/info.rb'
|
23
|
+
# load config interface
|
24
|
+
require 'plug/config.rb'
|
25
|
+
# automatically start local daemon
|
26
|
+
require 'plug/daemon.rb'
|
27
|
+
# voting/rating module
|
28
|
+
require 'plug/vote.rb'
|
29
|
+
# mlib interface
|
30
|
+
require 'plug/mlib.rb'
|
31
|
+
|
32
|
+
class Client
|
33
|
+
MEDIA_DIR = '.'
|
34
|
+
def pre_connect
|
35
|
+
end
|
36
|
+
# setup some things
|
37
|
+
def post_connect
|
38
|
+
async_start # requires async.rb
|
39
|
+
playbacklist # requires async.rb
|
40
|
+
setup_lists # requires chains.rb
|
41
|
+
end
|
42
|
+
# for the daemon plugin
|
43
|
+
def pre_daemon
|
44
|
+
end
|
45
|
+
def post_daemon(ipc_path)
|
46
|
+
start
|
47
|
+
end
|
48
|
+
def dead_daemon
|
49
|
+
end
|
50
|
+
shortcut :l, :last
|
51
|
+
shortcut :n, :skip
|
52
|
+
shortcut :p, :pause
|
53
|
+
shortcut :c, :config
|
54
|
+
shortcut :s, :search
|
55
|
+
shortcut :h, :help
|
56
|
+
end
|
57
|
+
# define custom functionality here,
|
58
|
+
# or include you own ruby files
|
59
|
+
end
|
data/x2c/core/args.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Copyright by Daniel Waeber, see the LICENSE file for details
|
2
|
+
module Xmms
|
3
|
+
module Options
|
4
|
+
@@opts = Hash.new
|
5
|
+
@@help = Hash.new
|
6
|
+
def self.opts
|
7
|
+
@@opts
|
8
|
+
end
|
9
|
+
def self.help
|
10
|
+
" "+@@help.values.format
|
11
|
+
end
|
12
|
+
def self.get_argv opt, val
|
13
|
+
upt = opt.upcase.gsub(/-/,'_')
|
14
|
+
i = ARGV.index('--'+opt)
|
15
|
+
arg = if i
|
16
|
+
ARGV.delete_at(i) if i
|
17
|
+
ARGV[i].nil? || ARGV[i][0..1]=='--' || ARGV.delete_at(i)
|
18
|
+
end
|
19
|
+
lambda {arg || Xmms::Client.const_defined?(upt) && Xmms::Client.const_get(upt) || ENV[upt] || val}
|
20
|
+
end
|
21
|
+
def self.[] arg
|
22
|
+
if arg.is_a? Hash
|
23
|
+
arg.each_pair do |k,a|
|
24
|
+
a.first = false if(a.first == 'false')
|
25
|
+
@@opts[k] = get_argv(k,a.first)
|
26
|
+
@@help[k] = "--#{k}\n #{a.last}\n default: #{a.first}"
|
27
|
+
end
|
28
|
+
else
|
29
|
+
@@opts[arg].call
|
30
|
+
end
|
31
|
+
end
|
32
|
+
def self.[]= key, val
|
33
|
+
@@opts[key]=lambda{val}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/x2c/core/client.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Copyright by Daniel Waeber, see the LICENSE file for details
|
2
|
+
|
3
|
+
# this module improves collection handling of the Cleint object and
|
4
|
+
# remembers the first started client, any object can access it
|
5
|
+
require 'core/args.rb'
|
6
|
+
|
7
|
+
module Kernel
|
8
|
+
# returns a xmms2 client object
|
9
|
+
def xmms
|
10
|
+
Xmms::Client.main
|
11
|
+
end
|
12
|
+
end
|
13
|
+
module Xmms
|
14
|
+
# the Client object is the main interface to the deamon.
|
15
|
+
# by default, all commands will be executed on the Client.
|
16
|
+
# To give you more power, the client will include many plugins/modules
|
17
|
+
# to give you extra functionality. You can get extra help on all of the Includes.
|
18
|
+
class Client
|
19
|
+
Options['xmms-path' => ['unix:///tmp/xmms-ipc', 'the socket path x2c connects to']]
|
20
|
+
@@main = nil
|
21
|
+
# return reference to the first known client
|
22
|
+
def self.main
|
23
|
+
@@main || raise(Client::DisconnectedError,"no running xmms client found")
|
24
|
+
end
|
25
|
+
|
26
|
+
alias_method :__initialize, :initialize
|
27
|
+
# set up xmms Client, connect to deamonn and set main refrence
|
28
|
+
def initialize name='x2c'
|
29
|
+
__initialize(name)
|
30
|
+
@@main ||= self
|
31
|
+
end
|
32
|
+
alias_method :__connect, :connect
|
33
|
+
def handled_connect path
|
34
|
+
puts "... connecting to daemon at #{path}"
|
35
|
+
__connect(path)
|
36
|
+
on_disconnect do
|
37
|
+
puts "\n... lost connection to deamon. bye."
|
38
|
+
Kernel.exit 1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
# try to connect to the daemon
|
42
|
+
def connect path=Options['xmms-path']
|
43
|
+
begin
|
44
|
+
handled_connect(path)
|
45
|
+
rescue ClientError => e
|
46
|
+
puts "\n... #{path}: #{e}"
|
47
|
+
exit 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
alias_method :__shutdown, :quit
|
51
|
+
# shutdown the daemon
|
52
|
+
def shutdown
|
53
|
+
puts "\n... shutting down daemon. bye."
|
54
|
+
__shutdown.val
|
55
|
+
exit 0
|
56
|
+
end
|
57
|
+
# exit the client
|
58
|
+
def quit; end
|
59
|
+
undef_method :quit
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# Copyright by Daniel Waeber, see the LICENSE file for details
|
2
|
+
|
3
|
+
require 'core/meta.rb'
|
4
|
+
require 'core/resulteval.rb'
|
5
|
+
|
6
|
+
# helpers for eassy collection manipulation
|
7
|
+
module Xmms
|
8
|
+
# Collections represent a selection of music out of you MLib.
|
9
|
+
#
|
10
|
+
# you can create them with the normal constructor Collection.new,
|
11
|
+
# or use the special constructors Collection.new_<type>:
|
12
|
+
# * new_equals: a field equals a value
|
13
|
+
# * new_match: a field matches a value
|
14
|
+
# * new_greater: a field is greater as a value
|
15
|
+
# * new_smaller: a field is smaller as a value
|
16
|
+
# * new_smaller: a field is smaller as a value
|
17
|
+
# * new_has: the media has a certain field
|
18
|
+
# * new_queue: create a queue out of ids
|
19
|
+
# * new_idlist: create a queue out of ids
|
20
|
+
# * univierse: get all media
|
21
|
+
# * default: get the default base of collections
|
22
|
+
#
|
23
|
+
# there are some functions on collections, that extract infomation and give you new ghings
|
24
|
+
# * c.attributes and c.operrands give you the internal information
|
25
|
+
# * c.idlist return the internal idlist of queues, pshuffles and idlists
|
26
|
+
# * c.parent return the base of the collection
|
27
|
+
class Collection
|
28
|
+
class Operands
|
29
|
+
def empty?
|
30
|
+
self.to_a.empty?
|
31
|
+
end
|
32
|
+
end
|
33
|
+
class Attributes
|
34
|
+
# get Attribute as Hash: { field => value}
|
35
|
+
def field
|
36
|
+
{self["field"] => self["value"]}
|
37
|
+
end
|
38
|
+
# add the attrHash to the attributes list
|
39
|
+
def add attrHash
|
40
|
+
attrHash.each_pair do |k,v|
|
41
|
+
self[k.to_s] = v.to_s
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
attr_accessor :name
|
46
|
+
# go through hole operands tree and call block with |collection, depth|
|
47
|
+
def tree_walk d=0, &block
|
48
|
+
yield(self, d)
|
49
|
+
self.operands.each do |o|
|
50
|
+
o.tree_walk(d+1, &block)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
# tree_walk with accumulater
|
54
|
+
def tree_inject a=self, d=0, &block
|
55
|
+
a = yield(a,d,self) #unless a=self
|
56
|
+
self.operands.each do |o|
|
57
|
+
a = o.tree_inject(a,d+1,&block)
|
58
|
+
end;a
|
59
|
+
end
|
60
|
+
|
61
|
+
# return an attribute
|
62
|
+
def [] field
|
63
|
+
attributes[field]
|
64
|
+
end
|
65
|
+
# set an attribute
|
66
|
+
def []= field, val
|
67
|
+
self.name ||= val
|
68
|
+
attributes[field]= val
|
69
|
+
end
|
70
|
+
# return the default base collection for new collections
|
71
|
+
def self.default
|
72
|
+
universe
|
73
|
+
end
|
74
|
+
|
75
|
+
# create pshuffle out of the collection
|
76
|
+
def pshuffle
|
77
|
+
Collection.new_pshuffle(self)
|
78
|
+
end
|
79
|
+
# create queue out of the collection
|
80
|
+
def queue
|
81
|
+
Collection.new_queue(self.list.ids)
|
82
|
+
end
|
83
|
+
# get the parent of the collection, eg. the collection this one is based on
|
84
|
+
def parent
|
85
|
+
operands.find{true}
|
86
|
+
end
|
87
|
+
|
88
|
+
# construct new constructor, used to define all of the new_<type> functions
|
89
|
+
def self.new_constructor ref, hash
|
90
|
+
hash.each_pair do |n,t|
|
91
|
+
module_eval <<-EOE
|
92
|
+
def self.#{n.to_s} *args
|
93
|
+
u = args.first.is_a?(Collection) ? args.shift : Collection.default
|
94
|
+
self.#{ref.to_s}(#{t},u,*args)
|
95
|
+
end
|
96
|
+
EOE
|
97
|
+
end
|
98
|
+
end
|
99
|
+
# create a new list (queue or idlist)
|
100
|
+
def self.new_list type, base, ids
|
101
|
+
ids = ids.ids if ids.is_a?(Songlist)
|
102
|
+
c = Collection.new(type)
|
103
|
+
c.name = "#{base.name}:"
|
104
|
+
c.idlist = ids
|
105
|
+
return c
|
106
|
+
end
|
107
|
+
# create a new selection, eg. equals, less, ...
|
108
|
+
# type is by default equals and the base of the list is the default one
|
109
|
+
# and an attribute has of type :field => :value, ...
|
110
|
+
def self.new_selection type, base, hash
|
111
|
+
hash.each_pair do|f,v|
|
112
|
+
c = Collection.new(type)
|
113
|
+
c.name ||= "#{base.name+'.' if base.name}#{v}"
|
114
|
+
c.operands.push base
|
115
|
+
c.attributes.add(:field => f, :value =>v)
|
116
|
+
base = c
|
117
|
+
end;base
|
118
|
+
end
|
119
|
+
|
120
|
+
# create a pshuffle out of base, if base is a hash, create an new_equals
|
121
|
+
def self.new_pshuffle base=Collection.default
|
122
|
+
base = Collection.new_equals(base) if base.is_a? Hash
|
123
|
+
c = Collection.new(TYPE_PARTYSHUFFLE)
|
124
|
+
c.name = "#{base.name}%"
|
125
|
+
c.operands.push(base)
|
126
|
+
return c
|
127
|
+
end
|
128
|
+
# create new_equals, new_has, new_greater and new_smaller constructors
|
129
|
+
new_constructor :new_selection,
|
130
|
+
:new_equals => TYPE_EQUALS, :new_match => TYPE_MATCH, :new_has => TYPE_HAS,
|
131
|
+
:new_greater => TYPE_GREATER, :new_smaller => TYPE_SMALLER
|
132
|
+
# create new_queue and new_idlist constructors
|
133
|
+
new_constructor :new_list,
|
134
|
+
:new_queue => TYPE_QUEUE, :new_idlist => TYPE_IDLIST
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# interface for client configuration. it will load config.
|
2
|
+
module Xmms
|
3
|
+
# don't quit on excetions in user code
|
4
|
+
def self.save_call
|
5
|
+
begin
|
6
|
+
yield
|
7
|
+
rescue Exception => e
|
8
|
+
puts "!! check your config: #{e}"
|
9
|
+
puts "!! "+e.backtrace.format("!! ")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
class Client
|
13
|
+
# edit you config file
|
14
|
+
def configure editor=ENV['EDITOR']||'vi'
|
15
|
+
system "#{editor} #{File.join(X2C_CONF,'config.rb')}"
|
16
|
+
end
|
17
|
+
# copy config into userconfdir
|
18
|
+
def setup
|
19
|
+
src = File.join(X2C_ROOT,'config.rb')
|
20
|
+
[`mkdir #{X2C_CONF} 2>&1`+
|
21
|
+
`mkdir #{File.join(X2C_CONF,'plug')} 2>&1`+
|
22
|
+
`cp #{src} #{X2C_CONF} 2>&1`+
|
23
|
+
"created confdir #{X2C_CONF} with the files",
|
24
|
+
`ls #{X2C_CONF} 2>&1`.split.map{|n| '> '+n}]
|
25
|
+
end
|
26
|
+
# empty methods that can be overwritten
|
27
|
+
def pre_connect; end
|
28
|
+
def post_connect; end
|
29
|
+
def welcome; end
|
30
|
+
end
|
31
|
+
begin
|
32
|
+
require File.join(X2C_CONF,'config.rb')
|
33
|
+
rescue LoadError => l
|
34
|
+
if l.message =~ /#{File.join(X2C_CONF,'config.rb')}/
|
35
|
+
require 'config.rb'
|
36
|
+
require 'plug/tutorial.rb'
|
37
|
+
else
|
38
|
+
require 'config.rb'
|
39
|
+
puts "!! check your config: #{l}"
|
40
|
+
puts "!! "+l.backtrace.format("!! ")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/x2c/core/meta.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Copyright by Daniel Waeber, see the LICENSE file for details
|
2
|
+
# some metaprogrammming stuff
|
3
|
+
module Help
|
4
|
+
@@ignore ||= Hash.new
|
5
|
+
def self.ignore klass, hash
|
6
|
+
@@ignore[klass] = (@@ignore[klass] || Hash.new).merge hash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def shortcut new, old
|
11
|
+
Help.ignore(self, new.to_sym => :skip)
|
12
|
+
class_eval <<-EVAL
|
13
|
+
def #{new} *args, &block
|
14
|
+
#{old} *args, &block
|
15
|
+
end
|
16
|
+
EVAL
|
17
|
+
end
|
18
|
+
def alias_forward new, target, old=new
|
19
|
+
if target.is_a?(Symbol)
|
20
|
+
Help.ignore(self,
|
21
|
+
new => {target.to_sym => :over})
|
22
|
+
define_method(new) do |*args|
|
23
|
+
send(target).send(old,*args)
|
24
|
+
end
|
25
|
+
else
|
26
|
+
Help.ignore(self, new => {})
|
27
|
+
define_method(new) do |*args|
|
28
|
+
target.send(old, *args)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def dynamic_forward target
|
34
|
+
respond = "__respond_to_#{target}?"
|
35
|
+
methods = "__methods_#{target}"
|
36
|
+
missing = "__method_missing_#{target}"
|
37
|
+
Help.ignore(self,
|
38
|
+
:method_missing => {respond.to_sym => :over,
|
39
|
+
target.to_sym => :over,
|
40
|
+
missing.to_sym => :skip})
|
41
|
+
Help.ignore(Kernel, respond.to_sym => :over)
|
42
|
+
class_eval <<-EVAL
|
43
|
+
alias_method :#{respond}, :respond_to?
|
44
|
+
alias_method :#{methods}, :methods
|
45
|
+
def respond_to? *args
|
46
|
+
#{respond}(*args) || #{target}.respond_to?(*args)
|
47
|
+
end
|
48
|
+
def methods
|
49
|
+
#{methods} + #{target}.methods
|
50
|
+
end
|
51
|
+
alias_method :#{missing}, :method_missing
|
52
|
+
def method_missing id, *args, &block
|
53
|
+
if #{respond}(id)
|
54
|
+
#{missing}(id,*args,&block)
|
55
|
+
else
|
56
|
+
#{target}.send(id,*args,&block)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
EVAL
|
60
|
+
end
|
61
|
+
|
62
|
+
def after_method_hook id, &block
|
63
|
+
oid = "__#{id}".to_sym
|
64
|
+
alias_method oid, id
|
65
|
+
define_method id do |*args|
|
66
|
+
block.call(send(oid,*args))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
def before_method_hook id, &block
|
70
|
+
oid = "__#{id}".to_sym
|
71
|
+
alias_method oid, id
|
72
|
+
define_method id do |*args|
|
73
|
+
catch(:nocall) do
|
74
|
+
send(oid, *block.call(*args))
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|