You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2013/09/28 07:18:08 UTC

svn commit: r1527151 - in /buildr/trunk: lib/buildr/ide/idea.rb spec/ide/idea_spec.rb

Author: donaldp
Date: Sat Sep 28 05:18:07 2013
New Revision: 1527151

URL: http://svn.apache.org/r1527151
Log:
Disable jsf facet on IDEA 13

Modified:
    buildr/trunk/lib/buildr/ide/idea.rb
    buildr/trunk/spec/ide/idea_spec.rb

Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1527151&r1=1527150&r2=1527151&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Sat Sep 28 05:18:07 2013
@@ -330,6 +330,7 @@ module Buildr #:nodoc:
           end
           default_enable_jsf = webroots.select{|webroot| File.exist?("#{webroot}/WEB-INF/faces-config.xml")}
           enable_jsf = options[:enable_jsf].nil? ? default_enable_jsf : options[:enable_jsf]
+          enable_jsf = false if root_project.ipr? && root_project.ipr.version >= '13'
           f.facet(:type => 'jsf', :name => 'JSF') do |jsf|
             jsf.configuration
           end if enable_jsf
@@ -434,6 +435,14 @@ module Buildr #:nodoc:
 
       protected
 
+      def root_project
+        p = buildr_project
+        while p.parent
+          p = p.parent
+        end
+        p
+      end
+
       def test_dependency_details
         main_dependencies_paths = main_dependencies.map(&:to_s)
         target_dir = buildr_project.compile.target.to_s
@@ -608,6 +617,7 @@ module Buildr #:nodoc:
       attr_accessor :artifacts
       attr_accessor :configurations
       attr_writer :jdk_version
+      attr_writer :version
 
       def initialize(buildr_project)
         super()
@@ -617,6 +627,10 @@ module Buildr #:nodoc:
         @configurations = []
       end
 
+      def version
+        @version || "12"
+      end
+
       def jdk_version
         @jdk_version ||= buildr_project.compile.options.source || "1.6"
       end

Modified: buildr/trunk/spec/ide/idea_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/idea_spec.rb?rev=1527151&r1=1527150&r2=1527151&view=diff
==============================================================================
--- buildr/trunk/spec/ide/idea_spec.rb (original)
+++ buildr/trunk/spec/ide/idea_spec.rb Sat Sep 28 05:18:07 2013
@@ -387,12 +387,68 @@ describe Buildr::IntellijIdea do
       end
     end
 
+    describe "using add_web_facet with jsf and idea version 12" do
+      before do
+        write "src/main/webapp/WEB-INF/web.xml"
+        write "src/main/webapp/WEB-INF/faces-config.xml"
+
+        @foo = define "foo" do
+          ipr.version = "12"
+          iml.add_web_facet
+        end
+        invoke_generate_task
+      end
+
+      it "generates a web facet with jsf facet auto-detected" do
+        doc = xml_document(@foo._("foo.iml"))
+        web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
+        doc.should have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
+      end
+    end
+
+    describe "using add_web_facet with jsf and idea version 13" do
+      before do
+        write "src/main/webapp/WEB-INF/web.xml"
+        write "src/main/webapp/WEB-INF/faces-config.xml"
+
+        @foo = define "foo" do
+          ipr.version = "13"
+          iml.add_web_facet
+        end
+        invoke_generate_task
+      end
+
+      it "does not generate a web facet with jsf facet" do
+        doc = xml_document(@foo._("foo.iml"))
+        web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
+        doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
+      end
+    end
+
+    describe "using add_web_facet with jsf and idea version 13 and jsf 'enabled'" do
+      before do
+        write "src/main/webapp/WEB-INF/web.xml"
+        write "src/main/webapp/WEB-INF/faces-config.xml"
+
+        @foo = define "foo" do
+          ipr.version = "13"
+          iml.add_web_facet(:enable_jsf => true)
+        end
+        invoke_generate_task
+      end
+
+      it "does not generate a web facet with jsf facet" do
+        doc = xml_document(@foo._("foo.iml"))
+        web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
+        doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
+      end
+    end
+
     describe "using add_web_facet" do
       before do
         write "src/main/webapp/WEB-INF/web.xml"
         write "src/main/webapp/WEB-INF/glassfish-web.xml"
         write "src/main/webapp/WEB-INF/context.xml"
-        write "src/main/webapp/WEB-INF/faces-config.xml"
 
         @foo = define "foo" do
           iml.add_web_facet
@@ -413,19 +469,12 @@ describe Buildr::IntellijIdea do
         web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp', @realtive='/']")
       end
-
-      it "generates a web facet with jsf facet auto-detected" do
-        doc = xml_document(@foo._("foo.iml"))
-        web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
-        doc.should have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
-      end
     end
 
     describe "using add_web_facet with specified parameters" do
       before do
         @foo = define "foo" do
           iml.add_web_facet(:deployment_descriptors => ["src/main/webapp2/WEB-INF/web.xml"],
-                            :enable_jsf => true,
                             :webroots => {"src/main/webapp2" => "/", "src/main/css" => "/css"})
         end
         invoke_generate_task
@@ -444,12 +493,6 @@ describe Buildr::IntellijIdea do
         doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp2', @realtive='/']")
         doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/css', @realtive='/css']")
       end
-
-      it "generates a web facet with jsf facet enabled" do
-        doc = xml_document(@foo._("foo.iml"))
-        web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
-        doc.should have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
-      end
     end
 
     describe "using add_jpa_facet" do