class Plasmoid::Package
Public Class Methods
new(filename)
click to toggle source
# File lib/plasmoid/package.rb, line 6 def initialize(filename) @filename = filename @pkg_name = File.basename(@filename, ".zip") end
Public Instance Methods
install()
click to toggle source
# File lib/plasmoid/package.rb, line 36 def install system("plasmapkg -i '#{@filename}'") end
run()
click to toggle source
# File lib/plasmoid/package.rb, line 32 def run system("plasmoidviewer '#{@pkg_name}'") end
uninstall()
click to toggle source
# File lib/plasmoid/package.rb, line 40 def uninstall system("plasmapkg -r '#{@pkg_name}'") end
write()
click to toggle source
# File lib/plasmoid/package.rb, line 11 def write File.unlink(@filename) if File.exist?(@filename) Zip::ZipFile.open(@filename, Zip::ZipFile::CREATE) do |zf| Find.find(".") do |path| path.sub!(/^\.\//, "") if path.empty? || path =~ /^\.+$/ || path =~ /\.(zip|haml)$/ || path == "Rakefile" next end if File.directory?(path) zf.dir.mkdir(path) else zf.file.open(path, "w") do |file| file.write(File.read(path)) end end end end end