For adding specs on 'trace' outputs, i think you'll need to enhance
spec_helpers.rb both on line 54 (to capture all 'trace' calls) and
line 93 (to provide a 'show_trace' checker).

lacton

On Sun, Feb 28, 2010 at 1:26 PM, lacton <[email protected]> wrote:
> I agree with Daniel.  The point of having a 'trace' method was to
> factor the 'if Buildr.application.options.trace' conditions that were
> popping up around the buildr code and the users' buildfiles.
>
> lacton
>
> On Sun, Feb 28, 2010 at 5:46 AM, Daniel Spiewak <[email protected]> wrote:
>> Shouldn't we just use `trace` instead of qualifying `info` with a
>> conditional?
>>
>> Daniel
>>
>> On Sat, Feb 27, 2010 at 10:43 PM, <[email protected]> wrote:
>>
>>> Author: boisvert
>>> Date: Sun Feb 28 04:43:30 2010
>>> New Revision: 917128
>>>
>>> URL: http://svn.apache.org/viewvc?rev=917128&view=rev
>>> Log:
>>> BUILDR-336 Java::Commands.java Prints Command Without --trace
>>> (Antoine Toulme)
>>>
>>>
>>> Added:
>>>    buildr/trunk/spec/java/commands_spec.rb
>>> Modified:
>>>    buildr/trunk/CHANGELOG
>>>    buildr/trunk/lib/buildr/java/commands.rb
>>>
>>> Modified: buildr/trunk/CHANGELOG
>>> URL:
>>> http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=917128&r1=917127&r2=917128&view=diff
>>>
>>> ==============================================================================
>>> --- buildr/trunk/CHANGELOG (original)
>>> +++ buildr/trunk/CHANGELOG Sun Feb 28 04:43:30 2010
>>> @@ -28,12 +28,13 @@
>>>  * Change: Load buildr.rb from $HOME/.buildr instead of $HOME
>>>           ($HOME/buildr.rb is still loaded with deprecation warning)
>>>  * Fixed:  BUILDR-223 Release Task: customizable commit message (Alexis
>>> Midon)
>>> +* Fixed:  BUILDR-327 Specifying :plugin eclipse nature explicitly fails
>>>  * Fixed:  BUILDR-330  Install task should re-install artifact even if they
>>>           already exist (Alexis Midon)
>>>  * Fixed:  BUILDR-334 Eclipse .classpath files use absolute paths for
>>> library
>>>           entries (Stefan Wasilewski)
>>> -* Fixed:  BUILDR-327 Specifying :plugin eclipse nature explicitly fails
>>> -* Fixed:  buildr test=all didn't run all tests as expected
>>> +* Fixed:  BUILDR-336 Java::Commands.java Prints Command Without --trace
>>> +          (Antoine Toulme)
>>>  * Fixed:  BUILDR-344 Buildr::TestFramework::TestResult::YamlFormatter uses
>>>           deprecated form of example_pending (Rhett Sutphin)
>>>  * Fixed:  BUILDR-345 Improve project documentation (Peter Schröder)
>>> @@ -62,6 +63,7 @@
>>>           task_dependency if artifact exists
>>>  * Fixed:  BUILDR-384 Buildr fails with rubygems 1.3.6
>>>  * Fixed:  BUILDR-386 Display JRuby version in buildr -V (Antoine Toulme)
>>> +* Fixed:  buildr test=all didn't run all tests as expected
>>>  * Fixed:  Fail-fast if package.with() or include() called with nil values
>>>  * Fixed:  Failures not reported correctly for ScalaTest (Alex Eagle)
>>>  * Fixed:  Test dependencies should include test compile dependencies
>>>
>>> Modified: buildr/trunk/lib/buildr/java/commands.rb
>>> URL:
>>> http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/commands.rb?rev=917128&r1=917127&r2=917128&view=diff
>>>
>>> ==============================================================================
>>> --- buildr/trunk/lib/buildr/java/commands.rb (original)
>>> +++ buildr/trunk/lib/buildr/java/commands.rb Sun Feb 28 04:43:30 2010
>>> @@ -57,7 +57,7 @@
>>>         cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] ||
>>> ENV['JAVA_OPTIONS']).to_s.split).flatten
>>>         cmd_args += args.flatten.compact
>>>         unless Buildr.application.options.dryrun
>>> -          info "Running #{name}" if name
>>> +          info "Running #{name}" if name && options[:verbose]
>>>           block = lambda { |ok, res| fail "Failed to execute #{name}, see
>>> errors above" unless ok } unless block
>>>           cmd_args = cmd_args.map(&:inspect).join(' ') if Util.win_os?
>>>           sh(*cmd_args) do |ok, ps|
>>>
>>> Added: buildr/trunk/spec/java/commands_spec.rb
>>> URL:
>>> http://svn.apache.org/viewvc/buildr/trunk/spec/java/commands_spec.rb?rev=917128&view=auto
>>>
>>> ==============================================================================
>>> --- buildr/trunk/spec/java/commands_spec.rb (added)
>>> +++ buildr/trunk/spec/java/commands_spec.rb Sun Feb 28 04:43:30 2010
>>> @@ -0,0 +1,34 @@
>>> +# Licensed to the Apache Software Foundation (ASF) under one or more
>>> +# contributor license agreements.  See the NOTICE file distributed with
>>> this
>>> +# work for additional information regarding copyright ownership.  The ASF
>>> +# licenses this file to you under the Apache License, Version 2.0 (the
>>> +# "License"); you may not use this file except in compliance with the
>>> License.
>>> +# You may obtain a copy of the License at
>>> +#
>>> +#    http://www.apache.org/licenses/LICENSE-2.0
>>> +#
>>> +# Unless required by applicable law or agreed to in writing, software
>>> +# distributed under the License is distributed on an "AS IS" BASIS,
>>> WITHOUT
>>> +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See
>>> the
>>> +# License for the specific language governing permissions and limitations
>>> under
>>> +# the License.
>>> +
>>> +require File.join(File.dirname(__FILE__), '../spec_helpers')
>>> +
>>> +
>>> +describe Java::Commands do
>>> +
>>> +  it "should not be verbose by default" do
>>> +    write "build.xml", <<-BUILD
>>> +    <project name="MyProject" default="dist" basedir=".">
>>> +        <description>
>>> +            simple example build file
>>> +        </description>
>>> +        <target name="dist"/>
>>> +    </project>
>>> +BUILD
>>> +    lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath
>>> => Buildr::Ant.dependencies) }.should_not show_info(/java/)
>>> +    lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath
>>> => Buildr::Ant.dependencies, :verbose => true) }.should show_info(/java/)
>>> +  end
>>> +
>>> +end
>>> \ No newline at end of file

Reply via email to