Add opal representation properties for scripting feed, account and

folder.
This commit is contained in:
Olof Hellman 2018-01-19 22:49:01 -08:00
parent fe5a11a2cc
commit 2973bf8edb
7 changed files with 45 additions and 1 deletions

View File

@ -141,6 +141,8 @@
D5A2678C20130ECF00A8D3C0 /* Author+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5A2678B20130ECF00A8D3C0 /* Author+Scriptability.swift */; };
D5A2679C201312F900A8D3C0 /* testNameOfAuthors.applescript in Sources */ = {isa = PBXBuildFile; fileRef = D5A2679B201312F900A8D3C0 /* testNameOfAuthors.applescript */; };
D5A2679D201313A200A8D3C0 /* testNameOfAuthors.applescript in CopyFiles */ = {isa = PBXBuildFile; fileRef = D5A2679B201312F900A8D3C0 /* testNameOfAuthors.applescript */; };
D5A267C120131B8300A8D3C0 /* testFeedOPML.applescript in Sources */ = {isa = PBXBuildFile; fileRef = D5A267B220131B8300A8D3C0 /* testFeedOPML.applescript */; };
D5A267C220131BA000A8D3C0 /* testFeedOPML.applescript in CopyFiles */ = {isa = PBXBuildFile; fileRef = D5A267B220131B8300A8D3C0 /* testFeedOPML.applescript */; };
D5D1751220020B980047B29D /* Evergreen.sdef in Resources */ = {isa = PBXBuildFile; fileRef = D5D175012002039D0047B29D /* Evergreen.sdef */; };
D5F4EDB5200744A700B9E363 /* ScriptingObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB4200744A700B9E363 /* ScriptingObject.swift */; };
D5F4EDB720074D6500B9E363 /* Feed+Scriptability.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F4EDB620074D6500B9E363 /* Feed+Scriptability.swift */; };
@ -442,6 +444,7 @@
dstPath = TestScripts;
dstSubfolderSpec = 7;
files = (
D5A267C220131BA000A8D3C0 /* testFeedOPML.applescript in CopyFiles */,
D5A2679D201313A200A8D3C0 /* testNameOfAuthors.applescript in CopyFiles */,
D5F4EDE920075C6700B9E363 /* testNameAndUrlOfEveryFeed.applescript in CopyFiles */,
D5F4EDEA20075C6700B9E363 /* testNameOfEveryFolder.applescript in CopyFiles */,
@ -585,6 +588,7 @@
D5907DB12004BB37005947E5 /* ScriptingObjectContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptingObjectContainer.swift; sourceTree = "<group>"; };
D5A2678B20130ECF00A8D3C0 /* Author+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Author+Scriptability.swift"; sourceTree = "<group>"; };
D5A2679B201312F900A8D3C0 /* testNameOfAuthors.applescript */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.applescript; path = testNameOfAuthors.applescript; sourceTree = "<group>"; };
D5A267B220131B8300A8D3C0 /* testFeedOPML.applescript */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.applescript; path = testFeedOPML.applescript; sourceTree = "<group>"; };
D5D175012002039D0047B29D /* Evergreen.sdef */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = Evergreen.sdef; path = ../Resources/Evergreen.sdef; sourceTree = "<group>"; };
D5F4EDB4200744A700B9E363 /* ScriptingObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScriptingObject.swift; sourceTree = "<group>"; };
D5F4EDB620074D6500B9E363 /* Feed+Scriptability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Feed+Scriptability.swift"; sourceTree = "<group>"; };
@ -1121,6 +1125,7 @@
isa = PBXGroup;
children = (
D5907C9D20023249005947E5 /* testGenericScript.applescript */,
D5A267B220131B8300A8D3C0 /* testFeedOPML.applescript */,
D5558FD1200223F60066386B /* testGetURL.applescript */,
D5F4EDE720075C1800B9E363 /* testNameAndUrlOfEveryFeed.applescript */,
D5A2679B201312F900A8D3C0 /* testNameOfAuthors.applescript */,
@ -1635,6 +1640,7 @@
D5558FD5200225680066386B /* NSAppleEventDescriptor+UserRecordFields.swift in Sources */,
D5558FD9200228D30066386B /* AppleEventUtils.swift in Sources */,
D5907CA1200232A1005947E5 /* testGetURL.applescript in Sources */,
D5A267C120131B8300A8D3C0 /* testFeedOPML.applescript in Sources */,
D5A2679C201312F900A8D3C0 /* testNameOfAuthors.applescript in Sources */,
849C64761ED37A5D003D8FC0 /* EvergreenTests.swift in Sources */,
D5558FD32002245C0066386B /* ScriptingTests.swift in Sources */,

View File

@ -49,6 +49,9 @@
<cocoa key="contents"/>
<type type="account item" list="yes"/>
</property>
<property name="opml representation" code="OPML" type="text" access="r" description="OPML representation for the account">
<cocoa key="opmlRepresentation"/>
</property>
<element type="feed">
<cocoa key="feeds"/>
</element>
@ -80,6 +83,9 @@
<property name="favicon url" code="FvUr" type="text" access="r" description="url for the feed favicon (optional)">
<cocoa key="faviconURL"/>
</property>
<property name="opml representation" code="OPML" type="text" access="r" description="OPML representation for the feed">
<cocoa key="opmlRepresentation"/>
</property>
<element type="author">
<cocoa key="authors"/>
</element>
@ -111,6 +117,9 @@
<property name="id" code="id " type="integer" access="r" description="The unique id of the account">
<cocoa key="uniqueId"/>
</property>
<property name="opml representation" code="OPML" type="text" access="r" description="OPML representation for the folder">
<cocoa key="opmlRepresentation"/>
</property>
</class>
</suite>

View File

@ -74,7 +74,12 @@ class ScriptableAccount: NSObject, UniqueIdScriptingObject, ScriptingObjectConta
}
return contentsArray as NSArray
}
@objc(opmlRepresentation)
var opmlRepresentation:String {
return self.account.OPMLString(indentLevel:0)
}
@objc(accountType)
var accountType:OSType {
var osType:String = ""

View File

@ -80,6 +80,11 @@ class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectContaine
return self.feed.faviconURL ?? ""
}
@objc(opmlRepresentation)
var opmlRepresentation:String {
return self.feed.OPMLString(indentLevel:0)
}
@objc(authors)
var authors:NSArray {
let feedAuthors = feed.authors ?? []

View File

@ -53,4 +53,9 @@ class ScriptableFolder: NSObject, UniqueIdScriptingObject {
return self.folder.name ?? ""
}
@objc(opmlRepresentation)
var opmlRepresentation:String {
return self.folder.OPMLString(indentLevel:0)
}
}

View File

@ -93,5 +93,9 @@ class ScriptingTests: XCTestCase {
func testNameOfAuthorsScript() {
_ = doIndividualScript(filename: "testNameOfAuthors")
}
func testNameOfAuthorsScript() {
_ = doIndividualScript(filename: "testFeedOPML")
}
}

View File

@ -0,0 +1,10 @@
-- this script just tests that no error was generated from the script
try
tell application "Evergreen"
opml representation of feed 1 of account 1
end tell
on error message
return {test_result:false, script_result:message}
end try
return {test_result:true}