public
Description: Scripts to automate build numbering, packaging and distributing (via sparkle)
Homepage:
Clone URL: git://github.com/ncb/xcode-build-scripts.git
xcode-build-scripts / feeder-appcast-update.rb
7083a75d » ncb 2008-08-01 Added feeder script - uses ... 1 #!/usr/bin/env ruby
2 #
3 # NOTE: Make sure the selected Feed in Feeder is the one you want to add to
4 #
5 # --file needs to be full path to file
6 # --shortVersion is the human readable / marketing version - aka 1.0, 2.0, etc
7 # --longVersion is what sparkle checks... aka 1.0_123
8 #
9 # www.nickbrawn.com // Nick Brawn
10
11 require 'optparse'
12 require 'osx/cocoa'
13
14 options = {}
15
16 def feeder(filename, shortVersion, longVersion)
17 include OSX
18 OSX.require_framework 'ScriptingBridge'
19 feeder = SBApplication.applicationWithBundleIdentifier_("com.reinvented.Feeder")
20 print "#{feeder.selectedFeed.name}\n"
21
22 selectedFeed = feeder.selectedFeed
23 print "#{filename}, #{shortVersion}\n\n\n"
24
25 p = {}
26 p["itemTitle"] = "New Build Available (#{longVersion})"
27 p['enclosureUploadFile'] = filename
28 p['feed'] = selectedFeed
29 p['sparkleVersion'] = longVersion
30 p['sparkleShortVersion'] = shortVersion
31 newItem = feeder.classForScriptingClass_("feed item").alloc.initWithProperties_(p)
32 print "#{newItem}\n"
33 feeder.selectedFeed.feedItems.addObject_(newItem)
34 #print newItem.activate
35 feeder.activate # use this if you want to edit prior to publishing
36 #feeder.selectedFeed.publish # use this for automatic publishing
37 end
38
39
40 opts = OptionParser.new
41
42 opts.on("--file=ARG", String) do |v|
43 options[:file] = v
44 end
45
46 opts.on("--shortVersion=ARG", String) do |v|
47 options[:short] = v
48 end
49
50 opts.on("--longVersion=ARG", String) do |v|
51 options[:long] = v
52 end
53 rest = opts.parse(ARGV)
54
55
56 #read_args
57 print "#{options}\n"
58
59 feeder(options[:file],options[:short],options[:long])
60
61 # Based on the following applescript
62 #
63 #tell application "Feeder"
64 #set theFeed to selected feed
65 #set episodeTitle to "This Episode's Title"
66 #set episodeLink to "http://example.com/epsiodelink.html"
67 #set enclosureFile to "Users:yourname:Desktop:Episode1.mp3"
68 #make new feed item at theFeed with properties {feed:theFeed, item title:episodeTitle, item link:episodeLink, enclosure upload file:enclosureFile}
69 #publish theFeed
70 #end tell