Module: ModuleSync::GitService::Factory
- Defined in:
- lib/modulesync/git_service/factory.rb
Overview
Git service’s factory
Class Method Summary collapse
Class Method Details
.instantiate(type:, endpoint:, token:) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/modulesync/git_service/factory.rb', line 5 def self.instantiate(type:, endpoint:, token:) raise MissingCredentialsError, <<~MESSAGE if token.nil? A token is required to use services from #{type}: Please set environment variable: "#{type.upcase}_TOKEN" or set the token entry in module options. MESSAGE klass(type: type).new token, endpoint end |
.klass(type:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/modulesync/git_service/factory.rb', line 14 def self.klass(type:) case type when :github require 'modulesync/git_service/github' ModuleSync::GitService::GitHub when :gitlab require 'modulesync/git_service/gitlab' ModuleSync::GitService::GitLab else raise NotImplementedError, "Unknown git service: '#{type}'" end end |