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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/git/declared_license.rb')
-rw-r--r--lib/gitlab/git/declared_license.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/gitlab/git/declared_license.rb b/lib/gitlab/git/declared_license.rb
new file mode 100644
index 00000000000..bc12b1918ea
--- /dev/null
+++ b/lib/gitlab/git/declared_license.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Git
+ # DeclaredLicense is the software license declared in a LICENSE or COPYING
+ # file in the git repository.
+ class DeclaredLicense
+ # SPDX Identifier for the license
+ attr_reader :key
+
+ # Full name of the license
+ attr_reader :name
+
+ # Nickname of the license (optional, a shorter user-friendly name)
+ attr_reader :nickname
+
+ # Filename of the file containing license
+ attr_accessor :path
+
+ # URL that points to the LICENSE
+ attr_reader :url
+
+ def initialize(key: nil, name: nil, nickname: nil, url: nil, path: nil)
+ @key = key
+ @name = name
+ @nickname = nickname
+ @url = url
+ @path = path
+ end
+
+ def ==(other)
+ return unless other.is_a?(self.class)
+
+ key == other.key
+ end
+ end
+ end
+end