Skip to content

Commit

Permalink
add gem tasks to Rakefile
Browse files Browse the repository at this point in the history
- rake gemspec
  generates open_id_authentication.gemspec to build gem in GitHub
- rake package
  build gem in pkg/open_id_authentication-VERSION.gem
- rake debug_gem
  show gemspec to be generated.
  • Loading branch information
moro committed Mar 25, 2009
1 parent e6df783 commit edaade0
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 17 deletions.
63 changes: 63 additions & 0 deletions Rakefile
@@ -1,6 +1,8 @@
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'

desc 'Default: run unit tests.'
task :default => :test
Expand All @@ -20,3 +22,64 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end

NAME = ENV["GEMNAME"] || "open_id_authentication"
DESCRIPTION = "Provides a thin wrapper around the excellent ruby-openid gem from JanRan. gem version is unofficial, github fork of rails's by moro"
AUTHOR = "David Heinemeier Hansson"
EMAIL = ""
HOMEPAGE = "http//github.com/rails/open_id_authentication"

RDOC_OPTS = [
'--title', "#{NAME} documentation",
"--charset", "utf-8",
"--opname", "index.html",
"--line-numbers",
"--main", "README",
"--inline-source",
]

spec = Gem::Specification.new do |s|
s.name = NAME
s.version = "1.0.0"
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = ["README", "CHANGElOG"]
s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
s.summary = DESCRIPTION
s.description = DESCRIPTION
s.author = AUTHOR
s.email = EMAIL
s.homepage = HOMEPAGE
s.executables = []
s.require_path = "lib"
s.test_files = Dir["test/*_test.rb"]

s.add_dependency("ruby-openid", ">=2.0.4")
#s.add_dependency('activesupport', '>=1.3.1')
#s.required_ruby_version = '>= 1.8.2'

s.files = %w(README CHANGElOG Rakefile) +
Dir.glob("{bin,doc,test,lib,templates,generators,extras,website,script}/**/*") +
Dir.glob("ext/**/*.{h,c,rb}") +
Dir.glob("examples/**/*.rb") +
Dir.glob("tools/*.rb") +
Dir.glob("rails/*.rb")

s.extensions = FileList["ext/**/extconf.rb"].to_a
end

Rake::GemPackageTask.new(spec) do |p|
p.need_tar = true
p.gem_spec = spec
end

desc 'Show information about the gem.'
task :debug_gem do
puts spec.to_ruby
end

desc 'Update gem spec'
task :gemspec do
open("#{NAME}.gemspec", 'w').write spec.to_ruby
end

19 changes: 2 additions & 17 deletions init.rb
@@ -1,18 +1,3 @@
if config.respond_to?(:gems)
config.gem 'ruby-openid', :lib => 'openid', :version => '>=2.0.4'
else
begin
require 'openid'
rescue LoadError
begin
gem 'ruby-openid', '>=2.0.4'
rescue Gem::LoadError
puts "Install the ruby-openid gem to enable OpenID support"
end
end
end
#!/usr/bin/env ruby

config.to_prepare do
OpenID::Util.logger = Rails.logger
ActionController::Base.send :include, OpenIdAuthentication
end
load File.expand_path('rails/init.rb', File.dirname(__FILE__))
34 changes: 34 additions & 0 deletions open_id_authentication.gemspec
@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{open_id_authentication}
s.version = "1.0.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["David Heinemeier Hansson"]
s.date = %q{2009-03-25}
s.description = %q{Provides a thin wrapper around the excellent ruby-openid gem from JanRan. gem version is unofficial, github fork of rails's by moro}
s.email = %q{}
s.extra_rdoc_files = ["README", "CHANGElOG"]
s.files = ["README", "CHANGElOG", "Rakefile", "test/mem_cache_store_test.rb", "test/normalize_test.rb", "test/open_id_authentication_test.rb", "test/status_test.rb", "test/test_helper.rb", "lib/open_id_authentication", "lib/open_id_authentication/association.rb", "lib/open_id_authentication/db_store.rb", "lib/open_id_authentication/mem_cache_store.rb", "lib/open_id_authentication/nonce.rb", "lib/open_id_authentication/request.rb", "lib/open_id_authentication/timeout_fixes.rb", "lib/open_id_authentication.rb", "generators/open_id_authentication_tables", "generators/open_id_authentication_tables/open_id_authentication_tables_generator.rb", "generators/open_id_authentication_tables/templates", "generators/open_id_authentication_tables/templates/migration.rb", "generators/upgrade_open_id_authentication_tables", "generators/upgrade_open_id_authentication_tables/templates", "generators/upgrade_open_id_authentication_tables/templates/migration.rb", "generators/upgrade_open_id_authentication_tables/upgrade_open_id_authentication_tables_generator.rb", "rails/init.rb"]
s.has_rdoc = true
s.homepage = %q{http//github.com/rails/open_id_authentication}
s.rdoc_options = ["--title", "open_id_authentication documentation", "--charset", "utf-8", "--opname", "index.html", "--line-numbers", "--main", "README", "--inline-source", "--exclude", "^(examples|extras)/"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.1}
s.summary = %q{Provides a thin wrapper around the excellent ruby-openid gem from JanRan. gem version is unofficial, github fork of rails's by moro}
s.test_files = ["test/mem_cache_store_test.rb", "test/normalize_test.rb", "test/open_id_authentication_test.rb", "test/status_test.rb"]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<ruby-openid>, [">= 2.0.4"])
else
s.add_dependency(%q<ruby-openid>, [">= 2.0.4"])
end
else
s.add_dependency(%q<ruby-openid>, [">= 2.0.4"])
end
end
18 changes: 18 additions & 0 deletions rails/init.rb
@@ -0,0 +1,18 @@
if config.respond_to?(:gems)
config.gem 'ruby-openid', :lib => 'openid', :version => '>=2.0.4'
else
begin
require 'openid'
rescue LoadError
begin
gem 'ruby-openid', '>=2.0.4'
rescue Gem::LoadError
puts "Install the ruby-openid gem to enable OpenID support"
end
end
end

config.to_prepare do
OpenID::Util.logger = Rails.logger
ActionController::Base.send :include, OpenIdAuthentication
end

0 comments on commit edaade0

Please sign in to comment.