Class: Utils::Gem

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/utils/gem.rb

Class Method Summary collapse

Class Method Details

.exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
# File 'lib/utils/gem.rb', line 9

def self.exists?(name)
  gemfile_content = File.read('Gemfile')

  pattern = /gem\s+['"]#{name}['"]/
  !gemfile_content.scan(pattern).empty?
end

.gemfile_exist?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/utils/gem.rb', line 17

def self.gemfile_exist?
  File.exist?('Gemfile')
end