libFinder 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03cfd63d12efc703c42aac43690567f9663dd0cb
4
- data.tar.gz: 1037a92cf8f8e12217ddb96365e9b5b913f39753
3
+ metadata.gz: 034d3218530c19844fe9f6e4b6d450dff9141587
4
+ data.tar.gz: be21a05bd3e6c91a141de0d0804c978f9ebad300
5
5
  SHA512:
6
- metadata.gz: 8e0ad8ee916776845c883a99f0a9b9f93f7b000ab6cd21da3b045225b63a0f778f25c0ec7cfee13bdcbe4ac52f363a2b2c36c8052337648f6daaf7cec33d80e0
7
- data.tar.gz: 2de949923c30deec11857b4629c18f3e4e29cfa9d1767fbc099cdc79df6b83561bece48a778e11dea192bfe861280de3ad0b74ab93407753715620f91dcac649
6
+ metadata.gz: 2cf300e76d533d07b8eda5a3bdf3479c904ffa0f497e1f775ecd745ab51244334e32e7c776d63596aaf0c6453287b15358968e1cf92c163004ee8f496c36adf8
7
+ data.tar.gz: c764ac184d8735c5642ee3e84d22fe851816203529431ac0478a887dc4efac7477d7bd71dd10bd5d993495de63e7c0eb4e03426cac66a7f99640441681b3abf1
@@ -2,5 +2,7 @@
2
2
 
3
3
  require "libFinder"
4
4
 
5
+ #running the class when the gem is called by its name in the terminal
6
+ #such an obident gem :D
5
7
  LibFinder::LibWorker.sniff
6
8
 
@@ -8,8 +8,12 @@ module LibFinder
8
8
  def self.sniff
9
9
  # a function to start the gem working used sniff cause i saw my dog doing so when searching for something :D
10
10
  if(self.is_rails)
11
+ #checking if we are in a rails file or not
11
12
  self.parse_gem_file
13
+ else
14
+ puts "please run this command in a rails app root folder"
12
15
  end
16
+
13
17
  end
14
18
 
15
19
  def self.is_rails
@@ -29,14 +33,15 @@ module LibFinder
29
33
 
30
34
  def self.parse_gem_file
31
35
  gems = []
36
+ #reading the file line by line
32
37
  File.readlines(Dir.pwd+"/Gemfile").each do |line|
38
+ #spliting the the read line by spaces
33
39
  line_data = line.split
40
+ #creating a regular expression that is used to match the versions
34
41
  regex=/\d+\.\d+\.*\d*/x
35
42
 
36
-
37
-
38
43
  if line_data[0] == "gem"
39
-
44
+ #if the line starts with the word gem then it is a gem and i will be parsed
40
45
  gem_info = {name: line_data[1].gsub(/[', ]/, '') ,version:""}
41
46
  line_data.each do |data|
42
47
  if data.match regex
@@ -52,8 +57,8 @@ module LibFinder
52
57
 
53
58
 
54
59
  def self.get_dependencies(gems)
55
-
56
- response=HTTParty.post("http://localhost:3000/find_dependencies",
60
+ #sending the post request to the webservice
61
+ response=HTTParty.post("https://whispering-journey-17183.herokuapp.com/find_dependencies",
57
62
  :body => {gems:gems,
58
63
  os_id:self.get_os
59
64
  }.to_json,
@@ -61,6 +66,7 @@ module LibFinder
61
66
  )
62
67
 
63
68
  dependencies = JSON.parse(response.body)
69
+ #parsing the response from string to jsn format
64
70
  if dependencies.count>0
65
71
  #calles the downloading and installing of the missing deps method
66
72
  #if the dependencies are greater than one
@@ -92,14 +98,13 @@ module LibFinder
92
98
 
93
99
  elsif self.get_os == 2
94
100
  #if the current os is mac
95
- command += "brew install "
101
+ command += "brew install " #in mac os
96
102
  deps.each do |dep|
97
103
  #a loop to go through all the dependencies to build the command string
98
104
  command += dep["name"]+" " #adding the lib name to the command
99
105
  end
100
106
  end
101
107
  #running the command
102
- puts command
103
108
  system(command)
104
109
 
105
110
  end
@@ -1,3 +1,4 @@
1
1
  module LibFinder
2
- VERSION = "0.5.2"
2
+ #handling the version
3
+ VERSION = "0.5.3"
3
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libFinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mody