Profile picture Schedule a Meeting
c a n d l a n d . n e t

Rake Package to Create Zipfile

Dusty Candland | | ruby, rake, wordpress

Small Rakefile to package a WordPress plugin into a zip file that can be installed by uploading.

The Rake::PackageTask requires FileTasks that describe how to build the files, since we don't really need to do anything, we just need to define what the files are.

require 'rake'
require 'rake/packagetask'

file 'README.txt'
file 'admin/**'
file 'includes/**'
file 'languages/**'
file 'public/**'
file "index.php"
file "LICENSE.txt"
file "README.txt"
file "remote-api.php"
file "uninstall.php"

Rake::PackageTask.new("remote-api", :noversion) do |p|
  p.need_zip = true
  p.package_files.include(
    "admin/**",
    "includes/**",
    "languages/**",
    "public/**",
    "index.php",
    "LICENSE.txt",
    "README.txt",
    "remote-api.php",
    "uninstall.php")
end

Then to create the zip, just run rake package. It'll create the file in the pkg/remote-api directory, or whatever name you gave the package.

Webmentions

These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: