diff --git a/.gitignore b/.gitignore index 793ffc5..614ca65 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,7 @@ oa-live *.gem .bundle .project +.yardoc +doc Gemfile.lock diff --git a/Rakefile b/Rakefile index 43a2060..958b3ba 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,14 @@ require 'rubygems' require 'rake' -require 'term/ansicolor' -include Term::ANSIColor +begin + require 'term/ansicolor' + include Term::ANSIColor +rescue LoadError + def cyan; '' end + def blue; '' end + def clear; '' end +end OMNIAUTH_GEMS = %w(oa-basic oa-core oa-oauth oa-openid oa-enterprise omniauth) @@ -60,6 +66,15 @@ namespace :dependencies do end end +task :release => ['release:tag', 'gems:publish', 'doc:pages:publish'] + +namespace :release do + task :tag do + system("git tag v#{version}") + system('git push origin --tags') + end +end + namespace :gems do desc 'Build all gems' @@ -70,7 +85,7 @@ namespace :gems do end desc 'Push all gems to Gemcutter' - task :release do + task :push do each_gem('is releasing to Gemcutter...') do system('rake gem:publish') end @@ -119,3 +134,33 @@ namespace :version do end task :default => :spec + +begin + require 'yard' + YARD::Rake::YardocTask.new(:doc) do |t| + t.name = 'doc' + t.files = OMNIAUTH_GEMS.inject([]){|a,g| a = a + ["#{g}/lib/**/*.rb"]; a} + ['README.markdown'] + t.options = ["-o", "../omniauth.doc"] + end + + namespace :doc do + YARD::Rake::YardocTask.new(:pages) do |t| + t.files = OMNIAUTH_GEMS.inject([]){|a,g| a = a + ["#{g}/lib/**/*.rb"]; a} + ['README.markdown'] + t.options = ["-o", "../omniauth.doc"] + end + + namespace :pages do + desc 'Generate and publish YARD docs to GitHub pages.' + task :publish => ['doc:pages'] do + Dir.chdir(File.dirname(__FILE__) + '/../omniauth.doc') do + system("git add .") + system("git add -u") + system("git commit -m 'Generating docs for version #{version}.'") + system("git push origin gh-pages") + end + end + end + end +rescue LoadError + puts "You need to install YARD." +end \ No newline at end of file diff --git a/oa-openid/README.rdoc b/oa-openid/README.rdoc deleted file mode 100644 index 7a16856..0000000 --- a/oa-openid/README.rdoc +++ /dev/null @@ -1,49 +0,0 @@ -= OmniAuth::OpenID - -OpenID strategies for the OmniAuth gem. - -== Installation - -To get just OpenID functionality: - - gem install oa-openid - -For the full auth suite: - - gem install omniauth - -== Stand-Alone Example - -Use the strategy as a middleware in your application: - - require 'omniauth/openid' - require 'openid/store/filesystem' - - use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp') - -Then simply direct users to '/auth/open_id' to prompt them for their OpenID identifier. You may also pre-set the identifier by passing an identifier parameter to the URL (Example: /auth/open_id?openid_url=yahoo.com). - -A list of all OpenID stores is available at http://github.com/openid/ruby-openid/tree/master/lib/openid/store/ - -== OmniAuth Builder - -If OpenID is one of several authentication strategies, use the OmniAuth Builder: - - require 'omniauth/openid' - require 'omniauth/basic' # for Campfire - require 'openid/store/filesystem' - - use OmniAuth::Builder do - provider :open_id, OpenID::Store::Filesystem.new('/tmp') - provider :campfire - end - -== Configured Identifiers - -You may pre-configure an OpenID identifier. For example, to use Google's main OpenID endpoint: - - use OmniAuth::Builder do - provider :openid, nil, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id' - end - -Note the use of nil, which will trigger ruby-openid's default Memory Store. \ No newline at end of file diff --git a/oa-openid/lib/omniauth/openid.rb b/oa-openid/lib/omniauth/openid.rb index 5a40f8c..26d0be3 100644 --- a/oa-openid/lib/omniauth/openid.rb +++ b/oa-openid/lib/omniauth/openid.rb @@ -1,6 +1,57 @@ require 'omniauth/core' module OmniAuth + # OmniAuth::OpenID provides strategies for authenticating to providers + # using the OpenID standard. + # + # == Installation + # + # To get just OpenID functionality: + # + # gem install oa-openid + # + # For the full auth suite: + # + # gem install omniauth + # + # == Stand-Alone Example + # + # Use the strategy as a middleware in your application: + # + # require 'omniauth/openid' + # require 'openid/store/filesystem' + # + # use Rack::Session::Cookie + # use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp') + # + # Then simply direct users to '/auth/open_id' to prompt them for their OpenID identifier. You may also pre-set the identifier by passing an identifier parameter to the URL (Example: /auth/open_id?openid_url=yahoo.com). + # + # A list of all OpenID stores is available at http://github.com/openid/ruby-openid/tree/master/lib/openid/store/ + # + # == OmniAuth Builder + # + # If OpenID is one of several authentication strategies, use the OmniAuth Builder: + # + # require 'omniauth/openid' + # require 'omniauth/basic' # for Campfire + # require 'openid/store/filesystem' + # + # use OmniAuth::Builder do + # provider :open_id, OpenID::Store::Filesystem.new('/tmp') + # provider :campfire + # end + # + # == Configured Identifiers + # + # You may pre-configure an OpenID identifier. For example, to use Google's main OpenID endpoint: + # + # use OmniAuth::Builder do + # provider :open_id, nil, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id' + # end + # + # Note the use of nil, which will trigger ruby-openid's default Memory Store. + module OpenID; end + module Strategies autoload :OpenID, 'omniauth/strategies/open_id' autoload :GoogleApps, 'omniauth/strategies/google_apps'