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