Permalink
Browse files

Some changes to support Bundler Gemhelper. Plus removing some old code

  • Loading branch information...
xntrik committed Jan 26, 2012
1 parent 4af2e61 commit 95fbb35c1576fbeb77ae083ec0369bda660b8029
View
@@ -46,3 +46,8 @@ pkg
# For rubinius:
#*.rbc
+
+# For Project
+test/rails_app/log
+test/rails_app/db/*.sqlite3
+Gemfile.lock
View
21 Gemfile
@@ -1,32 +1,13 @@
-source "http://rubygems.org"
-# Add dependencies required to use your gem here.
-# Example:
-gem "activesupport", "3.1.3"
-gem "rails"
-gem "devise"
-gem "rotp"
+source :rubygems
gemspec
-# The below are yoinked from devise_invitable's gemfile
group :test do
gem "sqlite3"
- gem "mongoid", "~> 2.0"
gem "bson_ext", "~> 1.3"
gem "capybara", "~> 0.4.0"
gem 'shoulda', '~> 2.11.3'
gem 'mocha', '~> 0.9.9'
gem 'factory_girl_rails', '~> 1.0'
gem 'rspec-rails', '~> 2.5.0'
end
-
-# End devise_invitable's gemfile stuff
-
-# Add dependencies to develop your gem here.
-# Include everything needed to run rake, tests, features, etc.
-group :development do
- gem "shoulda", "~> 2.11.3"
- gem "bundler", "~> 1.0.0"
- gem "jeweler", "~> 1.6.4"
- gem "simplecov"
-end
View
@@ -1,30 +1,6 @@
-# encoding: utf-8
-
-require 'rubygems'
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
require 'rake'
-
-require 'jeweler'
-Jeweler::Tasks.new do |gem|
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
- gem.name = "devise_google_authenticator"
- gem.homepage = "http://github.com/AsteriskLabs/devise_google_authenticator"
- gem.license = "MIT"
- gem.summary = %Q{Devise Google Authenticator Extension}
- gem.description = %Q{Devise Google Authenticator Extension, for adding Google's OTP to your Rails apps!}
- gem.email = "xntrik@gmail.com"
- gem.authors = ["Christian Frichot"]
- gem.files = Dir["{app,config,lib}/**/*"] + %w[LICENSE.txt README.rdoc]
- # dependencies defined in Gemfile
-end
-Jeweler::RubygemsDotOrgTasks.new
+require 'bundler'
+Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
@@ -33,30 +9,13 @@ Rake::TestTask.new(:test) do |test|
test.verbose = true
end
-# require 'rcov/rcovtask'
-# Rcov::RcovTask.new do |test|
-# test.libs << 'test'
-# test.pattern = 'test/**/test_*.rb'
-# test.verbose = true
-# test.rcov_opts << '--exclude "gems/*"'
-# end
-
+desc 'Default: run tests for all ORMs.'
task :default => :tests
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
-
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "devise_google_authenticator #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
-
desc 'Run Devise tests for all ORMs.'
task :tests do
Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
orm = File.basename(file).split(".").first
system "rake test DEVISE_ORM=#{orm}"
end
-end
+end
@@ -1,13 +1,8 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
-
+$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
Gem::Specification.new do |s|
s.name = "devise_google_authenticator"
s.version = "0.2.0"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Christian Frichot"]
s.date = "2012-01-23"
s.description = "Devise Google Authenticator Extension, for adding Google's OTP to your Rails apps!"
@@ -16,80 +11,23 @@ Gem::Specification.new do |s|
"LICENSE.txt",
"README.rdoc"
]
- s.files = [
- "LICENSE.txt",
- "README.rdoc",
- "app/controllers/devise/checkga_controller.rb",
- "app/controllers/devise/displayqr_controller.rb",
- "app/views/devise/checkga/show.html.erb",
- "app/views/devise/displayqr/show.html.erb",
- "config/locales/en.yml",
- "lib/devise_google_authenticatable/controllers/helpers.rb",
- "lib/devise_google_authenticatable/hooks/google_authenticatable.rb",
- "lib/devise_google_authenticatable/models/google_authenticatable.rb",
- "lib/devise_google_authenticatable/orm/active_record.rb",
- "lib/devise_google_authenticatable/patches.rb",
- "lib/devise_google_authenticatable/patches/check_ga.rb",
- "lib/devise_google_authenticatable/patches/display_qr.rb",
- "lib/devise_google_authenticatable/rails.rb",
- "lib/devise_google_authenticatable/routes.rb",
- "lib/devise_google_authenticatable/schema.rb",
- "lib/devise_google_authenticator.rb",
- "lib/generators/active_record/devise_google_authenticator_generator.rb",
- "lib/generators/active_record/templates/migration.rb",
- "lib/generators/devise_google_authenticator/devise_google_authenticator_generator.rb",
- "lib/generators/devise_google_authenticator/install_generator.rb",
- "lib/generators/devise_google_authenticator/views_generator.rb"
- ]
+ s.files = Dir["{app,config,lib}/**/*"] + %w[LICENSE.txt README.rdoc]
s.homepage = "http://github.com/AsteriskLabs/devise_google_authenticator"
s.licenses = ["MIT"]
s.require_paths = ["lib"]
- s.rubygems_version = "1.8.10"
s.summary = "Devise Google Authenticator Extension"
- if s.respond_to? :specification_version then
- s.specification_version = 3
+ s.required_ruby_version = '>= 1.8.6'
+ s.required_rubygems_version = '>= 1.3.6'
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<activesupport>, ["= 3.2.0"])
- s.add_runtime_dependency(%q<rails>, [">= 0"])
- s.add_runtime_dependency(%q<devise>, [">= 0"])
- s.add_runtime_dependency(%q<rotp>, [">= 0"])
- s.add_runtime_dependency(%q<devise_google_authenticator>, [">= 0"])
- s.add_development_dependency(%q<shoulda>, ["~> 2.11.3"])
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_development_dependency(%q<shoulda>, ["~> 2.11.3"])
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_development_dependency(%q<simplecov>, [">= 0"])
- else
- s.add_dependency(%q<activesupport>, ["= 3.2.0"])
- s.add_dependency(%q<rails>, [">= 0"])
- s.add_dependency(%q<devise>, [">= 0"])
- s.add_dependency(%q<rotp>, [">= 0"])
- s.add_dependency(%q<devise_google_authenticator>, [">= 0"])
- s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<simplecov>, [">= 0"])
- end
- else
- s.add_dependency(%q<activesupport>, ["= 3.2.0"])
- s.add_dependency(%q<rails>, [">= 0"])
- s.add_dependency(%q<devise>, [">= 0"])
- s.add_dependency(%q<rotp>, [">= 0"])
- s.add_dependency(%q<devise_google_authenticator>, [">= 0"])
- s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<shoulda>, ["~> 2.11.3"])
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
- s.add_dependency(%q<simplecov>, [">= 0"])
+ s.add_development_dependency('bundler', '~> 1.0.7')
+
+ {
+ 'rails' => ['>= 3.0.0', '< 3.2'],
+ 'devise' => ['>= 1.4.6', '< 1.6'],
+ 'rotp' => ['< 1.3.2']
+ }.each do |lib, version|
+ s.add_runtime_dependency(lib, *version)
end
-end
-
+
+end
@@ -1,9 +0,0 @@
-Warden::Manager.after_set_user do |record, warden, options|
- if record.respond_to?(:login_phase_one)
- if warden.session(options[:scope]).fetch(:gauth_phase_one,"nope") == "nope"
- redirect_to :controller => 'checkga', :action => 'show'
- end
- #warden.session(options[:scope])[:gauth_phase_one]
- #respond_with record, :location => {:controller => 'checkga', :action => 'show'}
- end
-end
@@ -1,5 +1,4 @@
require 'rotp'
-#require 'devise_google_authenticatable/hooks/google_authenticatable'
module Devise # :nodoc:
module Models # :nodoc:
@@ -23,17 +22,13 @@ def get_qr
def set_gauth_enabled(param)
self.update_without_password(param)
end
-
- def login_phase_one
- return "yep"
- end
def assign_tmp
self.update_attributes(:gauth_tmp => ROTP::Base32.random_base32, :gauth_tmp_datetime => DateTime.now)
self.gauth_tmp
end
- def validate_token(token)
+ def validate_token(token)
if self.gauth_tmp_datetime < self.class.ga_timeout.ago
return false
else

0 comments on commit 95fbb35

Please sign in to comment.