Permalink
Browse files

Remove whitespace [Gun.io WhitespaceBot]

  • Loading branch information...
1 parent 30c94a1 commit cab0213b37b63cee7197aa24840e32b8b557c698 Gun.io Whitespace Robot committed Oct 29, 2011
Showing with 359 additions and 359 deletions.
  1. +1 −1 UPGRADE.rdoc
  2. +9 −9 generators/oauth_consumer/oauth_consumer_generator.rb
  3. +3 −3 generators/oauth_consumer/templates/consumer_token.rb
  4. +5 −5 generators/oauth_consumer/templates/controller.rb
  5. +3 −3 generators/oauth_consumer/templates/migration.rb
  6. +3 −3 generators/oauth_consumer/templates/oauth_config.rb
  7. +1 −1 generators/oauth_consumer/templates/show.html.haml
  8. +1 −1 generators/oauth_provider/USAGE
  9. +8 −8 generators/oauth_provider/lib/insert_routes.rb
  10. +10 −10 generators/oauth_provider/oauth_provider_generator.rb
  11. +4 −4 generators/oauth_provider/templates/_form.html.haml
  12. +4 −4 generators/oauth_provider/templates/access_token.rb
  13. +8 −8 generators/oauth_provider/templates/client_application.rb
  14. +5 −5 generators/oauth_provider/templates/client_application_spec.rb
  15. +7 −7 generators/oauth_provider/templates/client_application_test.rb
  16. +4 −4 generators/oauth_provider/templates/clients_controller.rb
  17. +30 −30 generators/oauth_provider/templates/clients_controller_spec.rb
  18. +54 −54 generators/oauth_provider/templates/clients_controller_test.rb
  19. +3 −3 generators/oauth_provider/templates/controller.rb
  20. +2 −2 generators/oauth_provider/templates/index.html.erb
  21. +2 −2 generators/oauth_provider/templates/index.html.haml
  22. +4 −4 generators/oauth_provider/templates/migration.rb
  23. +1 −1 generators/oauth_provider/templates/oauth2_authorize.html.erb
  24. +1 −1 generators/oauth_provider/templates/oauth_nonce.rb
  25. +3 −3 generators/oauth_provider/templates/oauth_nonce_spec.rb
  26. +4 −4 generators/oauth_provider/templates/oauth_nonce_test.rb
  27. +6 −6 generators/oauth_provider/templates/oauth_token.rb
  28. +38 −38 generators/oauth_provider/templates/oauth_token_spec.rb
  29. +10 −10 generators/oauth_provider/templates/oauth_token_test.rb
  30. +7 −7 generators/oauth_provider/templates/request_token.rb
  31. +3 −3 generators/oauth_provider/templates/show.html.haml
  32. +1 −1 init.rb
  33. +3 −3 lib/generators/active_record/oauth_consumer_templates/consumer_token.rb
  34. +3 −3 lib/generators/active_record/oauth_consumer_templates/migration.rb
  35. +1 −1 lib/generators/active_record/oauth_provider_templates/request_token.rb
  36. +1 −1 lib/generators/haml/oauth_consumer_templates/show.html.haml
  37. +6 −6 lib/generators/mongoid/oauth_consumer_templates/consumer_token.rb
  38. +1 −1 lib/generators/mongoid/oauth_provider_templates/request_token.rb
  39. +6 −6 lib/generators/oauth_consumer/oauth_consumer_generator.rb
  40. +10 −10 lib/generators/oauth_consumer/templates/controller.rb
  41. +3 −3 lib/generators/oauth_consumer/templates/oauth_config.rb
  42. +19 −19 lib/oauth/controllers/application_controller_methods.rb
  43. +14 −14 lib/oauth/controllers/consumer_controller.rb
  44. +1 −1 lib/oauth/models/consumers/service_loader.rb
  45. +2 −2 lib/oauth/models/consumers/services/agree2_token.rb
  46. +7 −7 lib/oauth/models/consumers/services/fireeagle_token.rb
  47. +7 −7 lib/oauth/models/consumers/services/oauth2_token.rb
  48. +4 −4 lib/oauth/models/consumers/services/opentransact_token.rb
  49. +2 −2 lib/oauth/models/consumers/services/picomoney_token.rb
  50. +5 −5 lib/oauth/models/consumers/services/twitter_token.rb
  51. +5 −5 lib/oauth/models/consumers/simple_client.rb
  52. +14 −14 lib/oauth/models/consumers/token.rb
View
@@ -1,7 +1,7 @@
A few non backwards compatible changes have been made that are really easy to fix.
If you are upgrading a oauth_consumer from 0.3.x to 0.4.x add the following line to your consumer_token model:
-
+
belongs_to :user
So it looks like this:
@@ -5,26 +5,26 @@ class OauthConsumerGenerator < Rails::Generator::Base
def manifest
record do |m|
-
+
# Controller, helper, views, and test directories.
m.directory File.join('app/models')
m.directory File.join('app/controllers')
m.directory File.join('app/helpers')
m.directory File.join('app/views', 'oauth_consumers')
m.directory File.join('config/initializers')
-
+
m.template 'oauth_config.rb',File.join('config/initializers', "oauth_consumers.rb")
m.template 'consumer_token.rb',File.join('app/models',"consumer_token.rb")
m.template 'controller.rb',File.join('app/controllers',"oauth_consumers_controller.rb")
m.route_entry "map.resources :oauth_consumers,:member=>{:callback=>:get}"
-
+
@template_extension= options[:haml] ? "haml" : "erb"
-
+
m.template "show.html.#{@template_extension}", File.join('app/views', 'oauth_consumers', "show.html.#{@template_extension}")
m.template "index.html.#{@template_extension}", File.join('app/views', 'oauth_consumers', "index.html.#{@template_extension}")
-
- unless options[:skip_migration]
+
+ unless options[:skip_migration]
m.migration_template 'migration.rb', 'db/migrate', :assigns => {
:migration_name => "CreateOauthConsumerTokens"
}, :migration_file_name => "create_oauth_consumer_tokens"
@@ -40,11 +40,11 @@ def banner
def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
- opt.on("--skip-migration",
+ opt.on("--skip-migration",
"Don't generate a migration file") { |v| options[:skip_migration] = v }
-# opt.on("--test-unit",
+# opt.on("--test-unit",
# "Generate the Test::Unit compatible tests instead of RSpec") { |v| options[:test_unit] = v }
- opt.on("--haml",
+ opt.on("--haml",
"Templates use haml") { |v| options[:haml] = v }
end
end
@@ -1,11 +1,11 @@
require 'oauth/models/consumers/token'
class ConsumerToken < ActiveRecord::Base
include Oauth::Models::Consumers::Token
-
+
# You can safely remove this callback if you don't allow login from any of your services
before_create :create_user
-
+
# Modify this with class_name etc to match your application
belongs_to :user
-
+
end
@@ -1,27 +1,27 @@
require 'oauth/controllers/consumer_controller'
class OauthConsumersController < ApplicationController
include Oauth::Controllers::ConsumerController
-
+
def index
@consumer_tokens=ConsumerToken.all :conditions => {:user_id => current_user.id}
@services=OAUTH_CREDENTIALS.keys-@consumer_tokens.collect{|c| c.class.service_name}
end
-
+
def callback
super
end
def client
super
end
-
+
protected
-
+
# Change this to decide where you want to redirect user to after callback is finished.
# params[:id] holds the service name so you could use this to redirect to various parts
# of your application depending on what service you're connecting to.
def go_back
redirect_to root_url
end
-
+
end
@@ -1,16 +1,16 @@
class CreateOauthConsumerTokens < ActiveRecord::Migration
def self.up
-
+
create_table :consumer_tokens do |t|
t.integer :user_id
t.string :type, :limit => 30
t.string :token, :limit => 1024 # This has to be huge because of Yahoo's excessively large tokens
t.string :secret
t.timestamps
end
-
+
add_index :consumer_tokens, :token, :unique => true
-
+
end
def self.down
@@ -58,15 +58,15 @@
# :nu_bux => {
# :key => "",
# :secret => "",
-# :super_class => "OpenTransactToken", # if a OAuth service follows a particular standard
+# :super_class => "OpenTransactToken", # if a OAuth service follows a particular standard
# # with a token implementation you can set the superclass
# # to use
# :options => { # OAuth::Consumer options
-# :site => "http://nubux.heroku.com"
+# :site => "http://nubux.heroku.com"
# }
# }
# }
-#
+#
OAUTH_CREDENTIALS = {
} unless defined? OAUTH_CREDENTIALS
@@ -1,4 +1,4 @@
-%h1
+%h1
You are already Connected to
=params[:id].humanize
-form_tag oauth_consumer_path(params[:id]),:method=>:delete do
@@ -1,4 +1,4 @@
-./script/generate oauth_provider
+./script/generate oauth_provider
This creates an OAuth Provider controller as well as the requisite models.
@@ -3,7 +3,7 @@
Rails::Generator::Commands::Create.class_eval do
def route_entry(raw)
sentinel = 'ActionController::Routing::Routes.draw do |map|'
-
+
logger.route raw
unless options[:pretend]
gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
@@ -15,18 +15,18 @@ def route_entry(raw)
def route_resource(*resources)
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
sentinel = 'ActionController::Routing::Routes.draw do |map|'
-
+
logger.route "map.resource #{resource_list}"
unless options[:pretend]
gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
"#{match}\n map.resource #{resource_list}\n"
end
end
end
-
+
def route_name(name, path, route_options = {})
sentinel = 'ActionController::Routing::Routes.draw do |map|'
-
+
logger.route "map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
unless options[:pretend]
gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
@@ -35,7 +35,7 @@ def route_name(name, path, route_options = {})
end
end
end
-
+
Rails::Generator::Commands::Destroy.class_eval do
def route_resource(*resources)
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
@@ -45,7 +45,7 @@ def route_resource(*resources)
gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
end
end
-
+
def route_name(name, path, route_options = {})
look_for = "\n map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
logger.route "map.#{name} '#{path}', :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
@@ -54,13 +54,13 @@ def route_name(name, path, route_options = {})
end
end
end
-
+
Rails::Generator::Commands::List.class_eval do
def route_resource(*resources)
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
logger.route "map.resource #{resource_list}"
end
-
+
def route_name(name, path, options = {})
logger.route "map.#{name} '#{path}', :controller => '{options[:controller]}', :action => '#{options[:action]}'"
end
@@ -24,7 +24,7 @@ def initialize(runtime_args, runtime_options = {})
def manifest
record do |m|
-
+
# Check for class naming collisions.
# Check for class naming collisions.
m.class_collisions controller_class_path, "#{controller_class_name}Controller", # Oauth Controller
@@ -58,13 +58,13 @@ def manifest
m.route_name 'test_request', '/oauth/test_request',:controller=>'oauth',:action=>'test_request'
m.route_resources "#{controller_file_name}_clients".to_sym
-
+
if !options[:test_unit]
m.directory File.join('spec')
m.directory File.join('spec/models')
m.directory File.join('spec/fixtures', class_path)
m.directory File.join('spec/controllers', controller_class_path)
-
+
m.template 'client_application_spec.rb',File.join('spec/models',"client_application_spec.rb")
m.template 'oauth_token_spec.rb', File.join('spec/models',"oauth_token_spec.rb")
m.template 'oauth2_token_spec.rb', File.join('spec/models',"oauth2_token_spec.rb")
@@ -87,10 +87,10 @@ def manifest
m.template 'oauth_nonces.yml', File.join('test/fixtures',"oauth_nonces.yml")
m.template 'clients_controller_test.rb',File.join('test/functional',controller_class_path,"#{controller_file_name}_clients_controller_test.rb")
end
-
-
+
+
@template_extension= options[:haml] ? "haml" : "erb"
-
+
m.template "_form.html.#{@template_extension}", File.join('app/views', controller_class_path, 'oauth_clients', "_form.html.#{@template_extension}")
m.template "new.html.#{@template_extension}", File.join('app/views', controller_class_path, 'oauth_clients', "new.html.#{@template_extension}")
m.template "index.html.#{@template_extension}", File.join('app/views', controller_class_path, 'oauth_clients', "index.html.#{@template_extension}")
@@ -100,7 +100,7 @@ def manifest
m.template "oauth2_authorize.html.#{@template_extension}", File.join('app/views', controller_class_path, controller_file_name, "oauth2_authorize.html.#{@template_extension}")
m.template "authorize_success.html.#{@template_extension}", File.join('app/views', controller_class_path, controller_file_name, "authorize_success.html.#{@template_extension}")
m.template "authorize_failure.html.#{@template_extension}", File.join('app/views', controller_class_path, controller_file_name, "authorize_failure.html.#{@template_extension}")
-
+
unless options[:skip_migration]
m.migration_template 'migration.rb', 'db/migrate', :assigns => {
:migration_name => "CreateOauthTables"
@@ -117,11 +117,11 @@ def banner
def add_options!(opt)
opt.separator ''
opt.separator 'Options:'
- opt.on("--skip-migration",
+ opt.on("--skip-migration",
"Don't generate a migration file") { |v| options[:skip_migration] = v }
- opt.on("--test-unit",
+ opt.on("--test-unit",
"Generate the Test::Unit compatible tests instead of RSpec") { |v| options[:test_unit] = v }
- opt.on("--haml",
+ opt.on("--haml",
"Templates use haml") { |v| options[:haml] = v }
end
end
@@ -2,20 +2,20 @@
.field
%label{:for=>"client_application_name"} Name*
%br
- = f.text_field :name
+ = f.text_field :name
.field
%label{:for=>"client_application_url"} Main Application URL*
%br
- = f.text_field :url
+ = f.text_field :url
.field
%label{:for=>"client_application_callback_url"} Callback URL*
%br
- = f.text_field :callback_url
+ = f.text_field :callback_url
.field
%label{:for=>"client_application_support_url"} Support URL
%br
- = f.text_field :support_url
+ = f.text_field :support_url
@@ -1,15 +1,15 @@
class AccessToken < OauthToken
validates_presence_of :user, :secret
before_create :set_authorized_at
-
+
# Implement this to return a hash or array of the capabilities the access token has
# This is particularly useful if you have implemented user defined permissions.
# def capabilities
# {:invalidate=>"/oauth/invalidate",:capabilities=>"/oauth/capabilities"}
# end
-
- protected
-
+
+ protected
+
def set_authorized_at
self.authorized_at = Time.now
end
@@ -14,7 +14,7 @@ class ClientApplication < ActiveRecord::Base
validates_format_of :callback_url, :with => /\Ahttp(s?):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/i, :allow_blank=>true
attr_accessor :token_callback_url
-
+
def self.find_token(token_key)
token = OauthToken.find_by_token(token_key, :include => :client_application)
if token && token.authorized?
@@ -23,7 +23,7 @@ def self.find_token(token_key)
nil
end
end
-
+
def self.verify_request(request, options = {}, &block)
begin
signature = OAuth::Signature.build(request, options, &block)
@@ -34,22 +34,22 @@ def self.verify_request(request, options = {}, &block)
false
end
end
-
+
def oauth_server
@oauth_server ||= OAuth::Server.new("http://your.site")
end
-
+
def credentials
@oauth_client ||= OAuth::Consumer.new(key, secret)
end
-
+
# If your application requires passing in extra parameters handle it here
- def create_request_token(params={})
+ def create_request_token(params={})
RequestToken.create :client_application => self, :callback_url=>self.token_callback_url
end
-
+
protected
-
+
def generate_keys
self.key = OAuth::Helper.generate_key(40)[0,40]
self.secret = OAuth::Helper.generate_key(40)[0,40]
Oops, something went wrong. Retry.

0 comments on commit cab0213

Please sign in to comment.