Permalink
Browse files

Implement cookbooks plugged in real data

  • Loading branch information...
1 parent 8d11481 commit 25f0717fbfd3bb2c8df3c4c5652978478ca95aa1 Olivier Gutknecht committed May 17, 2009
View
10 Casserole.xcodeproj/project.pbxproj
@@ -44,6 +44,8 @@
77A53AFE0FB5A4E700040FC6 /* KCCookbooksController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A53AFD0FB5A4E700040FC6 /* KCCookbooksController.m */; };
77A53B260FB5A75600040FC6 /* KCChefConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A53B250FB5A75600040FC6 /* KCChefConnection.m */; };
77A53B910FB5B48500040FC6 /* KCNetworkOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 77A53B900FB5B48500040FC6 /* KCNetworkOperation.m */; };
+ 77B85FB70FC062B000AC2A91 /* LICENSE.txt in Resources */ = {isa = PBXBuildFile; fileRef = 77B85FB60FC062B000AC2A91 /* LICENSE.txt */; };
+ 77B85FC00FC067C300AC2A91 /* KCCookbook.m in Sources */ = {isa = PBXBuildFile; fileRef = 77B85FBF0FC067C300AC2A91 /* KCCookbook.m */; };
77C484540FB309980098C82D /* Search.xib in Resources */ = {isa = PBXBuildFile; fileRef = 77C484530FB309980098C82D /* Search.xib */; };
77C484580FB309CB0098C82D /* KCSearchController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C484570FB309CB0098C82D /* KCSearchController.m */; };
77C5C2150FB34CA9006D6BC8 /* KCNodesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C5C2140FB34CA9006D6BC8 /* KCNodesController.m */; };
@@ -126,6 +128,9 @@
77A53B250FB5A75600040FC6 /* KCChefConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCChefConnection.m; sourceTree = "<group>"; };
77A53B8F0FB5B48500040FC6 /* KCNetworkOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCNetworkOperation.h; sourceTree = "<group>"; };
77A53B900FB5B48500040FC6 /* KCNetworkOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCNetworkOperation.m; sourceTree = "<group>"; };
+ 77B85FB60FC062B000AC2A91 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; };
+ 77B85FBE0FC067C300AC2A91 /* KCCookbook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCCookbook.h; sourceTree = "<group>"; };
+ 77B85FBF0FC067C300AC2A91 /* KCCookbook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCCookbook.m; sourceTree = "<group>"; };
77C484510FB309940098C82D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Search.xib; sourceTree = "<group>"; };
77C484560FB309CB0098C82D /* KCSearchController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCSearchController.h; sourceTree = "<group>"; };
77C484570FB309CB0098C82D /* KCSearchController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCSearchController.m; sourceTree = "<group>"; };
@@ -193,6 +198,7 @@
29B97314FDCFA39411CA2CEA /* Casserole */ = {
isa = PBXGroup;
children = (
+ 77B85FB60FC062B000AC2A91 /* LICENSE.txt */,
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
@@ -304,6 +310,8 @@
77D439790FB5E6DD00F7867F /* KCNode.m */,
776BFEB10FB5F59700F0EC94 /* KCRegistration.h */,
776BFEB20FB5F59700F0EC94 /* KCRegistration.m */,
+ 77B85FBE0FC067C300AC2A91 /* KCCookbook.h */,
+ 77B85FBF0FC067C300AC2A91 /* KCCookbook.m */,
);
path = core;
sourceTree = "<group>";
@@ -381,6 +389,7 @@
77A53AF90FB5A40D00040FC6 /* Cookbooks.xib in Resources */,
775C57CC0FB6E43E002BA3BB /* Credits.rtf in Resources */,
779EF7BA0FB7391D000C014B /* Casserole.icns in Resources */,
+ 77B85FB70FC062B000AC2A91 /* LICENSE.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -410,6 +419,7 @@
776BFEB30FB5F59700F0EC94 /* KCRegistration.m in Sources */,
776B00FC0FB6180F00F0EC94 /* KCViewController.m in Sources */,
776B01620FB626EE00F0EC94 /* KCValueTransformers.m in Sources */,
+ 77B85FC00FC067C300AC2A91 /* KCCookbook.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
226 English.lproj/Cookbook.xib
@@ -2,9 +2,9 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9G55</string>
+ <string key="IBDocument.SystemVersion">9J61</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
- <string key="IBDocument.AppKitVersion">949.43</string>
+ <string key="IBDocument.AppKitVersion">949.46</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -37,7 +37,7 @@
</object>
<object class="NSCustomView" id="1005">
<reference key="NSNextResponder"/>
- <int key="NSvFlags">268</int>
+ <int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSBrowser" id="336150737">
@@ -58,11 +58,12 @@
</object>
<string key="NSPathSeparator">/</string>
<int key="NSMinColumnWidth">100</int>
- <int key="NSNumberOfVisibleColumns">5</int>
+ <int key="NSNumberOfVisibleColumns">3</int>
+ <int key="NSMaxNumberOfVisibleColumns">3</int>
<int key="NSColumnResizingType">1</int>
<double key="NSPreferedColumnWidth">1.000000e+02</double>
<bool key="NSAllowsTypeSelect">YES</bool>
- <int key="NSBrFlags">134430720</int>
+ <int key="NSBrFlags">1208041472</int>
</object>
<object class="NSTextField" id="61702477">
<reference key="NSNextResponder" ref="1005"/>
@@ -102,8 +103,8 @@
</object>
<object class="NSTextField" id="145462138">
<reference key="NSNextResponder" ref="1005"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{92, 561}, {73, 17}}</string>
+ <int key="NSvFlags">270</int>
+ <string key="NSFrame">{{92, 561}, {245, 17}}</string>
<reference key="NSSuperview" ref="1005"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="424017034">
@@ -120,27 +121,6 @@
<reference key="NSTextColor" ref="769287183"/>
</object>
</object>
- <object class="NSTextField" id="256871322">
- <reference key="NSNextResponder" ref="1005"/>
- <int key="NSvFlags">266</int>
- <string key="NSFrame">{{372, 561}, {286, 17}}</string>
- <reference key="NSSuperview" ref="1005"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="898129283">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents">Apache2</string>
- <object class="NSFont" key="NSSupport" id="22371976">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.300000e+01</double>
- <int key="NSfFlags">1044</int>
- </object>
- <string key="NSPlaceholderString">Apache2</string>
- <reference key="NSControlView" ref="256871322"/>
- <reference key="NSBackgroundColor" ref="193833240"/>
- <reference key="NSTextColor" ref="769287183"/>
- </object>
- </object>
<object class="NSScrollView" id="560884019">
<reference key="NSNextResponder" ref="1005"/>
<int key="NSvFlags">274</int>
@@ -389,25 +369,6 @@
<reference key="NSHScroller" ref="708577843"/>
<reference key="NSContentView" ref="939301342"/>
</object>
- <object class="NSTextField" id="969824128">
- <reference key="NSNextResponder" ref="1005"/>
- <int key="NSvFlags">265</int>
- <string key="NSFrame">{{478, 561}, {180, 17}}</string>
- <reference key="NSSuperview" ref="1005"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="798549209">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents">Placeholder, not actual data</string>
- <reference key="NSSupport" ref="22371976"/>
- <reference key="NSControlView" ref="969824128"/>
- <reference key="NSBackgroundColor" ref="193833240"/>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">2</int>
- <bytes key="NSRGB">MC41NDkwMTk2MyAwIDAuMDM1Mjk0MTE5AA</bytes>
- </object>
- </object>
- </object>
</object>
<string key="NSFrameSize">{675, 598}</string>
<reference key="NSSuperview"/>
@@ -442,14 +403,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
- <string key="label">cookbookStructure</string>
- <reference key="source" ref="1001"/>
- <reference key="destination" ref="336150737"/>
- </object>
- <int key="connectionID">17</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
<string key="label">textView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="807992957"/>
@@ -458,19 +411,52 @@
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">value: cookbookName</string>
- <reference key="source" ref="898129283"/>
+ <string key="label">content: arrangedObjects</string>
+ <reference key="source" ref="336150737"/>
+ <reference key="destination" ref="882977856"/>
+ <object class="NSNibBindingConnector" key="connector" id="631683406">
+ <reference key="NSSource" ref="336150737"/>
+ <reference key="NSDestination" ref="882977856"/>
+ <string key="NSLabel">content: arrangedObjects</string>
+ <string key="NSBinding">content</string>
+ <string key="NSKeyPath">arrangedObjects</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">31</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">contentValues: arrangedObjects.description</string>
+ <reference key="source" ref="336150737"/>
+ <reference key="destination" ref="882977856"/>
+ <object class="NSNibBindingConnector" key="connector" id="863566467">
+ <reference key="NSSource" ref="336150737"/>
+ <reference key="NSDestination" ref="882977856"/>
+ <string key="NSLabel">contentValues: arrangedObjects.description</string>
+ <string key="NSBinding">contentValues</string>
+ <string key="NSKeyPath">arrangedObjects.description</string>
+ <reference key="NSPreviousConnector" ref="631683406"/>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">32</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: cookbook.nodeTitle</string>
+ <reference key="source" ref="424017034"/>
<reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="898129283"/>
+ <reference key="NSSource" ref="424017034"/>
<reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: cookbookName</string>
+ <string key="NSLabel">value: cookbook.nodeTitle</string>
<string key="NSBinding">value</string>
- <string key="NSKeyPath">cookbookName</string>
+ <string key="NSKeyPath">cookbook.nodeTitle</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
- <int key="connectionID">19</int>
+ <int key="connectionID">38</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
@@ -486,72 +472,56 @@
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
- <int key="connectionID">25</int>
+ <int key="connectionID">52</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">contentArray: cookbookContents</string>
- <reference key="source" ref="882977856"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="882977856"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">contentArray: cookbookContents</string>
- <string key="NSBinding">contentArray</string>
- <string key="NSKeyPath">cookbookContents</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">cookbookBrowser</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="336150737"/>
</object>
- <int key="connectionID">27</int>
+ <int key="connectionID">54</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">content: arrangedObjects</string>
- <reference key="source" ref="336150737"/>
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">cookbookStructureController</string>
+ <reference key="source" ref="1001"/>
<reference key="destination" ref="882977856"/>
- <object class="NSNibBindingConnector" key="connector" id="631683406">
- <reference key="NSSource" ref="336150737"/>
- <reference key="NSDestination" ref="882977856"/>
- <string key="NSLabel">content: arrangedObjects</string>
- <string key="NSBinding">content</string>
- <string key="NSKeyPath">arrangedObjects</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
</object>
- <int key="connectionID">31</int>
+ <int key="connectionID">55</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">contentValues: arrangedObjects.description</string>
+ <string key="label">selectionIndexPaths: selections</string>
<reference key="source" ref="336150737"/>
- <reference key="destination" ref="882977856"/>
+ <reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="336150737"/>
- <reference key="NSDestination" ref="882977856"/>
- <string key="NSLabel">contentValues: arrangedObjects.description</string>
- <string key="NSBinding">contentValues</string>
- <string key="NSKeyPath">arrangedObjects.description</string>
- <reference key="NSPreviousConnector" ref="631683406"/>
+ <reference key="NSDestination" ref="1001"/>
+ <string key="NSLabel">selectionIndexPaths: selections</string>
+ <string key="NSBinding">selectionIndexPaths</string>
+ <string key="NSKeyPath">selections</string>
+ <reference key="NSPreviousConnector" ref="863566467"/>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
- <int key="connectionID">32</int>
+ <int key="connectionID">56</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">value: cookbookName</string>
- <reference key="source" ref="256871322"/>
+ <string key="label">contentArray: cookbook.content</string>
+ <reference key="source" ref="882977856"/>
<reference key="destination" ref="1001"/>
<object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="256871322"/>
+ <reference key="NSSource" ref="882977856"/>
<reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">value: cookbookName</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">cookbookName</string>
+ <string key="NSLabel">contentArray: cookbook.content</string>
+ <string key="NSBinding">contentArray</string>
+ <string key="NSKeyPath">cookbook.content</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
- <int key="connectionID">33</int>
+ <int key="connectionID">58</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@@ -588,12 +558,10 @@
<reference key="object" ref="1005"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="256871322"/>
- <reference ref="969824128"/>
- <reference ref="336150737"/>
- <reference ref="560884019"/>
<reference ref="61702477"/>
<reference ref="145462138"/>
+ <reference ref="336150737"/>
+ <reference ref="560884019"/>
</object>
<reference key="parent" ref="1002"/>
</object>
@@ -617,20 +585,6 @@
<reference key="parent" ref="61702477"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">7</int>
- <reference key="object" ref="256871322"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="898129283"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">8</int>
- <reference key="object" ref="898129283"/>
- <reference key="parent" ref="256871322"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="560884019"/>
<object class="NSMutableArray" key="children">
@@ -662,20 +616,6 @@
<reference key="parent" ref="1002"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">34</int>
- <reference key="object" ref="969824128"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="798549209"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">35</int>
- <reference key="object" ref="798549209"/>
- <reference key="parent" ref="969824128"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">36</int>
<reference key="object" ref="145462138"/>
<object class="NSMutableArray" key="children">
@@ -707,22 +647,18 @@
<string>12.IBPluginDependency</string>
<string>2.IBPluginDependency</string>
<string>20.IBPluginDependency</string>
- <string>34.IBPluginDependency</string>
- <string>35.IBPluginDependency</string>
<string>36.IBPluginDependency</string>
<string>37.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
- <string>7.IBPluginDependency</string>
- <string>8.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilderKit</string>
<string>com.apple.InterfaceBuilderKit</string>
- <string>{{117, 314}, {675, 598}}</string>
+ <string>{{120, 545}, {675, 598}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{628, 654}</string>
<string>{{217, 442}, {480, 272}}</string>
@@ -736,10 +672,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -762,7 +694,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">37</int>
+ <int key="maxID">58</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -774,15 +706,15 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>cookbookContents</string>
- <string>cookbookStructure</string>
+ <string>cookbookBrowser</string>
+ <string>cookbookStructureController</string>
<string>sourceText</string>
<string>textView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSMutableArray</string>
<string>NSBrowser</string>
+ <string>NSTreeController</string>
<string>NSString</string>
<string>NSTextView</string>
</object>
View
121 English.lproj/Cookbooks.xib
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9G55</string>
+ <string key="IBDocument.SystemVersion">9J61</string>
<string key="IBDocument.InterfaceBuilderVersion">677</string>
- <string key="IBDocument.AppKitVersion">949.43</string>
+ <string key="IBDocument.AppKitVersion">949.46</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="1"/>
+ <integer value="9"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -53,7 +53,7 @@
<object class="NSTableView" id="885996582">
<reference key="NSNextResponder" ref="1033500828"/>
<int key="NSvFlags">256</int>
- <string key="NSFrameSize">{463, 197}</string>
+ <string key="NSFrameSize">{463, 239}</string>
<reference key="NSSuperview" ref="1033500828"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="342675881">
@@ -79,7 +79,7 @@
<int key="NSCellFlags">75628032</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Cookbooks</string>
- <object class="NSFont" key="NSSupport">
+ <object class="NSFont" key="NSSupport" id="26">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">1.100000e+01</double>
<int key="NSfFlags">3100</int>
@@ -100,19 +100,15 @@
</object>
<object class="NSTextFieldCell" key="NSDataCell" id="408042814">
<int key="NSCellFlags">337772096</int>
- <int key="NSCellFlags2">2048</int>
+ <int key="NSCellFlags2">133120</int>
<string key="NSContents">Text Cell</string>
- <object class="NSFont" key="NSSupport" id="599502168">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">1.300000e+01</double>
- <int key="NSfFlags">1044</int>
- </object>
+ <reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="885996582"/>
<object class="NSColor" key="NSBackgroundColor" id="758676731">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlBackgroundColor</string>
- <object class="NSColor" key="NSColor" id="374265394">
+ <object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2OQA</bytes>
</object>
@@ -126,7 +122,6 @@
</object>
<int key="NSResizingMask">3</int>
<bool key="NSIsResizeable">YES</bool>
- <bool key="NSIsEditable">YES</bool>
<reference key="NSTableView" ref="885996582"/>
</object>
</object>
@@ -146,14 +141,14 @@
</object>
</object>
<double key="NSRowHeight">1.700000e+01</double>
- <int key="NSTvFlags">-700448768</int>
+ <int key="NSTvFlags">-692060160</int>
<int key="NSColumnAutoresizingStyle">4</int>
<int key="NSDraggingSourceMaskForLocal">15</int>
<int key="NSDraggingSourceMaskForNonLocal">0</int>
<bool key="NSAllowsTypeSelect">YES</bool>
</object>
</object>
- <string key="NSFrame">{{1, 17}, {463, 197}}</string>
+ <string key="NSFrame">{{1, 17}, {463, 239}}</string>
<reference key="NSSuperview" ref="686038337"/>
<reference key="NSNextKeyView" ref="885996582"/>
<reference key="NSDocView" ref="885996582"/>
@@ -163,7 +158,7 @@
<object class="NSScroller" id="404261388">
<reference key="NSNextResponder" ref="686038337"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{464, 17}, {15, 197}}</string>
+ <string key="NSFrame">{{464, 17}, {15, 239}}</string>
<reference key="NSSuperview" ref="686038337"/>
<reference key="NSTarget" ref="686038337"/>
<string key="NSAction">_doScroller:</string>
@@ -173,7 +168,7 @@
<object class="NSScroller" id="198526594">
<reference key="NSNextResponder" ref="686038337"/>
<int key="NSvFlags">256</int>
- <string key="NSFrame">{{1, 214}, {463, 15}}</string>
+ <string key="NSFrame">{{1, 256}, {463, 15}}</string>
<reference key="NSSuperview" ref="686038337"/>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="686038337"/>
@@ -196,7 +191,7 @@
</object>
<reference ref="564103562"/>
</object>
- <string key="NSFrameSize">{480, 230}</string>
+ <string key="NSFrameSize">{480, 272}</string>
<reference key="NSSuperview" ref="1005"/>
<reference key="NSNextKeyView" ref="1033500828"/>
<int key="NSsFlags">50</int>
@@ -207,30 +202,6 @@
<reference key="NSCornerView" ref="564103562"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
</object>
- <object class="NSTextField" id="119700182">
- <reference key="NSNextResponder" ref="1005"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{17, 243}, {180, 17}}</string>
- <reference key="NSSuperview" ref="1005"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSTextFieldCell" key="NSCell" id="779850602">
- <int key="NSCellFlags">68288064</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents">Placeholder, not actual data</string>
- <reference key="NSSupport" ref="599502168"/>
- <reference key="NSControlView" ref="119700182"/>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlColor</string>
- <reference key="NSColor" ref="374265394"/>
- </object>
- <object class="NSColor" key="NSTextColor">
- <int key="NSColorSpace">2</int>
- <bytes key="NSRGB">MC41MzMzMzMzNiAwIDAuMDI3NDUwOTgyAA</bytes>
- </object>
- </object>
- </object>
</object>
<string key="NSFrameSize">{480, 272}</string>
<reference key="NSSuperview"/>
@@ -263,22 +234,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">contentArray: cookbooks</string>
- <reference key="source" ref="1032641564"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="1032641564"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">contentArray: cookbooks</string>
- <string key="NSBinding">contentArray</string>
- <string key="NSKeyPath">cookbooks</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">17</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
<string key="label">content: arrangedObjects</string>
<reference key="source" ref="885996582"/>
<reference key="destination" ref="1032641564"/>
@@ -309,6 +264,30 @@
</object>
<int key="connectionID">20</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">contentArray: chefConnection.cookbooks</string>
+ <reference key="source" ref="1032641564"/>
+ <reference key="destination" ref="1001"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="1032641564"/>
+ <reference key="NSDestination" ref="1001"/>
+ <string key="NSLabel">contentArray: chefConnection.cookbooks</string>
+ <string key="NSBinding">contentArray</string>
+ <string key="NSKeyPath">chefConnection.cookbooks</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">25</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">contentsController</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="1032641564"/>
+ </object>
+ <int key="connectionID">26</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -345,7 +324,6 @@
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="686038337"/>
- <reference ref="119700182"/>
</object>
<reference key="parent" ref="1002"/>
</object>
@@ -403,20 +381,7 @@
<int key="objectID">16</int>
<reference key="object" ref="1032641564"/>
<reference key="parent" ref="1002"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">23</int>
- <reference key="object" ref="119700182"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="779850602"/>
- </object>
- <reference key="parent" ref="1005"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">24</int>
- <reference key="object" ref="779850602"/>
- <reference key="parent" ref="119700182"/>
+ <string key="objectName">Cookbooks Controller</string>
</object>
</object>
</object>
@@ -433,8 +398,6 @@
<string>1.editorWindowContentRectSynchronizationRect</string>
<string>12.IBPluginDependency</string>
<string>16.IBPluginDependency</string>
- <string>23.IBPluginDependency</string>
- <string>24.IBPluginDependency</string>
<string>4.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
@@ -459,8 +422,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -483,14 +444,18 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">24</int>
+ <int key="maxID">26</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">KCCookbooksController</string>
<string key="superclassName">KCViewController</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">contentsController</string>
+ <string key="NS.object.0">NSArrayController</string>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">gui/KCCookbooksController.h</string>
View
4 English.lproj/MainWindow.xib
@@ -553,7 +553,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
</object>
<object class="NSScroller" id="30509464">
<reference key="NSNextResponder" ref="909952441"/>
- <int key="NSvFlags">256</int>
+ <int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{-100, -100}, {15, 532}}</string>
<reference key="NSSuperview" ref="909952441"/>
<reference key="NSTarget" ref="909952441"/>
@@ -575,7 +575,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ</bytes>
<string key="NSFrameSize">{200, 423}</string>
<reference key="NSSuperview" ref="281380729"/>
<reference key="NSNextKeyView" ref="513889271"/>
- <int key="NSsFlags">0</int>
+ <int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="30509464"/>
<reference key="NSHScroller" ref="325037419"/>
<reference key="NSContentView" ref="513889271"/>
View
44 English.lproj/Status.xib
@@ -194,7 +194,7 @@
<object class="NSButtonCell" key="NSCell" id="299271504">
<int key="NSCellFlags">-2080244160</int>
<int key="NSCellFlags2">2048</int>
- <string key="NSContents">32 (vim, emacs, screen, apache2, openssl, darwinports, ldap, nginx, passenger, rails, merb)</string>
+ <string key="NSContents">32</string>
<reference key="NSSupport" ref="598438022"/>
<reference key="NSControlView" ref="177984490"/>
<int key="NSButtonFlags">-2042871553</int>
@@ -342,6 +342,9 @@
<reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
</object>
+ <object class="NSUserDefaultsController" id="1051466490">
+ <bool key="NSSharedInstance">YES</bool>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -465,22 +468,6 @@
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
- <string key="label">title: cookbooks</string>
- <reference key="source" ref="177984490"/>
- <reference key="destination" ref="1001"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="177984490"/>
- <reference key="NSDestination" ref="1001"/>
- <string key="NSLabel">title: cookbooks</string>
- <string key="NSBinding">title</string>
- <string key="NSKeyPath">cookbooks</string>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">87</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
<string key="label">argument: windowController.cookbooksController</string>
<reference key="source" ref="177984490"/>
<reference key="destination" ref="1001"/>
@@ -520,6 +507,22 @@
</object>
<int key="connectionID">91</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">title: chefConnection.cookbooks.@count</string>
+ <reference key="source" ref="177984490"/>
+ <reference key="destination" ref="1001"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="177984490"/>
+ <reference key="NSDestination" ref="1001"/>
+ <string key="NSLabel">title: chefConnection.cookbooks.@count</string>
+ <string key="NSBinding">title</string>
+ <string key="NSKeyPath">chefConnection.cookbooks.@count</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">94</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -753,6 +756,11 @@
<reference key="object" ref="299271504"/>
<reference key="parent" ref="177984490"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">97</int>
+ <reference key="object" ref="1051466490"/>
+ <reference key="parent" ref="1002"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -846,7 +854,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">91</int>
+ <int key="maxID">104</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
View
2 Info.plist
@@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.3</string>
+ <string>1.0</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2009 Fotonauts Inc.</string>
<key>NSMainNibFile</key>
View
8 core/KCAbstractNode.h
@@ -25,7 +25,8 @@
@property(assign) KCAbstractNode *parent;
@property(assign) BOOL isLeaf;
--(void)addObject:(id)o;
+-(void)addObject:(KCAbstractNode*)o;
+-(void)addSortedObject:(KCAbstractNode*)object;
-(void)refresh:(id)sender;
@@ -41,15 +42,20 @@
@interface KCChefNode : KCAbstractNode {
KCChefConnection *connection;
+ NSString *nodeType;
}
@property(assign) KCChefConnection *connection;
+@property(assign) NSString *nodeType;
@end
@interface KCNodesProxy : KCChefNode
@end
+@interface KCCookbooksProxy : KCChefNode
+@end
+
@interface KCViewControllerNode : KCChefNode {
KCViewController *viewController;
}
View
179 core/KCAbstractNode.m
@@ -31,7 +31,7 @@ - (void)refresh:(id)sender
{
}
-- (NSString*)description
+- (NSString*)description
{
return nodeTitle;
}
@@ -52,78 +52,91 @@ - (NSIndexPath*)path
- (void)setIsLeaf:(BOOL)flag;
-{
+{
isLeaf = flag;
if (isLeaf)
self.children = [NSMutableArray arrayWithObject:self];
- else
+ else
self.children = [NSMutableArray array];
-}
+}
- (BOOL)isLeaf;
-{
+{
return isLeaf;
-}
+}
- (NSMutableArray *)children;
-{
+{
return children;
-}
+}
- (void)setChildren:(NSMutableArray *)newChildren;
-{
- if (children == newChildren)
+{
+ if (children == newChildren)
return;
[children release];
children = [newChildren mutableCopy];
-}
+}
- (NSUInteger)countOfChildren;
-{
- if (self.isLeaf)
+{
+ if (self.isLeaf)
return 0;
return [self.children count];
-}
+}
-- (void)addObject:(id)object
-{
- if (self.isLeaf)
- return;
- [self.children insertObject:object atIndex:[self countOfChildren]];
-}
-- (void)insertObject:(id)object inChildrenAtIndex:(NSUInteger)index;
-{
- if (self.isLeaf)
+- (void)insertObject:(KCAbstractNode*)object inChildrenAtIndex:(NSUInteger)index;
+{
+ if (self.isLeaf)
return;
[self.children insertObject:object atIndex:index];
-}
+}
- (void)removeObjectFromChildrenAtIndex:(NSUInteger)index;
-{
- if (self.isLeaf)
+{
+ if (self.isLeaf)
return;
[self.children removeObjectAtIndex:index];
-}
+}
- (id)objectInChildrenAtIndex:(NSUInteger)index;
-{
- if (self.isLeaf)
+{
+ if (self.isLeaf)
return nil;
return [self.children objectAtIndex:index];
-}
+}
-- (void)replaceObjectInChildrenAtIndex:(NSUInteger)index withObject:(id)object;
-{
- if (self.isLeaf)
+- (void)replaceObjectInChildrenAtIndex:(NSUInteger)index withObject:(KCAbstractNode*)object;
+{
+ if (self.isLeaf)
return;
[self.children replaceObjectAtIndex:index withObject:object];
-}
+}
+
+
+- (void)addObject:(KCAbstractNode*)object
+{
+ [self insertObject:object inChildrenAtIndex:[self countOfChildren]];
+}
+
+- (void)addSortedObject:(KCAbstractNode*)object
+{
+ if (self.isLeaf)
+ return;
+ [self addObject:object];
+ [self willChangeValueForKey:@"children"];
+ [self.children sortUsingDescriptors:[NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"nodeTitle" ascending:YES]]];
+ [self didChangeValueForKey:@"children"];
+}
+
+
@end
@implementation KCChefNode
@synthesize connection;
+@synthesize nodeType;
@end
@implementation KCViewControllerNode
@@ -154,53 +167,111 @@ -(NSString*)iconName
}
- (void)setIsLeaf:(BOOL)flag;
-{
+{
return;
-}
+}
- (BOOL)isLeaf;
-{
+{
return NO;
-}
+}
- (NSMutableArray *)children;
-{
+{
return self.connection.nodes;
-}
+}
- (void)setChildren:(NSMutableArray *)newChildren;
-{
+{
return;
-}
+}
- (NSUInteger)countOfChildren;
-{
+{
return [self.connection.nodes count];
-}
+}
- (void)addObject:(id)object
-{
+{
return;
-}
+}
- (void)insertObject:(id)object inChildrenAtIndex:(NSUInteger)index;
-{
+{
return;
-}
+}
- (void)removeObjectFromChildrenAtIndex:(NSUInteger)index;
-{
+{
return;
-}
+}
- (id)objectInChildrenAtIndex:(NSUInteger)index;
-{
+{
return [connection.nodes objectAtIndex:index];
-}
+}
- (void)replaceObjectInChildrenAtIndex:(NSUInteger)index withObject:(id)object;
-{
+{
return;
-}
+}
+
+@end
+
+@implementation KCCookbooksProxy
+
+-(NSString*)iconName
+{
+ return NSImageNameMultipleDocuments;
+}
+
+- (void)setIsLeaf:(BOOL)flag;
+{
+ return;
+}
+- (BOOL)isLeaf;
+{
+ return NO;
+}
+
+- (NSMutableArray *)children;
+{
+ return self.connection.cookbooks;
+}
+
+- (void)setChildren:(NSMutableArray *)newChildren;
+{
+ return;
+}
+
+- (NSUInteger)countOfChildren;
+{
+ return [self.connection.cookbooks count];
+}
+
+- (void)addObject:(id)object
+{
+ return;
+}
+
+- (void)insertObject:(id)object inChildrenAtIndex:(NSUInteger)index;
+{
+ return;
+}
+
+- (void)removeObjectFromChildrenAtIndex:(NSUInteger)index;
+{
+ return;
+}
+
+- (id)objectInChildrenAtIndex:(NSUInteger)index;
+{
+ return [connection.cookbooks objectAtIndex:index];
+}
+
+- (void)replaceObjectInChildrenAtIndex:(NSUInteger)index withObject:(id)object;
+{
+ return;
+}
@end
View
4 core/KCChefConnection.h
@@ -8,17 +8,21 @@
#import <Cocoa/Cocoa.h>
+@class KCCookbook;
@interface KCChefConnection : NSObject {
NSString* serverURL; // https://chef.example.com
NSMutableArray* nodes;
NSMutableArray* registrations;
+ NSMutableArray* cookbooks;
}
@property (retain) NSString* serverURL;
@property (retain) NSMutableArray* registrations;
+@property (retain) NSMutableArray* cookbooks;
@property (retain) NSMutableArray* nodes;
-(void)refresh:(id)sender;
+-(KCCookbook*)cookbookForName:(NSString*)name;
@end
View
191 core/KCChefConnection.m
@@ -11,79 +11,206 @@
#import "KCNetworkOperation.h"
#import "KCRegistration.h"
#import "KCNode.h"
+#import "KCCookbook.h"
@implementation KCChefConnection
@synthesize serverURL;
@synthesize nodes;
+@synthesize cookbooks;
@synthesize registrations;
+// /cookbooks/varnish/recipes?id=balancer.rb
+
-(id)init
{
[super init];
[self setNodes:[NSMutableArray array]];
+ [self setCookbooks:[NSMutableArray array]];
[self setRegistrations:[NSMutableArray array]];
return self;
}
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
- if([keyPath isEqual:@"isFinished"]){
- [object removeObserver:self forKeyPath:@"isFinished"];
+-(void)addCookbook:(KCCookbook*)node
+{
+ NSSortDescriptor* sort = [[NSSortDescriptor alloc] initWithKey:@"nodeTitle" ascending:YES];
+ [self willChangeValueForKey:@"cookbooks"];
+ [cookbooks addObject:node];
+ [cookbooks sortUsingDescriptors:[NSArray arrayWithObject:sort]];
+ [self didChangeValueForKey:@"cookbooks"];
+}
+
+-(void)addNode:(KCNode*)node
+{
+ NSSortDescriptor* sort = [[NSSortDescriptor alloc] initWithKey:@"nodeTitle" ascending:YES];
+ [self willChangeValueForKey:@"nodes"];
+ [nodes addObject:node];
+ [nodes sortUsingDescriptors:[NSArray arrayWithObject:sort]];
+ [self didChangeValueForKey:@"nodes"];
+}
+
+-(void)processOperationResult:(KCNetworkOperation*)op
+{
+ NSArray* array = (NSArray*)op.result;
+ if ([op.type isEqualToString:@"get.nodes"]) {
+ [self willChangeValueForKey:@"nodes"];
+ [nodes removeAllObjects];
+ for (NSString *element in array) {
+ KCNode* node = [[KCNode alloc] init];
+ node.nodeTitle = element;
+ node.connection = self;
+ [self addNode:node];
+ [node refresh:self];
+ }
+ [self didChangeValueForKey:@"nodes"];
+ }
+ if ([op.type isEqualToString:@"get.registrations"]) {
+ [registrations removeAllObjects];
+ for (NSDictionary *element in array) {
+ KCRegistration* node = [[KCRegistration alloc] init];
+ node.nodeTitle = [element objectForKey:@"name"];
+ node.content = element; // We shouldn't duplicate content and nodeTitle, fix this.
+ node.connection = self;
+ [registrations addObject:node];
+ }
+ }
+ if ([op.type isEqualToString:@"get.recipes"]) {
+ for (NSDictionary *element in array) {
+ NSString* cookbookName = [element objectForKey:@"cookbook"];
+ NSString* name = [element objectForKey:@"name"];
+ KCCookbook* node = [self cookbookForName:cookbookName];
+ if (node==nil) {
+ node = [[KCCookbook alloc] init];
+ [node setNodeTitle:cookbookName];
+ node.connection = self;
+ [self addCookbook:node];
+ }
+ [node addRecipe:name];
+ // [node refreshRecipe:recipeName];
+ }
+ }
+ if ([op.type isEqualToString:@"get.attributes"]) {
+ for (NSDictionary *element in array) {
+ NSString* cookbookName = [element objectForKey:@"cookbook"];
+ NSString* name = [element objectForKey:@"name"];
+ KCCookbook* node = [self cookbookForName:cookbookName];
+ if (node==nil) {
+ node = [[KCCookbook alloc] init];
+ [node setNodeTitle:cookbookName];
+ node.connection = self;
+ [self addCookbook:node];
+ }
+ [node addAttribute:name];
+ // [node refreshRecipe:recipeName];
+ }
+ }
+ if ([op.type isEqualToString:@"get.definitions"]) {
+ for (NSDictionary *element in array) {
+ NSString* cookbookName = [element objectForKey:@"cookbook"];
+ NSString* name = [element objectForKey:@"name"];
+ KCCookbook* node = [self cookbookForName:cookbookName];
+ if (node==nil) {
+ node = [[KCCookbook alloc] init];
+ [node setNodeTitle:cookbookName];
+ node.connection = self;
+ [self addCookbook:node];
+ }
+ [node addDefinition:name];
+ // [node refreshRecipe:recipeName];
+ }
+ }
+ if ([op.type isEqualToString:@"get.libraries"]) {
+ for (NSDictionary *element in array) {
+ NSString* cookbookName = [element objectForKey:@"cookbook"];
+ NSString* name = [element objectForKey:@"name"];
+ KCCookbook* node = [self cookbookForName:cookbookName];
+ if (node==nil) {
+ node = [[KCCookbook alloc] init];
+ [node setNodeTitle:cookbookName];
+ node.connection = self;
+ [self addCookbook:node];
+ }
+ [node addLibrary:name];
+ // [node refreshRecipe:recipeName];
+ }
+ }
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ if([keyPath isEqual:@"isFinished"]){
+ [object removeObserver:self forKeyPath:@"isFinished"];
KCNetworkOperation* op = (KCNetworkOperation*)object;
if (op.error!=nil) {
NSAlert* a = [NSAlert alertWithError:op.error];
[a runModal];
}
else {
if ([op.result isKindOfClass:[NSArray class]])
- {
- NSArray* array = (NSArray*)op.result;
- if ([op.type isEqualToString:@"get.nodes"]) {
- [self willChangeValueForKey:@"nodes"];
- [nodes removeAllObjects];
- for (NSString *element in array) {
- KCNode* node = [[KCNode alloc] init];
- node.nodeTitle = element;
- node.connection = self;
- [nodes addObject:node];
- [node refresh:self];
- }
- [self didChangeValueForKey:@"nodes"];
- }
- if ([op.type isEqualToString:@"get.registrations"]) {
- [registrations removeAllObjects];
- for (NSDictionary *element in array) {
- KCRegistration* node = [[KCRegistration alloc] init];
- node.nodeTitle = [element objectForKey:@"name"];
- node.content = element; // We shouldn't duplicate content and nodeTitle, fix this.
- node.connection = self;
- [registrations addObject:node];
- }
- }
- }
+ [self performSelectorOnMainThread:@selector(processOperationResult:) withObject:op waitUntilDone:false];
}
- }
+ }
}
+-(KCCookbook*)cookbookForName:(NSString*)name
+{
+ // This access is inefficient, but everything will change with the new revision of the REST API.
+ for (KCCookbook* c in cookbooks)
+ {
+ if ([[c nodeTitle] isEqualToString:name])
+ return c;
+ }
+ return nil;
+}
+
-(void)refresh:(id)sender
{
+ [cookbooks removeAllObjects];
+
NSOperationQueue* queue = [(KCApplicationDelegate*)[NSApp delegate] queue];
KCNetworkOperation* nodesOp = [[KCNetworkOperation alloc] init];
nodesOp.url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/nodes.json", self.serverURL]];
nodesOp.type = @"get.nodes";
nodesOp.summary = @"Refreshing nodes list";
- [nodesOp addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
+ [nodesOp addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
[queue addOperation:nodesOp];
KCNetworkOperation* registrationsOp = [[KCNetworkOperation alloc] init];
registrationsOp.type = @"get.registrations";
registrationsOp.summary = @"Refreshing registrations";
registrationsOp.url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/registrations.json", self.serverURL]];
- [registrationsOp addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
+ [registrationsOp addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
[queue addOperation:registrationsOp];
+
+ KCNetworkOperation* cookbookOp1 = [[KCNetworkOperation alloc] init];
+ cookbookOp1.type = @"get.recipes";
+ cookbookOp1.summary = @"Refreshing recipes";
+ cookbookOp1.url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/cookbooks/_recipe_files", self.serverURL]];
+ [cookbookOp1 addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
+ [queue addOperation:cookbookOp1];
+
+ KCNetworkOperation* cookbookOp2 = [[KCNetworkOperation alloc] init];
+ cookbookOp2.type = @"get.attributes";
+ cookbookOp2.summary = @"Refreshing attribute files";
+ cookbookOp2.url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/cookbooks/_attribute_files", self.serverURL]];
+ [cookbookOp2 addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
+ [queue addOperation:cookbookOp2];
+
+ KCNetworkOperation* cookbookOp3 = [[KCNetworkOperation alloc] init];
+ cookbookOp3.type = @"get.definitions";
+ cookbookOp3.summary = @"Refreshing definitions";
+ cookbookOp3.url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/cookbooks/_definition_files", self.serverURL]];
+ [cookbookOp3 addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
+ [queue addOperation:cookbookOp3];
+
+ KCNetworkOperation* cookbookOp4 = [[KCNetworkOperation alloc] init];
+ cookbookOp4.type = @"get.libraries";
+ cookbookOp4.summary = @"Refreshing libraries";
+ cookbookOp4.url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/cookbooks/_library_files", self.serverURL]];
+ [cookbookOp4 addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
+ [queue addOperation:cookbookOp4];
}
@end
View
24 core/KCNetworkOperation.h
@@ -16,10 +16,30 @@
NSError *error;
NSString* type;
NSString* summary;
- NSObject* callback;
+ NSObject* userInfo;
}
-@property (retain) NSObject *callback;
+@property (retain) NSObject *userInfo;
+@property (retain) NSString *summary;
+@property (retain) NSString *type;
+@property (retain) NSObject *result;
+@property (retain) NSData *data;
+@property (retain) NSError *error;
+@property (retain) NSURL *url;
+
+@end
+
+@interface KCNetworkStringOperation : NSOperation {
+ NSObject *result;
+ NSData *data;
+ NSURL *url;
+ NSError *error;
+ NSString* type;
+ NSString* summary;
+ NSObject* userInfo;
+}
+
+@property (retain) NSObject *userInfo;
@property (retain) NSString *summary;
@property (retain) NSString *type;
@property (retain) NSObject *result;
View
42 core/KCNetworkOperation.m
@@ -15,7 +15,7 @@ + (void)setAllowsAnyHTTPSCertificate:(BOOL)fp8 forHost:(id)fp12;
@implementation KCNetworkOperation
-@synthesize callback;
+@synthesize userInfo;
@synthesize result;
@synthesize data;
@synthesize url;
@@ -31,6 +31,7 @@ -(void)main
[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[self url] host]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self url] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10];
+ [request addValue:@"application/json" forHTTPHeaderField:@"Accept"];
d = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&e];
if (d!=nil)
{
@@ -52,3 +53,42 @@ -(void)finalize
}
@end
+
+// Will refactor these two operations
+
+@implementation KCNetworkStringOperation
+@synthesize userInfo;
+@synthesize result;
+@synthesize data;
+@synthesize url;
+@synthesize error;
+@synthesize summary;
+@synthesize type;
+@synthesize userInfo;
+
+-(void)main
+{
+ NSError *e = nil;
+ NSData *d;
+ NSHTTPURLResponse *response = nil;
+
+ [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[self url] host]];
+ NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self url] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10];
+ d = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&e];
+ if (d!=nil)
+ {
+ [self setData:d];
+ NSString *string = [[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding];
+ [self setResult:string];
+ }
+ if (e!=nil)
+ NSLog(@"error %@ %@",self.url,e);
+ [self setError:e];
+}
+
+-(void)finalize
+{
+ [super finalize];
+}
+
+@end
View
13 gui/KCCookbookController.h
@@ -10,15 +10,20 @@
#import "KCViewController.h"
@interface KCCookbookController : KCViewController {
- NSMutableArray *cookbookContents;
- NSString *cookbookName;
+// NSMutableArray *cookbookContents;
+// NSString *cookbookName;
NSString *sourceText;
- IBOutlet NSBrowser *cookbookStructure;
+ IBOutlet NSBrowser *cookbookBrowser;
+ IBOutlet NSTreeController *cookbookStructureController;
NSTextView *textView;
+ KCCookbook *cookbook;
+ NSMutableArray *selections;
+ NSOperation *currentOperation;
}
-@property (retain) IBOutlet NSMutableArray *cookbookContents;
+// @property (retain) IBOutlet NSMutableArray *cookbookContents;
@property (retain) IBOutlet NSString *sourceText;
@property (retain) IBOutlet NSTextView *textView;
+@property (retain) KCCookbook* cookbook;
@end
View
154 gui/KCCookbookController.m
@@ -8,95 +8,97 @@
#import "KCCookbookController.h"
#import "KCAbstractNode.h"
+#import "KCApplicationDelegate.h"
+#import "KCNetworkOperation.h"
@implementation KCCookbookController
@synthesize sourceText;
-@synthesize cookbookContents;
@synthesize textView;
+@synthesize cookbook;
- (void)awakeFromNib
{
- NSMutableArray* a = [NSMutableArray array];
- KCChefNode *node;
- KCChefNode *child;
- node = [[KCChefNode alloc] init];
- [node setNodeTitle:@"Attributes"];
- [node setIsLeaf:false];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"apache.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- [a addObject:node];
+ [cookbookBrowser setTarget:self];
+ [cookbookBrowser setAction:@selector(browserSingleClick:)];
+ [cookbookBrowser setDoubleAction:@selector(browserDoubleClick:)];
+ [self setSourceText:@""];
+}
- node = [[KCChefNode alloc] init];
- [node setNodeTitle:@"Definitions"];
- [node setIsLeaf:false];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"apache_module.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"web_app.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"apache_site.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- [a addObject:node];
+-(NSString*)iconName
+{
+ return @"NSMysteryDocument";
+}
+
+- (IBAction)doubleSingleClick:(NSBrowser*)browser {
+}
-
- node = [[KCChefNode alloc] init];
- [node setNodeTitle:@"Recipes"];
- [node setIsLeaf:false];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"default.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"mod_dir.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"mod_headers.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"mod_proxy.rb"];
- [child setIsLeaf:true];
- [node addObject:child];
- [a addObject:node];
-
- node = [[KCChefNode alloc] init];
- [node setNodeTitle:@"Templates"];
- [node setIsLeaf:false];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"apache2.conf.erb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"ports.conf.erb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"web_app.conf.erb"];
- [child setIsLeaf:true];
- [node addObject:child];
- child = [[KCChefNode alloc] init];
- [child setNodeTitle:@"default_site.erb"];
- [child setIsLeaf:true];
- [node addObject:child];
- [a addObject:node];
-
- NSString* source = @"#\n# Cookbook Name:: apache2\n# Recipe:: default\n#\n\npackage \"apache2\" do\n action :install\nend\n\n";
+- (IBAction)browserSingleClick:(NSBrowser*)browser {
+ // Strange, the selection binding does not seem to work
+ [cookbookStructureController setSelectionIndexPaths:selections];
+ NSArray *objects = [cookbookStructureController selectedObjects];
+ if ([objects count] == 1) {
+ KCChefNode* node = [objects objectAtIndex:0];
+ // Find the last selected cell and show its information
+ NSString* title = [node nodeTitle];
+ NSString* category = [node nodeType];
+ NSString* value = [node nodeValue];
+ NSString* path = nil;
- [self setSourceText:source];
- [self setCookbookContents:a];
+ if ((value!=nil) && ([value length]!=0)) {
+ [self setSourceText:value];
+ return;
+ }
+ else
+ [self setSourceText:@""]; // so we cleanup during navigation
+
+ if ([category isEqualToString:@"library"])
+ path = [NSString stringWithFormat:@"/cookbooks/%@/libraries?id=%@", [cookbook nodeTitle], title];
+ if ([category isEqualToString:@"attribute"])
+ path = [NSString stringWithFormat:@"/cookbooks/%@/attributes?id=%@", [cookbook nodeTitle], title];
+ if ([category isEqualToString:@"definition"])
+ path = [NSString stringWithFormat:@"/cookbooks/%@/definitions?id=%@", [cookbook nodeTitle], title];
+ if ([category isEqualToString:@"recipe"])
+ path = [NSString stringWithFormat:@"/cookbooks/%@/recipes?id=%@", [cookbook nodeTitle], title];
+
+ if (path != nil) {
+ if (currentOperation!=nil) {
+ [currentOperation cancel];
+ currentOperation = nil;
+ }
+ NSOperationQueue* queue = [(KCApplicationDelegate*)[NSApp delegate] queue];
+ KCNetworkStringOperation* op = [[KCNetworkStringOperation alloc] init];
+ op.url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", self.chefConnection.serverURL, path]];
+ op.type = [NSString stringWithFormat:@"refresh.%@",category];
+ op.summary = [NSString stringWithFormat:@"Getting %@ file %@", category, title];
+ op.userInfo = node;
+ [op addObserver:self forKeyPath:@"isFinished" options:0 context:nil];
+ [queue addOperation:op];
+ }
+ }
}
--(NSString*)iconName
+
+- (void)observeValueForKeyPath:(NSString *)keyPath
+ ofObject:(id)object
+ change:(NSDictionary *)change
+ context:(void *)context
{
- return @"NSMysteryDocument";
+ if ([keyPath isEqual:@"isFinished"]) {
+ KCNetworkStringOperation* op = (KCNetworkStringOperation*)object;
+ if (op.error!=nil) {
+ NSAlert* a = [NSAlert alertWithError:op.error];
+ [a runModal];
+ }
+ else {
+ if (![op isCancelled])
+ [self setSourceText:[op.result description]];
+ if ((op.userInfo!=nil)&&([op.userInfo isKindOfClass:[KCChefNode class]]))
+ {
+ [(KCChefNode*)(op.userInfo) setNodeValue:[op.result description]];
+ }
+ }
+ }
}
+
@end
View
4 gui/KCCookbooksController.h
@@ -11,9 +11,7 @@
@interface KCCookbooksController : KCViewController {
- NSMutableArray* cookbooks;
+ IBOutlet NSArrayController* contentsController;
}
-@property (retain) NSMutableArray* cookbooks;
-
@end
View
20 gui/KCCookbooksController.m
@@ -11,26 +11,6 @@
@implementation KCCookbooksController
-@synthesize cookbooks;
-
-- (void)awakeFromNib
-{
- NSMutableArray* a = [NSMutableArray array];
- KCChefNode *node;
- node = [[KCChefNode alloc] init];
- [node setNodeTitle:@"CouchDB"];
- [node setIsLeaf:true];
- [a addObject:node];
- node = [[KCChefNode alloc] init];
- [node setNodeTitle:@"Apache"];
- [node setIsLeaf:true];
- [a addObject:node];
- node = [[KCChefNode alloc] init];
- [node setNodeTitle:@"Passenger"];
- [node setIsLeaf:true];
- [a addObject:node];
- [self setCookbooks:a];
-}
-(NSString*)iconName
{
View
40 gui/KCMainWindowController.m
@@ -8,6 +8,7 @@
#import "KCMainWindowController.h"
#import "KCAbstractNode.h"
+#import "KCCookbook.h"
#import "KCRegistrationsController.h"
#import "KCSearchController.h"
#import "KCStatusController.h"
@@ -41,8 +42,8 @@ -(void)prepareSourceContent
{
NSMutableArray* a = [NSMutableArray array];
KCViewControllerNode *viewNode;
- KCChefNode *child;
KCNodesProxy *nodeProxy;
+ KCCookbooksProxy *cookbookProxy;
viewNode = [[KCViewControllerNode alloc] init];
viewNode.viewController = statusController;
@@ -54,6 +55,13 @@ -(void)prepareSourceContent
[nodeProxy setNodeTitle:@"Nodes"];
[a addObject:nodeProxy];
+ cookbookProxy = [[KCCookbooksProxy alloc] init];
+ cookbookProxy.connection = self.chefConnection;
+ [cookbookProxy setNodeTitle:@"Cookbooks"];
+ [a addObject:cookbookProxy];
+
+#if 0
+ KCChefNode *child;
viewNode = [[KCViewControllerNode alloc] init];
viewNode.viewController = cookbooksController;
[viewNode setIsLeaf:false];
@@ -62,6 +70,7 @@ -(void)prepareSourceContent
[child setIsLeaf:true];
[viewNode addObject:child];
[a addObject:viewNode];
+#endif
viewNode = [[KCViewControllerNode alloc] init];
viewNode.viewController = registrationsController;
@@ -99,7 +108,7 @@ - (void)awakeFromNib
[[self window] setContentBorderThickness:32 forEdge:NSMinYEdge];
[self prepareSourceContent];
- [self addObserver:self forKeyPath:@"chefConnection.nodes.@count" options:0 context:nil];
+ [self addObserver:self forKeyPath:@"chefConnection.nodes.@count" options:0 context:nil];
}
// -------------------------------------------------------------------------------
@@ -165,37 +174,38 @@ - (void)changeItemView
if ([currentViewController view] != nil)
[[currentViewController view] removeFromSuperview]; // remove the current view
- if ([title isEqualToString:@"Registrations"])
+ if ([title isEqualToString:@"Registrations"])
{
[self setCurrentViewController:registrationsController]; // keep track of the current view controller
[currentViewController setTitle:@"Registrations"];
}
- else if ([title isEqualToString:@"Search"])
+ else if ([title isEqualToString:@"Search"])
{
[self setCurrentViewController:searchController]; // keep track of the current view controller
[currentViewController setTitle:@"Search"];
}
- else if ([node isKindOfClass:[KCNode class]])
+ else if ([node isKindOfClass:[KCNode class]])
{
nodeController.node = (KCNode*)node;
[self setCurrentViewController:nodeController]; // keep track of the current view controller
- [currentViewController setTitle:@"Node"];
+ [currentViewController setTitle:[node nodeTitle]];
+ }
+ else if ([node isKindOfClass:[KCCookbook class]])
+ {
+ cookbookController.cookbook = (KCCookbook*)node;
+ [self setCurrentViewController:cookbookController]; // keep track of the current view controller
+ [currentViewController setTitle:[node nodeTitle]];
}
- else if ([title isEqualToString:@"Cookbooks"])
+ else if ([title isEqualToString:@"Cookbooks"])
{
[self setCurrentViewController:cookbooksController]; // keep track of the current view controller
[currentViewController setTitle:@"Cookbooks"];
}
- else if ([title isEqualToString:@"Nodes"])
+ else if ([title isEqualToString:@"Nodes"])
{
[self setCurrentViewController:nodesController]; // keep track of the current view controller
[currentViewController setTitle:@"Nodes"];
}
- else if ([title isEqualToString:@"Apache2"])
- {
- [self setCurrentViewController:cookbookController]; // keep track of the current view controller
- [currentViewController setTitle:@"Cookbook"];
- }
else
{
[self setCurrentViewController:statusController]; // keep track of the current view controller
@@ -209,7 +219,7 @@ - (void)changeItemView
// make sure we automatically resize the controller's view to the current window size
[[currentViewController view] setFrame: [currentView bounds]];
}
-
+
- (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
[(KCImageAndTextCell*)cell setImage:nil];
@@ -222,7 +232,7 @@ - (void)outlineView:(NSOutlineView *)olv willDisplayCell:(NSCell*)cell forTableC
if (imageName!=nil)
[(KCImageAndTextCell*)cell setImage:[NSImage imageNamed:imageName]];
- else if ([[item nodeTitle] isEqualToString:@"Apache2"])
+ else if ([[item nodeTitle] isEqualToString:@"Apache2"])
[(KCImageAndTextCell*)cell setImage:[NSImage imageNamed:@"NSMysteryDocument"]];
}
}
View
6 gui/KCStatusController.h
@@ -9,10 +9,6 @@
#import <Cocoa/Cocoa.h>
#import "KCViewController.h"
-@interface KCStatusController : KCViewController {
- NSString* cookbooks;
-}
-
-@property (retain) NSString *cookbooks;
+@interface KCStatusController : KCViewController
@end
View
7 gui/KCStatusController.m
@@ -10,13 +10,6 @@
@implementation KCStatusController
-@synthesize cookbooks;
-
--(void)awakeFromNib
-{
- [self setCookbooks:@"2 (apache2, couchdb)"];
-}
-
-(void)refresh:(id)sender
{