Sha256: 1600b8f976a7c0e5e1cc735fd09089dee02246f62a5c13ee5f7ea07381af169b

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 KB

Contents

#! /usr/bin/env ruby

$LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))

require 'optparse'
require 'photoapp'

options = {}

OptionParser.new do |opts|
  opts.on("-c", "--config PATH", String, "Path to config file") do |config|
    options['config'] = config
  end
end.parse!

def update
  %w(Reprint Update).each do |app|
    FileUtils.rm "/Applications/#{app}.app"
    system "ln -s #{Photoapp.gem_dir("assets/#{app}.app")} /Applications/"
  end

  folder_actions_path = File.expand_path("~/Library/Workflows/Applications/Folder\\ Actions/")
  system "mkdir -p #{folder_actions_path}"
  system "rm -rf #{File.join(folder_actions_path, "photoapp-process.workflow")}"
  system "ln -s #{Photoapp.gem_dir('assets/photoapp-process.workflow')} #{folder_actions_path}"
end

def actions
  system "open /System/Library/Image\\ Capture/Support/Application/AutoImporter.app"
  system "open /System/Library/CoreServices/Folder\\ Actions\\ Setup.app"
end

def setup
  if `brew list imagemagick` =~ /Error:/
    system "brew update && brew install imagemagick"
  end

  unless `ls /Library/Automator` =~ /Import Files into Photos/
    system "say 'please install Automator actions for Photos app'"
    system "open #{Photoapp.gem_dir('assets/photos-action-installer.pkg')}"
  end

  update
  actions
end

if ARGV.first == 'setup'
  ARGV.shift
  setup
elsif ARGV.first == 'update'
  ARGV.shift
  update
elsif ARGV.first == 'set-actions'
  ARGV.shift
  actions
else

  if ARGV.first == 'process'
    ARGV.shift
    options['source'] = ARGV.shift
    Photoapp::Session.new(options).process
  elsif ARGV.first == 'upload'
    Photoapp::Session.new(options).upload
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
desoto-photoapp-0.3.3 exe/photoapp
desoto-photoapp-0.3.2 exe/photoapp