Sha256: 54a7af9c6ea13a23aadbd464885d978d89960e7aaa1e1024346a0757e45a733c
Contents?: true
Size: 1.47 KB
Versions: 5
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true require_relative "../base" module Neetob class CLI module FetchorupdateRepos class Execute < Base attr_accessor :sandbox, :apps def initialize(sandbox = false, apps = ["*"]) super() @sandbox = sandbox @apps = apps end def run neeto_apps = find_all_matching_apps_or_repos(apps, :github, sandbox) neeto_apps.each do |app| app_name = app.split("/").last ui.info("\nWorking on #{app_name}\n") if directory_exists(app_name) checkout_to_main_and_fetch_commits(app_name) else clone_repo(app_name) end end end def directory_exists(app_name) File.directory?(app_name) end def checkout_to_main_and_fetch_commits(app_name) %x[ cd #{app_name} && git checkout main && git pull origin main ] if $?.success? puts "------Successfully pulled main branch of #{app_name}------" else puts "------Unable to pull the main branch of #{app_name} due to conflicts------" end end def clone_repo(app_name) `git clone git@github.com:bigbinary/#{app_name}.git` if $?.success? puts "------Done cloning #{app_name}------" else puts "------Failed cloning #{app_name}------" end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems