Last active
November 4, 2015 02:57
-
-
Save f3r/8a6083c1a48dfae28abf to your computer and use it in GitHub Desktop.
WDI Project CLI
This file contains hidden or 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
# WDI PROJECT CLI | |
# Clone or Reset a bunch of WDI projects automatically | |
# | |
# Author: [email protected] | |
# General Assembly Hong Kong | |
$github_org = "wdi-hk-9" | |
$projects = %w( | |
Project-SushiMeAway | |
Project-EasyDoctor | |
Project-PlaySpace | |
Project-PeTuLah | |
Project-GoSpyGo | |
) | |
# Print & Run a bash command | |
def s(command) | |
puts command | |
system command | |
end | |
# LIST Project | |
def list_projects | |
$projects.each do |project| | |
puts " -> #{project}" | |
end | |
end | |
# CLONE Project | |
def clone_projects | |
$projects.each do |project| | |
s "git clone [email protected]:#{$github_org}/#{project}.git" | |
end | |
end | |
def reset_projects | |
$projects.each do |project| | |
puts ">> PROJECT: #{project}" | |
Dir.chdir project | |
s "git fetch origin" | |
s "git checkout master" | |
s "git reset --hard origin/master" | |
s "git clean -d -f" | |
s "bundle && rake db:reset db:seed" | |
Dir.chdir ("..") | |
end | |
end | |
def header | |
puts "*"*80 | |
puts "*" + "WDI INSTRUCTOR APP".center(78) + "*" | |
puts "*"*80 | |
puts | |
end | |
def start | |
begin | |
header() | |
puts "-"*80 | |
puts "1. LIST All Repos" | |
puts "2. CLONE All Repos" | |
puts "3. RESET All Repos" | |
puts "0. Exit" | |
puts | |
puts "?" | |
option = gets.chomp.to_i | |
case option | |
when 1 | |
list_projects() | |
when 2 | |
clone_projects() | |
when 3 | |
reset_projects() | |
end | |
end while option != 0 | |
end | |
start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment