diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..901f575 --- /dev/null +++ b/Gemfile @@ -0,0 +1 @@ +gemspec \ No newline at end of file diff --git a/acts_as_ferret.gemspec b/acts_as_ferret.gemspec index 34a519b..966a95c 100644 --- a/acts_as_ferret.gemspec +++ b/acts_as_ferret.gemspec @@ -1,7 +1,9 @@ +require File.expand_path("../lib/acts_as_ferret/version", __FILE__) + Gem::Specification.new do |s| s.name = 'acts_as_ferret' - s.version = '0.4.8.rails3' + s.version = ActsAsFerret::VERSION s.authors = ['Jens Kraemer'] s.summary = 'acts_as_ferret - Ferret based full text search for any ActiveRecord model' s.description = 'Rails plugin that adds powerful full text search capabilities to ActiveRecord models.' @@ -12,37 +14,26 @@ Gem::Specification.new do |s| s.bindir = 'bin' s.executables = ['aaf_install'] s.default_executable = 'aaf_install' - s.require_paths = ["lib"] - s.platform = Gem::Platform::RUBY - s.required_ruby_version = '>=1.8' + s.required_ruby_version = '>= 1.8.7' s.rubygems_version = '1.3.6' - 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('ferret', [">= 0.11.6"]) - else - s.add_dependency('ferret', [">= 0.11.6"]) - end - else - s.add_dependency('ferret', [">= 0.11.6"]) - end + + # the latest official published ferret gem is 0.11.6 which is incompatible with Ruby 1.9.x. + # Therefore I decided to publish the jk-ferret gem built from git head. + s.add_dependency 'jk-ferret', ">= 0.11.8" + s.add_dependency 'rails', ">= 3.0" - s.has_rdoc = true s.rdoc_options << "--charset=UTF-8" << '--title' << 'ActsAsFeret - Ferret powered full text search for Rails' << '--main' << 'README' - s.extra_rdoc_files = [ 'LICENSE', 'README' ] + s.test_files = Dir['test/**/*rb'] s.files = [ - '*rb', 'README', 'LICENSE', 'bin/*', @@ -54,4 +45,6 @@ Gem::Specification.new do |s| 'lib/**/*rb' ].map{|p| Dir[p]}.flatten + s.require_path = 'lib' + end diff --git a/lib/acts_as_ferret/version.rb b/lib/acts_as_ferret/version.rb new file mode 100644 index 0000000..81c768b --- /dev/null +++ b/lib/acts_as_ferret/version.rb @@ -0,0 +1,3 @@ +module ActsAsFerret + VERSION = '0.5' +end \ No newline at end of file diff --git a/rakefile b/rakefile index 09d7979..3335096 100644 --- a/rakefile +++ b/rakefile @@ -1,117 +1,17 @@ -# rakefile for acts_as_ferret. -# use to create a gem or generate rdoc api documentation. -# -# RELEASE creation: -# rake release REL=x.y.z - -require 'pathname' -require 'yaml' -require 'rake' -require 'rake/rdoctask' -require 'rake/packagetask' -require 'rake/gempackagetask' require 'rake/testtask' -require 'rake/contrib/rubyforgepublisher' - -def announce(msg='') - STDERR.puts msg -end - - -PKG_NAME = 'acts_as_ferret' -PKG_VERSION = ENV['REL'] -PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" -RUBYFORGE_PROJECT = 'actsasferret' -RUBYFORGE_USER = 'jkraemer' -desc 'Default: run unit tests.' -task :default => :test - -desc 'Test the acts_as_ferret plugin.' +desc 'Test the library.' Rake::TestTask.new(:test) do |t| t.libs << 'lib' t.pattern = 'test/**/*_test.rb' t.verbose = true end -desc 'Generate documentation for the acts_as_ferret plugin.' -Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'html' - rdoc.title = "acts_as_ferret - Ferret based full text search for any ActiveRecord model" - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.options << '--main' << 'README' - rdoc.rdoc_files.include('README', 'LICENSE') - rdoc.template = "#{ENV['template']}.rb" if ENV['template'] - rdoc.rdoc_files.include('lib/**/*.rb') -end - -# FIXME -desc "Publish the API documentation" -task :pdoc => [:rdoc] do - # Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, RUBYFORGE_USER).upload -end +gemspec = eval(File.read("acts_as_ferret.gemspec")) -if PKG_VERSION - spec = Gem::Specification.new do |s| - s.name = PKG_NAME - s.version = PKG_VERSION.dup - s.platform = Gem::Platform::RUBY - s.rubyforge_project = 'acts_as_ferret' - s.summary = "acts_as_ferret - Ferret based full text search for any ActiveRecord model" - s.description = "Rails plugin that adds powerful full text search capabilities to ActiveRecord models." - s.files = Dir.glob('**/*', File::FNM_DOTMATCH).reject do |f| - [ /\.$/, /sqlite$/, /\.log$/, /^pkg/, /\.svn/, /\.git/, /\.\w+\.sw.$/, - /^html/, /\~$/, /\/\._/, /\/#/, /\._/, /tmp\// ].any? {|regex| f =~ regex } - end - #s.files = FileList["{lib,test}/**/*"].to_a + %w(README MIT-LICENSE CHANGELOG) - s.add_dependency 'ferret' - s.require_path = 'lib' - s.bindir = "bin" - s.executables = ["aaf_install"] - s.default_executable = "aaf_install" - # s.autorequire = 'acts_as_ferret' - s.has_rdoc = true - # s.test_files = Dir['test/**/*_test.rb'] - s.author = "Jens Kraemer" - s.email = "jk@jkraemer.net" - s.homepage = "http://github.com/jkraemer/acts_as_ferret" - end - - desc "Update the gemspec for GitHub's gem server" - task :gemspec do - Pathname("#{spec.name}.gemspec").open('w') {|f| f << YAML.dump(spec) } - end +task :build => "#{gemspec.full_name}.gem" - desc 'build the gem' - task :package => :gemspec do - `gem build acts_as_ferret.gemspec` - `mv #{PKG_FILE_NAME}.gem pkg/#{PKG_FILE_NAME}.gem` - end - - desc 'publish to rubygems.org' - task :push => [ :package, :tag ] do - if ENV['RELTEST'] - announce "Release Task Testing, not pushing to rubygems.org" - else - `gem push pkg/#{PKG_FILE_NAME}.gem` - end - end - - - desc "tag the new release" - task :tag do - reltag = "rel_#{PKG_VERSION.gsub(/\./, '_')}" - announce "Tagging with [#{PKG_VERSION}]" - if ENV['RELTEST'] - announce "Release Task Testing, skipping tagging" - else - `git tag -m 'tagging release #{reltag}' -s #{reltag} HEAD` - `git tag -d stable` - `git tag -m 'tagging HEAD as stable' -s stable HEAD` - end - end - - desc 'Publish the gem and API docs' - task :release => [:pdoc, :push ] - +file "#{gemspec.full_name}.gem" => gemspec.files + ["acts_as_ferret.gemspec"] do + system "gem build acts_as_ferret.gemspec" + system "gem install #{gemspec.full_name}.gem" end