simple-client 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.bundle/config +4 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +23 -0
- data/bin/rake +16 -0
- data/lib/simple-client/simple-client.rb +229 -0
- data/lib/simple-client/version.rb +4 -0
- data/lib/simple-client.rb +1 -0
- data/test/test_simple-client.rb +236 -0
- data/vendor/bundle/ruby/1.8/bin/rake +19 -0
- data/vendor/bundle/ruby/1.8/cache/addressable-2.2.8.gem +0 -0
- data/vendor/bundle/ruby/1.8/cache/crack-0.3.1.gem +0 -0
- data/vendor/bundle/ruby/1.8/cache/rake-0.9.2.2.gem +0 -0
- data/vendor/bundle/ruby/1.8/cache/webmock-1.8.8.gem +0 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/CHANGELOG.md +126 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Gemfile +17 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Gemfile.lock +35 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/LICENSE.txt +202 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/README.md +83 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/Rakefile +37 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna/native.rb +43 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna/pure.rb +4886 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/idna.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/template.rb +1047 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/uri.rb +2288 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/lib/addressable/version.rb +30 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/idna_spec.rb +216 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/net_http_compat_spec.rb +26 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/template_spec.rb +2144 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/spec/addressable/uri_spec.rb +4928 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/clobber.rake +2 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/gem.rake +85 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/git.rake +45 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/metrics.rake +22 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/rspec.rake +58 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/rubyforge.rake +89 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/tasks/yard.rake +27 -0
- data/vendor/bundle/ruby/1.8/gems/addressable-2.2.8/website/index.html +110 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/History +25 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/LICENSE +20 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/README.rdoc +42 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/Rakefile +32 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/crack.gemspec +53 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/json.rb +79 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/util.rb +17 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack/xml.rb +232 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/lib/crack.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/crack_test.rb +4 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/data/twittersearch-firefox.json +1 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/data/twittersearch-ie.json +1 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/hash_test.rb +28 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/json_test.rb +82 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/parser_test.rb +27 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/string_test.rb +31 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/test_helper.rb +12 -0
- data/vendor/bundle/ruby/1.8/gems/crack-0.3.1/test/xml_test.rb +499 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/CHANGES +522 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/README.rdoc +197 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/Rakefile +369 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/TODO +20 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/bin/rake +33 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/command_line_usage.rdoc +114 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/glossary.rdoc +51 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/jamis.rb +591 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rake.1.gz +0 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rakefile.rdoc +557 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.6.rdoc +55 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/install.rb +90 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/alt_system.rb +109 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/application.rb +595 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/classic_namespace.rb +11 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/clean.rb +32 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/cloneable.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/ftptools.rb +150 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/publisher.rb +73 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/rubyforgepublisher.rb +16 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/sys.rb +191 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/default_loader.rb +10 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/dsl_definition.rb +176 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/early_time.rb +18 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/core.rb +27 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb +39 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/string.rb +167 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/time.rb +14 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_list.rb +403 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_task.rb +47 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_utils.rb +114 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb +145 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/gempackagetask.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/invocation_chain.rb +51 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/loaders/makefile.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/multi_task.rb +16 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/name_space.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/packagetask.rb +185 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/pathmap.rb +1 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/pseudo_status.rb +24 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb +29 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb +234 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/ruby182_test_unit_fix.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/runtest.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task.rb +327 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_arguments.rb +78 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/task_manager.rb +307 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/tasklib.rb +22 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/testtask.rb +191 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/version.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/win32.rb +55 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake.rb +69 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/file_creation.rb +34 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/helper.rb +492 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_application.rb +489 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_application_options.rb +335 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_clean.rb +14 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_definitions.rb +80 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_directory_task.rb +46 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_dsl.rb +77 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_extension.rb +59 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_list.rb +628 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_list_path_map.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_task.rb +102 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_file_utils.rb +305 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_ftp_file.rb +59 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_functional.rb +450 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_invocation_chain.rb +52 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_makefile_loader.rb +44 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_multi_task.rb +51 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_name_space.rb +43 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map.rb +157 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rake_test_loader.rb +21 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rdoc_task.rb +83 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_require.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_rules.rb +327 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task.rb +267 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_argument_parsing.rb +103 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_arguments.rb +88 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_lib.rb +9 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_manager.rb +157 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_manager_argument_resolution.rb +36 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_task_with_arguments.rb +173 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_test_task.rb +120 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_top_level_functions.rb +111 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/ruby/1.8/gems/rake-0.9.2.2/test/test_sys.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/CHANGELOG.md +749 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Gemfile +21 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Guardfile +24 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/LICENSE +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/README.md +728 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/Rakefile +65 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/api.rb +63 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/assertion_failure.rb +11 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/callback_registry.rb +35 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/config.rb +10 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/cucumber.rb +8 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/deprecation.rb +9 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/errors.rb +33 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/curb_adapter.rb +287 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/em_http_request/em_http_request_0_x.rb +151 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb +212 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +11 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/excon_adapter.rb +95 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/httpclient_adapter.rb +193 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/net_http.rb +279 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/patron_adapter.rb +129 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +180 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/matchers/hash_including_matcher.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/minitest.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rack_response.rb +63 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_execution_verifier.rb +56 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_pattern.rb +282 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_registry.rb +35 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_signature.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/request_stub.rb +97 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/response.rb +144 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/responses_sequence.rb +40 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers/request_pattern_matcher.rb +42 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers/webmock_matcher.rb +46 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec/matchers.rb +28 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/rspec.rb +33 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/stub_registry.rb +61 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/stub_request_snippet.rb +30 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/test_unit.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/hash_counter.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/hash_keys_stringifier.rb +23 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/headers.rb +43 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/json.rb +54 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/uri.rb +101 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/util/version_checker.rb +73 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/version.rb +3 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock/webmock.rb +124 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/lib/webmock.rb +49 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/test_helper.rb +29 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/test_webmock.rb +6 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/minitest/webmock_spec.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/curb/curb_spec.rb +340 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/curb/curb_spec_helper.rb +144 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/em_http_request/em_http_request_spec.rb +183 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +72 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/excon/excon_spec.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/excon/excon_spec_helper.rb +38 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/httpclient/httpclient_spec.rb +76 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/httpclient/httpclient_spec_helper.rb +48 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_shared.rb +125 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_spec.rb +255 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/net_http_spec_helper.rb +55 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/patron/patron_spec.rb +136 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/patron/patron_spec_helper.rb +50 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +142 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/callbacks.rb +146 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/request_expectations.rb +666 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/returning_declared_responses.rb +367 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/stubbing_requests.rb +447 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +74 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +56 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/webmock_shared.rb +41 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/quality_spec.rb +60 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/spec_helper.rb +57 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/example_curl_output.txt +22 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/my_rack_app.rb +48 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/network_connection.rb +25 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/support/webmock_server.rb +65 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/errors_spec.rb +32 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/rack_response_spec.rb +74 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_execution_verifier_spec.rb +100 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_pattern_spec.rb +479 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_registry_spec.rb +75 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_signature_spec.rb +113 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/request_stub_spec.rb +198 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/response_spec.rb +267 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/stub_registry_spec.rb +86 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/stub_request_snippet_spec.rb +95 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/hash_counter_spec.rb +39 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/headers_spec.rb +28 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/json_spec.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/uri_spec.rb +257 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/util/version_checker_spec.rb +59 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/unit/webmock_spec.rb +7 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/http_request.rb +24 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/shared_test.rb +76 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/test_helper.rb +23 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/test/test_webmock.rb +6 -0
- data/vendor/bundle/ruby/1.8/gems/webmock-1.8.8/webmock.gemspec +35 -0
- data/vendor/bundle/ruby/1.8/specifications/addressable-2.2.8.gemspec +38 -0
- data/vendor/bundle/ruby/1.8/specifications/crack-0.3.1.gemspec +25 -0
- data/vendor/bundle/ruby/1.8/specifications/rake-0.9.2.2.gemspec +33 -0
- data/vendor/bundle/ruby/1.8/specifications/webmock-1.8.8.gemspec +61 -0
- metadata +390 -0
@@ -0,0 +1,557 @@
|
|
1
|
+
= Rakefile Format (as of version 0.8.7)
|
2
|
+
|
3
|
+
First of all, there is no special format for a Rakefile. A Rakefile
|
4
|
+
contains executable Ruby code. Anything legal in a ruby script is
|
5
|
+
allowed in a Rakefile.
|
6
|
+
|
7
|
+
Now that we understand there is no special syntax in a Rakefile, there
|
8
|
+
are some conventions that are used in a Rakefile that are a little
|
9
|
+
unusual in a typical Ruby program. Since a Rakefile is tailored to
|
10
|
+
specifying tasks and actions, the idioms used in a Rakefile are
|
11
|
+
designed to support that.
|
12
|
+
|
13
|
+
So, what goes into a Rakefile?
|
14
|
+
|
15
|
+
== Tasks
|
16
|
+
|
17
|
+
Tasks are the main unit of work in a Rakefile. Tasks have a name
|
18
|
+
(usually given as a symbol or a string), a list of prerequisites (more
|
19
|
+
symbols or strings) and a list of actions (given as a block).
|
20
|
+
|
21
|
+
=== Simple Tasks
|
22
|
+
|
23
|
+
A task is declared by using the +task+ method. +task+ takes a single
|
24
|
+
parameter that is the name of the task.
|
25
|
+
|
26
|
+
task :name
|
27
|
+
|
28
|
+
=== Tasks with Prerequisites
|
29
|
+
|
30
|
+
Any prerequisites are given as a list (enclosed in square brackets)
|
31
|
+
following the name and an arrow (=>).
|
32
|
+
|
33
|
+
task :name => [:prereq1, :prereq2]
|
34
|
+
|
35
|
+
<b>NOTE:</b> Although this syntax looks a little funky, it is legal
|
36
|
+
Ruby. We are constructing a hash where the key is :name and the value
|
37
|
+
for that key is the list of prerequisites. It is equivalent to the
|
38
|
+
following ...
|
39
|
+
|
40
|
+
hash = Hash.new
|
41
|
+
hash[:name] = [:prereq1, :prereq2]
|
42
|
+
task(hash)
|
43
|
+
|
44
|
+
=== Tasks with Actions
|
45
|
+
|
46
|
+
Actions are defined by passing a block to the +task+ method. Any Ruby
|
47
|
+
code can be placed in the block. The block may reference the task
|
48
|
+
object via the block parameter.
|
49
|
+
|
50
|
+
task :name => [:prereq1, :prereq2] do |t|
|
51
|
+
# actions (may reference t)
|
52
|
+
end
|
53
|
+
|
54
|
+
=== Multiple Definitions
|
55
|
+
|
56
|
+
A task may be specified more than once. Each specification adds its
|
57
|
+
prerequisites and actions to the existing definition. This allows one
|
58
|
+
part of a rakefile to specify the actions and a different rakefile
|
59
|
+
(perhaps separately generated) to specify the dependencies.
|
60
|
+
|
61
|
+
For example, the following is equivalent to the single task
|
62
|
+
specification given above.
|
63
|
+
|
64
|
+
task :name
|
65
|
+
task :name => [:prereq1]
|
66
|
+
task :name => [:prereq2]
|
67
|
+
task :name do |t|
|
68
|
+
# actions
|
69
|
+
end
|
70
|
+
|
71
|
+
== File Tasks
|
72
|
+
|
73
|
+
Some tasks are designed to create a file from one or more other files.
|
74
|
+
Tasks that generate these files may be skipped if the file already
|
75
|
+
exists. File tasks are used to specify file creation tasks.
|
76
|
+
|
77
|
+
File tasks are declared using the +file+ method (instead of the +task+
|
78
|
+
method). In addition, file tasks are usually named with a string
|
79
|
+
rather than a symbol.
|
80
|
+
|
81
|
+
The following file task creates a executable program (named +prog+)
|
82
|
+
given two object files name <tt>a.o</tt> and <tt>b.o</tt>. The tasks
|
83
|
+
for creating <tt>a.o</tt> and <tt>b.o</tt> are not shown.
|
84
|
+
|
85
|
+
file "prog" => ["a.o", "b.o"] do |t|
|
86
|
+
sh "cc -o #{t.name} #{t.prerequisites.join(' ')}"
|
87
|
+
end
|
88
|
+
|
89
|
+
== Directory Tasks
|
90
|
+
|
91
|
+
It is common to need to create directories upon demand. The
|
92
|
+
+directory+ convenience method is a short-hand for creating a FileTask
|
93
|
+
that creates the directory. For example, the following declaration
|
94
|
+
...
|
95
|
+
|
96
|
+
directory "testdata/examples/doc"
|
97
|
+
|
98
|
+
is equivalent to ...
|
99
|
+
|
100
|
+
file "testdata" do |t| mkdir t.name end
|
101
|
+
file "testdata/examples" do |t| mkdir t.name end
|
102
|
+
file "testdata/examples/doc" do |t| mkdir t.name end
|
103
|
+
|
104
|
+
The +directory+ method does not accept prerequisites or actions, but
|
105
|
+
both prerequisites and actions can be added later. For example ...
|
106
|
+
|
107
|
+
directory "testdata"
|
108
|
+
file "testdata" => ["otherdata"]
|
109
|
+
file "testdata" do
|
110
|
+
cp Dir["standard_data/*.data"], "testdata"
|
111
|
+
end
|
112
|
+
|
113
|
+
== Tasks with Parallel Prerequisites
|
114
|
+
|
115
|
+
Rake allows parallel execution of prerequisites using the following syntax:
|
116
|
+
|
117
|
+
multitask :copy_files => [:copy_src, :copy_doc, :copy_bin] do
|
118
|
+
puts "All Copies Complete"
|
119
|
+
end
|
120
|
+
|
121
|
+
In this example, +copy_files+ is a normal rake task. Its actions are
|
122
|
+
executed whenever all of its prerequisites are done. The big
|
123
|
+
difference is that the prerequisites (+copy_src+, +copy_bin+ and
|
124
|
+
+copy_doc+) are executed in parallel. Each of the prerequisites are
|
125
|
+
run in their own Ruby thread, possibly allowing faster overall runtime.
|
126
|
+
|
127
|
+
=== Secondary Prerequisites
|
128
|
+
|
129
|
+
If any of the primary prerequisites of a multitask have common secondary
|
130
|
+
prerequisites, all of the primary/parallel prerequisites will wait
|
131
|
+
until the common prerequisites have been run.
|
132
|
+
|
133
|
+
For example, if the <tt>copy_<em>xxx</em></tt> tasks have the
|
134
|
+
following prerequisites:
|
135
|
+
|
136
|
+
task :copy_src => [:prep_for_copy]
|
137
|
+
task :copy_bin => [:prep_for_copy]
|
138
|
+
task :copy_doc => [:prep_for_copy]
|
139
|
+
|
140
|
+
Then the +prep_for_copy+ task is run before starting all the copies in
|
141
|
+
parallel. Once +prep_for_copy+ is complete, +copy_src+, +copy_bin+,
|
142
|
+
and +copy_doc+ are all run in parallel. Note that +prep_for_copy+ is
|
143
|
+
run only once, even though it is referenced in multiple threads.
|
144
|
+
|
145
|
+
=== Thread Safety
|
146
|
+
|
147
|
+
The Rake internal data structures are thread-safe with respect
|
148
|
+
to the multitask parallel execution, so there is no need for the user
|
149
|
+
to do extra synchronization for Rake's benefit. However, if there are
|
150
|
+
user data structures shared between the parallel prerequisites, the
|
151
|
+
user must do whatever is necessary to prevent race conditions.
|
152
|
+
|
153
|
+
== Tasks with Arguments
|
154
|
+
|
155
|
+
Prior to version 0.8.0, rake was only able to handle command line
|
156
|
+
arguments of the form NAME=VALUE that were passed into Rake via the
|
157
|
+
ENV hash. Many folks had asked for some kind of simple command line
|
158
|
+
arguments, perhaps using "--" to separate regular task names from
|
159
|
+
argument values on the command line. The problem is that there was no
|
160
|
+
easy way to associate positional arguments on the command line with
|
161
|
+
different tasks. Suppose both tasks :a and :b expect a command line
|
162
|
+
argument: does the first value go with :a? What if :b is run first?
|
163
|
+
Should it then get the first command line argument.
|
164
|
+
|
165
|
+
Rake 0.8.0 solves this problem by explicitly passing values directly
|
166
|
+
to the tasks that need them. For example, if I had a release task
|
167
|
+
that required a version number, I could say:
|
168
|
+
|
169
|
+
rake release[0.8.2]
|
170
|
+
|
171
|
+
And the string "0.8.2" will be passed to the :release task. Multiple
|
172
|
+
arguments can be passed by separating them with a comma, for example:
|
173
|
+
|
174
|
+
rake name[john,doe]
|
175
|
+
|
176
|
+
Just a few words of caution. The rake task name and its arguments
|
177
|
+
need to be a single command line argument to rake. This generally
|
178
|
+
means no spaces. If spaces are needed, then the entire rake +
|
179
|
+
argument string should be quoted. Something like this:
|
180
|
+
|
181
|
+
rake "name[billy bob, smith]"
|
182
|
+
|
183
|
+
(Quoting rules vary between operating systems and shells, so make sure
|
184
|
+
you consult the proper docs for your OS/shell).
|
185
|
+
|
186
|
+
=== Tasks Arguments and the Environment
|
187
|
+
|
188
|
+
Task argument values can also be picked up from the environment. For
|
189
|
+
example, if the "release" task expected a parameter named
|
190
|
+
"release_version", then either
|
191
|
+
|
192
|
+
rake release[0.8.2]
|
193
|
+
|
194
|
+
or
|
195
|
+
|
196
|
+
RELEASE_VERSION rake release
|
197
|
+
|
198
|
+
will work. Environment variable names must either match the task
|
199
|
+
parameter exactly, or match an all-uppercase version of the task
|
200
|
+
parameter.
|
201
|
+
|
202
|
+
=== Tasks that Expect Parameters
|
203
|
+
|
204
|
+
Parameters are only given to tasks that are setup to expect them. In
|
205
|
+
order to handle named parameters, the task declaration syntax for
|
206
|
+
tasks has been extended slightly.
|
207
|
+
|
208
|
+
For example, a task that needs a first name and last name might be
|
209
|
+
declared as:
|
210
|
+
|
211
|
+
task :name, [:first_name, :last_name]
|
212
|
+
|
213
|
+
The first argument is still the name of the task (:name in this case).
|
214
|
+
The next two arguments are the names of the parameters expected by
|
215
|
+
:name in an array (:first_name and :last_name in the example).
|
216
|
+
|
217
|
+
To access the values of the parameters, the block defining the task
|
218
|
+
behaviour can now accept a second parameter:
|
219
|
+
|
220
|
+
task :name, [:first_name, :last_name] do |t, args|
|
221
|
+
puts "First name is #{args.first_name}"
|
222
|
+
puts "Last name is #{args.last_name}"
|
223
|
+
end
|
224
|
+
|
225
|
+
The first argument of the block "t" is always bound to the current
|
226
|
+
task object. The second argument "args" is an open-struct like object
|
227
|
+
that allows access to the task arguments. Extra command line
|
228
|
+
arguments to a task are ignored. Missing command line arguments are
|
229
|
+
picked up from matching environment variables. If there are no
|
230
|
+
matching environment variables, they are given the nil value.
|
231
|
+
|
232
|
+
If you wish to specify default values for the arguments, you can use
|
233
|
+
the with_defaults method in the task body. Here is the above example
|
234
|
+
where we specify default values for the first and last names:
|
235
|
+
|
236
|
+
task :name, [:first_name, :last_name] do |t, args|
|
237
|
+
args.with_defaults(:first_name => "John", :last_name => "Dough")
|
238
|
+
puts "First name is #{args.first_name}"
|
239
|
+
puts "Last name is #{args.last_name}"
|
240
|
+
end
|
241
|
+
|
242
|
+
=== Tasks that Expect Parameters and Have Prerequisites
|
243
|
+
|
244
|
+
Tasks that use parameters have a slightly different format for
|
245
|
+
prerequisites. Use the arrow notation to indicate the prerequisites
|
246
|
+
for tasks with arguments. For example:
|
247
|
+
|
248
|
+
task :name, [:first_name, :last_name] => [:pre_name] do |t, args|
|
249
|
+
args.with_defaults(:first_name => "John", :last_name => "Dough")
|
250
|
+
puts "First name is #{args.first_name}"
|
251
|
+
puts "Last name is #{args.last_name}"
|
252
|
+
end
|
253
|
+
|
254
|
+
=== Deprecated Task Parameters Format
|
255
|
+
|
256
|
+
There is an older format for declaring task parameters that omitted
|
257
|
+
the task argument array and used the :needs keyword to introduce the
|
258
|
+
dependencies. That format is still supported for compatibility, but
|
259
|
+
is not recommended for use. The older format may be dropped in future
|
260
|
+
versions of rake.
|
261
|
+
|
262
|
+
== Accessing Task Programmatically
|
263
|
+
|
264
|
+
Sometimes it is useful to manipulate tasks programmatically in a
|
265
|
+
Rakefile. To find a task object, use the <tt>:[]</tt> operator on the
|
266
|
+
<tt>Rake::Task</tt>.
|
267
|
+
|
268
|
+
=== Programmatic Task Example
|
269
|
+
|
270
|
+
For example, the following Rakefile defines two tasks. The :doit task
|
271
|
+
simply prints a simple "DONE" message. The :dont class will lookup
|
272
|
+
the doit class and remove (clear) all of its prerequisites and
|
273
|
+
actions.
|
274
|
+
|
275
|
+
task :doit do
|
276
|
+
puts "DONE"
|
277
|
+
end
|
278
|
+
|
279
|
+
task :dont do
|
280
|
+
Rake::Task[:doit].clear
|
281
|
+
end
|
282
|
+
|
283
|
+
Running this example:
|
284
|
+
|
285
|
+
$ rake doit
|
286
|
+
(in /Users/jim/working/git/rake/x)
|
287
|
+
DONE
|
288
|
+
$ rake dont doit
|
289
|
+
(in /Users/jim/working/git/rake/x)
|
290
|
+
$
|
291
|
+
|
292
|
+
The ability to programmatically manipulate tasks gives rake very
|
293
|
+
powerful meta-programming capabilities w.r.t. task execution, but
|
294
|
+
should be used with cation.
|
295
|
+
|
296
|
+
== Rules
|
297
|
+
|
298
|
+
When a file is named as a prerequisite, but does not have a file task
|
299
|
+
defined for it, Rake will attempt to synthesize a task by looking at a
|
300
|
+
list of rules supplied in the Rakefile.
|
301
|
+
|
302
|
+
Suppose we were trying to invoke task "mycode.o", but no task is
|
303
|
+
defined for it. But the rakefile has a rule that look like this ...
|
304
|
+
|
305
|
+
rule '.o' => ['.c'] do |t|
|
306
|
+
sh "cc #{t.source} -c -o #{t.name}"
|
307
|
+
end
|
308
|
+
|
309
|
+
This rule will synthesize any task that ends in ".o". It has a
|
310
|
+
prerequisite a source file with an extension of ".c" must exist. If
|
311
|
+
Rake is able to find a file named "mycode.c", it will automatically
|
312
|
+
create a task that builds "mycode.o" from "mycode.c".
|
313
|
+
|
314
|
+
If the file "mycode.c" does not exist, rake will attempt
|
315
|
+
to recursively synthesize a rule for it.
|
316
|
+
|
317
|
+
When a task is synthesized from a rule, the +source+ attribute of the
|
318
|
+
task is set to the matching source file. This allows us to write
|
319
|
+
rules with actions that reference the source file.
|
320
|
+
|
321
|
+
=== Advanced Rules
|
322
|
+
|
323
|
+
Any regular expression may be used as the rule pattern. Additionally,
|
324
|
+
a proc may be used to calculate the name of the source file. This
|
325
|
+
allows for complex patterns and sources.
|
326
|
+
|
327
|
+
The following rule is equivalent to the example above.
|
328
|
+
|
329
|
+
rule( /\.o$/ => [
|
330
|
+
proc {|task_name| task_name.sub(/\.[^.]+$/, '.c') }
|
331
|
+
]) do |t|
|
332
|
+
sh "cc #{t.source} -c -o #{t.name}"
|
333
|
+
end
|
334
|
+
|
335
|
+
<b>NOTE:</b> Because of a _quirk_ in Ruby syntax, parenthesis are
|
336
|
+
required on *rule* when the first argument is a regular expression.
|
337
|
+
|
338
|
+
The following rule might be used for Java files ...
|
339
|
+
|
340
|
+
rule '.java' => [
|
341
|
+
proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') }
|
342
|
+
] do |t|
|
343
|
+
java_compile(t.source, t.name)
|
344
|
+
end
|
345
|
+
|
346
|
+
<b>NOTE:</b> +java_compile+ is a hypothetical method that invokes the
|
347
|
+
java compiler.
|
348
|
+
|
349
|
+
== Importing Dependencies
|
350
|
+
|
351
|
+
Any ruby file (including other rakefiles) can be included with a
|
352
|
+
standard Ruby +require+ command. The rules and declarations in the
|
353
|
+
required file are just added to the definitions already accumulated.
|
354
|
+
|
355
|
+
Because the files are loaded _before_ the rake targets are evaluated,
|
356
|
+
the loaded files must be "ready to go" when the rake command is
|
357
|
+
invoked. This make generated dependency files difficult to use. By
|
358
|
+
the time rake gets around to updating the dependencies file, it is too
|
359
|
+
late to load it.
|
360
|
+
|
361
|
+
The +Rake.import+ command addresses this by specifying a file to be
|
362
|
+
loaded _after_ the main rakefile is loaded, but _before_ any targets
|
363
|
+
on the command line are invoked. In addition, if the file name
|
364
|
+
matches an explicit task, that task is invoked before loading the
|
365
|
+
file. This allows dependency files to be generated and used in a
|
366
|
+
single rake command invocation.
|
367
|
+
|
368
|
+
<b>NOTE:</b> Starting in Rake version 0.9.0, the top level +import+
|
369
|
+
command is deprecated and we recommend using the scoped
|
370
|
+
"+Rake.import+" command mentioned above. Future versions of Rake will
|
371
|
+
drop support for the top level +import+ command.
|
372
|
+
|
373
|
+
=== Example:
|
374
|
+
|
375
|
+
require 'rake/loaders/makefile'
|
376
|
+
|
377
|
+
file ".depends.mf" => [SRC_LIST] do |t|
|
378
|
+
sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
|
379
|
+
end
|
380
|
+
|
381
|
+
Rake.import ".depends.mf"
|
382
|
+
|
383
|
+
If ".depends" does not exist, or is out of date w.r.t. the source
|
384
|
+
files, a new ".depends" file is generated using +makedepend+ before
|
385
|
+
loading.
|
386
|
+
|
387
|
+
== Comments
|
388
|
+
|
389
|
+
Standard Ruby comments (beginning with "#") can be used anywhere it is
|
390
|
+
legal in Ruby source code, including comments for tasks and rules.
|
391
|
+
However, if you wish a task to be described using the "-T" switch,
|
392
|
+
then you need to use the +desc+ command to describe the task.
|
393
|
+
|
394
|
+
=== Example:
|
395
|
+
|
396
|
+
desc "Create a distribution package"
|
397
|
+
task :package => [ ... ] do ... end
|
398
|
+
|
399
|
+
The "-T" switch (or "--tasks" if you like to spell things out) will
|
400
|
+
display a list of tasks that have a description. If you use +desc+ to
|
401
|
+
describe your major tasks, you have a semi-automatic way of generating
|
402
|
+
a summary of your Rake file.
|
403
|
+
|
404
|
+
traken$ rake -T
|
405
|
+
(in /home/.../rake)
|
406
|
+
rake clean # Remove any temporary products.
|
407
|
+
rake clobber # Remove any generated file.
|
408
|
+
rake clobber_rdoc # Remove rdoc products
|
409
|
+
rake contrib_test # Run tests for contrib_test
|
410
|
+
rake default # Default Task
|
411
|
+
rake install # Install the application
|
412
|
+
rake lines # Count lines in the main rake file
|
413
|
+
rake rdoc # Build the rdoc HTML Files
|
414
|
+
rake rerdoc # Force a rebuild of the RDOC files
|
415
|
+
rake test # Run tests
|
416
|
+
rake testall # Run all test targets
|
417
|
+
|
418
|
+
Only tasks with descriptions will be displayed with the "-T" switch.
|
419
|
+
Use "-P" (or "--prereqs") to get a list of all tasks and their
|
420
|
+
prerequisites.
|
421
|
+
|
422
|
+
== Namespaces
|
423
|
+
|
424
|
+
As projects grow (and along with it, the number of tasks), it is
|
425
|
+
common for task names to begin to clash. For example, if you might
|
426
|
+
have a main program and a set of sample programs built by a single
|
427
|
+
Rakefile. By placing the tasks related to the main program in one
|
428
|
+
namespace, and the tasks for building the sample programs in a
|
429
|
+
different namespace, the task names will not will not interfere with
|
430
|
+
each other.
|
431
|
+
|
432
|
+
For example:
|
433
|
+
|
434
|
+
namespace "main" do
|
435
|
+
task :build do
|
436
|
+
# Build the main program
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
440
|
+
namespace "samples" do
|
441
|
+
task :build do
|
442
|
+
# Build the sample programs
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
task :build => ["main:build", "samples:build"]
|
447
|
+
|
448
|
+
Referencing a task in a separate namespace can be achieved by
|
449
|
+
prefixing the task name with the namespace and a colon
|
450
|
+
(e.g. "main:build" refers to the :build task in the +main+ namespace).
|
451
|
+
Nested namespaces are supported, so
|
452
|
+
|
453
|
+
Note that the name given in the +task+ command is always the unadorned
|
454
|
+
task name without any namespace prefixes. The +task+ command always
|
455
|
+
defines a task in the current namespace.
|
456
|
+
|
457
|
+
=== FileTasks
|
458
|
+
|
459
|
+
File task names are not scoped by the namespace command. Since the
|
460
|
+
name of a file task is the name of an actual file in the file system,
|
461
|
+
it makes little sense to include file task names in name space.
|
462
|
+
Directory tasks (created by the +directory+ command) are a type of
|
463
|
+
file task and are also not affected by namespaces.
|
464
|
+
|
465
|
+
=== Name Resolution
|
466
|
+
|
467
|
+
When looking up a task name, rake will start with the current
|
468
|
+
namespace and attempt to find the name there. If it fails to find a
|
469
|
+
name in the current namespace, it will search the parent namespaces
|
470
|
+
until a match is found (or an error occurs if there is no match).
|
471
|
+
|
472
|
+
The "rake" namespace is a special implicit namespace that refers to
|
473
|
+
the toplevel names.
|
474
|
+
|
475
|
+
If a task name begins with a "^" character, the name resolution will
|
476
|
+
start in the parent namespace. Multiple "^" characters are allowed.
|
477
|
+
|
478
|
+
Here is an example file with multiple :run tasks and how various names
|
479
|
+
resolve in different locations.
|
480
|
+
|
481
|
+
task :run
|
482
|
+
|
483
|
+
namespace "one" do
|
484
|
+
task :run
|
485
|
+
|
486
|
+
namespace "two" do
|
487
|
+
task :run
|
488
|
+
|
489
|
+
# :run => "one:two:run"
|
490
|
+
# "two:run" => "one:two:run"
|
491
|
+
# "one:two:run" => "one:two:run"
|
492
|
+
# "one:run" => "one:run"
|
493
|
+
# "^run" => "one:run"
|
494
|
+
# "^^run" => "rake:run" (the top level task)
|
495
|
+
# "rake:run" => "rake:run" (the top level task)
|
496
|
+
end
|
497
|
+
|
498
|
+
# :run => "one:run"
|
499
|
+
# "two:run" => "one:two:run"
|
500
|
+
# "^run" => "rake:run"
|
501
|
+
end
|
502
|
+
|
503
|
+
# :run => "rake:run"
|
504
|
+
# "one:run" => "one:run"
|
505
|
+
# "one:two:run" => "one:two:run"
|
506
|
+
|
507
|
+
== FileLists
|
508
|
+
|
509
|
+
FileLists are the way Rake manages lists of files. You can treat a
|
510
|
+
FileList as an array of strings for the most part, but FileLists
|
511
|
+
support some additional operations.
|
512
|
+
|
513
|
+
=== Creating a FileList
|
514
|
+
|
515
|
+
Creating a file list is easy. Just give it the list of file names:
|
516
|
+
|
517
|
+
fl = FileList['file1.rb', file2.rb']
|
518
|
+
|
519
|
+
Or give it a glob pattern:
|
520
|
+
|
521
|
+
fl = FileList['*.rb']
|
522
|
+
|
523
|
+
== Odds and Ends
|
524
|
+
|
525
|
+
=== do/end versus { }
|
526
|
+
|
527
|
+
Blocks may be specified with either a +do+/+end+ pair, or with curly
|
528
|
+
braces in Ruby. We _strongly_ recommend using +do+/+end+ to specify the
|
529
|
+
actions for tasks and rules. Because the rakefile idiom tends to
|
530
|
+
leave off parentheses on the task/file/rule methods, unusual
|
531
|
+
ambiguities can arise when using curly braces.
|
532
|
+
|
533
|
+
For example, suppose that the method +object_files+ returns a list of
|
534
|
+
object files in a project. Now we use +object_files+ as the
|
535
|
+
prerequisites in a rule specified with actions in curly braces.
|
536
|
+
|
537
|
+
# DON'T DO THIS!
|
538
|
+
file "prog" => object_files {
|
539
|
+
# Actions are expected here (but it doesn't work)!
|
540
|
+
}
|
541
|
+
|
542
|
+
Because curly braces have a higher precedence than +do+/+end+, the
|
543
|
+
block is associated with the +object_files+ method rather than the
|
544
|
+
+file+ method.
|
545
|
+
|
546
|
+
This is the proper way to specify the task ...
|
547
|
+
|
548
|
+
# THIS IS FINE
|
549
|
+
file "prog" => object_files do
|
550
|
+
# Actions go here
|
551
|
+
end
|
552
|
+
|
553
|
+
----
|
554
|
+
|
555
|
+
== See
|
556
|
+
|
557
|
+
* README.rdoc -- Main documentation for Rake.
|
@@ -0,0 +1,151 @@
|
|
1
|
+
= Why rake?
|
2
|
+
|
3
|
+
Ok, let me state from the beginning that I never intended to write this
|
4
|
+
code. I'm not convinced it is useful, and I'm not convinced anyone
|
5
|
+
would even be interested in it. All I can say is that Why's onion truck
|
6
|
+
must by been passing through the Ohio valley.
|
7
|
+
|
8
|
+
What am I talking about? ... A Ruby version of Make.
|
9
|
+
|
10
|
+
See, I can sense you cringing already, and I agree. The world certainly
|
11
|
+
doesn't need yet another reworking of the "make" program. I mean, we
|
12
|
+
already have "ant". Isn't that enough?
|
13
|
+
|
14
|
+
It started yesterday. I was helping a coworker fix a problem in one of
|
15
|
+
the Makefiles we use in our project. Not a particularly tough problem,
|
16
|
+
but during the course of the conversation I began lamenting some of the
|
17
|
+
shortcomings of make. In particular, in one of my makefiles I wanted to
|
18
|
+
determine the name of a file dynamically and had to resort to some
|
19
|
+
simple scripting (in Ruby) to make it work. "Wouldn't it be nice if you
|
20
|
+
could just use Ruby inside a Makefile" I said.
|
21
|
+
|
22
|
+
My coworker (a recent convert to Ruby) agreed, but wondered what it
|
23
|
+
would look like. So I sketched the following on the whiteboard...
|
24
|
+
|
25
|
+
"What if you could specify the make tasks in Ruby, like this ..."
|
26
|
+
|
27
|
+
task "build" do
|
28
|
+
java_compile(...args, etc ...)
|
29
|
+
end
|
30
|
+
|
31
|
+
"The task function would register "build" as a target to be made,
|
32
|
+
and the block would be the action executed whenever the build
|
33
|
+
system determined that it was time to do the build target."
|
34
|
+
|
35
|
+
We agreed that would be cool, but writing make from scratch would be WAY
|
36
|
+
too much work. And that was the end of that!
|
37
|
+
|
38
|
+
... Except I couldn't get the thought out of my head. What exactly
|
39
|
+
would be needed to make the about syntax work as a make file? Hmmm, you
|
40
|
+
would need to register the tasks, you need some way of specifying
|
41
|
+
dependencies between tasks, and some way of kicking off the process.
|
42
|
+
Hey! What if we did ... and fifteen minutes later I had a working
|
43
|
+
prototype of Ruby make, complete with dependencies and actions.
|
44
|
+
|
45
|
+
I showed the code to my coworker and we had a good laugh. It was just
|
46
|
+
about a page worth of code that reproduced an amazing amount of the
|
47
|
+
functionality of make. We were both truly stunned with the power of
|
48
|
+
Ruby.
|
49
|
+
|
50
|
+
But it didn't do everything make did. In particular, it didn't have
|
51
|
+
timestamp based file dependencies (where a file is rebuilt if any of its
|
52
|
+
prerequisite files have a later timestamp). Obviously THAT would be a
|
53
|
+
pain to add and so Ruby Make would remain an interesting experiment.
|
54
|
+
|
55
|
+
... Except as I walked back to my desk, I started thinking about what
|
56
|
+
file based dependencies would really need. Rats! I was hooked again,
|
57
|
+
and by adding a new class and two new methods, file/timestamp
|
58
|
+
dependencies were implemented.
|
59
|
+
|
60
|
+
Ok, now I was really hooked. Last night (during CSI!) I massaged the
|
61
|
+
code and cleaned it up a bit. The result is a bare-bones replacement
|
62
|
+
for make in exactly 100 lines of code.
|
63
|
+
|
64
|
+
For the curious, you can see it at ...
|
65
|
+
* doc/proto_rake.rdoc
|
66
|
+
|
67
|
+
Oh, about the name. When I wrote the example Ruby Make task on my
|
68
|
+
whiteboard, my coworker exclaimed "Oh! I have the perfect name: Rake ...
|
69
|
+
Get it? Ruby-Make. Rake!" He said he envisioned the tasks as leaves
|
70
|
+
and Rake would clean them up ... or something like that. Anyways, the
|
71
|
+
name stuck.
|
72
|
+
|
73
|
+
Some quick examples ...
|
74
|
+
|
75
|
+
A simple task to delete backup files ...
|
76
|
+
|
77
|
+
task :clean do
|
78
|
+
Dir['*~'].each {|fn| rm fn rescue nil}
|
79
|
+
end
|
80
|
+
|
81
|
+
Note that task names are symbols (they are slightly easier to type
|
82
|
+
than quoted strings ... but you may use quoted string if you would
|
83
|
+
rather). Rake makes the methods of the FileUtils module directly
|
84
|
+
available, so we take advantage of the <tt>rm</tt> command. Also note
|
85
|
+
the use of "rescue nil" to trap and ignore errors in the <tt>rm</tt>
|
86
|
+
command.
|
87
|
+
|
88
|
+
To run it, just type "rake clean". Rake will automatically find a
|
89
|
+
Rakefile in the current directory (or above!) and will invoke the
|
90
|
+
targets named on the command line. If there are no targets explicitly
|
91
|
+
named, rake will invoke the task "default".
|
92
|
+
|
93
|
+
Here's another task with dependencies ...
|
94
|
+
|
95
|
+
task :clobber => [:clean] do
|
96
|
+
rm_r "tempdir"
|
97
|
+
end
|
98
|
+
|
99
|
+
Task :clobber depends upon task :clean, so :clean will be run before
|
100
|
+
:clobber is executed.
|
101
|
+
|
102
|
+
Files are specified by using the "file" command. It is similar to the
|
103
|
+
task command, except that the task name represents a file, and the task
|
104
|
+
will be run only if the file doesn't exist, or if its modification time
|
105
|
+
is earlier than any of its prerequisites.
|
106
|
+
|
107
|
+
Here is a file based dependency that will compile "hello.cc" to
|
108
|
+
"hello.o".
|
109
|
+
|
110
|
+
file "hello.cc"
|
111
|
+
file "hello.o" => ["hello.cc"] do |t|
|
112
|
+
srcfile = t.name.sub(/\.o$/, ".cc")
|
113
|
+
sh %{g++ #{srcfile} -c -o #{t.name}}
|
114
|
+
end
|
115
|
+
|
116
|
+
I normally specify file tasks with string (rather than symbols). Some
|
117
|
+
file names can't be represented by symbols. Plus it makes the
|
118
|
+
distinction between them more clear to the casual reader.
|
119
|
+
|
120
|
+
Currently writing a task for each and every file in the project would be
|
121
|
+
tedious at best. I envision a set of libraries to make this job
|
122
|
+
easier. For instance, perhaps something like this ...
|
123
|
+
|
124
|
+
require 'rake/ctools'
|
125
|
+
Dir['*.c'].each do |fn|
|
126
|
+
c_source_file(fn)
|
127
|
+
end
|
128
|
+
|
129
|
+
where "c_source_file" will create all the tasks need to compile all the
|
130
|
+
C source files in a directory. Any number of useful libraries could be
|
131
|
+
created for rake.
|
132
|
+
|
133
|
+
That's it. There's no documentation (other than whats in this
|
134
|
+
message). Does this sound interesting to anyone? If so, I'll continue
|
135
|
+
to clean it up and write it up and publish it on RAA. Otherwise, I'll
|
136
|
+
leave it as an interesting exercise and a tribute to the power of Ruby.
|
137
|
+
|
138
|
+
Why /might/ rake be interesting to Ruby programmers. I don't know,
|
139
|
+
perhaps ...
|
140
|
+
|
141
|
+
* No weird make syntax (only weird Ruby syntax :-)
|
142
|
+
* No need to edit or read XML (a la ant)
|
143
|
+
* Platform independent build scripts.
|
144
|
+
* Will run anywhere Ruby exists, so no need to have "make" installed.
|
145
|
+
If you stay away from the "sys" command and use things like
|
146
|
+
'ftools', you can have a perfectly platform independent
|
147
|
+
build script. Also rake is only 100 lines of code, so it can
|
148
|
+
easily be packaged along with the rest of your code.
|
149
|
+
|
150
|
+
So ... Sorry for the long rambling message. Like I said, I never
|
151
|
+
intended to write this code at all.
|