diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e14dbc..78b580f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,17 @@ All notable changes to this project will be documented in this file. This changelog was automatically generated using [Caretaker](https://github.com/DevelopersToolbox/caretaker) by [Wolf Software](https://github.com/WolfSoftware) -### [v0.1.3](https://github.com/DevelopersToolbox/github-ripper/compare/v0.1.2...v0.1.3) +### [Unreleased](https://github.com/DevelopersToolbox/github-ripper/compare/v0.1.3...HEAD) + +- sonar cloud [`[head]`](https://github.com/DevelopersToolbox/github-ripper/commit/) + +### [v0.1.2](https://github.com/DevelopersToolbox/github-ripper/compare/v0.1.1...v0.1.2) > Released on May, 20th 2022 -- removed verbose/debugging code [`[head]`](https://github.com/DevelopersToolbox/github-ripper/commit/) +- removed verbose/debugging code [`[b528584]`](https://github.com/DevelopersToolbox/github-ripper/commit/b528584305575a1567adaaeb8c29be47bc25404d) -### [v0.1.2](https://github.com/DevelopersToolbox/github-ripper/compare/v0.1.1...v0.1.2) +### [v0.1.1](https://github.com/DevelopersToolbox/github-ripper/compare/v0.1.0...v0.1.1) > Released on May, 20th 2022 @@ -21,7 +25,7 @@ This changelog was automatically generated using [Caretaker](https://github.com/ - Update travis slack integration due to new slack organisation [`[751d7e3]`](https://github.com/DevelopersToolbox/github-ripper/commit/751d7e3994ba8ab24052568d521dd406b773a47f) -### [v0.1.1](https://github.com/DevelopersToolbox/github-ripper/compare/v0.1.0...v0.1.1) +### [v0.1.0](https://github.com/DevelopersToolbox/github-ripper/releases/v0.1.0) > Released on June, 12th 2021 @@ -31,9 +35,5 @@ This changelog was automatically generated using [Caretaker](https://github.com/ - Fix travis rvm versions and slack integration [`[13e051b]`](https://github.com/DevelopersToolbox/github-ripper/commit/13e051b88cf6081e2e47665332f035b77c8c4aea) -### [v0.1.0](https://github.com/DevelopersToolbox/github-ripper/releases/v0.1.0) - -> Released on March, 12th 2021 - - The initial commit [`[d6e8c31]`](https://github.com/DevelopersToolbox/github-ripper/commit/d6e8c3134a2a0f19446da799615aeda8998bc8b4) diff --git a/lib/github-ripper.rb b/lib/github-ripper.rb index 6584b65..9eedcf9 100644 --- a/lib/github-ripper.rb +++ b/lib/github-ripper.rb @@ -5,6 +5,7 @@ require 'rainbow' require 'terminal-table' +require_relative 'github-ripper/constants' require_relative 'github-ripper/function-maps' require_relative 'github-ripper/git' require_relative 'github-ripper/report' diff --git a/lib/github-ripper/constants.rb b/lib/github-ripper/constants.rb new file mode 100644 index 0000000..e676acc --- /dev/null +++ b/lib/github-ripper/constants.rb @@ -0,0 +1,8 @@ +# +# Class docs to go here +# + +class GithubRipper + GIT_CLONE = 'git clone'.freeze + GIT_PULL = 'git pull'.freeze +end diff --git a/lib/github-ripper/git.rb b/lib/github-ripper/git.rb index e7138b4..6ae8919 100644 --- a/lib/github-ripper/git.rb +++ b/lib/github-ripper/git.rb @@ -42,7 +42,7 @@ def execute_command(command) end def clone_repo(options, repo, repo_path) - return { :repo => repo, :path => repo_path, :status => 'Dry Run', :when => 'git clone', :info => '' } if flag_set?(options, :dry_run) + return { :repo => repo, :path => repo_path, :status => 'Dry Run', :when => GithubRipper::GIT_CLONE, :info => '' } if flag_set?(options, :dry_run) FileUtils.mkdir_p repo_path @@ -50,13 +50,13 @@ def clone_repo(options, repo, repo_path) command = "#{clone_type}#{repo} #{repo_path}" return_code, output = execute_command(command) - return { :repo => repo, :path => repo_path, :status => 'Failed', :when => 'git clone', :info => output } if return_code.positive? + return { :repo => repo, :path => repo_path, :status => 'Failed', :when => GithubRipper::GIT_CLONE, :info => output } if return_code.positive? - { :repo => repo, :path => repo_path, :status => 'Success', :when => 'git clone', :info => 'Clone Succeeded' } + { :repo => repo, :path => repo_path, :status => 'Success', :when => GithubRipper::GIT_CLONE, :info => 'Clone Succeeded' } end def update_repo(options, repo, repo_path) - return { :repo => repo, :path => repo_path, :status => 'Dry Run', :when => 'git clone', :info => '' } if flag_set?(options, :dry_run) + return { :repo => repo, :path => repo_path, :status => 'Dry Run', :when => GithubRipper::GIT_CLONE, :info => '' } if flag_set?(options, :dry_run) olddir = Dir.pwd Dir.chdir repo_path @@ -65,9 +65,9 @@ def update_repo(options, repo, repo_path) return_code, output = execute_command(command) Dir.chdir olddir - return { :repo => repo, :path => repo_path, :status => 'Failed', :when => 'git pull', :info => output } if return_code.positive? + return { :repo => repo, :path => repo_path, :status => 'Failed', :when => GithubRipper::GIT_PULL, :info => output } if return_code.positive? - { :repo => repo, :path => repo_path, :status => 'Success', :when => 'git pull', :info => 'Pull Succeeded' } + { :repo => repo, :path => repo_path, :status => 'Success', :when => GithubRipper::GIT_PULL, :info => 'Pull Succeeded' } end def clone_repo_wrapper(options, repo)