Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed more FB, TC, and Mongo stuff. New gemspec.

  • Loading branch information...
commit 7ba16487cddb05005dcaf31a4ce11c7063aabe10 1 parent 0825f3d
Ned Ludd nedludd authored
10 Rakefile
View
@@ -5,13 +5,13 @@ begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
- gemspec.name = 'sinatra-authentication'
- gemspec.version = '0.3.2'
+ gemspec.name = 'sinatra-authentication-nedludd'
+ gemspec.version = '0.0.1'
gemspec.description = "Simple authentication plugin for sinatra."
gemspec.summary = "Simple authentication plugin for sinatra."
- gemspec.homepage = "http://github.com/maxjustus/sinatra-authentication"
- gemspec.author = "Max Justus Spransy"
- gemspec.email = "maxjustus@gmail.com"
+ gemspec.homepage = "http://github.com/nedludd/sinatra-authentication"
+ gemspec.author = ["Max Justus Spransy" "Tim Hermans"]
+ gemspec.email = ["maxjustus@gmail.com" "thermans@gmail.com"]
gemspec.add_dependency "sinatra"
gemspec.add_dependency "dm-core"
gemspec.add_dependency "dm-migrations"
3  lib/models/datamapper_user.rb
View
@@ -7,9 +7,6 @@ class DmUser
property :salt, String
property :created_at, DateTime
property :permission_level, Integer, :default => 1
- if Sinatra.const_defined?('FacebookObject')
- property :fb_uid, String
- end
attr_accessor :password, :password_confirmation
#protected equievelant? :protected => true doesn't exist in dm 0.10.0
7 lib/views/edit.haml
View
@@ -8,8 +8,6 @@
- else
- if @user.email
= @user.email
- - elsif @user.fb_uid
- <fb:name uid=#{@user.fb_uid} linked='false' />
- else
account
%form{:action => "/users/#{@user.id}/edit", :method => "post"}
@@ -37,7 +35,4 @@
Authenticated user
.buttons
%input{ :value => "Update", :type => "submit" }
- - if Sinatra.const_defined?('FacebookObject')
- - unless @user.fb_uid
- |
- = render_facebook_connect_link('Link account with Facebook')
+
2  lib/views/index.haml
View
@@ -10,8 +10,6 @@
%td
- if user.email
= user.email
- - elsif user.fb_uid
- <fb:name uid=#{user.fb_uid} />
- else
"user #{user.id}"
- if current_user.admin?
6 lib/views/login.haml
View
@@ -15,8 +15,4 @@
%input{:value => "login", :type => "submit"}
%a{:href => "/signup", :class => 'sinatra_authentication_link'}
Signup
- - if Sinatra.const_defined?('FacebookObject')
- .third_party_signup
- %h3.section_title One click login:
- .login_link.facebook_login
- = render_facebook_connect_link('Login using facebook', :size => 'large')
+
2  lib/views/show.haml
View
@@ -2,8 +2,6 @@
%h1.page_title
- if @user.email
= @user.email
- - elsif @user.fb_uid
- <fb:name uid=#{@user.fb_uid} linked='false' />
- if current_user.admin?
%h2 permission level
= @user.permission_level
5 lib/views/signup.haml
View
@@ -19,8 +19,3 @@
%input{ :value => "Create account", :type => "submit" }
%a{:href => "/login", :class => 'sinatra_authentication_link'}
Login
- - if Sinatra.const_defined?('FacebookObject')
- .third_party_signup
- %h3.section_title One click signup:
- .login_link.facebook_login
- = render_facebook_connect_link('Signup using facebook', :size => 'large')
109 sinatra-authentication.gemspec
View
@@ -1,109 +0,0 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{sinatra-authentication}
- s.version = "0.3.2"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Max Justus Spransy"]
- s.date = %q{2010-06-29}
- s.description = %q{Simple authentication plugin for sinatra.}
- s.email = %q{maxjustus@gmail.com}
- s.extra_rdoc_files = [
- "TODO"
- ]
- s.files = [
- ".gitignore",
- "History.txt",
- "Manifest",
- "Rakefile",
- "TODO",
- "example/dm_extend_app.rb",
- "example/dm_sinbook.rb",
- "example/extend_views/edit.haml",
- "example/extend_views/index.haml",
- "example/extend_views/login.haml",
- "example/extend_views/show.haml",
- "example/extend_views/signup.haml",
- "example/mm_app.rb",
- "example/tc_app.rb",
- "example/tc_sinbook.rb",
- "lib/models/abstract_user.rb",
- "lib/models/datamapper_user.rb",
- "lib/models/dm_adapter.rb",
- "lib/sinatra-authentication.rb",
- "lib/views/edit.haml",
- "lib/views/index.haml",
- "lib/views/login.haml",
- "lib/views/show.haml",
- "lib/views/signup.haml",
- "readme.markdown",
- "sinatra-authentication.gemspec",
- "test/datamapper_test.rb",
- "test/lib/dm_app.rb",
- "test/lib/dm_extend_app.rb",
- "test/lib/dm_sinbook.rb",
- "test/lib/extend_views/edit.haml",
- "test/lib/extend_views/index.haml",
- "test/lib/extend_views/login.haml",
- "test/lib/extend_views/show.haml",
- "test/lib/extend_views/signup.haml",
- "test/lib/helper.rb",
- "test/lib/mm_app.rb",
- "test/lib/tc_app.rb",
- "test/lib/tc_sinbook.rb",
- "test/mongomapper_test.rb",
- "test/route_tests.rb",
- "test/rufus_tokyo_test.rb"
- ]
- s.homepage = %q{http://github.com/maxjustus/sinatra-authentication}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.6}
- s.summary = %q{Simple authentication plugin for sinatra.}
- s.test_files = [
- "test/route_tests.rb",
- "test/datamapper_test.rb",
- "test/rufus_tokyo_test.rb",
- "test/mongomapper_test.rb",
- "test/lib/tc_app.rb",
- "test/lib/dm_app.rb",
- "test/lib/mm_app.rb",
- "test/lib/tc_sinbook.rb",
- "test/lib/dm_sinbook.rb",
- "test/lib/helper.rb",
- "test/lib/dm_extend_app.rb"
- ]
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
-
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<sinatra>, [">= 0"])
- s.add_runtime_dependency(%q<dm-core>, [">= 0"])
- s.add_runtime_dependency(%q<dm-migrations>, [">= 0"])
- s.add_runtime_dependency(%q<dm-validations>, [">= 0"])
- s.add_runtime_dependency(%q<dm-timestamps>, [">= 0"])
- s.add_runtime_dependency(%q<rack-flash>, [">= 0"])
- else
- s.add_dependency(%q<sinatra>, [">= 0"])
- s.add_dependency(%q<dm-core>, [">= 0"])
- s.add_dependency(%q<dm-migrations>, [">= 0"])
- s.add_dependency(%q<dm-validations>, [">= 0"])
- s.add_dependency(%q<dm-timestamps>, [">= 0"])
- s.add_dependency(%q<rack-flash>, [">= 0"])
- end
- else
- s.add_dependency(%q<sinatra>, [">= 0"])
- s.add_dependency(%q<dm-core>, [">= 0"])
- s.add_dependency(%q<dm-migrations>, [">= 0"])
- s.add_dependency(%q<dm-validations>, [">= 0"])
- s.add_dependency(%q<dm-timestamps>, [">= 0"])
- s.add_dependency(%q<rack-flash>, [">= 0"])
- end
-end
-
55 test/lib/dm_sinbook.rb
View
@@ -1,55 +0,0 @@
-require 'rubygems'
-require 'sinatra'
-require 'haml'
-require 'sinbook'
-require 'dm-core'
-require File.join(File.dirname(__FILE__), '../../lib/sinatra-authentication')
-
-facebook do
- api_key 'aa2db1b96cb7b57f0c5b1d4d3d8f0a22'
- secret '21d94ee63969ae3b3f833689838ca00f'
- app_id 48652736613
- url 'peoplewithjetpacks.com:4568/'
- callback 'peoplewithjetpacks.com:4568/'
-end
-
-set :port, 4568
-
-DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/test.db")
-DataMapper.auto_migrate!
-
-use Rack::Session::Cookie, :secret => "heyhihello"
-
-set :environment, 'development'
-set :public, 'public'
-set :views, 'views'
-
-get '/' do
- haml :main
-end
-
-get '/test' do
- login_required
- 'hihihi'
-end
-
-__END__
-
-@@ layout
-%html{:xmlns=>"http://www.w3.org/1999/xhtml", :'xmlns:fb'=>"http://www.facebook.com/2008/fbml"}
- %head
- %title Welcome to my Facebook Connect website!
- %script{:type => 'text/javascript', :src => 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US'}
- %body
- = render_login_logout
- = yield
- :javascript
- FB.init("#{fb.api_key}", "/receiver")
-
-@@ main
-- if fb[:user]
- Hi,
- %fb:profile-pic{:uid => fb[:user]}
- %fb:name{:uid => fb[:user], :useyou => 'false', :firstnameonly => 'true'}
- !
-
24 test/lib/mm_app.rb
View
@@ -1,24 +0,0 @@
-require 'rubygems'
-require 'sinatra/base'
-require 'haml'
-require 'mongo_mapper'
-require File.join(File.dirname(__FILE__), '../../lib/sinatra-authentication')
-
-logger = Logger.new($stdout)
-MongoMapper.connection = Mongo::Connection.new('db.mongohq.com', 27017, :logger => logger)
-MongoMapper.database = "fdbk"
-MongoMapper.database.authenticate(ENV['mongohq_user'], ENV['mongohq_pass'])
-
-class TestApp < Sinatra::Base
- use Rack::Session::Cookie, :secret => "heyhihello"
-
- register Sinatra::LilAuthentication
-
- set :environment, 'development'
- set :public, 'public'
- set :views, 'views'
-
- get '/' do
- haml "= render_login_logout", :layout => :layout
- end
-end
16 test/lib/tc_app.rb
View
@@ -1,16 +0,0 @@
-require 'rubygems'
-require 'sinatra'
-require 'haml'
-require 'rufus/tokyo'
-require File.join(File.dirname(__FILE__), '../../lib/sinatra-authentication')
-
-use Rack::Session::Cookie, :secret => "heyhihello"
-TcUserTable.cabinet_path = File.dirname(__FILE__)
-
-set :environment, 'development'
-set :public, 'public'
-set :views, 'views'
-
-get '/' do
- haml "= render_login_logout", :layout => :layout
-end
62 test/lib/tc_sinbook.rb
View
@@ -1,62 +0,0 @@
-require 'rubygems'
-require 'haml'
-require 'sinbook'
-require 'rufus/tokyo'
-require 'sinatra'
-require File.join(File.dirname(__FILE__), '../../lib/sinatra-authentication')
-
-use Rack::Session::Cookie, :secret => "heyhihello"
-TcUserTable.cabinet_path = File.dirname(__FILE__)
-
-facebook do
- api_key 'aa2db1b96cb7b57f0c5b1d4d3d8f0a22'
- secret '21d94ee63969ae3b3f833689838ca00f'
- app_id 48652736613
- url 'peoplewithjetpacks.com:4568/'
- callback 'peoplewithjetpacks.com:4568/'
-end
-
-set :port, 4568
-
-get '/' do
- haml :main
-end
-
-get '/test' do
- login_required
- 'hihihi'
-end
-
-__END__
-
-@@ layout
-%html{:xmlns=>"http://www.w3.org/1999/xhtml", :'xmlns:fb'=>"http://www.facebook.com/2008/fbml"}
- %head
- %title Welcome to my Facebook Connect website!
- %script{:type => 'text/javascript', :src => 'http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US'}
- %script{:type => 'text/javascript', :src => 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'}
- :javascript
- $(document).ready(function(){
- /* test facebook crap works with ajax */
- $('.sinatra-authentication-login').click(function(){
- $.get($(this).attr('href'), {}, function(data){
- $('#test_box').html(data);
- });
- return false;
- });
- });
- %body
- = render_login_logout
- = yield
- :javascript
- FB.init("#{fb.api_key}", "/receiver")
- #test_box
-
-@@ main
-- if fb[:user]
- Hi,
- %fb:profile-pic{:uid => fb[:user]}
- %fb:name{:uid => fb[:user], :useyou => 'false', :firstnameonly => 'true'}
- !
- %br/
-
39 test/mongomapper_test.rb
View
@@ -1,39 +0,0 @@
-require 'lib/mm_app'
-require 'lib/helper'
-require 'test/unit'
-require 'rack/test'
-
-Test::Unit::TestCase.send :include, Rack::Test::Methods
-
-class SinatraAuthMongoMapperTest < Test::Unit::TestCase
- include Rack::Test::Methods
-
- def app
- TestApp
- end
-
- def setup
- post '/signup', TestHelper.gen_user
- follow_redirect!
- get '/logout'
- end
-
- def test_should_login
- post '/login', {'email' => TestHelper.gen_user['user[email]'], 'password' => TestHelper.gen_user['user[password]']}
- follow_redirect!
-
- assert_equal 'http://example.org/', last_request.url
- #assert cookie_jar['user']
- assert last_request.env['rack.session'][:user]
- assert last_response.ok?
- end
-
- def test_should_logout
- post '/login', {'email' => TestHelper.gen_user['user[email]'], 'password' => TestHelper.gen_user['user[password]']}
- get '/logout'
- follow_redirect!
-
- assert !last_request.env['rack.session'][:user]
- assert_equal 'http://example.org/', last_request.url
- end
-end
5 test/rufus_tokyo_test.rb
View
@@ -1,5 +0,0 @@
-require 'lib/tc_app'
-require 'lib/helper'
-require 'test/unit'
-require 'rack/test'
-require 'route_tests'
Please sign in to comment.
Something went wrong with that request. Please try again.