From 2565254242ad4d12a3504aefa3cfe72500bfefc8 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Mon, 31 Oct 2011 05:35:35 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- oauth2-core/lib/oauth2/attributes.rb | 22 +++++++++---------- oauth2-core/lib/oauth2/core.rb | 2 +- oauth2-core/lib/oauth2/headers.rb | 8 +++---- .../lib/oauth2/headers/authenticate.rb | 20 ++++++++--------- .../lib/oauth2/headers/authorization.rb | 18 +++++++-------- oauth2-core/oauth2-core.gemspec | 8 +++---- oauth2-core/spec/attributes_spec.rb | 10 ++++----- oauth2-core/spec/headers/authenticate_spec.rb | 2 +- .../spec/headers/authorization_spec.rb | 4 ++-- .../models/oauth2/authorization_code_grant.rb | 4 ++-- oauth2-rails/lib/oauth2/rails.rb | 10 ++++----- .../oauth2/rails/adapters/active_record.rb | 10 ++++----- .../lib/oauth2/rails/adapters/base.rb | 8 +++---- oauth2-rails/lib/oauth2/rails/config.rb | 4 ++-- oauth2-rails/lib/oauth2/rails/engine.rb | 10 ++++----- oauth2-rails/oauth2-rails.gemspec | 10 ++++----- oauth2-rails/spec/rails/config_spec.rb | 14 ++++++------ oauth2-rails/spec/rails_spec.rb | 2 +- oauth2-rails/spec/spec_helper.rb | 2 +- 19 files changed, 84 insertions(+), 84 deletions(-) diff --git a/oauth2-core/lib/oauth2/attributes.rb b/oauth2-core/lib/oauth2/attributes.rb index acffc54..0e17d32 100644 --- a/oauth2-core/lib/oauth2/attributes.rb +++ b/oauth2-core/lib/oauth2/attributes.rb @@ -2,26 +2,26 @@ require 'active_support/core_ext/class/inheritable_attributes' module OAuth2 - + module Attributes - + extend ActiveSupport::Concern - + included do class_inheritable_array :attribute_names self.attribute_names = Array.new end - + def attributes @attributes ||= Hash.new end - + module ClassMethods - + # Defines a callback for a handle. def attribute(handle) attribute_names << handle.to_sym - + class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{handle}(&block) @attributes ||= {} @@ -38,22 +38,22 @@ def #{handle}(&block) raise "No attribute or callback for '#{handle}' defined" end end - + def #{handle.to_s.gsub('?', '')}=(value) @attributes ||= {} @attributes[:#{handle}] = value end EOS end - + def attributes(*handles) handles.each do |handle| attribute(handle) end end - + end end - + end \ No newline at end of file diff --git a/oauth2-core/lib/oauth2/core.rb b/oauth2-core/lib/oauth2/core.rb index 66694f7..7e3c3d5 100644 --- a/oauth2-core/lib/oauth2/core.rb +++ b/oauth2-core/lib/oauth2/core.rb @@ -1,5 +1,5 @@ module OAuth2 - + autoload :Headers, 'oauth2/headers' autoload :Signature, 'oauth2/signature' diff --git a/oauth2-core/lib/oauth2/headers.rb b/oauth2-core/lib/oauth2/headers.rb index 6c57520..02640ae 100644 --- a/oauth2-core/lib/oauth2/headers.rb +++ b/oauth2-core/lib/oauth2/headers.rb @@ -1,10 +1,10 @@ module OAuth2 - + module Headers - + autoload :Authorization, 'oauth2/headers/authorization' autoload :Authenticate, 'oauth2/headers/authenticate' - + end - + end \ No newline at end of file diff --git a/oauth2-core/lib/oauth2/headers/authenticate.rb b/oauth2-core/lib/oauth2/headers/authenticate.rb index d612e4f..7bd9445 100644 --- a/oauth2-core/lib/oauth2/headers/authenticate.rb +++ b/oauth2-core/lib/oauth2/headers/authenticate.rb @@ -1,24 +1,24 @@ require 'oauth2/attributes' module OAuth2 - + module Headers - + class Authenticate - + Attributes = [ :realm, :algorithms, :auth_uri, :token_uri, :error ] - + Attributes.each do |attribute| attr_accessor attribute end - + def valid? raise "Realm not set" unless realm - + end - + def to_hash Attributes.inject(Hash.new) do |hash, attribute| value = send(attribute) @@ -26,7 +26,7 @@ def to_hash hash end end - + def to_s to_hash.collect do |key, value| name = key.to_s.gsub('_', '-') @@ -35,7 +35,7 @@ def to_s end end - + end - + end \ No newline at end of file diff --git a/oauth2-core/lib/oauth2/headers/authorization.rb b/oauth2-core/lib/oauth2/headers/authorization.rb index c397c39..1664afc 100644 --- a/oauth2-core/lib/oauth2/headers/authorization.rb +++ b/oauth2-core/lib/oauth2/headers/authorization.rb @@ -23,7 +23,7 @@ def initialize(attributes = {}) Attributes.each do |attribute| attr_accessor(attribute) end - + def validate case request_type when :bearer @@ -37,13 +37,13 @@ def validate end end - @errors.blank? + @errors.blank? end - + def errors @errors ||= [] end - + def attributes hash = ActiveSupport::OrderedHash.new Attributes.each do |attribute| @@ -51,7 +51,7 @@ def attributes end hash end - + def to_s attrs = attributes.collect do |key, value| %{#{key}="#{value}"} if value @@ -77,16 +77,16 @@ def parse(string) header.errors << :format_invalid return header end - + tuples.map! { |tuple| tuple.strip! } - + tuples.each do |tuple| - + # Parameters sent without a value MUST be treated as if they were # omitted from the request. # http://tools.ietf.org/html/draft-ietf-oauth-v2-09#page-18 unless tuple =~ /\s*(.+)="(.*)"/ - header.errors << :format_invalid + header.errors << :format_invalid else key, value = $1.to_sym, $2 next if value.empty? diff --git a/oauth2-core/oauth2-core.gemspec b/oauth2-core/oauth2-core.gemspec index cb17ed5..294eb78 100644 --- a/oauth2-core/oauth2-core.gemspec +++ b/oauth2-core/oauth2-core.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) - + Gem::Specification.new do |s| s.name = "oauth2-core" s.version = '0.1.4' @@ -11,13 +11,13 @@ Gem::Specification.new do |s| s.homepage = "http://github.com/aflatter/oauth2-ruby" s.summary = "" s.description = "" - + s.required_rubygems_version = ">= 1.3.6" - + s.add_dependency(%q, [">= 0.0.0"]) s.add_development_dependency "rspec" - + s.files = Dir.glob("{bin,lib}/**/*") + %w(LICENSE README.md) s.require_path = 'lib' end diff --git a/oauth2-core/spec/attributes_spec.rb b/oauth2-core/spec/attributes_spec.rb index 96e6f5f..5f57f58 100644 --- a/oauth2-core/spec/attributes_spec.rb +++ b/oauth2-core/spec/attributes_spec.rb @@ -8,10 +8,10 @@ include OAuth2::Attributes attributes :foo end - + klass.new end - + it "should allow to set an attribute to nil" do subject.foo = nil subject.foo.should be_nil @@ -22,15 +22,15 @@ subject.foo { foo } subject.foo.should == foo end - + it "should return user defined value if defined" do foo = stub("some value") subject.foo = foo subject.foo.should == foo end - + it "should raise exception if no callback or value is defined" do lambda { subject.foo }.should raise_error(RuntimeError) end - + end \ No newline at end of file diff --git a/oauth2-core/spec/headers/authenticate_spec.rb b/oauth2-core/spec/headers/authenticate_spec.rb index d78d2a4..86b12b3 100644 --- a/oauth2-core/spec/headers/authenticate_spec.rb +++ b/oauth2-core/spec/headers/authenticate_spec.rb @@ -2,5 +2,5 @@ require 'oauth2/headers/authenticate' describe OAuth2::Headers::Authenticate do - + end \ No newline at end of file diff --git a/oauth2-core/spec/headers/authorization_spec.rb b/oauth2-core/spec/headers/authorization_spec.rb index e32531f..96b2f59 100644 --- a/oauth2-core/spec/headers/authorization_spec.rb +++ b/oauth2-core/spec/headers/authorization_spec.rb @@ -37,14 +37,14 @@ Token token="vF9dft4qmT", nonce="" EOS - + example_without_empty_value = <<-EOS Token token="vF9dft4qmT" EOS OAuth2::Headers::Authorization.parse(example_with_empty_value).to_s.should == OAuth2::Headers::Authorization.parse(example_without_empty_value).to_s end - + it "ignores parameters without value using the new method" do OAuth2::Headers::Authorization.new(:token => "vF9dft4qmT", :signature => "").to_s.should == OAuth2::Headers::Authorization.new(:token => "vF9dft4qmT").to_s end diff --git a/oauth2-rails/app/models/oauth2/authorization_code_grant.rb b/oauth2-rails/app/models/oauth2/authorization_code_grant.rb index 1fdda59..fa2745e 100644 --- a/oauth2-rails/app/models/oauth2/authorization_code_grant.rb +++ b/oauth2-rails/app/models/oauth2/authorization_code_grant.rb @@ -1,5 +1,5 @@ class AuthorizationCodeGrant < ActiveRecord::Base - + set_table_name 'oauth2_authorization_code_grants' - + end diff --git a/oauth2-rails/lib/oauth2/rails.rb b/oauth2-rails/lib/oauth2/rails.rb index 074155c..61c33dc 100644 --- a/oauth2-rails/lib/oauth2/rails.rb +++ b/oauth2-rails/lib/oauth2/rails.rb @@ -3,14 +3,14 @@ require 'active_support/core_ext/module' module OAuth2 - + module Rails - + class << self - + mattr_accessor :config self.config = Config.new - + def setup(&block) config.setup(&block) end @@ -18,5 +18,5 @@ def setup(&block) end end - + end \ No newline at end of file diff --git a/oauth2-rails/lib/oauth2/rails/adapters/active_record.rb b/oauth2-rails/lib/oauth2/rails/adapters/active_record.rb index e949fc4..9dce605 100644 --- a/oauth2-rails/lib/oauth2/rails/adapters/active_record.rb +++ b/oauth2-rails/lib/oauth2/rails/adapters/active_record.rb @@ -5,7 +5,7 @@ module Rails module Adapters class ActiveRecord < Base - + def initialize super @models = Hash.new @@ -16,20 +16,20 @@ def create_authorization_code_grant(attributes) attributes.slice(:client, :user, :request_uri, :code) ) end - + # create_table :oauth2_authorization_code_grants do |t| # t.string :code # t.string :redirect_uri # t.integer :user_id # t.integer :client_id # end - + protected - + def constantize_model(id) OAuth2::Rails.config.models[:models][id].to_s.camelize.constantize end - + def model(id) @models[id] ||= constantize_model(id) end diff --git a/oauth2-rails/lib/oauth2/rails/adapters/base.rb b/oauth2-rails/lib/oauth2/rails/adapters/base.rb index d3d55b4..fde845d 100644 --- a/oauth2-rails/lib/oauth2/rails/adapters/base.rb +++ b/oauth2-rails/lib/oauth2/rails/adapters/base.rb @@ -1,15 +1,15 @@ module OAuth2 - + module Rails - + module Adapters - + class Base def initialize(options) @options = options end - + # Must be implemented by subclasses # Returns true on success, else false. def create_authorization_code_grant(attributes) diff --git a/oauth2-rails/lib/oauth2/rails/config.rb b/oauth2-rails/lib/oauth2/rails/config.rb index fa8bdc3..d076f3e 100644 --- a/oauth2-rails/lib/oauth2/rails/config.rb +++ b/oauth2-rails/lib/oauth2/rails/config.rb @@ -5,12 +5,12 @@ module OAuth2 module Rails class Config - + class << self # We alias this method to something shorter. alias :option :attr_accessor_with_default end - + option :adapter, :active_record option :enforce_scopes, true diff --git a/oauth2-rails/lib/oauth2/rails/engine.rb b/oauth2-rails/lib/oauth2/rails/engine.rb index cb0bcd5..381ca63 100644 --- a/oauth2-rails/lib/oauth2/rails/engine.rb +++ b/oauth2-rails/lib/oauth2/rails/engine.rb @@ -1,13 +1,13 @@ require 'rails' module OAuth2 - + module Rails class Engine < ::Rails::Engine - + class << self - + def root @root ||= File.expand_path("../../../..", __FILE__) end @@ -18,7 +18,7 @@ def root pattern = File.join(root, "generators", "oauth2", "*_generator.rb") Dir.glob(pattern).each { |f| require f } end - + %w{models controllers}.each do |dir| path = File.join(root, 'app', dir) config.load_paths << path @@ -28,5 +28,5 @@ def root end end - + end \ No newline at end of file diff --git a/oauth2-rails/oauth2-rails.gemspec b/oauth2-rails/oauth2-rails.gemspec index 44ff141..724a59c 100644 --- a/oauth2-rails/oauth2-rails.gemspec +++ b/oauth2-rails/oauth2-rails.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) - + Gem::Specification.new do |s| s.name = "oauth2-rails" s.version = '0.1.4' @@ -11,13 +11,13 @@ Gem::Specification.new do |s| s.homepage = "http://github.com/aflatter/oauth2-ruby" s.summary = "" s.description = "" - + s.required_rubygems_version = ">= 1.3.6" - + s.add_dependency(%q, [">= 0.1.4"]) - + s.add_development_dependency "rspec" - + s.files = Dir.glob("{bin,lib}/**/*") + %w(LICENSE README.md) s.require_path = 'lib' end diff --git a/oauth2-rails/spec/rails/config_spec.rb b/oauth2-rails/spec/rails/config_spec.rb index d5d272e..d2c4beb 100644 --- a/oauth2-rails/spec/rails/config_spec.rb +++ b/oauth2-rails/spec/rails/config_spec.rb @@ -2,33 +2,33 @@ require 'oauth2/rails/config' describe OAuth2::Rails::Config do - + it "has a default of :active_record for adapter" do subject.adapter.should == :active_record end - + it "allows to set adapter" do subject.adapter = :foo_bar subject.adapter.should == :foo_bar end - + it "has a default of true for enforce_scopes" do subject.enforce_scopes.should == true end - + it "allows to set enforce_scopes" do subject.enforce_scopes = false subject.enforce_scopes.should == false end - + it "has defaults for models" do subject.models.should == {:client => :client} end - + it "allows to set models" do models = {:client => :bar} subject.models = models subject.models.should == models end - + end \ No newline at end of file diff --git a/oauth2-rails/spec/rails_spec.rb b/oauth2-rails/spec/rails_spec.rb index 276b927..d8ed495 100644 --- a/oauth2-rails/spec/rails_spec.rb +++ b/oauth2-rails/spec/rails_spec.rb @@ -3,7 +3,7 @@ it "should initialize a configuration" do subject.config.should be_a(OAuth2::Rails::Config) end - + it "should setup its configuration" do blk = Proc.new { } subject.config.should_receive(:setup).once.and_yield(blk) diff --git a/oauth2-rails/spec/spec_helper.rb b/oauth2-rails/spec/spec_helper.rb index cce3713..0121261 100644 --- a/oauth2-rails/spec/spec_helper.rb +++ b/oauth2-rails/spec/spec_helper.rb @@ -11,7 +11,7 @@ require "bundler" Bundler.setup rescue LoadError => e - puts 'Bundler not found. Please install bundler with the command gem install bundler' + puts 'Bundler not found. Please install bundler with the command gem install bundler' end begin