Skip to content

Commit

Permalink
🚀 - 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandademic authored Oct 8, 2021
1 parent 343b205 commit b1232d4
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions dist/lattefile
Original file line number Diff line number Diff line change
@@ -1,47 +1,43 @@

# frozen_string_literal
require 'inifile'
require 'open-uri'
#require 'facter'
# TODO: bring back helper
require 'colorize'
# module to download Packages
module Pkg
def self.findPkg(query)
$query = query
puts "Getting #{$query}"
puts "Starting install of #{$query}".colorize(:yellow)
Pkg.getPkgfile
end

def self.getPkgfile
pfr = URI.open("https://raw.githubusercontent.com/Pandademic/Latte/master/pkgs/#{$query}.ini").read
packageFileURL = "https://raw.githubusercontent.com/Pandademic/Latte/master/pkgs/#{$query}.ini"
puts "Package file:#{pfr}"
# implemnt no donwload of pkg file by using pfr
system("curl -O #{packageFileURL}")
puts 'package file download complete'
puts 'package file download complete!'.colorize(:green)
Pkg.downloadLatest
end

def self.downloadLatest
file = IniFile.load("#{$query}.ini")
puts 'loaded file'
puts 'Package file read!'.colorize(:green)
pkgdata = file['package']
zipsupport = pkgdata['Media']
if zipsupport == true
@RURL = pkgdata['MediaUrl']
system "curl -O #{@RURL}"
puts "#$query install success!".colorize(:green)
else
@Isc = pkgdata['InstallCommand'] # install command
system @Isc.to_s
puts "#$query installed successfully".colorize(:green)
end
end
end
@param1 = ARGV[1]
#$os = Facter['osfamily'].value
abort('That is not a command') while ARGV.empty?
if ARGV[0] == 'add'
Pkg.findPkg @param1.to_s
elsif Pkg.findPkg @param1.to_s
else
puts 'Unknown Command'
puts 'Unknown Command' .colorize(:red)
exit 1
end

0 comments on commit b1232d4

Please sign in to comment.