# frozen_string_literal: true class GithubRepo attr_accessor :repo_url, :repo_path def initialize(repo_url = nil, repo_path = nil) @repo_url = repo_url @repo_path = repo_path end def git_clone_repo if repo_url.nil? || repo_path.nil? puts 'Please provide a repo url and repo_path' else Git.clone(repo_url, repo_path) end end def pull_latest_changes `cd #{repo_path}; git pull;` puts "Now pulling latest changes from #{repo_path}" end def read_json(filename) JSON.parse(File.read(filename), symbolize_names: true) end def pull_or_clone if Dir.exist?(repo_path) pull_latest_changes else git_clone_repo end end end