Object
This class represent the configration file.
This class represent the configration file.
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 23 def self.from_path(path) new(YAML.load(path.read), config_path: path) end
Generate a rbs lockfile from Gemfile.lock to `config_path`. If `with_lockfile` is true, it respects existing rbs lockfile.
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 19 def self.generate_lockfile(config_path,, gemfile_lock_path,, with_lockfile: true) LockfileGenerator.generate(config_path: config_path, gemfile_lock_path: gemfile_lock_path, with_lockfile: with_lockfile) end
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 27 def self.lockfile_of(config_path) lock_path = to_lockfile_path(config_path) from_path lock_path if lock_path.exist? end
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 41 def add_gem(gem) gems << gem end
It raises an error when there are non-available libraries
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 71 def check_rbs_availability! raise CollectionNotAvailable unless repo_path.exist? gems.each do |gem| case gem['source']['type'] when 'git' meta_path = repo_path.join(gem['name'], gem['version'], Sources::Git::METADATA_FILENAME) raise CollectionNotAvailable unless meta_path.exist? raise CollectionNotAvailable unless gem == YAML.load(meta_path.read) end end end
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 62 def dump_to(io) YAML.dump(@data, io) end
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 45 def gem(gem_name) gems.find { |gem| gem['name'] == gem_name } end
# File rbs-2.1.0/lib/rbs/collection/config.rb, line 66 def gems @data['gems'] ||= [] end