Created
April 17, 2016 14:09
-
-
Save wtnabe/75d8a30eb466bf90aecd704e292faea5 to your computer and use it in GitHub Desktop.
pickup latest todomvc vanillajs app's code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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