diff --git a/lib/warbler/task.rb b/lib/warbler/task.rb index b0825e43..5fed7f95 100644 --- a/lib/warbler/task.rb +++ b/lib/warbler/task.rb @@ -108,7 +108,9 @@ def define_compiled_task task "compiled" do jar.compile(config) task @name do - rm_f config.compiled_ruby_files.map {|f| f.sub(/\.rb$/, '.class') } + extensions = config.compiled_ruby_files&.map { |f| File.extname(f) }&.uniq || ['.rb'] + regex_extensions = extensions.map { |extension| extension.sub('.', '\.') }.join('|') + rm_f config.compiled_ruby_files.map {|f| f.sub(/#{regex_extensions}$/, '.class') } end end end diff --git a/spec/warbler/task_spec.rb b/spec/warbler/task_spec.rb index e584ab3f..b2d007ba 100644 --- a/spec/warbler/task_spec.rb +++ b/spec/warbler/task_spec.rb @@ -18,6 +18,8 @@ config.gems = ["rake"] config.webserver = "test" config.webxml.jruby.max.runtimes = 5 + + config.compiled_ruby_files = FileList['**/*.rb', '**/.rake'] end end @@ -150,6 +152,12 @@ def run_task(t) File.exist?('app/helpers/application_helper.class').should be false end + it "should not delete another extensions but .class files after finishing the jar" do + config.features << "compiled" + silence { run_task "warble" } + File.exist?('lib/tasks/utils.rake').should be true + end + context "where symlinks are available" do begin FileUtils.ln_s "README.txt", "r.txt.symlink", :verbose => false