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