Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created September 3, 2012 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/3609933 to your computer and use it in GitHub Desktop.
Save walterdavis/3609933 to your computer and use it in GitHub Desktop.
=begin
Parse out the version numbers for Freeway Actions installed on your computer.
Requires the Nokogiri gem to be installed; if you haven't, then type
sudo gem install nokogiri
in your terminal.
To use, type
ruby get_versions.rb
or
ruby get_versions.rb username action_file_name
to see only the versions of a specific Action.
=end
require 'rubygems'
require 'nokogiri'
require 'fileutils'
def list_versions( base )
Dir.glob( File.join(base,'**/*.fwaction') ).each do | action_file |
file_name = File.basename(action_file)
next if ARGV[1] && ! file_name.downcase.match(ARGV[1].chomp.downcase)
puts "\nFile: #{file_name}"
doc = Nokogiri::HTML(File.read(action_file))
doc.css('action-version').each do |vers|
if vers['version']
action = vers.ancestors('action, item-action, page-action, folder-action').first
if action
name = (action['title']) ? action['title'] : action['name']
puts "\t#{name} (#{action.name}) - #{vers['version']}"
else
puts "\t[Possibly malformed Action] (#{action.name}) - #{vers['version']}"
end
end
end
end
end
user = ((ARGV[0]) ? ARGV[0] : `whoami`).chomp
puts "\n\nBUILT-IN ACTIONS:"
base = "/Applications/Freeway 5.5 Pro.app/"
list_versions( base )
base = "/Users/#{user}/Library/Application Support/Freeway 5/"
puts "\n\nUSER ACTIONS:"
list_versions( base )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment