Skip to content

Commit

Permalink
Add warning message for directories that don't exist in config.dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Feb 6, 2009
1 parent 786d330 commit 73b6914
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
8 changes: 6 additions & 2 deletions lib/warbler/task.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#--
# (c) Copyright 2007-2008 Sun Microsystems, Inc.
# (c) Copyright 2007-2009 Sun Microsystems, Inc.
# See the file LICENSES.txt included with the distribution for
# software license details.
#++
Expand Down Expand Up @@ -227,7 +227,11 @@ def define_public_file_tasks
end

def define_webinf_file_tasks
target_files = @config.dirs.map do |d|
target_files = @config.dirs.select do |d|
exists = File.directory?(d)
warn "warning: application directory `#{d}' does not exist or is not a directory; skipping" unless exists
exists
end.map do |d|
define_file_task(d, "#{@config.staging_dir}/#{apply_pathmaps(d, :application)}")
end
files = FileList[*(@config.dirs.map{|d| "#{d}/**/*"})]
Expand Down
14 changes: 12 additions & 2 deletions spec/warbler/task_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#--
# (c) Copyright 2007-2008 Sun Microsystems, Inc.
# (c) Copyright 2007-2009 Sun Microsystems, Inc.
# See the file LICENSES.txt included with the distribution for
# software license details.
#++
Expand Down Expand Up @@ -36,7 +36,9 @@ def define_tasks(*tasks)
@defined_tasks ||= []
tasks.each do |task|
unless @defined_tasks.include?(task)
Warbler::Task.new "warble", @config, "define_#{task}_task".to_sym do |t|
meth = "define_#{task}_task"
meth = "define_#{task}_tasks" unless Warbler::Task.private_instance_methods.include?(meth)
Warbler::Task.new "warble", @config, meth.to_sym do |t|
options.each {|k,v| t.send "#{k}=", v }
end
@defined_tasks << task
Expand Down Expand Up @@ -438,6 +440,14 @@ class << t; public :instance_variable_get; end
@config.webxml.booter.should == :rails
@config.webxml.jruby.max.runtimes.should == 1
end

it "should skip directories that don't exist in config.dirs and print a warning" do
@config = Warbler::Config.new
@config.dirs = %w(lib notexist)
define_tasks "webinf_file"
Rake.application.lookup("#{@config.staging_dir}/WEB-INF/lib").should_not be_nil
Rake.application.lookup("#{@config.staging_dir}/WEB-INF/notexist").should be_nil
end
end

describe "The warbler.rake file" do
Expand Down
2 changes: 1 addition & 1 deletion warbler.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Gem::Specification.new do |s|

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nick Sieger"]
s.date = %q{2008-12-18}
s.date = %q{2009-01-21}
s.default_executable = %q{warble}
s.description = %q{= Warbler}
s.email = %q{nick@nicksieger.com}
Expand Down

0 comments on commit 73b6914

Please sign in to comment.