Skip to content
Browse files

gemspec, license, readme updates

  • Loading branch information...
1 parent 15e8896 commit a96d2831dba10747c22fac6b91bdef2cb5d58134 @leonid-shevtsov committed Aug 6, 2010
Showing with 78 additions and 20 deletions.
  1. +19 −0 .gemspec
  2. +20 −0 LICENSE
  3. +39 −20 README.md
View
19 .gemspec
@@ -0,0 +1,19 @@
+require 'rake'
+
+spec = Gem::Specification.new do |s|
+ s.author = 'Leonid Shevtsov'
+ s.email = 'leonid@shevtsov.me'
+
+ s.name = 'headless'
+ s.version = '0.0.1'
+ s.summary = 'Ruby headless display interface'
+
+ s.description = <<-EOF
+ Headless is a Ruby interface for Xvfb. It allows you to create a headless display straight from Ruby code, hiding some low-level action.
+ EOF
+ s.requirements = 'Xvfb'
+ s.homepage = 'http://github.com/leonid-shevtsov/headless'
+
+ s.files = FileList['lib/*.rb', '[A-Z]*'].to_a
+ s.has_rdoc = true
+end
View
20 LICENSE
@@ -0,0 +1,20 @@
+ Copyright (c) 2010 Leonid Shevtsov
+
+ 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.
+
View
59 README.md
@@ -1,42 +1,61 @@
-= Headless
+# Headless
Headless is a Ruby interface for Xvfb. It allows you to create a headless display straight from Ruby code, hiding some low-level action.
I created it so I can run Selenium tests in Cucumber without any shell scripting, so that, for instance, you can go headless only when you run tests
against Selenium.
-== Prerequisites
+## Prerequisites
* X Window System
* Xvfb[http://en.wikipedia.org/wiki/Xvfb]
-== Usage
+## Usage
Block mode:
- require 'rubygems'
- require 'headless'
- require 'selenium-webdriver'
+ require 'rubygems'
+ require 'headless'
+ require 'selenium-webdriver'
+
+ Headless.ly do
+ driver = Selenium::WebDriver.for :firefox
+ driver.navigate.to 'http://google.com'
+ puts driver.title
+ end
+
+Object mode:
+
+ require 'rubygems'
+ require 'headless'
+ require 'selenium-webdriver'
+
+ headless = Headless.new
+ headless.start
- Headless.ly do
driver = Selenium::WebDriver.for :firefox
driver.navigate.to 'http://google.com'
- puts driver.title
- end
+ puts driver.title
+
+ headless.destroy
+
+## Cucumber
+
+Running cucumber headless is now as simple as adding a before and after hook in `features/support/env.rb`:
-Object mode:
- require 'rubygems'
- require 'headless'
- require 'selenium-webdriver'
+ # change the condition to fit your setup
+ if Capybara.current_driver == :selenium
+ require 'headless'
- headless = Headless.new
- headless.start
+ headless = Headless.new
+ headless.start
- driver = Selenium::WebDriver.for :firefox
- driver.navigate.to 'http://google.com'
- puts driver.title
+ at_exit do
+ headless.destroy
+ end
+ end
- headless.destroy
+---
-== Cucumber
+&copy; 2010 Leonid Shevtsov, released under the MIT license

0 comments on commit a96d283

Please sign in to comment.
Something went wrong with that request. Please try again.