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 read_markdown(filename) data = File.read(filename) formatter = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil) # should give us the html doc RDoc::Markdown.parse(data).accept(formatter) end def pull_or_clone if Dir.exist?(repo_path) pull_latest_changes else git_clone_repo end end end