Class: SysLibs::Task
- Inherits:
-
Object
- Object
- SysLibs::Task
- Defined in:
- lib/sys_libs.rb
Instance Method Summary collapse
-
#getMissingLibs(packagesArray, os) ⇒ Object
Send a post request to the server to retrieve the required sys libs.
-
#getOS ⇒ Object
Get the current os.
-
#getPackages ⇒ Object
Read the project’s Gemfile, fetch all uncommented gems and add to array.
Instance Method Details
#getMissingLibs(packagesArray, os) ⇒ Object
Send a post request to the server to retrieve the required sys libs
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/sys_libs.rb', line 43 def getMissingLibs(packagesArray, os) response = RestClient.post "https://stormy-bayou-25992.herokuapp.com/packages/search", { :packages => packagesArray, :os => os } body = JSON.parse(response.body) body.each do |key, value| puts key["name"] + " needs the following sys libs to be installed:" key["dependencies"].each do |d| puts d["name"] end end end |
#getOS ⇒ Object
Get the current os
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sys_libs.rb', line 24 def getOS @os ||= ( host_os = RbConfig::CONFIG['host_os'] case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ :windows when /darwin|mac os/ :mac when /linux/ :linux when /solaris|bsd/ :unix else raise Error::WebDriverError, "unknown os: #{host_os.inspect}" end ) end |
#getPackages ⇒ Object
Read the project’s Gemfile, fetch all uncommented gems and add to array
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sys_libs.rb', line 7 def getPackages @packagesArray = [] f = File.open("Gemfile", "r") f.each_line do |line| if !line.include?"#" and line.include? "gem" and !line.include?"rubygems.org" and !line.include? "gemspec" name = line.split(" ")[1].slice(1..-2) if name[-1].chr == "'" name = name.slice(0..-2) end @packagesArray << (name) end end f.close return @packagesArray end |