Skip to content

Commit

Permalink
Merge pull request #118 from patriciomacadden/fix_pluginize_task
Browse files Browse the repository at this point in the history
warble pluginize does not work on rails 3.x
  • Loading branch information
guilleiguaran committed Nov 17, 2012
2 parents 8da2141 + 92d423a commit 952a9ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/warbler/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ def define_config_task

def define_pluginize_task
task "pluginize" do
if !Dir["vendor/plugins/warbler*"].empty? && ENV["FORCE"].nil?
puts "I found an old nest in vendor/plugins; please trash it so I can make a new one"
puts "(directory vendor/plugins/warbler* exists)"
if !Dir["lib/tasks/warbler*"].empty? && ENV["FORCE"].nil?
puts "I found an old nest in lib/tasks; please trash it so I can make a new one"
puts "(directory lib/tasks/warbler* exists)"
else
rm_rf FileList["vendor/plugins/warbler*"], :verbose => false
mkdir_p "vendor/plugins/warbler/tasks"
File.open("vendor/plugins/warbler/tasks/warbler.rake", "w") do |f|
rm_rf FileList["lib/tasks/warbler*"], :verbose => false
mkdir_p "lib/tasks/warbler"
File.open("lib/tasks/warbler/warbler.rake", "w") do |f|
f.puts "require 'warbler'"
f.puts "Warbler::Task.new"
end
Expand Down
10 changes: 5 additions & 5 deletions spec/warbler/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Warbler.application = nil
Warbler.framework_detection = @detection
@argv.reverse.each {|a| ARGV.unshift a}
rm_rf FileList['vendor/plugins/warbler']
rm_rf FileList['lib/tasks/warbler']
end

it "should be able to list its tasks" do
Expand Down Expand Up @@ -67,17 +67,17 @@
end
end

it "should refuse to pluginize if the vendor/plugins/warbler directory exists" do
mkdir_p "vendor/plugins/warbler"
it "should refuse to pluginize if the lib/tasks/warbler directory exists" do
mkdir_p "lib/tasks/warbler"
ARGV.unshift "pluginize"
silence { Warbler::Application.new.run }
File.exist?("vendor/plugins/warbler/tasks/warbler.rake").should_not be_true
File.exist?("lib/tasks/warbler/warbler.rake").should_not be_true
end

it "should define a pluginize task for adding the tasks to a Rails application" do
ARGV.unshift "pluginize"
silence { Warbler::Application.new.run }
File.exist?("vendor/plugins/warbler/tasks/warbler.rake").should be_true
File.exist?("lib/tasks/warbler/warbler.rake").should be_true
end

it "should provide a means to load the project Rakefile" do
Expand Down

0 comments on commit 952a9ac

Please sign in to comment.