Skip to content

Commit

Permalink
Rakefile: Require Ruby version >= 1.9.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
blackwinter committed May 7, 2014
1 parent e8b19e7 commit 7456b97
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 129 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -2,9 +2,9 @@ language:
ruby

rvm:
- '1.9.3'
- '2.0.0'
- '2.1.1'
- '1.9'
- '2.0'
- '2.1'
- ruby-head
- jruby-19mode
- jruby-head
Expand Down
21 changes: 12 additions & 9 deletions Rakefile
Expand Up @@ -4,15 +4,18 @@ begin
require 'hen'

Hen.lay! {{
:gem => {
:name => %q{wadl},
:version => WADL::VERSION,
:summary => %q{Ruby client for the Web Application Description Language.},
:authors => ['Leonard Richardson', 'Jens Wille'],
:email => ['leonardr@segfault.org', 'jens.wille@gmail.com'],
:license => %q{AGPL-3.0},
:homepage => :blackwinter,
:dependencies => %w[cyclops rf-rest-open-uri mime-types safe_yaml]
gem: {
name: %q{wadl},
version: WADL::VERSION,
summary: %q{Super cheap Ruby WADL client.},
description: %q{Ruby client for the Web Application Description Language.},
authors: ['Leonard Richardson', 'Jens Wille'],
email: 'jens.wille@gmail.com',
license: %q{AGPL-3.0},
homepage: :blackwinter,
dependencies: %w[cyclops rf-rest-open-uri mime-types safe_yaml],

required_ruby_version: '>= 1.9.3'
}
}}
rescue LoadError => err
Expand Down
4 changes: 2 additions & 2 deletions lib/wadl.rb
Expand Up @@ -4,7 +4,7 @@
# wadl -- Super cheap Ruby WADL client #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,7 +26,7 @@
###############################################################################
#++

require 'wadl/version'
require_relative 'wadl/version'

module WADL

Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/address.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

# The Address class keeps track of the user's path through a resource
Expand Down
3 changes: 1 addition & 2 deletions lib/wadl/application.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -27,7 +27,6 @@
#++

require 'rexml/document'
require 'wadl'

module WADL

Expand Down
9 changes: 1 addition & 8 deletions lib/wadl/cheap_schema.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

# A cheap way of defining an XML schema as Ruby classes and then parsing
Expand Down Expand Up @@ -389,8 +387,3 @@ def to_s(indent = 0, collection = false)
end

end

# Simple backport for Ruby <= 1.8.5
class Object # :nodoc:
def instance_variable_defined?(sym); instance_eval("defined?(#{sym})"); end
end unless Object.method_defined?(:instance_variable_defined?)
18 changes: 9 additions & 9 deletions lib/wadl/cli.rb
Expand Up @@ -25,8 +25,8 @@
#++

require 'cgi'
require 'stringio'
require 'cyclops'
require 'stringio'
require 'wadl'

begin
Expand All @@ -53,12 +53,12 @@ def usage(*)

def defaults
super.merge(
:config => 'config.yaml',
:method => 'GET',
:user => ENV['USER'] || '',
:request_token_url => '%s/oauth/request_token',
:access_token_url => '%s/oauth/access_token',
:authorize_url => '%s/oauth/authorize'
config: 'config.yaml',
method: 'GET',
user: ENV['USER'] || '',
request_token_url: '%s/oauth/request_token',
access_token_url: '%s/oauth/access_token',
authorize_url: '%s/oauth/authorize'
)
end

Expand All @@ -85,7 +85,7 @@ def run(arguments)
stderr.puts api if debug >= 2
end

response = auth_resource.send(options[:method].downcase, :query => query)
response = auth_resource.send(options[:method].downcase, query: query)

stderr.puts response.code.join(' ')
stdout.puts response.representation unless response.code.first =~ /\A[45]/
Expand Down Expand Up @@ -182,7 +182,7 @@ def add_param(params, key, value)

def basic_auth_resource
user, pass = options.values_at(:user, :password)
pass ||= ask("Password for user #{user}: ") { |q| q.echo = false }
pass ||= askpass("Password for user #{user}: ")

quit 'USER and PASSWORD required' unless user && pass

Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/documentation.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class Documentation < CheapSchema
Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/fault.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class Fault < Exception
Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/fault_format.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class FaultFormat < RepresentationFormat
Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/has_docs.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class HasDocs < CheapSchema
Expand Down
11 changes: 5 additions & 6 deletions lib/wadl/http_method.rb
Expand Up @@ -28,7 +28,6 @@

require 'safe_yaml/load'
require 'rf-rest-open-uri'
require 'wadl'

begin
require 'oauth/client/helper'
Expand Down Expand Up @@ -95,11 +94,11 @@ def set_oauth_header(headers, uri)
request = OpenURI::Methods[headers[:method]].new(uri.to_s)

headers[OAUTH_HEADER] = OAuth::Client::Helper.new(request,
:request_uri => request.path,
:consumer => consumer = OAuth::Consumer.new(*args[0, 2]),
:token => OAuth::AccessToken.new(consumer, *args[2, 2]),
:scheme => 'header',
:signature_method => 'HMAC-SHA1'
request_uri: request.path,
consumer: consumer = OAuth::Consumer.new(*args[0, 2]),
token: OAuth::AccessToken.new(consumer, *args[2, 2]),
scheme: 'header',
signature_method: 'HMAC-SHA1'
).header
end

Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/link.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class Link < HasDocs
Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/option.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class Option < HasDocs
Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/param.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class Param < HasDocs
Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/representation_container.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

# A mixin for objects that contain representations
Expand Down
11 changes: 6 additions & 5 deletions lib/wadl/representation_format.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -27,7 +27,6 @@
#++

require 'cgi'
require 'wadl'

module WADL

Expand All @@ -38,15 +37,17 @@ class RepresentationFormat < HasDocs
has_many Param
may_be_reference

FORM_TYPES = %w[application/x-www-form-urlencoded multipart/form-data]

def is_form_representation?
mediaType == 'application/x-www-form-urlencoded' || mediaType == 'multipart/form-data'
FORM_TYPES.include?(mediaType)
end

# Creates a representation by plugging a set of parameters
# into a representation format.
def %(values)
unless mediaType == 'application/x-www-form-urlencoded'
raise "wadl.rb can't instantiate a representation of type #{mediaType}"
unless is_form_representation?
raise "wadl can't instantiate a representation of type #{mediaType}"
end

representation = []
Expand Down
4 changes: 1 addition & 3 deletions lib/wadl/request_format.rb
Expand Up @@ -4,7 +4,7 @@
# A component of wadl, the super cheap Ruby WADL client. #
# #
# Copyright (C) 2006-2008 Leonard Richardson #
# Copyright (C) 2010-2013 Jens Wille #
# Copyright (C) 2010-2014 Jens Wille #
# #
# Authors: #
# Leonard Richardson <leonardr@segfault.org> (Original author) #
Expand All @@ -26,8 +26,6 @@
###############################################################################
#++

require 'wadl'

module WADL

class RequestFormat < HasDocs
Expand Down

0 comments on commit 7456b97

Please sign in to comment.