Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Created April 17, 2016 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtnabe/75d8a30eb466bf90aecd704e292faea5 to your computer and use it in GitHub Desktop.
Save wtnabe/75d8a30eb466bf90aecd704e292faea5 to your computer and use it in GitHub Desktop.
pickup latest todomvc vanillajs app's code
# -*- mode: ruby -*-
desc 'latest-todomvc-vanilla'
task 'latest-todomvc-vanilla' => ['clean:dest', 'todomvc:fetch'] do
sh <<EOD
cd #{File.join(todomvc_dir, 'examples')}
git ls-files vanillajs | cpio -pud ../../
EOD
end
#
# [return] String
#
def todomvc_repos
'https://github.com/tastejs/todomvc'
end
#
# [return] String
#
def todomvc_dir
File.join(File.dirname(__FILE__), 'todomvc')
end
#
# [return] String
#
def vanillajs_dir
File.join(File.dirname(__FILE__), 'vanillajs')
end
namespace :todomvc do
desc 'todomvc:fetch'
task :fetch do
if File.exist?(todomvc_dir)
sh <<EOD
cd #{todomvc_dir}
git pull
EOD
else
sh "git clone #{todomvc_repos}"
end
end
end
desc 'clean'
task :clean => ['clean:todomvc', 'clean:dest'] do; end
namespace :clean do
desc 'clean:dest'
task :dest do
sh "rm -fr #{vanillajs_dir}"
end
desc 'clean:todomvc'
task :todomvc do
sh "rm -fr #{todomvc_dir}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment