lib/tasks/publish.rake in daddy-0.1.8 vs lib/tasks/publish.rake in daddy-0.1.9
- old
+ new
@@ -2,10 +2,12 @@
require 'daddy/git'
namespace :dad do
task :publish do
+ fail('環境編集 TITLE を指定してください。') unless ENV['TITLE'] and not ENV['TITLE'].blank?
+
if File.exist?("#{Rails.root}/db/schema.rb")
fail unless system("bundle exec rake db:schema:load RAILS_ENV=test")
end
system("mkdir -p features/reports")
@@ -26,16 +28,20 @@
else
git = Daddy::Git.new
current_branch = git.current_branch
end
- dir = '/var/lib/daddy/spec'
+ dir = '/var/lib/daddy/spec/' + title_to_dirname(ENV['TITLE'])
system("sudo mkdir -p #{dir}")
system("sudo chown -R #{ENV['USER']}:#{ENV['USER']} #{dir}")
system("mkdir -p #{dir}/#{current_branch}")
system("rm -Rf #{dir}/#{current_branch}/*")
system("cp -Rf features/reports/* #{dir}/#{current_branch}/")
system("cp -Rf coverage #{dir}/#{current_branch}/")
end
+end
+
+def self.title_to_dirname(title)
+ title.sub(' ', '_').downcase
end