0
@@ -10,40 +10,51 @@ require 'pp'
0
desc "Make plugin package"
0
- unless path = ENV['path']
0
+ # Grab the path specified, or use all feather-* plugins found
0
+ paths = ENV['path'].nil? ? Dir.glob("feather-*") : [ENV['path']]
0
+ # Show usage if no plugins are found and none is specified
0
puts 'Usage: rake feather:package path=<plugin path> [target=<target path>]'
0
- puts "Load manifest..."
0
- pp manifest = YAML::load_file(File.join(path, 'manifest.yml'))
0
- # Target directory for package files
0
+ # Setup default target if none specified, otherwise use that
0
target = ENV['target'] ? ENV['target'] : File.join(File.dirname(__FILE__), 'pkg')
0
- puts "Target is: #{target}"
0
- Dir.mkdir(target) if not File.exists?(target)
0
- package = "#{manifest['name']}-#{manifest['version']}"
0
- puts "Package: #{package}"
0
- manifest['package'] = "#{package}.tgz"
0
- command = "tar -czf #{package}.tgz --exclude pkg -C #{path} ."
0
- puts "Packing: #{command}"
0
- FileUtils.mv("#{package}.tgz", target)
0
- File.open(File.join(target, "#{package}.yml"), 'w') do |f|
0
- f.puts(manifest.to_yaml)
0
+ # Loop through paths, packaging each one
0
+ puts "Packaging... (#{path})"
0
+# This packages the set path, with the specified target path
0
+def package(path, target)
0
+ puts "Load manifest..."
0
+ manifest = YAML::load_file(File.join(path, 'manifest.yml'))
0
+ # Target directory for package files
0
+ puts "Target is: #{target}"
0
+ Dir.mkdir(target) if not File.exists?(target)
0
+ package = "#{manifest['name']}-#{manifest['version']}"
0
+ puts "Package: #{package}"
0
+ manifest['package'] = "#{package}.tgz"
0
+ command = "tar -czf #{package}.tgz --exclude pkg -C #{path} ."
0
+ puts "Packing: #{command}"
0
+ FileUtils.mv("#{package}.tgz", target)
0
+ File.open(File.join(target, "#{package}.yml"), 'w') do |f|
0
+ f.puts(manifest.to_yaml)
0
\ No newline at end of file