Sha256: 1799ee7338d93c05dadf7a4cf54bf3c45b1127db738abe14b207dd73ea12b4cc
Contents?: true
Size: 1.57 KB
Versions: 22
Compression:
Stored size: 1.57 KB
Contents
# frozen_string_literal: true require_relative "../base" module Neetob class CLI module FetchorupdateRepos class Execute < Base attr_accessor :sandbox, :apps, :all_neeto_repos def initialize(sandbox = false, all_neeto_repos = false, apps = ["*"]) super() @sandbox = sandbox @apps = apps @all_neeto_repos = all_neeto_repos end def run neeto_apps = find_all_matching_apps(apps, :github, sandbox, false, all_neeto_repos) 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
22 entries across 22 versions & 2 rubygems