Return-Path: Delivered-To: apmail-incubator-buildr-commits-archive@locus.apache.org Received: (qmail 33705 invoked from network); 21 Sep 2008 17:53:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Sep 2008 17:53:27 -0000 Received: (qmail 53945 invoked by uid 500); 21 Sep 2008 17:53:24 -0000 Delivered-To: apmail-incubator-buildr-commits-archive@incubator.apache.org Received: (qmail 53928 invoked by uid 500); 21 Sep 2008 17:53:24 -0000 Mailing-List: contact buildr-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: buildr-dev@incubator.apache.org Delivered-To: mailing list buildr-commits@incubator.apache.org Received: (qmail 53919 invoked by uid 99); 21 Sep 2008 17:53:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Sep 2008 10:53:24 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Sep 2008 17:52:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 66F53238896F; Sun, 21 Sep 2008 10:53:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r697563 - /incubator/buildr/trunk/spec/eclipse_spec.rb Date: Sun, 21 Sep 2008 17:53:06 -0000 To: buildr-commits@incubator.apache.org From: lacton@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080921175306.66F53238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: lacton Date: Sun Sep 21 10:53:06 2008 New Revision: 697563 URL: http://svn.apache.org/viewvc?rev=697563&view=rev Log: Reduced duplication by refactoring common code Modified: incubator/buildr/trunk/spec/eclipse_spec.rb Modified: incubator/buildr/trunk/spec/eclipse_spec.rb URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/eclipse_spec.rb?rev=697563&r1=697562&r2=697563&view=diff ============================================================================== --- incubator/buildr/trunk/spec/eclipse_spec.rb (original) +++ incubator/buildr/trunk/spec/eclipse_spec.rb Sun Sep 21 10:53:06 2008 @@ -33,10 +33,16 @@ default_output = classpath_xml_elements.collect("classpathentry[@kind='output']") { |n| n.attributes['path'] } specific_output[0] || default_output[0] end + + def project_xml_elements + task('eclipse').invoke + REXML::Document.new(File.open('.project')).root.elements + end end describe Buildr::Eclipse do + include EclipseHelper describe "eclipse's .project file" do @@ -49,15 +55,11 @@ JAVA_BUILDER = 'org.eclipse.jdt.core.javabuilder' def project_natures - task('eclipse').invoke - REXML::Document.new(File.open('.project')). - root.elements.collect("natures/nature") { |n| n.text } + project_xml_elements.collect("natures/nature") { |n| n.text } end def build_commands - task('eclipse').invoke - REXML::Document.new(File.open('.project')). - root.elements.collect("buildSpec/buildCommand/name") { |n| n.text } + project_xml_elements.collect("buildSpec/buildCommand/name") { |n| n.text } end before do @@ -88,9 +90,7 @@ JAVA_CONTAINER = 'org.eclipse.jdt.launching.JRE_CONTAINER' def classpath_containers attribute='path' - task('eclipse').invoke - REXML::Document.new(File.open('.classpath')). - root.elements.collect("classpathentry[@kind='con']") { |n| n.attributes[attribute] } + classpath_xml_elements.collect("classpathentry[@kind='con']") { |n| n.attributes[attribute] } end before do @@ -107,7 +107,6 @@ end describe 'source folders' do - include EclipseHelper before do write 'buildfile'