Rakefile in sphinx-0.9.10.2122 vs Rakefile in sphinx-2.1.1.3711

- old
+ new

@@ -1,45 +1,50 @@ -require 'rake' +require 'bundler' +Bundler::GemHelper.install_tasks -begin - require 'jeweler' - Jeweler::Tasks.new do |gemspec| - gemspec.name = 'sphinx' - gemspec.summary = 'Sphinx Client API for Ruby' - gemspec.description = 'An easy interface to Sphinx standalone full-text search engine. It is implemented as plugin for Ruby on Rails, but can be easily used as standalone library.' - gemspec.email = 'kpumuk@kpumuk.info' - gemspec.homepage = 'http://github.com/kpumuk/sphinx' - gemspec.authors = ['Dmytro Shteflyuk'] +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) + +task :test => :spec +task :default => :spec + +require 'yard' +YARD::Rake::YardocTask.new(:yard) do |t| + t.options = ['--title', 'Sphinx Client API Documentation'] + if ENV['PRIVATE'] + t.options.concat ['--protected', '--private'] + else + t.options.concat ['--protected', '--no-private'] end - Jeweler::GemcutterTasks.new -rescue LoadError - puts 'Jeweler not available. Install it with: sudo gem install jeweler' end -begin - require 'spec/rake/spectask' +require 'bundler' +Bundler::GemHelper.install_tasks - desc 'Default: run specs' - task :default => :spec +namespace :fixtures do + FIXTURES_DIR = File.expand_path('../spec/fixtures', __FILE__) - desc 'Test the sphinx plugin' - Spec::Rake::SpecTask.new do |t| - t.libs << 'lib' - t.pattern = 'spec/*_spec.rb' + desc 'Update textures for sphinx requests' + task :requests do + rm Dir.glob("#{FIXTURES_DIR}/requests/*.dat") + Dir["#{FIXTURES_DIR}/requests/php/*.php"].each do |file| + puts name = File.basename(file, '.php') + File.open(File.join(File.dirname(file), '..', "#{name}.dat"), 'w') do |f| + f.write `env SPHINX_MOCK_REQUEST=1 php "#{file}"` + end + end end -rescue LoadError - puts 'RSpec not available. Install it with: sudo gem install rspec' -end -begin - require 'yard' - YARD::Rake::YardocTask.new(:yard) do |t| - t.options = ['--title', 'Sphinx Client API Documentation'] - if ENV['PRIVATE'] - t.options.concat ['--protected', '--private'] - else - t.options << '--no-private' + desc 'Update textures for sphinx responses' + task :responses do + rm Dir.glob("#{FIXTURES_DIR}/responses/*.dat") + Dir["#{FIXTURES_DIR}/responses/php/*.php"].each do |file| + puts name = File.basename(file, '.php') + File.open(File.join(File.dirname(file), '..', "#{name}.dat"), 'w') do |f| + f.write `env SPHINX_MOCK_RESPONSE=1 php "#{file}"` + end end end -rescue LoadError - puts 'Yard not available. Install it with: sudo gem install yard' end + +desc 'Update binary fixtures' +task :fixtures => %w[ fixtures:requests fixtures:responses]