lib/autobuild/importer.rb in autobuild-1.4.9 vs lib/autobuild/importer.rb in autobuild-1.5.0

- old
+ new

@@ -2,11 +2,12 @@ require 'autobuild/exceptions' # This class is the base class for objects that are used to get the source from # various RCS into the package source directory. A list of patches to apply # after the import can be given in the +:patches+ option. -class Autobuild::Importer +module Autobuild +class Importer # Instances of the Importer::Status class represent the status of a current # checkout w.r.t. the remote repository. class Status # Remote and local are at the same point UP_TO_DATE = 0 @@ -42,11 +43,17 @@ # # More options are specific to each importer type. def initialize(options); @options = options end def patches - @options[:patches] ||= [] + if @options[:patches].respond_to?(:to_ary) + @options[:patches] + elsif !@options[:patches] + [] + else + [@options[:patches]] + end end # Performs the import of +package+ def import(package) srcdir = package.srcdir @@ -123,7 +130,8 @@ File.open(patchlist(package), 'w+') do |f| f.write(cur_patches.join("\n")) end end end +end end