Permalink
Browse files

House keeping stuff, mostly an idiotic commit

  • Loading branch information...
1 parent 9f3971f commit 22f30f9844e871064bca85c9a66304d9baf5e36a @lsdr lsdr committed Feb 23, 2012
Showing with 51 additions and 49 deletions.
  1. +1 −0 .travis.yml
  2. +3 −0 Gemfile
  3. +16 −7 LICENSE
  4. +9 −7 README.md
  5. +0 −31 bin/gem_exec
  6. +1 −1 browsah.gemspec
  7. +20 −0 examples/simple.rb
  8. +1 −2 script/console
  9. +0 −1 test/test_helper.rb
View
@@ -1,4 +1,5 @@
language: ruby
+bundler_args: --without test
rvm:
- 1.9.2
View
@@ -1,2 +1,5 @@
source :rubygems
gemspec
+
+# for those crazy, psychopaths that love ruby-debug
+gem 'ruby-debug19', :group => :test
View
23 LICENSE
@@ -1,10 +1,19 @@
-Copyright (c) 2011, Abril Midia
-All rights reserved.
+Copyright (c) 2011 Abril Midia
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+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:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+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
@@ -1,11 +1,14 @@
# It's a REAL BROWSAH!!!1!
+[![Build Status](https://secure.travis-ci.org/abril/browsah.png)](http://travis-ci.org/abril/browsah)
Unlike other HTTP client libraries, `browsah` aims to be a true browser.
-[![Build Status](https://secure.travis-ci.org/abril/browsah.png)](http://travis-ci.org/abril/browsah)
+`browsah` depends on [em-http-request](http://rubygems.org/gems/em-http-request) and [em-synchrony](http://rubygems.org/gems/em-synchrony), thus is Ruby 1.9.x only.
-# Sample Code
-## Simple POST/GET:
+## Examples
+For more examples, see [examples](https://github.com/abril/browsah/tree/master/examples).
+
+### Simple POST/GET:
```ruby
require 'browsah'
@@ -30,8 +33,7 @@ bw.get '/urlshortener/v1/url?shortUrl=http://goo.gl/TT1LT' do |r|
end
```
-# License
-
-browsah is licensed under the [BSD License](http://opensource.org/licenses/BSD-2-Clause).
+## License
+[MIT License](http://opensource.org/licenses/MIT). Copyright (c) 2011 Abril Midia.
-See LICENSE file for details.
+See LICENSE for details.
View
@@ -1,31 +0,0 @@
-#!/usr/bin/env ruby
-require "optparse"
-
-options = {}
-
-optparse = OptionParser.new do |opts|
- opts.banner = "Uso: gem_exec -r FILE -c FILE"
-
- opts.on( '-r', '--recipe FILE', 'blablabla' ) do |recipe|
- options[:recipe] = recipe
- end
-
- opts.on( '-c', '--config FILE', 'blablabla' ) do |config|
- options[:config] = config
- end
-
- opts.on( '-d', '--debug', 'Inicializar com ruby-debug' ) do
- require "rubygems"
- require "ruby-debug"
- end
-
- opts.on( '-h', '--help', 'Mostra essa ajuda' ) do
- puts opts
- exit
- end
-end
-
-optparse.parse!
-
-# do something with options var
-
View
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = 'HTTP client and Hypermedia browser'
s.require_paths = ['lib']
- s.files = Dir['{lib/**/*.rb, README.md}']
+ s.files = Dir['{lib/**/*.rb, README.md, LICENSE}']
s.authors = 'Abril'
s.email = 'lfcipriani@gmail.com'
View
@@ -0,0 +1,20 @@
+require 'browsah'
+require 'json'
+
+headers = { 'Content-Type' => 'application/json' }
+body = { "longUrl" => "http://engineering.abril.com.br" }.to_json
+bw = Browsah.new('https://www.googleapis.com')
+
+bw.post '/urlshortener/v1/url', :body => body, :headers => headers do |r|
+ r.on(200) do
+ parsed = JSON.parse(r.body)
+ jj parsed
+ end
+end
+
+bw.get '/urlshortener/v1/url?shortUrl=http://goo.gl/TT1LT' do |r|
+ r.on(200) do
+ parsed = JSON.parse(r.body)
+ jj parsed
+ end
+end
View
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
# File: script/console
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
-ENV["MIGRATOR_CALLER"] = "console"
-libs = " -r #{File.expand_path(File.dirname(__FILE__)) + '/../lib/browsah.rb'} -r ruby-debug"
+libs = " -r #{File.expand_path(File.dirname(__FILE__)) + '/../lib/browsah.rb'}"
puts "Loading gem development environment..."
exec "#{irb} #{libs} --simple-prompt #{ARGV.join("")}"
View
@@ -3,7 +3,6 @@
require 'minitest/autorun'
require 'webmock/test_unit'
-require 'minitest/pride'
begin
require 'ruby-debug'

0 comments on commit 22f30f9

Please sign in to comment.