Skip to content

Commit dbf9b5d

Browse files
feat: can configure downloading the file from pipeline
1 parent 039d6f2 commit dbf9b5d

File tree

6 files changed

+29
-23
lines changed

6 files changed

+29
-23
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ gem "rake", "~> 13.0"
1111
gem "rest-client"
1212
gem "rspec", "~> 3.0"
1313
gem "rubocop", "~> 1.21"
14+
gem "pry"

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ GEM
1010
remote: https://rubygems.org/
1111
specs:
1212
ast (2.4.2)
13+
coderay (1.1.3)
1314
colorize (0.8.1)
1415
diff-lcs (1.5.0)
1516
domain_name (0.5.20190701)
@@ -18,6 +19,7 @@ GEM
1819
http-cookie (1.0.5)
1920
domain_name (~> 0.5)
2021
json (2.6.2)
22+
method_source (1.0.0)
2123
mime-types (3.4.1)
2224
mime-types-data (~> 3.2015)
2325
mime-types-data (3.2022.0105)
@@ -26,6 +28,9 @@ GEM
2628
parallel (1.22.1)
2729
parser (3.1.2.1)
2830
ast (~> 2.4.1)
31+
pry (0.14.1)
32+
coderay (~> 1.1)
33+
method_source (~> 1.0)
2934
rainbow (3.1.1)
3035
rake (13.0.6)
3136
regexp_parser (2.6.0)
@@ -74,6 +79,7 @@ DEPENDENCIES
7479
codeclimate_diff!
7580
colorize
7681
json
82+
pry
7783
rake (~> 13.0)
7884
rest-client
7985
rspec (~> 3.0)

exe/codeclimate_diff

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift("#{__dir__}/../lib")
55

66
require "optparse"
77
require "codeclimate_diff/runner"
8+
require "codeclimate_diff"
89

910
options = {}
1011
OptionParser.new do |opts|

lib/codeclimate_diff.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
# frozen_string_literal: true
22

33
require_relative "codeclimate_diff/version"
4-
require_relative "codeclimate_diff/configuration"
54

65
module CodeclimateDiff
6+
class Configuration
7+
attr_accessor :gitlab,
8+
:github
9+
10+
def initialize
11+
@gitlab = {
12+
main_branch_name: "main",
13+
download_baseline_from_pipeline: false,
14+
project_id: nil,
15+
host: nil,
16+
personal_access_token: nil
17+
}
18+
19+
@github = {
20+
# TODO: Add GitHub requirements
21+
}
22+
end
23+
end
24+
725
class << self
826
def configuration
927
@configuration ||= Configuration.new

lib/codeclimate_diff/configuration.rb

Lines changed: 0 additions & 22 deletions
This file was deleted.

lib/codeclimate_diff/downloader.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# frozen_string_literal: true
22

33
require "rest-client"
4+
require "pry"
45

56
module CodeclimateDiff
67
class Downloader
8+
79
def self.refresh_baseline_if_configured
810
should_download = CodeclimateDiff.configuration.gitlab[:download_baseline_from_pipeline]
911
return unless should_download

0 commit comments

Comments
 (0)