lib/tasks/publish.rake in daddy-0.0.8 vs lib/tasks/publish.rake in daddy-0.0.9

- old
+ new

@@ -1,22 +1,23 @@ # coding: UTF-8 +require 'daddy/git' + namespace :dad do - task :publish do |t| + task :publish do system("mkdir -p features/reports") system("bundle exec rake db:test:prepare") system("bundle exec rake dad:cucumber PUBLISH=true OUTPUT_FILE=diary.html features/開発日記") system("bundle exec rake dad:cucumber PUBLISH=true OUTPUT_FILE=index.html features/仕様書") system("mkdir -p tmp") - system("git branch > tmp/branches") - current_branch = 'master' - File.readlines('tmp/branches').each do |b| - if b.start_with?('*') - current_branch = b.split[1] - break - end + + if ENV['BRANCH'] + current_branch = ENV['BRANCH'] + else + git = Daddy::Git.new + current_branch = git.current_branch end unless File.exist?('tmp/gh-pages') system("cd tmp && git clone -b gh-pages git@github.com:ichylinux/daddy.git gh-pages") else @@ -32,6 +33,7 @@ system("cd tmp/gh-pages && git add .") system("cd tmp/gh-pages && git commit -m 'publish'") system("cd tmp/gh-pages && git push") end + end