lib/pg_migrate/package.rb in pg_migrate-0.1.6 vs lib/pg_migrate/package.rb in pg_migrate-0.1.7

- old
+ new

@@ -1,11 +1,17 @@ require 'erb' require 'fileutils' require 'rubygems' -require 'rubygems/builder' -#require 'rubygems/package' +begin + # this occurs in rubygems < 2.0.0 + require 'rubygems/builder' +rescue LoadError + # this occurs in rubygems > 2.0.0 + require 'rubygems/package' +end + module PgMigrate class Package attr_accessor :manifest_reader @@ -99,11 +105,15 @@ raise 'unable to build gem from specification' end @log.debug "packaging gem" Dir.chdir(output_dir) do - Gem::Builder.new(spec).build + if defined?(Gem::Builder) + Gem::Builder.new(spec).build + else + Gem::Package.build(spec) + end end #Gem::Package.build spec, false end def userfiles(built_migration_path, name) @@ -137,6 +147,6 @@ File.open(output_filepath, 'w') do |writer| writer.syswrite(content) end end end -end \ No newline at end of file +end