Sha256: fa15da860cdf79f858e60699cc8784dc6b2e01ce03aa8b45fd85ed55590b1f13
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 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(apps, :github, sandbox) neeto_apps.each do |app| app_name = app.split("/").last 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neetob-0.1.2 | lib/neetob/cli/fetchorupdate_repos/execute.rb |
neetob-0.1.1 | lib/neetob/cli/fetchorupdate_repos/execute.rb |
neetob-0.1.0 | lib/neetob/cli/fetchorupdate_repos/execute.rb |