aruba-0.5.3/0000755000004100000410000000000012176213235012643 5ustar www-datawww-dataaruba-0.5.3/aruba.gemspec0000644000004100000410000000210512176213235015300 0ustar www-datawww-data# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'aruba' s.version = '0.5.3' s.authors = ["Aslak Hellesøy", "David Chelimsky", "Mike Sassak", "Matt Wynne"] s.description = 'CLI Steps for Cucumber, hand-crafted for you in Aruba' s.summary = "aruba-#{s.version}" s.email = 'cukes@googlegroups.com' s.homepage = 'http://github.com/cucumber/aruba' s.add_runtime_dependency 'cucumber', '>= 1.1.1' s.add_runtime_dependency 'childprocess', '>= 0.3.6' s.add_runtime_dependency 'rspec-expectations', '>= 2.7.0' s.add_development_dependency 'bcat', '>= 0.6.1' s.add_development_dependency 'kramdown', '>= 0.14' s.add_development_dependency 'rake', '>= 0.9.2' s.add_development_dependency 'rspec', '>= 2.7.0' s.rubygems_version = ">= 1.6.1" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.rdoc_options = ["--charset=UTF-8"] s.require_path = "lib" end aruba-0.5.3/.travis.yml0000644000004100000410000000025012176213235014751 0ustar www-datawww-datalanguage: ruby rvm: - 2.0.0 - 1.9.3 - 1.8.7 - jruby-18mode notifications: email: - cukes-devs@googlegroups.com irc: - "irc.freenode.org#cucumber" aruba-0.5.3/LICENSE0000644000004100000410000000212312176213235013646 0ustar www-datawww-dataCopyright (c) 2010,2011,2012,2013 Aslak Hellesøy, David Chelimsky and Mike Sassak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. aruba-0.5.3/README.md0000644000004100000410000002115012176213235014121 0ustar www-datawww-data[![Build Status](https://secure.travis-ci.org/cucumber/aruba.png)](http://travis-ci.org/cucumber/aruba) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/cucumber/aruba) Aruba is Cucumber extension for testing command line applications written in any programming language. Features at a glance: * Test any command line application * Manipulate the file system * Create great HTML documentation based on your own Cucumber scenarios ## Usage If you have a `Gemfile`, add `aruba`. Otherwise, install it like this: gem install aruba Then, `require` the library in one of your ruby files under `features/support` (e.g. `env.rb`) ```ruby require 'aruba/cucumber' ``` You now have a bunch of step definitions that you can use in your features. Look at `lib/aruba/cucumber.rb` to see them all. Look at `features/*.feature` for examples (which are also testing Aruba itself). ## Configuration Aruba has some default behaviour that you can change if you need to. ### Use a different working directory Per default Aruba will create a directory `tmp/aruba` where it performs its file operations. If you want to change this behaviour put this into your `features/support/env.rb`: ```ruby Before do @dirs = ["somewhere/else"] end ``` ### Modify the PATH Aruba will automatically add the `bin` directory of your project to the `PATH` environment variable for the duration of each Cucumber scenario. So if you're developing a Ruby gem with a binary command, you can test those commands as though the gem were already installed. If you need other directories to be added to the `PATH`, you can put the following in `features/support/env.rb`: ENV['PATH'] = "/my/special/bin/path#{File::PATH_SEPARATOR}#{ENV['PATH']}" ### Increasing timeouts A process sometimes takes longer than expected to terminate, and Aruba will kill them off (and fail your scenario) if it is still alive after 3 seconds. If you need more time you can modify the timeout by assigning a different value to `@aruba_timeout_seconds` in a `Before` block: ```ruby Before do @aruba_timeout_seconds = 5 end ``` ### Increasing IO wait time Running processes interactively can result in race conditions when Aruba executes an IO-related step but the interactive process has not yet flushed or read some content. To help prevent this Aruba waits before reading or writing to the process if it is still running. You can control the wait by setting `@aruba_io_wait_seconds` to an appropriate value. This is particularly useful with tags: ```ruby Before('@slow_process') do @aruba_io_wait_seconds = 5 end ``` ### Tags Aruba defines several tags that you can put on on individual scenarios, or on a feature. #### Seeing more output with `@announce-*` To get more information on what Aruba is doing, use these tags: * `@announce-cmd` - See what command is run * `@announce-stdout` - See the stdout * `@announce-stderr` - See the stderr * `@announce-dir` - See the current directory * `@announce-env` - See environment variables set by Aruba * `@announce` - Does all of the above ### Adding Hooks You can hook into Aruba's lifecycle just before it runs a command: ```ruby Aruba.configure do |config| config.before_cmd do |cmd| puts "About to run '#{cmd}'" end end ``` #### Keep files around with `@no-clobber` Aruba clobbers all files in its working directory before each scenario. -Unless you tag it with `@no-clobber` #### Making assertions about ANSI escapes with `@ansi` Aruba strips away ANSI escapes from the stdout and stderr of spawned child processes by default. It's usually rather cumbersome to make assertions about coloured output. Still, there might be cases where you want to leave the ANSI escapes intact. Just tag your scenario with `@ansi`. Alternatively you can add your own Before hook that sets `@aruba_keep_ansi = true`. ### Testing Ruby CLI programs without spawning a new Ruby process. If your CLI program is written in Ruby you can speed up your suite of scenarios by running your CLI in the same process as Cucumber/Aruba itself. In order to be able to do this, the entry point for your CLI application must be a class that has a constructor with a particular signature and an `execute!` method: ```ruby class MyMain def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel) @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel end def execute! # your code here, assign a value to exitstatus @kernel.exit(exitstatus) end end ``` Your `bin/something` executable would look something like the following: ```ruby require 'my_main' MyMain.new(ARGV.dup).execute! ``` Then wire it all up in your `features/support/env.rb` file: ```ruby require 'aruba' require 'aruba/in_process' Aruba::InProcess.main_class = MyMain Aruba.process = Aruba::InProcess ``` That's it! Everything will now run inside the same ruby process, making your suite a lot faster. Cucumber itself uses this approach to test itself, so check out the Cucumber source code for an example. ### JRuby Tips Improve startup time by disabling JIT and forcing client JVM mode. This can be accomplished by adding ```ruby require 'aruba/jruby' ``` or setting a hook like this example: ```ruby Aruba.configure do |config| config.before_cmd do |cmd| set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived set_env('JAVA_OPTS', "-d32 #{ENV['JAVA_OPTS']}") # force jRuby to use client JVM for faster startup times end end if RUBY_PLATFORM == 'java' ``` *Note* - no conflict resolution on the JAVA/JRuby environment options is done; only merging. For more complex settings please manually set the environment variables in the hook or externally. A larger process timeout for java may be needed ```ruby Before do @aruba_timeout_seconds = RUBY_PLATFORM == 'java' ? 60 : 10 end ``` Refer to http://blog.headius.com/2010/03/jruby-startup-time-tips.html for other tips on startup time. ## Reporting *Important* - you need [Pygments](http://pygments.org/) installed to use this feature. Aruba can generate a HTML page for each scenario that contains: * The title of the scenario * The description from the scenario (You can use Markdown here) * The command(s) that were run * The output from those commands (in colour if the output uses ANSI escapes) * The files that were created (syntax highlighted in in colour) In addition to this, it creates an `index.html` file with links to all individual report files. Reporting is off by default, but you can enable it by defining the `ARUBA_REPORT_DIR` environment variable, giving it the value where reports should be written: ARUBA_REPORT_DIR=doc cucumber features This will use Aruba's built-in template by default (See the `templates` folder). If you want to use your own template you can override its location: ARUBA_REPORT_TEMPLATES=templates ARUBA_REPORT_DIR=doc cucumber features The templates directory must contain a `main.erb` and `files.erb` template. It can also contain other assets such as css, javascript and images. All of these files will be copied over to the report dir well. ### Escaping Markdown There are some edge cases where Gherkin and Markdown don't agree. Bullet lists using `*` is one example. The `*` is also an alias for step keywords in Gherkin. Markdown headers (the kind starting with a `#`) is another example. They are parsed as comments by Gherkin. To use either of these, just escape them with a backslash. So instead of writing: ```gherkin Scenario: Make tea ## Making tea * Get a pot * And some hot water Given... ``` You'd write: ```gherkin Scenario: Make tea \## Making tea \* Get a pot \* And some hot water Given... ``` This way Gherkin won't recognize these lines as special tokens, and the reporter will render them as Markdown. (The reporter strips away any leading the backslashes before handing it off to the Markdown parser). Another option is to use alternative Markdown syntax and omit conflicts and escaping altogether: ```gherkin Scenario: Make tea Making tea ---------- - Get a pot - And some hot water Given... ``` ## Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. Note: the existing tests may fail * Commit, do not mess with Rakefile, gemspec or History. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. ## Copyright Copyright (c) 2010,2011,2012,2013 Aslak Hellesøy, David Chelimsky and Mike Sassak. See LICENSE for details. aruba-0.5.3/Rakefile0000644000004100000410000000103612176213235014310 0ustar www-datawww-data# encoding: utf-8 require 'rubygems' require 'bundler' Bundler.setup Bundler::GemHelper.install_tasks require 'cucumber/rake/task' Cucumber::Rake::Task.new do |t| end Cucumber::Rake::Task.new(:cucumber_wip) do |t| t.cucumber_opts = "-p wip" end require 'rspec/core/rake_task' desc "Run RSpec" RSpec::Core::RakeTask.new do |spec| spec.pattern = 'spec/**/*_spec.rb' spec.rspec_opts = ['--color', '--format nested'] end desc "Run tests, both RSpec and Cucumber" task :test => [:spec, :cucumber, :cucumber_wip] task :default => :test aruba-0.5.3/History.md0000644000004100000410000002577212176213235014643 0ustar www-datawww-data## [master](https://github.com/cucumber/aruba/compare/v0.5.2...master) * Fix for UTF-8 support (#151 Matt Wynne, Jarl Friis) * Fix for open file leakage (#150 @JonRowe) ## [v0.5.2](https://github.com/cucumber/aruba/compare/v0.5.1...v0.5.2) * Plugin API for greater speed. Test Ruby CLI programs in a single Ruby process (#148 Aslak Hellesøy) * Fix memory leak when several commands are executed in a single run (#144 @y-higuchi) ## [v0.5.1](https://github.com/cucumber/aruba/compare/v0.5.0...v0.5.1) * Individual timeout settings when running commands (#124 Jarl Friis) * Varous fixes for JRuby tests, should now work on more versions of JRuby ## [v0.5.0](https://github.com/cucumber/aruba/compare/v0.4.10...v0.5.0) * Add #with_file_content to the DSL (#110 Pavel Argentov) * Make JRuby performance tweaks optional (#102 Taylor Carpenter, #125 Andy Lindeman) * Add assert_partial_output_interactive so you can peek at the output from a running process (#104 Taylor Carpenter) * Add assert_not_matching_output (#111 Pavel Argentov) * Add remove_dir (#121 Piotr Niełacny) ## [v0.4.11](https://github.com/cucumber/aruba/compare/v0.4.10...v0.4.11) * Fix duplicated output (#91 Robert Wahler, Matt Wynne) * Fix Gemspec format (#101 Matt Wynne) ## [v0.4.10](https://github.com/cucumber/aruba/compare/v0.4.9...v0.4.10) * Fix broken JRuby file following rename of hook (Thomas Reynolds) * Add terminate method to API (Taylor Carpenter) ## [v0.4.9](https://github.com/cucumber/aruba/compare/v0.4.8...v0.4.9) * Rename before_run hook to before_cmd (Matt Wynne) * Fix 1.8.7 compatibility (#95 Dave Copeland) ## [v0.4.8](https://github.com/cucumber/aruba/compare/v0.4.7...v0.4.8) * Add before_run hook (Matt Wynne) * Add JRuby performance tweaks (#93 Myron Marston / Matt Wynne) * Invalid/Corrupt spec file for 0.4.7 - undefined method call for nil:Nilclass (#47 Aslak Hellesøy) ## [v0.4.7](https://github.com/cucumber/aruba/compare/v0.4.6...v0.4.7) * Remove rdiscount dependency. (#85 Aslak Hellesøy) * Pin to ffi 1.0.9 since 1.0.10 is broken. (Aslak Hellesøy) * Added file size specific steps to the Aruba API. (#89 Hector Castro) ## [v0.4.6](https://github.com/cucumber/aruba/compare/v0.4.5...v0.4.6) * Upgraded deps to latest gems. (Aslak Hellesøy) * Added Regexp support to Aruba::Api#assert_no_partial_output (Aslak Hellesøy) ## [v0.4.5](https://github.com/cucumber/aruba/compare/v0.4.4...v0.4.5) * Better assertion failure message when an exit code is not as expected. (Matt Wynne) ## [v0.4.4](https://github.com/cucumber/aruba/compare/v0.4.3...v0.4.4) * Fix various bugs with interative processes. (Matt Wynne) ## [v0.4.3](https://github.com/cucumber/aruba/compare/v0.4.2...v0.4.3) * Aruba reporting now creates an index file for reports, linking them all together. (Aslak Hellesøy) ## [v0.4.2](https://github.com/cucumber/aruba/compare/v0.4.1...v0.4.2) * Appending to a file creates the parent directory if it doesn't exist. (Aslak Hellesøy) ## [v0.4.1](https://github.com/cucumber/aruba/compare/v0.4.0...v0.4.1) * Move more logic into Aruba::Api (Aslak Hellesøy) ## [v0.4.0](https://github.com/cucumber/aruba/compare/v0.3.7...v0.4.0) * New, awesome HTML reporting feature that captures everything that happens during a scenario. (Aslak Hellesøy) * ANSI escapes from output are stripped by default. Override this with the @ansi tag. (Aslak Hellesøy) ## [v0.3.7](https://github.com/cucumber/aruba/compare/v0.3.6...v0.3.7) * Make Aruba::Api#get_process return the last executed process with passed cmd (Potapov Sergey) * Replace announce with puts to comply with cucumber 0.10.6 (Aslak Hellesøy) * Fix childprocess STDIN to be synchronous (#40, #71 Tim Ekl) ## [v0.3.6](https://github.com/cucumber/aruba/compare/v0.3.5...v0.3.6) * Changed default value of @aruba_timeout_seconds from 1 to 3. (Aslak Hellesøy) * Separate hooks and steps to make it easier to build your own steps on top of Aruba's API (Mike Sassak) * @no-clobber to prevent cleanup before each scenario (Mike Sassak) ## [v0.3.5](https://github.com/cucumber/aruba/compare/v0.3.4...v0.3.5) * Store processes in an array to ensure order of operations on Ruby 1.8.x (#48 Mike Sassak) ## [v0.3.4](https://github.com/cucumber/aruba/compare/v0.3.3...v0.3.4) * Use backticks (\`) instead of quotes (") to specify command line. Quote still works, but is deprecated. (Anthony Eden, Aslak Hellesøy) ## [v0.3.3](https://github.com/cucumber/aruba/compare/v0.3.2...v0.3.3) * Updated RSpec development requirement to 2.5 (Robert Speicher, Mike Sassak, Aslak Hellesøy) * Updated RubyGems dependency to 1.6.1 (Robert Speicher) ## [v0.3.2](https://github.com/cucumber/aruba/compare/v0.3.1...v0.3.2) * Wrong number of args in the When I overwrite step (Aslak Hellesøy) ## [v0.3.1](https://github.com/cucumber/aruba/compare/v0.3.0...v0.3.1) * Broken 0.3.0 release (#43, #44 Mike Sassak) * Quotes (") and newline (\n) in step arguments are no longer unescaped. (Aslak Hellesøy) ## [v0.3.0](https://github.com/cucumber/aruba/compare/v0.2.8...v0.3.0) * Remove latency introduced in the 0.2.8 release (#42 Mike Sassak) * New stepdef Then /^the stdout should contain:$/ do |partial_output| (Aslak Hellesøy) * Quotes (") and newline (\n) in step arguments no longer need to be backslash-escaped. (Aslak Hellesøy) ## [v0.2.8](https://github.com/cucumber/aruba/compare/v0.2.7...v0.2.8) * Replaced background_process with childprocess, a cross-platform process control library. This will allow Aruba to run on Windows and JRuby in addition to *nix MRI. (#16, #27, #31 Mike Sassak, Jari Bakken, Matt Wynne, Arve Knudsen) ## [v0.2.7](https://github.com/cucumber/aruba/compare/v0.2.6...v0.2.7) * Upgrade to Cucumber 0.10.0. (Aslak Hellesøy) * require 'aruba' does nothing - you have to require 'aruba/cucumber' now. This is to prevent bundler from loading it when we don't want to. (Aslak Hellesøy) * Outputting a lot of data causes process to time out (#30 Mike Sassak) ## [v0.2.6](https://github.com/cucumber/aruba/compare/v0.2.5...v0.2.6) * You can set @aruba_timeout_seconds in a Before hook to tell Aruba to wait for a process to complete. Default: 1 second. (Aslak Hellesøy) * Fixed small bug in /^the stdout should contain exactly:$/ (Aslak Hellesøy) ## [v0.2.5](https://github.com/cucumber/aruba/compare/v0.2.4...v0.2.5) * Added 'a file named "whatever" should (not) exist' (Robert Speicher) * Added 'a directory named "whatever" should (not) exist' (Robert Speicher) * Added /^the stderr should contain exactly:"$/ (Aslak Hellesøy) * Added /^the stdout should contain exactly:"$/ (Aslak Hellesøy) * Added /it should pass with exactly:/ (Aslak Hellesøy) * @announce, @announce-dir and @announce-cmd for interactive processes (Mike Sassak) * Add step defs for detecting output, stdout and stderr by process name (Mike Sassak) * Stop all processes before verifying filesystem changes to ensure async operations are complete (#17 Mike Sassak) * Outputting large amounts of data causes run steps to hang (#18 Mike Sassak) ## [v0.2.4](https://github.com/cucumber/aruba/compare/v0.2.3...v0.2.4) * Added step definitions for removing files and checking presence of a single file. (Aslak Hellesøy) ## [v0.2.3](https://github.com/cucumber/aruba/compare/v0.2.2...v0.2.3) * Directory should not exist gives false-positive (#13,#15 Nicholas Rutherford) * Added step definitions for comparing file contents with regexps (#9 Aslak Hellesøy) * Always put ./bin at the beginning of $PATH to make it easier to run own executables (#7 Aslak Hellesøy) * Communication with interactive processes (#4 Mike Sassak) * Remove hyphens separating stdout and stderr (Arve Knudsen) ## [v0.2.2](https://github.com/cucumber/aruba/compare/v0.2.1...v0.2.2) * Added a @bin tag that sets up './bin' first on the path (Aslak Hellesøy) * Richer API making aruba easier to use from Ruby code. (Mark Nijhof, Aslak Hellesøy) * No more support for RVM. Use rvm 1.9.2,1.8.7 exec cucumber .... instead. (Mark Nijhof, Aslak Hellesøy) ## [v0.2.1](https://github.com/cucumber/aruba/compare/v0.2.0...v0.2.1) * Always compare with RSpec should =~ instead of should match. This gives a diff when there is no match. (Aslak Hellesøy) ## [v0.2.0](https://github.com/cucumber/aruba/compare/v0.1.9...v0.2.0) * Added aruba.gemspec. (David Chelimsky) * Several step definitions regarding output have changed. (#1 Aslak Hellesøy) - /^I should see "([^\"]*)"$/ + /^the output should contain "([^"]*)"$/ - /^I should not see "([^\"]*)"$/ + /^the output should not contain "([^"]*)"$/ - /^I should see:$/ + /^the output should contain:$/ - /^I should not see:$/ + /^the output should not contain:$/ - /^I should see exactly "([^\"]*)"$/ + /^the output should contain exactly "([^"]*)"$/ - /^I should see exactly:$/ + /^the output should contain exactly:$/ - /^I should see matching \/([^\/]*)\/$/ + /^the output should match \/([^\/]*)\/$/ - /^I should see matching:$/ + /^the output should match:$/ ## [v0.1.9](https://github.com/cucumber/aruba/compare/v0.1.8...v0.1.9) * If the GOTGEMS environment variable is set, bundler won't run (faster). (Aslak Hellesøy) ## [v0.1.8](https://github.com/cucumber/aruba/compare/v0.1.7...v0.1.8) * Use // instead of "" for "I should see matching" step. (Aslak Hellesøy) * Replace rvm gemset character '%' with '@' for rvm 0.1.24 (#5 Ashley Moran) * Support gem bundler, making it easier to specify gems. (Aslak Hellesøy) ## [v0.1.7](https://github.com/cucumber/aruba/compare/v0.1.6...v0.1.7) * New @announce-stderr tag (Robert Wahler) * New "I should see matching" steps using Regexp (Robert Wahler) ## [v0.1.6](https://github.com/cucumber/aruba/compare/v0.1.5...v0.1.6) * When /^I successfully run "(.*)"$/ now prints the combined output if exit status is not 0. (Aslak Hellesøy) * Add bundle to list of common ruby scripts. (Aslak Hellesøy) ## [v0.1.5](https://github.com/cucumber/aruba/compare/v0.1.4...v0.1.5) * Added ability to map rvm versions to a specific version with config/aruba-rvm.yml. (Aslak Hellesøy) * Check for presence of files. (Aslak Hellesøy) * Allow specification of rvm gemsets. (Aslak Hellesøy) * Detect ruby commands and use current ruby when rvm is not explicitly used. (Aslak Hellesøy) * Added support for rvm, making it possible to choose Ruby interpreter. (Aslak Hellesøy) * Added @announce-cmd, @announce-stdout and @announce tags, useful for seeing what's executed and outputted. (Aslak Hellesøy) ## [v0.1.4](https://github.com/cucumber/aruba/compare/v0.1.3...v0.1.4) * New step definition for appending to a file (Aslak Hellesøy) ## [v0.1.3](https://github.com/cucumber/aruba/compare/v0.1.2...v0.1.3) * New step definition for cd (change directory) (Aslak Hellesøy) ## [v0.1.2](https://github.com/cucumber/aruba/compare/v0.1.1...v0.1.2) * Separated API from Cucumber step definitions, makes this usable without Cucumber. (Aslak Hellesøy) ## [v0.1.1](https://github.com/cucumber/aruba/compare/v0.1.0...v0.1.1) * Better Regexp escaping (David Chelimsky) ## [v0.1.0](https://github.com/cucumber/aruba/compare/ed6a175d23aaff62dbf355706996f276f304ae8b...v0.1.1) * First release (David Chelimsky and Aslak Hellesøy) aruba-0.5.3/features/0000755000004100000410000000000012176213235014461 5ustar www-datawww-dataaruba-0.5.3/features/exit_statuses.feature0000644000004100000410000000171112176213235020742 0ustar www-datawww-dataFeature: exit statuses In order to specify expected exit statuses As a developer using Cucumber I want to use the "the exit status should be" step Scenario: exit status of 0 When I run `true` Then the exit status should be 0 Scenario: non-zero exit status When I run `false` Then the exit status should be 1 And the exit status should not be 0 Scenario: Successfully run something When I successfully run `true` Scenario: Successfully run something for a long time Given The default aruba timeout is 0 seconds When I successfully run `sleep 1` for up to 2 seconds Scenario: Unsuccessfully run something that takes too long Given The default aruba timeout is 0 seconds When I do aruba I successfully run `sleep 1` Then aruba should fail with "process still alive after 0 seconds" Scenario: Unsuccessfully run something When I do aruba I successfully run `false` Then aruba should fail with "" aruba-0.5.3/features/interactive.feature0000644000004100000410000000214312176213235020353 0ustar www-datawww-dataFeature: Interactive process control In order to test interactive command line applications As a developer using Cucumber I want to use the interactive session steps @wip-jruby-java-1.6 Scenario: Running ruby interactively Given a file named "echo.rb" with: """ while res = gets.chomp break if res == "quit" puts res.reverse end """ When I run `ruby echo.rb` interactively And I type "hello, world" And I type "quit" Then it should pass with: """ dlrow ,olleh """ @posix Scenario: Running a native binary interactively When I run `cat` interactively And I type "Hello, world" And I type "" Then the output should contain: """ Hello, world """ @posix Scenario: Stop processes before checking for filesystem changes See: http://github.com/aslakhellesoy/aruba/issues#issue/17 for context Given a directory named "rename_me" When I run `mv rename_me renamed` interactively Then a directory named "renamed" should exist And a directory named "rename_me" should not exist aruba-0.5.3/features/custom_ruby_process.feature0000644000004100000410000000062712176213235022154 0ustar www-datawww-dataFeature: Custom Ruby Process Running a lot of scenarios where each scenario uses Aruba to spawn a new ruby process can be time consuming. Aruba lets you plug in your own process class that can run a command in the same ruby process as Cucumber/Aruba. @in-process Scenario: Run a passing custom process When I run `reverse olleh dlrow` Then the output should contain "hello world" aruba-0.5.3/features/no_clobber.feature0000644000004100000410000000137212176213235020145 0ustar www-datawww-dataFeature: No clobber By default Aruba removes its scratch directory before every scenario. This isn't always the right thing to do, especially when the path to the default directory has been changed. Use @no-clobber to stop Aruba from cleaning up after itself. Scenario: Change the filesystem Given a directory named "foo/bar" And a file named "foo/bar/baz.txt" with: """ I don't want to die! """ @no-clobber Scenario: Verify nothing was clobbered Then a file named "foo/bar/baz.txt" should exist And the file "foo/bar/baz.txt" should contain exactly: """ I don't want to die! """ Scenario: Cleanup and verify the previous scenario Then a file named "foo/bar/baz.txt" should not exist aruba-0.5.3/features/utf-8.feature0000644000004100000410000000046712176213235017010 0ustar www-datawww-dataFeature: UTF-8 Scenario: Write then assert on the content of a file with UTF-8 characters in Given a file named "turning-japanese" with: """ フィーチャ """ And I run `cat turning-japanese` Then the output should contain exactly: """ フィーチャ """ aruba-0.5.3/features/output.feature0000644000004100000410000001523112176213235017400 0ustar www-datawww-dataFeature: Output In order to specify expected output As a developer using Cucumber I want to use the "the output should contain" step @posix Scenario: Detect subset of one-line output When I run `printf 'hello world'` Then the output should contain "hello world" Scenario: Detect absence of one-line output When I run `printf "hello world"` Then the output should not contain "good-bye" Scenario: Detect subset of multiline output When I run `printf "hello\nworld"` Then the output should contain: """ hello """ Scenario: Detect absence of multiline output When I run `printf "hello\nworld"` Then the output should not contain: """ good-bye """ @posix Scenario: Detect exact one-line output When I run `printf "hello world"` Then the output should contain exactly: """ hello world """ @ansi @posix Scenario: Detect exact one-line output with ANSI output When I run `printf "\e[36mhello world\e[0m"` Then the output should contain exactly: """ \e[36mhello world\e[0m """ @posix Scenario: Detect exact one-line output with ANSI output stripped by default When I run `printf "\e[36mhello world\e[0m"` Then the output should contain exactly: """ hello world """ @posix Scenario: Detect exact multiline output When I run `printf "hello\nworld"` Then the output should contain exactly: """ hello world """ @announce Scenario: Detect subset of one-line output with regex When I run `printf "hello, ruby"` Then the output should contain "ruby" And the output should match /^hello(, world)?/ @announce @posix Scenario: Detect subset of multiline output with regex When I run `printf "hello\nworld\nextra line1\nextra line2\nimportant line"` Then the output should match: """ he..o wor.d .* important line """ @announce Scenario: Negative matching of one-line output with regex When I run `printf "hello, ruby"` Then the output should contain "ruby" And the output should not match /ruby is a better perl$/ @announce @posix Scenario: Negative matching of multiline output with regex When I run `printf "hello\nworld\nextra line1\nextra line2\nimportant line"` Then the output should not match: """ ruby is a .* perl """ @announce @posix Scenario: Match passing exit status and partial output When I run `printf "hello\nworld"` Then it should pass with: """ hello """ @posix Scenario: Match passing exit status and exact output When I run `printf "hello\nworld"` Then it should pass with exactly: """ hello world """ @announce-stdout Scenario: Match failing exit status and partial output When I run `bash -c '(printf "hello\nworld";exit 99)'` Then it should fail with: """ hello """ @posix Scenario: Match failing exit status and exact output When I run `bash -c '(printf "hello\nworld";exit 99)'` Then it should fail with exactly: """ hello world """ @announce-stdout @posix Scenario: Match failing exit status and output with regex When I run `bash -c '(printf "hello\nworld";exit 99)'` Then it should fail with regex: """ hello\s*world """ @announce-cmd @posix Scenario: Match output in stdout When I run `printf "hello\nworld"` Then the stdout should contain "hello" Then the stderr should not contain "hello" @announce Scenario: Match output on several lines When I run `printf 'GET /'` Then the stdout should contain: """ GET / """ @posix Scenario: Match output on several lines using quotes When I run `printf 'GET "/"'` Then the stdout should contain: """ GET "/" """ @posix Scenario: Detect output from all processes When I run `printf "hello world!\n"` And I run `cat` interactively And I type "hola" And I type "" Then the output should contain exactly: """ hello world! hola """ @posix Scenario: Detect stdout from all processes When I run `printf "hello world!\n"` And I run `cat` interactively And I type "hola" And I type "" Then the stdout should contain: """ hello world! hola """ And the stderr should not contain anything @posix Scenario: Detect stderr from all processes When I run `bash -c 'printf "hello world!\n" >&2'` And I run `bash -c 'cat >&2 '` interactively And I type "hola" And I type "" Then the stderr should contain: """ hello world! hola """ And the stdout should not contain anything Scenario: Detect output from named source When I run `printf 'simple'` And I run `cat` interactively And I type "interactive" And I type "" Then the output from "printf 'simple'" should contain "simple" And the output from "printf 'simple'" should contain exactly "simple" And the output from "printf 'simple'" should contain exactly: """ simple """ And the output from "cat" should not contain "simple" Scenario: Detect stdout from named source When I run `printf 'hello'` And I run `printf 'goodbye'` Then the stdout from "printf 'hello'" should contain "hello" And the stdout from "printf 'hello'" should contain exactly "hello" And the stdout from "printf 'hello'" should contain exactly: """ hello """ And the stderr from "printf 'hello'" should not contain "hello" And the stdout from "printf 'goodbye'" should not contain "hello" Scenario: Detect stderr from named source When I run `bash -c 'printf hello >&2'` And I run `printf goodbye` Then the stderr from "bash -c 'printf hello >&2'" should contain "hello" And the stderr from "bash -c 'printf hello >&2'" should contain exactly "hello" And the stderr from "bash -c 'printf hello >&2'" should contain exactly: """ hello """ And the stdout from "bash -c 'printf hello >&2'" should not contain "hello" And the stderr from "printf goodbye" should not contain "hello" Scenario: Detect second output from named source with custom name When I set env variable "ARUBA_TEST_VAR" to "first" And I run `bash -c 'printf $ARUBA_TEST_VAR'` Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "first" When I set env variable "ARUBA_TEST_VAR" to "second" And I run `bash -c 'printf $ARUBA_TEST_VAR'` Then the output from "bash -c 'printf $ARUBA_TEST_VAR'" should contain "second" aruba-0.5.3/features/flushing.feature0000644000004100000410000000163012176213235017655 0ustar www-datawww-dataFeature: Flushing output In order to test processes that output a lot of data As a developer using Aruba I want to make sure that large amounts of output aren't buffered Scenario: A little output When I run `bash -c 'for ((c=0; c<256; c = c+1)); do echo -n "a"; done'` Then the output should contain "a" And the output should be 256 bytes long And the exit status should be 0 Scenario: Tons of output When I run `bash -c 'for ((c=0; c<65536; c = c+1)); do echo -n "a"; done'` Then the output should contain "a" And the output should be 65536 bytes long And the exit status should be 0 Scenario: Tons of interactive output When I run `bash -c 'read size; for ((c=0; c<$size; c = c+1)); do echo -n "a"; done'` interactively And I type "65536" Then the output should contain "a" And the output should be 65536 bytes long # And the exit status should be 0 aruba-0.5.3/features/step_definitions/0000755000004100000410000000000012176213235020027 5ustar www-datawww-dataaruba-0.5.3/features/step_definitions/aruba_dev_steps.rb0000644000004100000410000000135412176213235023525 0ustar www-datawww-dataWhen /^I do aruba (.*)$/ do |aruba_step| begin step(aruba_step) rescue => e @aruba_exception = e end end # Useful for debugging timing problems When /^sleep (\d+)$/ do |time| sleep time.to_i end When /^I set env variable "(\w+)" to "([^"]*)"$/ do |var, value| ENV[var] = value end Then /^aruba should fail with "([^"]*)"$/ do |error_message| @aruba_exception.message.should include(unescape(error_message)) end Then /^the following step should fail with Spec::Expectations::ExpectationNotMetError:$/ do |multiline_step| proc {steps multiline_step}.should raise_error(RSpec::Expectations::ExpectationNotMetError) end Then /^the output should be (\d+) bytes long$/ do |length| all_output.length.should == length.to_i end aruba-0.5.3/features/file_system_commands.feature0000644000004100000410000001100412176213235022236 0ustar www-datawww-dataFeature: file system commands In order to specify commands that load files As a developer using Cucumber I want to create temporary files Scenario: create a dir Given a directory named "foo/bar" When I run `file foo/bar` Then the stdout should contain "foo/bar: directory" Scenario: create a file Given a file named "foo/bar/example.txt" with: """ hello world """ When I run `cat foo/bar/example.txt` Then the output should contain exactly "hello world" Scenario: create a fixed sized file Given a 1048576 byte file named "test.txt" Then a 1048576 byte file named "test.txt" should exist Scenario: Append to a file \### We like appending to files: 1. Disk space is cheap 1. It's completely safe \### Here is a list: - One - Two Given a file named "foo/bar/example.txt" with: """ hello world """ When I append to "foo/bar/example.txt" with: """ this was appended """ When I run `cat foo/bar/example.txt` Then the stdout should contain "hello world" And the stdout should contain "this was appended" Scenario: Append to a new file When I append to "thedir/thefile" with "x" And I append to "thedir/thefile" with "y" Then the file "thedir/thefile" should contain "xy" Scenario: clean up files generated in previous scenario Then the file "foo/bar/example.txt" should not exist Scenario: change to a subdir Given a file named "foo/bar/example.txt" with: """ hello world """ When I cd to "foo/bar" And I run `cat example.txt` Then the output should contain "hello world" Scenario: Reset current directory from previous scenario When I run `pwd` Then the output should match /\057tmp\057aruba$/ Scenario: Holler if cd to bad dir When I do aruba I cd to "foo/nonexistant" Then aruba should fail with "tmp/aruba/foo/nonexistant is not a directory" Scenario: Check for presence of a subset of files Given an empty file named "lorem/ipsum/dolor" Given an empty file named "lorem/ipsum/sit" Given an empty file named "lorem/ipsum/amet" Then the following files should exist: | lorem/ipsum/dolor | | lorem/ipsum/amet | Scenario: Check for absence of files Then the following files should not exist: | lorem/ipsum/dolor | Scenario: Check for presence of a single file Given an empty file named "lorem/ipsum/dolor" Then a file named "lorem/ipsum/dolor" should exist Scenario: Check for absence of a single file Then a file named "lorem/ipsum/dolor" should not exist Scenario: Check for presence of a subset of directories Given a directory named "foo/bar" Given a directory named "foo/bla" Then the following directories should exist: | foo/bar | | foo/bla | Scenario: check for absence of directories Given a directory named "foo/bar" Given a directory named "foo/bla" Then the following step should fail with Spec::Expectations::ExpectationNotMetError: """ Then the following directories should not exist: | foo/bar/ | | foo/bla/ | """ Scenario: Check for presence of a single directory Given a directory named "foo/bar" Then a directory named "foo/bar" should exist Scenario: Check for absence of a single directory Given a directory named "foo/bar" Then the following step should fail with Spec::Expectations::ExpectationNotMetError: """ Then a directory named "foo/bar" should not exist """ Scenario: Check file contents Given a file named "foo" with: """ hello world """ Then the file "foo" should contain "hello world" And the file "foo" should not contain "HELLO WORLD" Scenario: Check file contents with regexp Given a file named "foo" with: """ hello world """ Then the file "foo" should match /hel.o world/ And the file "foo" should not match /HELLO WORLD/ Scenario: Check file contents with docstring Given a file named "foo" with: """ foo bar baz foobar """ Then the file "foo" should contain: """ bar baz """ Scenario: Remove file Given a file named "foo" with: """ hello world """ When I remove the file "foo" Then the file "foo" should not exist Scenario: Just a dummy for reporting Given an empty file named "a/b.txt" Given an empty file named "a/b/c.txt" Given an empty file named "a/b/c/d.txt" aruba-0.5.3/features/before_cmd_hooks.feature0000644000004100000410000000256112176213235021332 0ustar www-datawww-dataFeature: before_cmd hooks You can configure Aruba to run blocks of code before it runs each command. The command will be passed to the block. Scenario: Run a simple command with a before hook Given a file named "test.rb" with: """ $: << '../../lib' require 'aruba/api' Aruba.configure do |config| config.before_cmd do |cmd| puts "about to run `#{cmd}`" end end include Aruba::Api run_simple("echo 'running'") puts all_stdout """ When I run `ruby test.rb` Then it should pass with: """ about to run `echo 'running'` running """ # This should move into a spec Scenario: Use something from the context where the command was run Given a file named "test.rb" with: """ $: << '../../lib' require 'aruba/api' Aruba.configure do |config| config.before_cmd do |cmd| puts "I can see @your_context=#{@your_context}" end end class Test include Aruba::Api def test @your_context = "something" run_simple("echo 'running'") puts all_stdout end end Test.new.test """ When I run `ruby test.rb` Then it should pass with: """ I can see @your_context=something running """ aruba-0.5.3/features/support/0000755000004100000410000000000012176213235016175 5ustar www-datawww-dataaruba-0.5.3/features/support/env.rb0000644000004100000410000000020512176213235017307 0ustar www-datawww-data$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib') require 'aruba/cucumber' require 'fileutils' require 'rspec/expectations' aruba-0.5.3/features/support/jruby.rb0000644000004100000410000000012112176213235017647 0ustar www-datawww-dataif RUBY_PLATFORM == 'java' Before do @aruba_timeout_seconds = 10 end end aruba-0.5.3/features/support/custom_main.rb0000644000004100000410000000102412176213235021035 0ustar www-datawww-datarequire 'aruba' require 'aruba/spawn_process' require 'aruba/in_process' require 'shellwords' require 'stringio' class CustomMain def initialize(argv, stdin, stdout, stderr, kernel) @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel end def execute! @stdout.puts(@argv.map{|arg| arg.reverse}.join(' ')) end end Before('@in-process') do Aruba::InProcess.main_class = CustomMain Aruba.process = Aruba::InProcess end After('~@in-process') do Aruba.process = Aruba::SpawnProcess endaruba-0.5.3/spec/0000755000004100000410000000000012176213235013575 5ustar www-datawww-dataaruba-0.5.3/spec/spec_helper.rb0000644000004100000410000000216612176213235016420 0ustar www-datawww-datarequire 'rspec/core' require 'aruba/api' module ManipulatesConstants # http://digitaldumptruck.jotabout.com/?p=551 def with_constants(constants, &block) saved_constants = {} constants.each do |constant, val| saved_constants[ constant ] = Object.const_get( constant ) Kernel::silence_warnings { Object.const_set( constant, val ) } end begin block.call ensure constants.each do |constant, val| Kernel::silence_warnings { Object.const_set( constant, saved_constants[ constant ] ) } end end end end # http://mislav.uniqpath.com/2011/06/ruby-verbose-mode/ # these methods are already present in Active Support module Kernel def silence_warnings with_warnings(nil) { yield } end def with_warnings(flag) old_verbose, $VERBOSE = $VERBOSE, flag yield ensure $VERBOSE = old_verbose end end unless Kernel.respond_to? :silence_warnings RSpec.configure do |config| config.filter_run :focus => true config.run_all_when_everything_filtered = true config.treat_symbols_as_metadata_keys_with_true_values = true config.include(ManipulatesConstants) end aruba-0.5.3/spec/aruba/0000755000004100000410000000000012176213235014667 5ustar www-datawww-dataaruba-0.5.3/spec/aruba/hooks_spec.rb0000644000004100000410000000076012176213235017354 0ustar www-datawww-datarequire 'aruba/config' describe Aruba::Hooks do it 'executes a stored hook' do hook_was_run = false subject.append :hook_label, lambda { hook_was_run = true } subject.execute :hook_label, self hook_was_run.should be_true end it 'executes a stored hook that takes multiple arguments' do hook_values = [] subject.append :hook_label, lambda { |a,b,c| hook_values = [a,b,c] } subject.execute :hook_label, self, 1, 2, 3 hook_values.should == [1,2,3] end end aruba-0.5.3/spec/aruba/api_spec.rb0000644000004100000410000001173512176213235017006 0ustar www-datawww-datarequire 'spec_helper' describe Aruba::Api do before(:each) do klass = Class.new { include Aruba::Api def set_tag(tag_name, value) self.instance_variable_set "@#{tag_name.to_s}", value end def announce_or_puts(*args) p caller[0..2] end } @aruba = klass.new @file_name = "test.txt" @file_size = 256 @file_path = File.join(@aruba.current_dir, @file_name) (@aruba.dirs.length-1).times do |depth| #Ensure all parent dirs exists dir = File.join(*@aruba.dirs[0..depth]) Dir.mkdir(dir) unless File.exist?(dir) end raise "We must work with relative paths, everything else is dangerous" if ?/ == @aruba.current_dir[0] FileUtils.rm_rf(@aruba.current_dir) Dir.mkdir(@aruba.current_dir) end describe 'current_dir' do it "should return the current dir as 'tmp/aruba'" do @aruba.current_dir.should match(/^tmp\/aruba$/) end end describe 'directories' do context 'delete directory' do before(:each) do @directory_name = 'test_dir' @directory_path = File.join(@aruba.current_dir, @directory_name) Dir.mkdir(@directory_path) end it 'should delete directory' do @aruba.remove_dir(@directory_name) File.exist?(@directory_path).should == false end end end describe 'files' do context 'fixed size' do it "should write a fixed sized file" do @aruba.write_fixed_size_file(@file_name, @file_size) File.exist?(@file_path).should == true File.size(@file_path).should == @file_size end it "should check an existing file size" do @aruba.write_fixed_size_file(@file_name, @file_size) @aruba.check_file_size([[@file_name, @file_size]]) end it "should check an existing file size and fail" do @aruba.write_fixed_size_file(@file_name, @file_size) lambda { @aruba.check_file_size([[@file_name, @file_size + 1]]) }.should raise_error end end context 'existing' do before(:each) { File.open(@file_path, 'w') { |f| f << "" } } it "should delete file" do @aruba.remove_file(@file_name) File.exist?(@file_path).should == false end end end describe 'tags' do describe '@announce_stdout' do after(:each){@aruba.stop_processes!} context 'enabled' do it "should announce to stdout exactly once" do @aruba.should_receive(:announce_or_puts).once @aruba.set_tag(:announce_stdout, true) @aruba.run_simple('echo "hello world"', false) @aruba.all_output.should match(/hello world/) end end context 'disabled' do it "should not announce to stdout" do @aruba.should_not_receive(:announce_or_puts) @aruba.set_tag(:announce_stdout, false) @aruba.run_simple('echo "hello world"', false) @aruba.all_output.should match(/hello world/) end end end end describe "#with_file_content" do before :each do @aruba.write_file(@file_name, "foo bar baz") end it "checks the given file's full content against the expectations in the passed block" do @aruba.with_file_content @file_name do |full_content| full_content.should == "foo bar baz" end end context "checking the file's content against the expectations in the block" do it "is successful when the inner expectations match" do expect do @aruba.with_file_content @file_name do |full_content| full_content.should match /foo/ full_content.should_not match /zoo/ end end . not_to raise_error RSpec::Expectations::ExpectationNotMetError end it "raises RSpec::Expectations::ExpectationNotMetError when the inner expectations don't match" do expect do @aruba.with_file_content @file_name do |full_content| full_content.should match /zoo/ full_content.should_not match /foo/ end end . to raise_error RSpec::Expectations::ExpectationNotMetError end end end #with_file_content describe "#assert_not_matching_output" do before(:each){ @aruba.run_simple("echo foo", false) } after(:each){ @aruba.stop_processes! } it "passes when the output doesn't match a regexp" do @aruba.assert_not_matching_output "bar", @aruba.all_output end it "fails when the output does match a regexp" do expect do @aruba.assert_not_matching_output "foo", @aruba.all_output end . to raise_error RSpec::Expectations::ExpectationNotMetError end end describe "#run_interactive" do before(:each){@aruba.run_interactive "cat"} after(:each){@aruba.stop_processes!} it "respond to input" do @aruba.type "Hello" @aruba.type "" @aruba.all_output.should == "Hello\n" end it "respond to eot" do @aruba.type "Hello" @aruba.eot @aruba.all_output.should == "Hello\n" end end end # Aruba::Api aruba-0.5.3/spec/aruba/spawn_process_spec.rb0000644000004100000410000000173112176213235021116 0ustar www-datawww-datarequire 'aruba/spawn_process' module Aruba describe SpawnProcess do let(:process) { SpawnProcess.new('echo "yo"', 0.1, 0.1) } describe "#stdout" do before { process.run! } it "returns the stdout" do process.stdout.should == "yo\n" end it "returns all the stdout, every time you call it" do process.stdout.should == "yo\n" process.stdout.should == "yo\n" end end describe "#stop" do before { process.run! } it "sends any output to the reader" do reader = stub.as_null_object reader.should_receive(:stdout).with("yo\n") process.stop(reader) end end describe "#run!" do context "upon process launch error" do let(:process_failure) { SpawnProcess.new('does_not_exists', 1, 1) } it "raises a Aruba::LaunchError" do lambda{process_failure.run!}.should raise_error(::Aruba::LaunchError) end end end end end aruba-0.5.3/spec/aruba/jruby_spec.rb0000644000004100000410000000201212176213235017354 0ustar www-datawww-datarequire 'spec_helper' require 'aruba/config' require 'aruba/api' include Aruba::Api describe "Aruba JRuby Startup Helper" do before(:all) do @fake_env = ENV.clone end before(:each) do Aruba.config = Aruba::Config.new @fake_env['JRUBY_OPTS'] = "--1.9" @fake_env['JAVA_OPTS'] = "-Xdebug" end it 'configuration does not load when RUBY_PLATFORM is not java' do with_constants :ENV => @fake_env, :RUBY_PLATFORM => 'x86_64-chocolate' do load 'aruba/jruby.rb' Aruba.config.hooks.execute :before_cmd, self ENV['JRUBY_OPTS'].should == "--1.9" ENV['JAVA_OPTS'].should == "-Xdebug" end end it 'configuration loads for java and merges existing environment variables' do with_constants :ENV => @fake_env, :RUBY_PLATFORM => 'java' do RbConfig::CONFIG.stub(:[] => 'solaris') load 'aruba/jruby.rb' Aruba.config.hooks.execute :before_cmd, self ENV['JRUBY_OPTS'].should == "-X-C --1.9" ENV['JAVA_OPTS'].should == "-d32 -Xdebug" end end end aruba-0.5.3/.rspec0000644000004100000410000000001012176213235013747 0ustar www-datawww-data--color aruba-0.5.3/.document0000644000004100000410000000007412176213235014463 0ustar www-datawww-dataREADME.rdoc lib/**/*.rb bin/* features/**/*.feature LICENSE aruba-0.5.3/metadata.yml0000644000004100000410000001223712176213235015153 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: aruba version: !ruby/object:Gem::Version version: 0.5.3 prerelease: platform: ruby authors: - Aslak Hellesøy - David Chelimsky - Mike Sassak - Matt Wynne autorequire: bindir: bin cert_chain: [] date: 2013-05-17 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: cucumber requirement: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 1.1.1 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 1.1.1 - !ruby/object:Gem::Dependency name: childprocess requirement: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 0.3.6 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 0.3.6 - !ruby/object:Gem::Dependency name: rspec-expectations requirement: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 2.7.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 2.7.0 - !ruby/object:Gem::Dependency name: bcat requirement: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 0.6.1 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 0.6.1 - !ruby/object:Gem::Dependency name: kramdown requirement: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0.14' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0.14' - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 0.9.2 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 0.9.2 - !ruby/object:Gem::Dependency name: rspec requirement: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 2.7.0 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 2.7.0 description: CLI Steps for Cucumber, hand-crafted for you in Aruba email: cukes@googlegroups.com executables: [] extensions: [] extra_rdoc_files: [] files: - .document - .gitignore - .rspec - .rvmrc - .travis.yml - Gemfile - History.md - LICENSE - README.md - Rakefile - aruba.gemspec - config/.gitignore - cucumber.yml - features/before_cmd_hooks.feature - features/custom_ruby_process.feature - features/exit_statuses.feature - features/file_system_commands.feature - features/flushing.feature - features/interactive.feature - features/no_clobber.feature - features/output.feature - features/step_definitions/aruba_dev_steps.rb - features/support/custom_main.rb - features/support/env.rb - features/support/jruby.rb - features/utf-8.feature - lib/aruba.rb - lib/aruba/api.rb - lib/aruba/config.rb - lib/aruba/cucumber.rb - lib/aruba/cucumber/hooks.rb - lib/aruba/errors.rb - lib/aruba/in_process.rb - lib/aruba/jruby.rb - lib/aruba/reporting.rb - lib/aruba/spawn_process.rb - spec/aruba/api_spec.rb - spec/aruba/hooks_spec.rb - spec/aruba/jruby_spec.rb - spec/aruba/spawn_process_spec.rb - spec/spec_helper.rb - templates/css/console.css - templates/css/filesystem.css - templates/css/pygments-autumn.css - templates/files.erb - templates/images/LICENSE - templates/images/folder.png - templates/images/page_white.png - templates/images/page_white_gherkin.png - templates/images/page_white_ruby.png - templates/index.erb - templates/js/filesystem.js - templates/js/jquery-1.6.1.min.js - templates/main.erb homepage: http://github.com/cucumber/aruba licenses: [] post_install_message: rdoc_options: - --charset=UTF-8 require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' segments: - 0 hash: 4547606792464091190 required_rubygems_version: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' segments: - 0 hash: 4547606792464091190 requirements: [] rubyforge_project: rubygems_version: 1.8.23 signing_key: specification_version: 3 summary: aruba-0.5.3 test_files: [] aruba-0.5.3/templates/0000755000004100000410000000000012176213235014641 5ustar www-datawww-dataaruba-0.5.3/templates/css/0000755000004100000410000000000012176213235015431 5ustar www-datawww-dataaruba-0.5.3/templates/css/filesystem.css0000644000004100000410000000132112176213235020324 0ustar www-datawww-data.filesystem ul { background: #FFFFFF; margin: 0; padding: 0; } .filesystem li { list-style-type: none; padding-left: 20px; margin-bottom: 4px; } .filesystem li .highlight { display: block; border: 1px solid #CCCCCC; margin-top: 4px; } .filesystem li .highlight pre, pre.console { margin: 2px; padding: 2px; } .filesystem li.file { cursor: pointer; } .filesystem li.folder { background: url('../images/folder.png') no-repeat; } .filesystem li.feature { background: url('../images/page_white_gherkin.png') no-repeat; } .filesystem li.rb { background: url('../images/page_white_ruby.png') no-repeat; } .filesystem li.unknown { background: url('../images/page_white.png') no-repeat; } aruba-0.5.3/templates/css/console.css0000644000004100000410000000052012176213235017602 0ustar www-datawww-data.console { background-color: #000000; color: #ffffff; } .console .xterm_ef1 { /* red */ color: #ff0000; } .console .xterm_ef2 { /* green */ color: #00ff00; } .console .xterm_ef3 { /* yellow */ color: #ffff00; } .console .xterm_ef6 { /* cyan */ color: #00ffff; } .console .xterm_ef8 { /* gray */ color: #888888; } aruba-0.5.3/templates/css/pygments-autumn.css0000644000004100000410000000703112176213235021321 0ustar www-datawww-data/* https://raw.github.com/richleland/pygments-css/master/autumn.css */ .highlight .hll { background-color: #ffffcc } .highlight .c { color: #aaaaaa; font-style: italic } /* Comment */ .highlight .err { color: #F00000; background-color: #F0A0A0 } /* Error */ .highlight .k { color: #0000aa } /* Keyword */ .highlight .cm { color: #aaaaaa; font-style: italic } /* Comment.Multiline */ .highlight .cp { color: #4c8317 } /* Comment.Preproc */ .highlight .c1 { color: #aaaaaa; font-style: italic } /* Comment.Single */ .highlight .cs { color: #0000aa; font-style: italic } /* Comment.Special */ .highlight .gd { color: #aa0000 } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gi { color: #00aa00 } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #0000aa } /* Keyword.Constant */ .highlight .kd { color: #0000aa } /* Keyword.Declaration */ .highlight .kn { color: #0000aa } /* Keyword.Namespace */ .highlight .kp { color: #0000aa } /* Keyword.Pseudo */ .highlight .kr { color: #0000aa } /* Keyword.Reserved */ .highlight .kt { color: #00aaaa } /* Keyword.Type */ .highlight .m { color: #009999 } /* Literal.Number */ .highlight .s { color: #aa5500 } /* Literal.String */ .highlight .na { color: #1e90ff } /* Name.Attribute */ .highlight .nb { color: #00aaaa } /* Name.Builtin */ .highlight .nc { color: #00aa00; text-decoration: underline } /* Name.Class */ .highlight .no { color: #aa0000 } /* Name.Constant */ .highlight .nd { color: #888888 } /* Name.Decorator */ .highlight .ni { color: #800000; font-weight: bold } /* Name.Entity */ .highlight .nf { color: #00aa00 } /* Name.Function */ .highlight .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */ .highlight .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #aa0000 } /* Name.Variable */ .highlight .ow { color: #0000aa } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mf { color: #009999 } /* Literal.Number.Float */ .highlight .mh { color: #009999 } /* Literal.Number.Hex */ .highlight .mi { color: #009999 } /* Literal.Number.Integer */ .highlight .mo { color: #009999 } /* Literal.Number.Oct */ .highlight .sb { color: #aa5500 } /* Literal.String.Backtick */ .highlight .sc { color: #aa5500 } /* Literal.String.Char */ .highlight .sd { color: #aa5500 } /* Literal.String.Doc */ .highlight .s2 { color: #aa5500 } /* Literal.String.Double */ .highlight .se { color: #aa5500 } /* Literal.String.Escape */ .highlight .sh { color: #aa5500 } /* Literal.String.Heredoc */ .highlight .si { color: #aa5500 } /* Literal.String.Interpol */ .highlight .sx { color: #aa5500 } /* Literal.String.Other */ .highlight .sr { color: #009999 } /* Literal.String.Regex */ .highlight .s1 { color: #aa5500 } /* Literal.String.Single */ .highlight .ss { color: #0000aa } /* Literal.String.Symbol */ .highlight .bp { color: #00aaaa } /* Name.Builtin.Pseudo */ .highlight .vc { color: #aa0000 } /* Name.Variable.Class */ .highlight .vg { color: #aa0000 } /* Name.Variable.Global */ .highlight .vi { color: #aa0000 } /* Name.Variable.Instance */ .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */aruba-0.5.3/templates/images/0000755000004100000410000000000012176213235016106 5ustar www-datawww-dataaruba-0.5.3/templates/images/page_white_gherkin.png0000755000004100000410000000637312176213235022453 0ustar www-datawww-dataPNG  IHDRa CiCCPICC profilexڝSwX>eVBl"#Ya@Ņ VHUĂ H(gAZU\8ܧ}zy&j9R<:OHɽH gyx~t?op.$P&W " R.TSd ly|B" I>ةآ(G$@`UR,@".Y2GvX@`B, 8C L0ҿ_pH˕͗K3w!lBa)f "#HL 8?flŢko">!N_puk[Vh]3 Z zy8@P< %b0>3o~@zq@qanvRB1n#Dž)4\,XP"MyRD!ɕ2 w ONl~Xv@~- g42y@+͗\LD*A aD@ $<B AT:18 \p` Aa!:b""aH4 Q"rBj]H#-r9\@ 2G1Qu@Ơst4]k=Kut}c1fa\E`X&cX5V5cX7va$^lGXLXC%#W 1'"O%zxb:XF&!!%^'_H$ɒN !%2I IkHH-S>iL&m O:ňL $RJ5e?2BQͩ:ZImvP/S4u%͛Cˤ-Кigih/t ݃EЗkw Hb(k{/LӗT02goUX**|:V~TUsU?y TU^V}FUP թU6RwRPQ__c FHTc!2eXBrV,kMb[Lvv/{LSCsfffqƱ9ٜJ! {--?-jf~7zھbrup@,:m:u 6Qu>cy Gm7046l18c̐ckihhI'&g5x>fob4ekVyVV׬I\,mWlPW :˶vm))Sn1 9a%m;t;|rtuvlp4éĩWggs5KvSmnz˕ҵܭm=}M.]=AXq㝧/^v^Y^O&0m[{`:>=e>>z"=#~~~;yN`k5/ >B Yroc3g,Z0&L~oL̶Gli})*2.QStqt,֬Yg񏩌;jrvgjlRlc웸xEt$ =sl3Ttcܢ˞w|/9%bKGD pHYsww<tIME 09IDAT8ˍKTQ{?QSgrB2%&@0hӬ -r[pn E+e{qt&~| l<ϯT*Zc_E:1znp5H@hҔ&R/F)L&J?Z`!|:2!X7p!-`QGq\gc\<9E m74@5I*>Æ s& xPrdHGhd˔ihCQ=i"LW"L'M{(ZlYBFpVTmVfPduk bYX\^MźE8ɏwn2W""`Fvizz) Yvk`ȉmӬQC-1]FGqc@Zoٍ["]{MyJ^5[RNn=Z;Zko|1,/IENDB`aruba-0.5.3/templates/images/page_white_ruby.png0000755000004100000410000000116212176213235021774 0ustar www-datawww-dataPNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<IDAT8ˍOOABHV&&$$ Hmr3 "'. I?v f~̼N0*#bVB  6Y%qA?7MضaժT* H_u]x'FeYuZMDQ.jɝ(} KK/ZX;SwO\IԄdQgo_A?mVh<\y0:|+PUDkk@ vI`cf&ߒj:ss('S݇iA9|a :8}d{,# _0M#hdd.ghf*E9 ctn"rN .'׽B~F'!pXXqw>k%Q"42&ۙ}\MvlwqI)Yz;B I|"a7& <6vjIENDB`aruba-0.5.3/templates/images/LICENSE0000644000004100000410000000113512176213235017113 0ustar www-datawww-dataSilk icon set 1.3 _________________________________________ Mark James http://www.famfamfam.com/lab/icons/silk/ _________________________________________ This work is licensed under a Creative Commons Attribution 2.5 License. [ http://creativecommons.org/licenses/by/2.5/ ] This means you may use it for any purpose, and make any changes you like. All I ask is that you include a link back to this page in your credits. Are you using this icon set? Send me an email (including a link or picture if available) to mjames@gmail.com Any other questions about this icon set please contact mjames@gmail.comaruba-0.5.3/templates/images/folder.png0000755000004100000410000000103112176213235020065 0ustar www-datawww-dataPNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<IDAT8œA[EtQg7wALCWA0P017p2=:A3cb2'pܪ$Vme@ ݬ2OTO1W/`z8% ;O;9P#9B}^nO;Ǫo~ d~E dpɳ__j").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem )});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument|| b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);aruba-0.5.3/templates/index.erb0000644000004100000410000000076012176213235016445 0ustar www-datawww-data <%= index_title %>

<%= index_title %>

<% Aruba::Reporting.reports.keys.sort{|f1, f2| f1.title <=> f2.title}.each do |feature| -%>

<%= feature.title %>

    <% Aruba::Reporting.reports[feature].each do |scenario, report_path| %>
  • <%= scenario.title %>
  • <% end -%>
<% end -%> aruba-0.5.3/templates/files.erb0000644000004100000410000000075212176213235016441 0ustar www-datawww-data<% if children(file).any? %>
    <% children(file).each do |child| css_class = File.directory?(child) ? 'folder' : File.extname(child) == '' ? 'file unknown' : 'file ' + File.extname(child)[1..-1] -%>
  • <%= File.basename(child) -%> <% if File.file?(child) %> <%= pygmentize(child) %> <% end %> <% again(erb, _erbout, child) -%>
  • <% end -%>
<% end -%>aruba-0.5.3/templates/main.erb0000644000004100000410000000165512176213235016266 0ustar www-datawww-data <%= title %>

<%= title %>

<%= description %>

Files

<%= files %>

Output

<% commands.each do |cmd| -%>
$ <%= cmd %>
<% end -%>
<%= output %>
aruba-0.5.3/config/0000755000004100000410000000000012176213235014110 5ustar www-datawww-dataaruba-0.5.3/config/.gitignore0000644000004100000410000000001512176213235016074 0ustar www-datawww-dataaruba-rvm.ymlaruba-0.5.3/Gemfile0000644000004100000410000000043512176213235014140 0ustar www-datawww-datasource "http://rubygems.org" gemspec # Use source from sibling folders (if available) instead of gems # %w[cucumber].each do |g| # if File.directory?(File.dirname(__FILE__) + "/../#{g}") # @dependencies.reject!{|dep| dep.name == g} # gem g, :path => "../#{g}" # end # end aruba-0.5.3/cucumber.yml0000644000004100000410000000066312176213235015200 0ustar www-datawww-data<% java_version = (RUBY_DESCRIPTION.match(/.*?on.*?(1\.[\d]\..*? )/))[1] if defined?(JRUBY_VERSION) std_opts = "--color --tags ~@wip" std_opts << " --tags ~@wip-jruby-java-1.6" if defined?(JRUBY_VERSION) && (java_version < '1.7.0') wip_opts = "--color --tags @wip:3" wip_opts = "--color --tags @wip:3,@wip-jruby-java-1.6:3" if defined?(JRUBY_VERSION) && (java_version < '1.7.0') %> default: <%= std_opts %> wip: --wip <%= wip_opts %> aruba-0.5.3/.gitignore0000644000004100000410000000026412176213235014635 0ustar www-datawww-data## MAC OS .DS_Store ## TEXTMATE *.tmproj tmtags ## EMACS *~ \#* .\#* ## VIM *.swp tags ## PROJECT::GENERAL coverage rdoc pkg ## PROJECT::SPECIFIC tmp .bundle doc Gemfile.lock aruba-0.5.3/lib/0000755000004100000410000000000012176213235013411 5ustar www-datawww-dataaruba-0.5.3/lib/aruba.rb0000644000004100000410000000020512176213235015025 0ustar www-datawww-datarequire 'aruba/spawn_process' module Aruba class << self attr_accessor :process end self.process = Aruba::SpawnProcess endaruba-0.5.3/lib/aruba/0000755000004100000410000000000012176213235014503 5ustar www-datawww-dataaruba-0.5.3/lib/aruba/reporting.rb0000644000004100000410000000605312176213235017045 0ustar www-datawww-dataif(ENV['ARUBA_REPORT_DIR']) ENV['ARUBA_REPORT_TEMPLATES'] ||= File.dirname(__FILE__) + '/../../templates' require 'fileutils' require 'erb' require 'cgi' require 'bcat/ansi' require 'rdiscount' require 'aruba/spawn_process' module Aruba module Reporting class << self def reports @reports ||= Hash.new do |hash, feature| hash[feature] = [] end end end def pygmentize(file) pygmentize = SpawnProcess.new(%{pygmentize -f html -O encoding=utf-8 "#{file}"}, 3, 0.5) pygmentize.run! do |p| exit_status = p.stop(false) if(exit_status == 0) p.stdout(false) elsif(p.stderr(false) =~ /no lexer/) # Pygment's didn't recognize it IO.read(file) else STDERR.puts "\e[31m#{p.stderr} - is pygments installed?\e[0m" exit $?.exitstatus end end end def title @scenario.title end def description unescaped_description = @scenario.description.gsub(/^(\s*)\\/, '\1') markdown = RDiscount.new(unescaped_description) markdown.to_html end def commands @commands || [] end def output @aruba_keep_ansi = true # We want the output coloured! escaped_stdout = CGI.escapeHTML(all_stdout) html = Bcat::ANSI.new(escaped_stdout).to_html Bcat::ANSI::STYLES.each do |name, style| html.gsub!(/style='#{style}'/, %{class="xterm_#{name}"}) end html end def report erb = ERB.new(template('main.erb'), nil, '-') erb.result(binding) end def files erb = ERB.new(template('files.erb'), nil, '-') file = current_dir erb.result(binding) end def again(erb, _erbout, file) _erbout.concat(erb.result(binding)) end def children(dir) Dir["#{dir}/*"].sort end def template(path) IO.read(File.join(ENV['ARUBA_REPORT_TEMPLATES'], path)) end def depth File.dirname(@scenario.feature.file).split('/').length end def index erb = ERB.new(template('index.erb'), nil, '-') erb.result(binding) end def index_title "Examples" end end end World(Aruba::Reporting) After do |scenario| @scenario = scenario html_file = "#{scenario.feature.file}:#{scenario.line}.html" report_file = File.join(ENV['ARUBA_REPORT_DIR'], html_file) _mkdir(File.dirname(report_file)) File.open(report_file, 'w') do |io| io.write(report) end Aruba::Reporting.reports[scenario.feature] << [scenario, html_file] FileUtils.cp_r(File.join(ENV['ARUBA_REPORT_TEMPLATES'], '.'), ENV['ARUBA_REPORT_DIR']) Dir["#{ENV['ARUBA_REPORT_DIR']}/**/*.erb"].each{|f| FileUtils.rm(f)} end at_exit do index_file = File.join(ENV['ARUBA_REPORT_DIR'], "index.html") extend(Aruba::Reporting) File.open(index_file, 'w') do |io| io.write(index) end end end aruba-0.5.3/lib/aruba/api.rb0000644000004100000410000002666312176213235015616 0ustar www-datawww-datarequire 'fileutils' require 'rbconfig' require 'rspec/expectations' require 'aruba' require 'aruba/config' module Aruba module Api include RSpec::Matchers def in_current_dir(&block) _mkdir(current_dir) Dir.chdir(current_dir, &block) end def current_dir File.join(*dirs) end def cd(dir) dirs << dir raise "#{current_dir} is not a directory." unless File.directory?(current_dir) end def dirs @dirs ||= ['tmp', 'aruba'] end def write_file(file_name, file_content) _create_file(file_name, file_content, false) end def write_fixed_size_file(file_name, file_size) _create_fixed_size_file(file_name, file_size, false) end def overwrite_file(file_name, file_content) _create_file(file_name, file_content, true) end def _create_file(file_name, file_content, check_presence) in_current_dir do raise "expected #{file_name} to be present" if check_presence && !File.file?(file_name) _mkdir(File.dirname(file_name)) File.open(file_name, 'w') { |f| f << file_content } end end def _create_fixed_size_file(file_name, file_size, check_presence) in_current_dir do raise "expected #{file_name} to be present" if check_presence && !File.file?(file_name) _mkdir(File.dirname(file_name)) File.open(file_name, "wb"){ |f| f.seek(file_size - 1); f.write("\0") } end end def remove_file(file_name) in_current_dir do FileUtils.rm(file_name) end end def append_to_file(file_name, file_content) in_current_dir do _mkdir(File.dirname(file_name)) File.open(file_name, 'a') { |f| f << file_content } end end def create_dir(dir_name) in_current_dir do _mkdir(dir_name) end end def remove_dir(directory_name) in_current_dir do FileUtils.rmdir(directory_name) end end def check_file_presence(paths, expect_presence) prep_for_fs_check do paths.each do |path| if expect_presence File.should be_file(path) else File.should_not be_file(path) end end end end def check_file_size(paths_and_sizes) prep_for_fs_check do paths_and_sizes.each do |path, size| File.size(path).should == size end end end def with_file_content(file, &block) prep_for_fs_check do content = IO.read(file) yield(content) end end def check_file_content(file, partial_content, expect_match) regexp = regexp(partial_content) prep_for_fs_check do content = IO.read(file) if expect_match content.should =~ regexp else content.should_not =~ regexp end end end def check_exact_file_content(file, exact_content) prep_for_fs_check { IO.read(file).should == exact_content } end def check_directory_presence(paths, expect_presence) prep_for_fs_check do paths.each do |path| if expect_presence File.should be_directory(path) else File.should_not be_directory(path) end end end end def prep_for_fs_check(&block) stop_processes! in_current_dir{ block.call } end def _mkdir(dir_name) FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name) end def unescape(string) string = string.gsub('\n', "\n").gsub('\"', '"').gsub('\e', "\e") string = string.gsub(/\e\[\d+(?>(;\d+)*)m/, '') unless @aruba_keep_ansi string end def regexp(string_or_regexp) Regexp === string_or_regexp ? string_or_regexp : Regexp.compile(Regexp.escape(string_or_regexp)) end def output_from(cmd) cmd = detect_ruby(cmd) get_process(cmd).output end def stdout_from(cmd) cmd = detect_ruby(cmd) get_process(cmd).stdout end def stderr_from(cmd) cmd = detect_ruby(cmd) get_process(cmd).stderr end def all_stdout stop_processes! only_processes.inject("") { |out, ps| out << ps.stdout } end def all_stderr stop_processes! only_processes.inject("") { |out, ps| out << ps.stderr } end def all_output all_stdout << all_stderr end def assert_exact_output(expected, actual) actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should == unescape(expected) end def assert_partial_output(expected, actual) actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should include(unescape(expected)) end def assert_matching_output(expected, actual) actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should =~ /#{unescape(expected)}/m end def assert_not_matching_output(expected, actual) actual.force_encoding(expected.encoding) if RUBY_VERSION >= "1.9" unescape(actual).should_not =~ /#{unescape(expected)}/m end def assert_no_partial_output(unexpected, actual) actual.force_encoding(unexpected.encoding) if RUBY_VERSION >= "1.9" if Regexp === unexpected unescape(actual).should_not =~ unexpected else unescape(actual).should_not include(unexpected) end end def assert_partial_output_interactive(expected) unescape(_read_interactive).include?(unescape(expected)) ? true : false end def assert_passing_with(expected) assert_exit_status_and_partial_output(true, expected) end def assert_failing_with(expected) assert_exit_status_and_partial_output(false, expected) end def assert_exit_status_and_partial_output(expect_to_pass, expected) assert_success(expect_to_pass) assert_partial_output(expected, all_output) end # TODO: Remove this. Call more methods elsewhere instead. Reveals more intent. def assert_exit_status_and_output(expect_to_pass, expected_output, expect_exact_output) assert_success(expect_to_pass) if expect_exact_output assert_exact_output(expected_output, all_output) else assert_partial_output(expected_output, all_output) end end def assert_success(success) success ? assert_exit_status(0) : assert_not_exit_status(0) end def assert_exit_status(status) last_exit_status.should eq(status), append_output_to("Exit status was #{last_exit_status} but expected it to be #{status}.") end def assert_not_exit_status(status) last_exit_status.should_not eq(status), append_output_to("Exit status was #{last_exit_status} which was not expected.") end def append_output_to(message) "#{message} Output:\n\n#{all_output}\n" end def processes @processes ||= [] end def stop_processes! processes.each do |_, process| stop_process(process) end end def terminate_processes! processes.each do |_, process| terminate_process(process) stop_process(process) end end def register_process(name, process) processes << [name, process] end def get_process(wanted) processes.reverse.find{ |name, _| name == wanted }[-1] end def only_processes processes.collect{ |_, process| process } end def run(cmd, timeout = nil) timeout ||= exit_timeout @commands ||= [] @commands << cmd cmd = detect_ruby(cmd) in_current_dir do Aruba.config.hooks.execute(:before_cmd, self, cmd) announcer.dir(Dir.pwd) announcer.cmd(cmd) process = Aruba.process.new(cmd, timeout, io_wait) register_process(cmd, process) process.run! block_given? ? yield(process) : process end end DEFAULT_TIMEOUT_SECONDS = 3 def exit_timeout @aruba_timeout_seconds || DEFAULT_TIMEOUT_SECONDS end DEFAULT_IO_WAIT_SECONDS = 0.1 def io_wait @aruba_io_wait_seconds || DEFAULT_IO_WAIT_SECONDS end def run_simple(cmd, fail_on_error=true, timeout = nil) run(cmd, timeout) do |process| stop_process(process) end @timed_out = last_exit_status.nil? assert_exit_status(0) if fail_on_error end def run_interactive(cmd) @interactive = run(cmd) end def type(input) return eot if "" == input _write_interactive(_ensure_newline(input)) end def eot @interactive.stdin.close end def _write_interactive(input) @interactive.stdin.write(input) @interactive.stdin.flush end def _read_interactive @interactive.read_stdout end def _ensure_newline(str) str.chomp << "\n" end def announce_or_puts(msg) if(@puts) Kernel.puts(msg) else puts(msg) end end def detect_ruby(cmd) if cmd =~ /^ruby\s/ cmd.gsub(/^ruby\s/, "#{current_ruby} ") else cmd end end def current_ruby File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) end def use_clean_gemset(gemset) run_simple(%{rvm gemset create "#{gemset}"}, true) if all_stdout =~ /'#{gemset}' gemset created \((.*)\)\./ gem_home = $1 set_env('GEM_HOME', gem_home) set_env('GEM_PATH', gem_home) set_env('BUNDLE_PATH', gem_home) paths = (ENV['PATH'] || "").split(File::PATH_SEPARATOR) paths.unshift(File.join(gem_home, 'bin')) set_env('PATH', paths.uniq.join(File::PATH_SEPARATOR)) run_simple("gem install bundler", true) else raise "I didn't understand rvm's output: #{all_stdout}" end end def unset_bundler_env_vars %w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key| set_env(key, nil) end end def set_env(key, value) announcer.env(key, value) original_env[key] = ENV.delete(key) ENV[key] = value end def restore_env original_env.each do |key, value| ENV[key] = value end end def original_env @original_env ||= {} end # TODO: move some more methods under here! private def last_exit_status return @last_exit_status if @last_exit_status stop_processes! @last_exit_status end def stop_process(process) @last_exit_status = process.stop(announcer) end def terminate_process(process) process.terminate end def announcer Announcer.new(self, :stdout => @announce_stdout, :stderr => @announce_stderr, :dir => @announce_dir, :cmd => @announce_cmd, :env => @announce_env) end class Announcer def initialize(session, options = {}) @session, @options = session, options end def stdout(content) return unless @options[:stdout] print content end def stderr(content) return unless @options[:stderr] print content end def dir(dir) return unless @options[:dir] print "$ cd #{dir}" end def cmd(cmd) return unless @options[:cmd] print "$ #{cmd}" end def env(key, value) return unless @options[:env] print %{$ export #{key}="#{value}"} end private def print(message) @session.announce_or_puts(message) end end end end aruba-0.5.3/lib/aruba/cucumber/0000755000004100000410000000000012176213235016310 5ustar www-datawww-dataaruba-0.5.3/lib/aruba/cucumber/hooks.rb0000644000004100000410000000170112176213235017757 0ustar www-datawww-dataBefore('@disable-bundler') do unset_bundler_env_vars end Before do @__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR) ENV['PATH'] = ([File.expand_path('bin')] + @__aruba_original_paths).join(File::PATH_SEPARATOR) end After do ENV['PATH'] = @__aruba_original_paths.join(File::PATH_SEPARATOR) end Before('~@no-clobber') do FileUtils.rm_rf(current_dir) end Before('@puts') do @puts = true end Before('@announce-cmd') do @announce_cmd = true end Before('@announce-stdout') do @announce_stdout = true end Before('@announce-stderr') do @announce_stderr = true end Before('@announce-dir') do @announce_dir = true end Before('@announce-env') do @announce_env = true end Before('@announce') do @announce_stdout = true @announce_stderr = true @announce_cmd = true @announce_dir = true @announce_env = true end Before('@ansi') do @aruba_keep_ansi = true end After do restore_env processes.clear end aruba-0.5.3/lib/aruba/cucumber.rb0000644000004100000410000002340212176213235016636 0ustar www-datawww-datarequire 'aruba/api' require 'aruba/cucumber/hooks' require 'aruba/reporting' World(Aruba::Api) Given /The default aruba timeout is (\d+) seconds/ do |seconds| @aruba_timeout_seconds = seconds.to_i end Given /^I'm using a clean gemset "([^"]*)"$/ do |gemset| use_clean_gemset(gemset) end Given /^a directory named "([^"]*)"$/ do |dir_name| create_dir(dir_name) end Given /^a file named "([^"]*)" with:$/ do |file_name, file_content| write_file(file_name, file_content) end Given /^a (\d+) byte file named "([^"]*)"$/ do |file_size, file_name| write_fixed_size_file(file_name, file_size.to_i) end Given /^an empty file named "([^"]*)"$/ do |file_name| write_file(file_name, "") end When /^I write to "([^"]*)" with:$/ do |file_name, file_content| write_file(file_name, file_content) end When /^I overwrite "([^"]*)" with:$/ do |file_name, file_content| overwrite_file(file_name, file_content) end When /^I append to "([^"]*)" with:$/ do |file_name, file_content| append_to_file(file_name, file_content) end When /^I append to "([^"]*)" with "([^"]*)"$/ do |file_name, file_content| append_to_file(file_name, file_content) end When /^I remove the file "([^"]*)"$/ do |file_name| remove_file(file_name) end When /^I cd to "([^"]*)"$/ do |dir| cd(dir) end When /^I run "(.*)"$/ do |cmd| warn(%{\e[35m The /^I run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m}) run_simple(unescape(cmd), false) end When /^I run `([^`]*)`$/ do |cmd| run_simple(unescape(cmd), false) end When /^I successfully run "(.*)"$/ do |cmd| warn(%{\e[35m The /^I successfully run "(.*)"$/ step definition is deprecated. Please use the `backticks` version\e[0m}) run_simple(unescape(cmd)) end ## I successfully run `echo -n "Hello"` ## I successfully run `sleep 29` for up to 30 seconds When /^I successfully run `(.*?)`(?: for up to (\d+) seconds)?$/ do |cmd, secs| run_simple(unescape(cmd), true, secs && secs.to_i) end When /^I run "([^"]*)" interactively$/ do |cmd| warn(%{\e[35m The /^I run "([^"]*)" interactively$/ step definition is deprecated. Please use the `backticks` version\e[0m}) run_interactive(unescape(cmd)) end When /^I run `([^`]*)` interactively$/ do |cmd| run_interactive(unescape(cmd)) end When /^I type "([^"]*)"$/ do |input| type(input) end When /^I wait for (?:output|stdout) to contain "([^"]*)"$/ do |expected| Timeout::timeout(exit_timeout) do loop do break if assert_partial_output_interactive(expected) sleep 0.1 end end end Then /^the output should contain "([^"]*)"$/ do |expected| assert_partial_output(expected, all_output) end Then /^the output from "([^"]*)" should contain "([^"]*)"$/ do |cmd, expected| assert_partial_output(expected, output_from(cmd)) end Then /^the output from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, unexpected| assert_no_partial_output(unexpected, output_from(cmd)) end Then /^the output should not contain "([^"]*)"$/ do |unexpected| assert_no_partial_output(unexpected, all_output) end Then /^the output should contain:$/ do |expected| assert_partial_output(expected, all_output) end Then /^the output should not contain:$/ do |unexpected| assert_no_partial_output(unexpected, all_output) end ## the output should contain exactly "output" ## the output from `echo -n "Hello"` should contain exactly "Hello" Then /^the output(?: from "(.*?)")? should contain exactly "(.*?)"$/ do |cmd, expected| assert_exact_output(expected, cmd ? output_from(cmd) : all_output) end ## the output should contain exactly: ## the output from `echo -n "Hello"` should contain exactly: Then /^the output(?: from "(.*?)")? should contain exactly:$/ do |cmd, expected| assert_exact_output(expected, cmd ? output_from(cmd) : all_output) end # "the output should match" allows regex in the partial_output, if # you don't need regex, use "the output should contain" instead since # that way, you don't have to escape regex characters that # appear naturally in the output Then /^the output should match \/([^\/]*)\/$/ do |expected| assert_matching_output(expected, all_output) end Then /^the output should match:$/ do |expected| assert_matching_output(expected, all_output) end # The previous two steps antagonists Then /^the output should not match \/([^\/]*)\/$/ do |expected| assert_not_matching_output(expected, all_output) end Then /^the output should not match:$/ do |expected| assert_not_matching_output(expected, all_output) end Then /^the exit status should be (\d+)$/ do |exit_status| assert_exit_status(exit_status.to_i) end Then /^the exit status should not be (\d+)$/ do |exit_status| assert_not_exit_status(exit_status.to_i) end Then /^it should (pass|fail) with:$/ do |pass_fail, partial_output| self.__send__("assert_#{pass_fail}ing_with", partial_output) end Then /^it should (pass|fail) with exactly:$/ do |pass_fail, exact_output| assert_exit_status_and_output(pass_fail == "pass", exact_output, true) end Then /^it should (pass|fail) with regexp?:$/ do |pass_fail, expected| assert_matching_output(expected, all_output) assert_success(pass_fail == 'pass') end ## the stderr should contain "hello" ## the stderr from "echo -n 'Hello'" should contain "hello" ## the stderr should contain exactly: ## the stderr from "echo -n 'Hello'" should contain exactly: Then /^the stderr(?: from "(.*?)")? should contain( exactly)? "(.*?)"$/ do |cmd, exact, expected| if exact assert_exact_output(expected, cmd ? stderr_from(cmd) : all_stderr) else assert_partial_output(expected, cmd ? stderr_from(cmd) : all_stderr) end end ## the stderr should contain: ## the stderr from "echo -n 'Hello'" should contain: ## the stderr should contain exactly: ## the stderr from "echo -n 'Hello'" should contain exactly: Then /^the stderr(?: from "(.*?)")? should contain( exactly)?:$/ do |cmd, exact, expected| if exact assert_exact_output(expected, cmd ? stderr_from(cmd) : all_stderr) else assert_partial_output(expected, cmd ? stderr_from(cmd) : all_stderr) end end ## the stdout should contain "hello" ## the stdout from "echo -n 'Hello'" should contain "hello" ## the stdout should contain exactly: ## the stdout from "echo -n 'Hello'" should contain exactly: Then /^the stdout(?: from "(.*?)")? should contain( exactly)? "(.*?)"$/ do |cmd, exact, expected| if exact assert_exact_output(expected, cmd ? stdout_from(cmd) : all_stdout) else assert_partial_output(expected, cmd ? stdout_from(cmd) : all_stdout) end end ## the stdout should contain: ## the stdout from "echo -n 'Hello'" should contain: ## the stdout should contain exactly: ## the stdout from "echo -n 'Hello'" should contain exactly: Then /^the stdout(?: from "(.*?)")? should contain( exactly)?:$/ do |cmd, exact, expected| if exact assert_exact_output(expected, cmd ? stdout_from(cmd) : all_stdout) else assert_partial_output(expected, cmd ? stdout_from(cmd) : all_stdout) end end Then /^the stderr should not contain "([^"]*)"$/ do |unexpected| assert_no_partial_output(unexpected, all_stderr) end Then /^the stderr should not contain:$/ do |unexpected| assert_no_partial_output(unexpected, all_stderr) end Then /^the (stderr|stdout) should not contain anything$/ do |stream_name| stream = self.send("all_#{stream_name}") stream.should be_empty end Then /^the stdout should not contain "([^"]*)"$/ do |unexpected| assert_no_partial_output(unexpected, all_stdout) end Then /^the stdout should not contain:$/ do |unexpected| assert_no_partial_output(unexpected, all_stdout) end Then /^the stdout from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, unexpected| assert_no_partial_output(unexpected, stdout_from(cmd)) end Then /^the stderr from "([^"]*)" should not contain "([^"]*)"$/ do |cmd, unexpected| assert_no_partial_output(unexpected, stderr_from(cmd)) end Then /^the file "([^"]*)" should not exist$/ do |file_name| check_file_presence([file_name], false) end Then /^the following files should exist:$/ do |files| check_file_presence(files.raw.map{|file_row| file_row[0]}, true) end Then /^the following files should not exist:$/ do |files| check_file_presence(files.raw.map{|file_row| file_row[0]}, false) end Then /^a file named "([^"]*)" should exist$/ do |file| check_file_presence([file], true) end Then /^a file named "([^"]*)" should not exist$/ do |file| check_file_presence([file], false) end Then /^a (\d+) byte file named "([^"]*)" should exist$/ do |file_size, file_name| check_file_size([[file_name, file_size.to_i]]) end Then /^the following directories should exist:$/ do |directories| check_directory_presence(directories.raw.map{|directory_row| directory_row[0]}, true) end Then /^the following directories should not exist:$/ do |directories| check_directory_presence(directories.raw.map{|directory_row| directory_row[0]}, false) end Then /^a directory named "([^"]*)" should exist$/ do |directory| check_directory_presence([directory], true) end Then /^a directory named "([^"]*)" should not exist$/ do |directory| check_directory_presence([directory], false) end Then /^the file "([^"]*)" should contain "([^"]*)"$/ do |file, partial_content| check_file_content(file, partial_content, true) end Then /^the file "([^"]*)" should not contain "([^"]*)"$/ do |file, partial_content| check_file_content(file, partial_content, false) end Then /^the file "([^"]*)" should contain:$/ do |file, partial_content| check_file_content(file, partial_content, true) end Then /^the file "([^"]*)" should contain exactly:$/ do |file, exact_content| check_exact_file_content(file, exact_content) end Then /^the file "([^"]*)" should match \/([^\/]*)\/$/ do |file, partial_content| check_file_content(file, /#{partial_content}/, true) end Then /^the file "([^"]*)" should not match \/([^\/]*)\/$/ do |file, partial_content| check_file_content(file, /#{partial_content}/, false) end aruba-0.5.3/lib/aruba/spawn_process.rb0000644000004100000410000000375212176213235017725 0ustar www-datawww-datarequire 'childprocess' require 'tempfile' require 'shellwords' require 'aruba/errors' module Aruba class SpawnProcess include Shellwords def initialize(cmd, exit_timeout, io_wait) @exit_timeout = exit_timeout @io_wait = io_wait @cmd = cmd @process = nil @exit_code = nil @output_cache = nil @error_cache = nil end def run!(&block) @process = ChildProcess.build(*shellwords(@cmd)) @out = Tempfile.new("aruba-out") @err = Tempfile.new("aruba-err") @process.io.stdout = @out @process.io.stderr = @err @process.duplex = true @exit_code = nil begin @process.start rescue ChildProcess::LaunchError => e raise LaunchError.new(e.message) end yield self if block_given? end def stdin @process.io.stdin end def output stdout + stderr end def stdout wait_for_io { read(@out) } || @output_cache end def stderr wait_for_io { read(@err) } || @error_cache end def read_stdout wait_for_io do @process.io.stdout.flush open(@out.path).read end end def stop(reader) return @exit_code unless @process unless @process.exited? @process.poll_for_exit(@exit_timeout) end @exit_code = @process.exit_code @process = nil close_and_cache_out close_and_cache_err if reader reader.stdout stdout reader.stderr stderr end @exit_code end def terminate if @process @process.stop stop nil end end private def wait_for_io(&block) if @process sleep @io_wait yield end end def read(io) io.rewind io.read end def close_and_cache_out @output_cache = read @out @out.close @out = nil end def close_and_cache_err @error_cache = read @err @err.close @err = nil end end end aruba-0.5.3/lib/aruba/jruby.rb0000644000004100000410000000070112176213235016161 0ustar www-datawww-data# ideas taken from: http://blog.headius.com/2010/03/jruby-startup-time-tips.html Aruba.configure do |config| config.before_cmd do # disable JIT since these processes are so short lived set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # force jRuby to use client JVM for faster startup times set_env('JAVA_OPTS', "-d32 #{ENV['JAVA_OPTS']}") if RbConfig::CONFIG['host_os'] =~ /solaris|sunos/i end end if RUBY_PLATFORM == 'java' aruba-0.5.3/lib/aruba/errors.rb0000644000004100000410000000012512176213235016342 0ustar www-datawww-datamodule Aruba class Error < StandardError; end class LaunchError < Error; end end aruba-0.5.3/lib/aruba/config.rb0000644000004100000410000000134212176213235016275 0ustar www-datawww-datamodule Aruba class Config attr_reader :hooks def initialize @hooks = Hooks.new end # Register a hook to be called before Aruba runs a command def before_cmd(&block) @hooks.append(:before_cmd, block) end end #nodoc class Hooks def initialize @store = Hash.new do |hash, key| hash[key] = [] end end def append(label, block) @store[label] << block end def execute(label, context, *args) @store[label].each do |block| context.instance_exec(*args, &block) end end end class << self attr_accessor :config def configure yield config end end self.config = Config.new end aruba-0.5.3/lib/aruba/in_process.rb0000644000004100000410000000171612176213235017201 0ustar www-datawww-datarequire 'shellwords' require 'stringio' module Aruba class InProcess include Shellwords class FakeKernel attr_reader :exitstatus def initialize @exitstatus = 0 end def exit(exitstatus) @exitstatus = exitstatus end end def self.main_class=(main_class) @@main_class = main_class end def initialize(cmd, exit_timeout, io_wait) args = shellwords(cmd) @argv = args[1..-1] @stdin = StringIO.new @stdout = StringIO.new @stderr = StringIO.new @kernel = FakeKernel.new end def run!(&block) raise "You need to call Aruba::InProcess.main_class = YourMainClass" unless @@main_class @@main_class.new(@argv, @stdin, @stdout, @stderr, @kernel).execute! yield self if block_given? end def stop(reader) @kernel.exitstatus end def stdout @stdout.string end def stderr @stderr.string end end endaruba-0.5.3/.rvmrc0000644000004100000410000000001612176213235013772 0ustar www-datawww-datarvm @cucumber