Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing require rubygems from sources

Removed require rubygems from lib. All samples updated.
Rakefile sets rubygems to RUBYOPT if env variable does not exist.
You can see more info at http://tomayko.com/writings/require-rubygems-antipattern
  • Loading branch information...
commit 8ae09c76f943d35a517f04813913c38917aa85c9 1 parent fc223c3
Roger Leite authored
View
2  Rakefile
@@ -1,6 +1,8 @@
require "bundler/gem_tasks"
require "rake/testtask"
+ENV["RUBYOPT"] = "rubygems" if ENV["RUBYOPT"].nil?
+
Rake::TestTask.new do |t|
t.libs.push "lib"
t.libs.push "test"
View
1  lib/restfolia.rb
@@ -1,7 +1,6 @@
require "net/http"
require "uri"
-require "rubygems"
require "multi_json"
require "restfolia/version"
View
3  samples/changing_links_parse.rb
@@ -1,8 +1,7 @@
# Run this sample from root project:
-# $ ruby samples/changing_links_parse.rb
+# $ ruby -rubygems samples/changing_links_parse.rb
-require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
View
4 samples/cookies_options.rb
@@ -1,11 +1,11 @@
# Run this sample from root project:
-# $ ruby samples/cookies_options.rb
+# $ ruby -rubygems samples/cookies_options.rb
-require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
+# Running https://github.com/rogerleite/simple_api
SERVICE_URL = "http://localhost:9292/recursos/busca"
sample_cookie = "PREF=ID=988f14fa5edd3243:TM=1335470032:LM=1335470032:S=KVBslNbyz6bG0DqU; expires=Sat, 26-Apr-2014 19:53:52 GMT; path=/; domain=.google.com, NID=59=peUyZQuLWQ_0gELr1yDf0FT4ZlT7ZdITNrO5OhkEnAvp_8MZ4TT6pHq7_q_Su-puTw7vGml_Ok6du8fLreGHzfpMs4Qh1v-qBCFYGuCNbzpwN670x5MFbGKy0KUXA3WP; expires=Fri, 26-Oct-2012 19:53:52 GMT; path=/; domain=.google.com; HttpOnly"
View
4 samples/headers_options.rb
@@ -1,11 +1,11 @@
# Run this sample from root project:
-# $ ruby samples/headers_options.rb
+# $ ruby -rubygems samples/headers_options.rb
-require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
+# Running https://github.com/rogerleite/simple_api
SERVICE_URL = "http://localhost:9292/recursos/busca"
# accessing headers attribute
View
16 samples/http_behaviour.rb
@@ -1,14 +1,14 @@
# Run this sample from root project:
-# $ ruby samples/http_behaviour.rb
+# $ ruby -rubygems samples/http_behaviour.rb
-require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
-require "ostruct"
Restfolia::HTTP.behaviours do
+ clear #clean all defined behaviours
+
on(200) do |http_response|
content_type = (http_response["content-type"] =~ /application\/json/)
if !content_type
@@ -36,17 +36,13 @@
# custom_helper
#end
- #helpers do
- # def custom_helper
- # 'lixo'
- # end
- #end
-
end
+# Running https://github.com/rogerleite/simple_api
SERVICE_URL = "http://localhost:9292/recursos/busca"
+
resource = Restfolia.at(SERVICE_URL).get
-puts resource.inspect
+puts resource.inspect # => #<Restfolia::Resource ...>
Restfolia.at("http://google.com").get
# => "3xx error"
View
6 samples/using_custom_factory.rb
@@ -1,16 +1,16 @@
# Run this sample from root project:
-# $ ruby samples/using_custom_factory.rb
+# $ ruby -rubygems samples/using_custom_factory.rb
-require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
require "ostruct"
+# Running https://github.com/rogerleite/simple_api
SERVICE_URL = "http://localhost:9292/recursos/busca"
resource = Restfolia.at(SERVICE_URL).get
-puts resource.inspect # => #<Restfolia::Resource ...>
+#puts resource.inspect # => #<Restfolia::Resource ...>
# Here you have the "pure" json from response body.
# You can do anything.
View
6 samples/using_custom_resource.rb
@@ -1,16 +1,16 @@
# Run this sample from root project:
-# $ ruby samples/using_custom_resource.rb
+# $ ruby -rubygems samples/using_custom_resource.rb
-require "rubygems"
$LOAD_PATH << "lib"
require "restfolia"
require "ostruct"
+# Running https://github.com/rogerleite/simple_api
SERVICE_URL = "http://localhost:9292/recursos/busca"
resource = Restfolia.at(SERVICE_URL).get
-puts resource.inspect # => #<Restfolia::Resource ...>
+#puts resource.inspect # => #<Restfolia::Resource ...>
# Here you have the advantage to use a custom resource
# and the same time you have the recursive lookup at hash
Please sign in to comment.
Something went wrong with that request. Please try again.