Class: LibFinder::LibWorker

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/libFinder.rb

Class Method Summary collapse

Class Method Details

.is_railsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/libFinder.rb', line 15

def self.is_rails
  base_path = Dir.pwd
  controllers = File.exist?(base_path+"/app/controllers")
  #check if the file has a controllers folder or not
  models = File.exist?(base_path+"/app/models")
  #check if the file has a models folder or not
  if controllers && models
    #if both are true then it is a rails app 
    return true 
  else 
    puts "this is not a rails application file please change directory to a rails application file"
    return false
  end
end

.parse_gem_fileObject



30
31
32
33
34
35
36
# File 'lib/libFinder.rb', line 30

def self.parse_gem_file
  File.readlines(Dir.pwd+"/Gemfile").each do |line|
    if line.split[0] =="gem" 
      puts line
    end
  end
end

.sniffObject



8
9
10
11
12
13
# File 'lib/libFinder.rb', line 8

def self.sniff
  # a function to start the gem working used sniff cause i saw my dog doing so when searching for something :D
  if(self.is_rails)
    self.parse_gem_file
  end
end