Sha256: 885792d844a42b93a7c538a5393da24e165ce81e34802bda395bdd161e4c22d8

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

#! /usr/bin/ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))

require 'rubygems'
require 'rimapub'
require 'rdoc/ri/ri_paths'
require 'getoptions'
require 'pp'

COMMAND_LIST = ['publish', 'setup' ]
opt = GetOptions.new(%w( help set=s command=s description=s images=@s x! tags=s Title=s Date=s))

if opt['help'] 
	puts "Usage: rimapub -c <#{COMMAND_LIST.join(', ')}> -s <image set> -d <image description> -t <tags comma separated and quoted> -i <image list or glob> "
	puts "                -D <publish date YY-MM-DD> -T <image title>"
	puts "       rimapub -h"
	exit 0
end

set  = opt['set'] || "default"
command = opt['command'] || "publish"
description = opt['description'] || ""
images = opt['images'] || "*"
verbose = opt['x'] || false
tags = opt['tags'] || ""
title = opt['Title'] || ""
date = opt['Date'] || Time.now.strftime("%Y-%m-%d")


#begin
if COMMAND_LIST.include? command 
	puts "Executing command #{command}" if verbose
	case command
		when 'publish':
			
			images.each do |f|
				f = File.expand_path(f)

				Dir.glob(f) do |f2|					
					if(!File.directory? f2)
						if File.exists?(f2)
							puts "Publishing #{f2} in set #{set} with title #{title}" if verbose
							aPublisher = Rimapub::Rimapub.new(verbose)
							aPublisher.publish(f2, set, title, description, tags)
						else
							puts "File #{f2} does not exist."
						end
					else
						puts "Directory of images not supported"
					end
				end
			end
		else
			puts "Unsupported command"
		end
end
# rescue
# 	puts "An error has occured #{$!}" 
# end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jmcarbo-rimapub-0.0.3 bin/rimapub