Class: Zewo::App
- Inherits:
-
Thor
- Object
- Thor
- Zewo::App
- Defined in:
- lib/zewo.rb
Defined Under Namespace
Classes: Repo
Instance Method Summary collapse
- #checkout ⇒ Object
- #clone_osx_dev ⇒ Object
- #init ⇒ Object
- #make_osx_dev_projects ⇒ Object
- #make_projects ⇒ Object
- #pull ⇒ Object
- #setup_osx_dev ⇒ Object
- #status ⇒ Object
- #tag(tag) ⇒ Object
Instance Method Details
#checkout ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/zewo.rb', line 298 def checkout if ![:branch] && ![:tag] puts 'Need to specify either --tag or --branch'.red return end Dir['*/'].each do |folder_name| folder_name = folder_name[0...-1] matched = `cd #{folder_name} && git tag` .split("\n") .select { |t| t.start_with?([:tag]) } .last if [:tag] matched = [:branch] if [:branch] if matched silent_cmd("cd #{folder_name} && git checkout #{matched}") puts "Checked out #{folder_name} at #{matched}".green else puts "No matching specifiers for #{folder_name}".red end end end |
#clone_osx_dev ⇒ Object
355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/zewo.rb', line 355 def clone_osx_dev puts 'Cloning repositories...' each_osx_whitelisted_repo_async do |repo| unless File.directory?(repo.name) print "Cloning #{repo.data['organization']}/#{repo.name}...".green + "\n" silent_cmd("git clone #{repo.data['clone_url']}") cloned_name = repo.data['clone_url'].split('/').last if cloned_name.end_with?('-OSX') FileUtils.mv cloned_name, cloned_name[0...-4] end end end end |
#init ⇒ Object
341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/zewo.rb', line 341 def init use_ssh = prompt('Clone using SSH?') each_repo_async do |repo| print "Checking #{repo.name}..." + "\n" unless File.directory?(repo.name) print "Cloning #{repo.name}...".green + "\n" silent_cmd("git clone #{repo.data[use_ssh ? 'clone_url' : 'ssh_url']}") end end puts 'Done!' end |
#make_osx_dev_projects ⇒ Object
371 372 373 374 |
# File 'lib/zewo.rb', line 371 def make_osx_dev_projects each_osx_whitelisted_repo(&:configure_xcode_project) each_osx_whitelisted_repo(&:build_dependencies) end |
#make_projects ⇒ Object
335 336 337 338 |
# File 'lib/zewo.rb', line 335 def make_projects each_code_repo(&:configure_xcode_project) each_code_repo(&:build_dependencies) end |
#pull ⇒ Object
322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/zewo.rb', line 322 def pull print "Updating all repositories...\n" each_code_repo_async do |repo| if uncommited_changes?(repo.name) print "Uncommitted changes in #{repo.name}. Not updating.".red + "\n" next end system("cd #{repo.name}; git pull") end puts 'Done!' end |
#setup_osx_dev ⇒ Object
378 379 380 381 382 383 384 385 386 |
# File 'lib/zewo.rb', line 378 def setup_osx_dev() clone_osx_dev() invoke 'checkout', [], :tag => [:version] checkout_modulemap_versions() make_osx_dev_projects() end |
#status ⇒ Object
274 275 276 277 278 279 280 281 282 |
# File 'lib/zewo.rb', line 274 def status each_code_repo do |repo| str = repo.name str = uncommited_changes?(repo.name) ? str.red : str.green tag = `cd #{repo.name}; git describe --abbrev=0 --tags` || 'No tag' str += " (#{tag})" puts str.delete("\n") end end |
#tag(tag) ⇒ Object
285 286 287 288 289 290 291 292 293 |
# File 'lib/zewo.rb', line 285 def tag(tag) each_code_repo do |repo| should_tag = prompt("create tag #{tag} in #{repo.name}?") if should_tag silent_cmd("cd #{repo.name} && git tag #{tag}") puts repo.name.green end end end |