Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2019-04-04 11:45:09 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2019-04-04 11:45:09 +0300
commit1d9ee789986b59329e66e069e000c370d1bc9725 (patch)
tree58eb6d34521e945d3c21a2c6288a382cecc2b65c
parent38e42123d053b36d05f04b08fbbc95b59ad9c0a1 (diff)
Remove VersionInfo code
VersionInfo was used in Ruby to disply the Git version and make assertions on that. For Gitaly, this is handled in the Go part, so it could be removed from the Ruby sidecar.
-rw-r--r--ruby/lib/gitlab/git.rb9
-rw-r--r--ruby/lib/gitlab/version_info.rb54
-rw-r--r--ruby/spec/lib/gitlab/version_info_spec.rb66
3 files changed, 0 insertions, 129 deletions
diff --git a/ruby/lib/gitlab/git.rb b/ruby/lib/gitlab/git.rb
index 110ac0547..09b6e8b37 100644
--- a/ruby/lib/gitlab/git.rb
+++ b/ruby/lib/gitlab/git.rb
@@ -16,7 +16,6 @@ require_relative 'git_logger.rb'
require_relative 'rails_logger.rb'
require_relative 'gollum.rb'
require_relative 'config.rb'
-require_relative 'version_info'
dir = __dir__
@@ -124,14 +123,6 @@ module Gitlab
sha1[0, length] == sha2[0, length]
end
end
-
- module Version
- extend Gitlab::Git::Popen
-
- def self.git_version
- Gitlab::VersionInfo.parse(popen(%W(#{Gitlab.config.git.bin_path} --version), nil).first)
- end
- end
end
end
diff --git a/ruby/lib/gitlab/version_info.rb b/ruby/lib/gitlab/version_info.rb
deleted file mode 100644
index b5f4bec54..000000000
--- a/ruby/lib/gitlab/version_info.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-module Gitlab
- class VersionInfo
- include Comparable
-
- attr_reader :major, :minor, :patch
-
- def self.parse(str)
- if str && m = str.match(/(\d+)\.(\d+)\.(\d+)/)
- VersionInfo.new(m[1].to_i, m[2].to_i, m[3].to_i)
- else
- VersionInfo.new
- end
- end
-
- def initialize(major = 0, minor = 0, patch = 0)
- @major = major
- @minor = minor
- @patch = patch
- end
-
- def <=>(other)
- return unless other.is_a? VersionInfo
- return unless valid? && other.valid?
-
- if other.major < @major
- 1
- elsif @major < other.major
- -1
- elsif other.minor < @minor
- 1
- elsif @minor < other.minor
- -1
- elsif other.patch < @patch
- 1
- elsif @patch < other.patch
- -1
- else
- 0
- end
- end
-
- def to_s
- if valid?
- format("%d.%d.%d", @major, @minor, @patch)
- else
- "Unknown"
- end
- end
-
- def valid?
- @major >= 0 && @minor >= 0 && @patch >= 0 && @major + @minor + @patch > 0
- end
- end
-end
diff --git a/ruby/spec/lib/gitlab/version_info_spec.rb b/ruby/spec/lib/gitlab/version_info_spec.rb
deleted file mode 100644
index 8cf95ba33..000000000
--- a/ruby/spec/lib/gitlab/version_info_spec.rb
+++ /dev/null
@@ -1,66 +0,0 @@
-require 'spec_helper'
-
-describe Gitlab::VersionInfo do
- let(:unknown) { described_class.new }
- let(:v0_0_1) { described_class.new(0, 0, 1) }
- let(:v0_1_0) { described_class.new(0, 1, 0) }
- let(:v1_0_0) { described_class.new(1, 0, 0) }
- let(:v1_0_1) { described_class.new(1, 0, 1) }
- let(:v1_1_0) { described_class.new(1, 1, 0) }
- let(:v2_0_0) { described_class.new(2, 0, 0) }
-
- context '>' do
- it { expect(v2_0_0).to be > v1_1_0 }
- it { expect(v1_1_0).to be > v1_0_1 }
- it { expect(v1_0_1).to be > v1_0_0 }
- it { expect(v1_0_0).to be > v0_1_0 }
- it { expect(v0_1_0).to be > v0_0_1 }
- end
-
- context '>=' do
- it { expect(v2_0_0).to be >= described_class.new(2, 0, 0) }
- it { expect(v2_0_0).to be >= v1_1_0 }
- end
-
- context '<' do
- it { expect(v0_0_1).to be < v0_1_0 }
- it { expect(v0_1_0).to be < v1_0_0 }
- it { expect(v1_0_0).to be < v1_0_1 }
- it { expect(v1_0_1).to be < v1_1_0 }
- it { expect(v1_1_0).to be < v2_0_0 }
- end
-
- context '<=' do
- it { expect(v0_0_1).to be <= described_class.new(0, 0, 1) }
- it { expect(v0_0_1).to be <= v0_1_0 }
- end
-
- context '==' do
- it { expect(v0_0_1).to eq(described_class.new(0, 0, 1)) }
- it { expect(v0_1_0).to eq(described_class.new(0, 1, 0)) }
- it { expect(v1_0_0).to eq(described_class.new(1, 0, 0)) }
- end
-
- context '!=' do
- it { expect(v0_0_1).not_to eq(v0_1_0) }
- end
-
- context 'unknown' do
- it { expect(unknown).not_to be v0_0_1 }
- it { expect(unknown).not_to be described_class.new }
- it { expect { unknown > v0_0_1 }.to raise_error(ArgumentError) }
- it { expect { unknown < v0_0_1 }.to raise_error(ArgumentError) }
- end
-
- context 'parse' do
- it { expect(described_class.parse("1.0.0")).to eq(v1_0_0) }
- it { expect(described_class.parse("1.0.0.1")).to eq(v1_0_0) }
- it { expect(described_class.parse("git 1.0.0b1")).to eq(v1_0_0) }
- it { expect(described_class.parse("git 1.0b1")).not_to be_valid }
- end
-
- context 'to_s' do
- it { expect(v1_0_0.to_s).to eq("1.0.0") }
- it { expect(unknown.to_s).to eq("Unknown") }
- end
-end