tasks/github-gem.rake in wvanbergen-scoped_search-0.7.3 vs tasks/github-gem.rake in wvanbergen-scoped_search-1.0.0

- old
+ new

@@ -1,6 +1,7 @@ require 'rubygems' +require 'rubyforge' require 'rake' require 'rake/tasklib' require 'date' module Rake @@ -22,27 +23,20 @@ def register_all_tasks! namespace(:gem) do desc "Updates the file lists for this gem" task(:manifest) { manifest_task } + + desc "Builds a .gem package for #{@name}" + task(:build) { build_task } - desc "Builds a ruby gem for #{@name}" - task(:build => [:manifest]) { build_task } - - desc "Installs the ruby gem for #{@name} locally" - task(:install => [:build]) { install_task } - - desc "Uninstalls the ruby gem for #{@name} locally" - task(:uninstall) { uninstall_task } - desc "Releases a new version of #{@name}" task(:release) { release_task } - end + + end end - - protected def reload_gemspec! raise "No gemspec file found!" if gemspec_file.nil? spec = File.read(gemspec_file) @@ -133,28 +127,30 @@ # update the spec file spec = File.read(gemspec_file) spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do assignment = $1 - bunch = $2 ? list.grep(/^test.*_test\.rb$/) : list + bunch = $2 ? list.grep(/^(test.*_test\.rb|spec.*_spec.rb)$/) : list '%s%%w(%s)' % [assignment, bunch.join(' ')] end File.open(gemspec_file, 'w') { |f| f << spec } reload_gemspec! end def build_task sh "gem build #{gemspec_file}" + Dir.mkdir('pkg') unless File.exist?('pkg') + sh "mv #{name}-#{specification.version}.gem pkg/#{name}-#{specification.version}.gem" end def install_task - raise "#{name} .gem file not found" unless File.exist?("#{name}-#{specification.version}.gem") - sh "gem install #{name}-#{specification.version}.gem" + raise "#{name} .gem file not found" unless File.exist?("pkg/#{name}-#{specification.version}.gem") + sh "gem install pkg/#{name}-#{specification.version}.gem" end def uninstall_task - raise "#{name} .gem file not found" unless File.exist?("#{name}-#{specification.version}.gem") + raise "#{name} .gem file not found" unless File.exist?("pkg/#{name}-#{specification.version}.gem") sh "gem uninstall #{name}" end def release_task verify_clean_status('master') \ No newline at end of file