diff --git a/lib/cap-pack/recipes/rails/migrate_if_changed.rb b/lib/cap-pack/recipes/rails/migrate_if_changed.rb new file mode 100644 index 0000000..6f4e3fb --- /dev/null +++ b/lib/cap-pack/recipes/rails/migrate_if_changed.rb @@ -0,0 +1,9 @@ +namespace :rails do + desc 'Migrate the database if db/schema.rb has changed since the last revision' + task :migrate_if_changed do + if !(result = %x{git log #{current_revision}..#{revision} db/schema.rb}.strip).empty? + top.deploy.migrate + end + end +end + diff --git a/lib/cap-pack/recipes/tail.rb b/lib/cap-pack/recipes/tail.rb index 4191c83..aface01 100644 --- a/lib/cap-pack/recipes/tail.rb +++ b/lib/cap-pack/recipes/tail.rb @@ -1,7 +1,7 @@ desc "Tail all or a single remote file" task :tail do pattern = ENV["LOGFILE_PATTERN"] || "*.log" - run "tail -f #{shared_path}/log/#{ENV["LOGFILE_PATTERN"]}" do |channel, stream, data| + run "tail -f #{shared_path}/log/#{pattern}" do |channel, stream, data| puts "#{data}" break if stream == :err end