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 +4 -4
- data/exe/libFinder +2 -0
- data/lib/libFinder.rb +12 -7
- data/lib/libFinder/version.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 034d3218530c19844fe9f6e4b6d450dff9141587
|
4
|
+
data.tar.gz: be21a05bd3e6c91a141de0d0804c978f9ebad300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cf300e76d533d07b8eda5a3bdf3479c904ffa0f497e1f775ecd745ab51244334e32e7c776d63596aaf0c6453287b15358968e1cf92c163004ee8f496c36adf8
|
7
|
+
data.tar.gz: c764ac184d8735c5642ee3e84d22fe851816203529431ac0478a887dc4efac7477d7bd71dd10bd5d993495de63e7c0eb4e03426cac66a7f99640441681b3abf1
|
data/exe/libFinder
CHANGED
data/lib/libFinder.rb
CHANGED
@@ -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("
|
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
|
data/lib/libFinder/version.rb
CHANGED