candle 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. data/README.md +27 -2
  2. data/VERSION +1 -1
  3. data/lib/candle/generators/blank.rb +3 -2
  4. data/lib/candle/generators/help.rb +3 -1
  5. data/lib/candle/generators/table.rb +129 -0
  6. data/lib/candle/generators/{lua → templates/blank}/scripts/AppDelegate.lua +0 -0
  7. data/lib/candle/generators/{lua → templates/blank}/scripts/tests/init.lua +0 -0
  8. data/lib/candle/generators/{lua → templates/blank}/scripts/tests/someTest.lua +0 -0
  9. data/lib/candle/generators/templates/project.rake +158 -0
  10. data/lib/candle/generators/templates/table/WaxApplication/ProtocolLoader.h +12 -0
  11. data/lib/candle/generators/templates/table/WaxApplication/WaxApplication-Info.plist.tt +36 -0
  12. data/lib/candle/generators/templates/table/WaxApplication/WaxApplication-Prefix.pch.tt +14 -0
  13. data/lib/candle/generators/templates/table/WaxApplication/en.lproj/InfoPlist.strings +2 -0
  14. data/lib/candle/generators/templates/table/WaxApplication/main.m.tt +20 -0
  15. data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/project.pbxproj +851 -0
  16. data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  17. data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  18. data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme +86 -0
  19. data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
  20. data/lib/candle/generators/templates/table/scripts/AppDelegate.lua +33 -0
  21. data/lib/candle/generators/templates/table/scripts/CapitalsTable.lua +36 -0
  22. data/lib/candle/generators/templates/table/scripts/StatesTable.lua +50 -0
  23. data/lib/candle/generators/templates/table/scripts/states.plist +606 -0
  24. data/lib/candle/generators/templates/table/scripts/tests/init.lua +6 -0
  25. data/lib/candle/generators/templates/table/scripts/tests/someTest.lua +12 -0
  26. data/lib/candle/generators/templates/xib/WaxApplication/ProtocolLoader.h +12 -0
  27. data/lib/candle/generators/templates/xib/WaxApplication/WaxApplication-Info.plist.tt +36 -0
  28. data/lib/candle/generators/templates/xib/WaxApplication/WaxApplication-Prefix.pch.tt +14 -0
  29. data/lib/candle/generators/templates/xib/WaxApplication/en.lproj/InfoPlist.strings +2 -0
  30. data/lib/candle/generators/templates/xib/WaxApplication/main.m.tt +20 -0
  31. data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/project.pbxproj +855 -0
  32. data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  33. data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  34. data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme +86 -0
  35. data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
  36. data/lib/candle/generators/templates/xib/scripts/AppDelegate.lua +32 -0
  37. data/lib/candle/generators/templates/xib/scripts/BlueViewController.lua +23 -0
  38. data/lib/candle/generators/templates/xib/scripts/BlueViewController.xib +176 -0
  39. data/lib/candle/generators/templates/xib/scripts/OrangeViewController.lua +24 -0
  40. data/lib/candle/generators/templates/xib/scripts/OrangeViewController.xib +177 -0
  41. data/lib/candle/generators/templates/xib/scripts/tests/init.lua +6 -0
  42. data/lib/candle/generators/templates/xib/scripts/tests/someTest.lua +12 -0
  43. data/lib/candle/generators/xib.rb +128 -0
  44. data/lib/candle/version.rb +2 -4
  45. data/lib/candle.rb +1 -1
  46. metadata +365 -307
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:WaxApplication.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,86 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "0460"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "C57ED6E516E59BF400F57BA4"
18
+ BuildableName = "WaxApplication.app"
19
+ BlueprintName = "WaxApplication"
20
+ ReferencedContainer = "container:WaxApplication.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28
+ shouldUseLaunchSchemeArgsEnv = "YES"
29
+ buildConfiguration = "Debug">
30
+ <Testables>
31
+ </Testables>
32
+ <MacroExpansion>
33
+ <BuildableReference
34
+ BuildableIdentifier = "primary"
35
+ BlueprintIdentifier = "C57ED6E516E59BF400F57BA4"
36
+ BuildableName = "WaxApplication.app"
37
+ BlueprintName = "WaxApplication"
38
+ ReferencedContainer = "container:WaxApplication.xcodeproj">
39
+ </BuildableReference>
40
+ </MacroExpansion>
41
+ </TestAction>
42
+ <LaunchAction
43
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
44
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
45
+ launchStyle = "0"
46
+ useCustomWorkingDirectory = "NO"
47
+ buildConfiguration = "Debug"
48
+ ignoresPersistentStateOnLaunch = "NO"
49
+ debugDocumentVersioning = "YES"
50
+ allowLocationSimulation = "YES">
51
+ <BuildableProductRunnable>
52
+ <BuildableReference
53
+ BuildableIdentifier = "primary"
54
+ BlueprintIdentifier = "C57ED6E516E59BF400F57BA4"
55
+ BuildableName = "WaxApplication.app"
56
+ BlueprintName = "WaxApplication"
57
+ ReferencedContainer = "container:WaxApplication.xcodeproj">
58
+ </BuildableReference>
59
+ </BuildableProductRunnable>
60
+ <AdditionalOptions>
61
+ </AdditionalOptions>
62
+ </LaunchAction>
63
+ <ProfileAction
64
+ shouldUseLaunchSchemeArgsEnv = "YES"
65
+ savedToolIdentifier = ""
66
+ useCustomWorkingDirectory = "NO"
67
+ buildConfiguration = "Release"
68
+ debugDocumentVersioning = "YES">
69
+ <BuildableProductRunnable>
70
+ <BuildableReference
71
+ BuildableIdentifier = "primary"
72
+ BlueprintIdentifier = "C57ED6E516E59BF400F57BA4"
73
+ BuildableName = "WaxApplication.app"
74
+ BlueprintName = "WaxApplication"
75
+ ReferencedContainer = "container:WaxApplication.xcodeproj">
76
+ </BuildableReference>
77
+ </BuildableProductRunnable>
78
+ </ProfileAction>
79
+ <AnalyzeAction
80
+ buildConfiguration = "Debug">
81
+ </AnalyzeAction>
82
+ <ArchiveAction
83
+ buildConfiguration = "Release"
84
+ revealArchiveInOrganizer = "YES">
85
+ </ArchiveAction>
86
+ </Scheme>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>WaxApplication.xcscheme</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ <key>SuppressBuildableAutocreation</key>
14
+ <dict>
15
+ <key>C57ED6E516E59BF400F57BA4</key>
16
+ <dict>
17
+ <key>primary</key>
18
+ <true/>
19
+ </dict>
20
+ </dict>
21
+ </dict>
22
+ </plist>
@@ -0,0 +1,33 @@
1
+ waxClass{"AppDelegate", protocols = {"UIApplicationDelegate"}}
2
+
3
+ -- Well done! You are almost ready to run a lua app on your iPhone!
4
+ --
5
+ -- Just run the app (⌘↵) in the simulator or on a device!
6
+ -- You will see a dull, bland "hello world" app (it is your job to spice it up.)
7
+ --
8
+ -- If your prefer using TextMate to edit the Lua code just type
9
+ -- 'rake tm' from the command line to setup a wax TextMate project.
10
+ --
11
+ -- What's next?
12
+ -- 1. Check out some of the example apps to learn how to do
13
+ -- more complicated apps.
14
+ -- 2. Then you start writing your app!
15
+ -- 3. Let us know if you need any help at http://groups.google.com/group/iphonewax
16
+
17
+ require "StatesTable"
18
+ require "CapitalsTable"
19
+
20
+ waxClass{"AppDelegate", protocols = {"UIApplicationDelegate"}}
21
+
22
+ function applicationDidFinishLaunching(self, application)
23
+ local frame = UIScreen:mainScreen():bounds()
24
+ self.window = UIWindow:initWithFrame(frame)
25
+ self.window:setBackgroundColor(UIColor:orangeColor())
26
+ self.window:makeKeyAndVisible()
27
+
28
+ local statesTable = StatesTable:init()
29
+ self.navigationController = UINavigationController:initWithRootViewController(statesTable)
30
+
31
+ self.window:addSubview(self.navigationController:view())
32
+ end
33
+
@@ -0,0 +1,36 @@
1
+ waxClass{"CapitalsTable", UITableViewController, protocols = {"UITableViewDataSource"}}
2
+
3
+ function init(self, state)
4
+ self.super:initWithStyle(UITableViewStyleGrouped)
5
+ self.state = state
6
+ self:setTitle(state.name)
7
+ return self
8
+ end
9
+
10
+
11
+ function viewDidLoad(self)
12
+ self:tableView():setDataSource(self)
13
+ end
14
+
15
+ -- DataSource
16
+ -------------
17
+ function numberOfSectionsInTableView(self, tableView)
18
+ return 1
19
+ end
20
+
21
+ function tableView_numberOfRowsInSection(self, tableView, section)
22
+ return #table.keys(self.state)
23
+ end
24
+
25
+ function tableView_cellForRowAtIndexPath(self, tableView, indexPath)
26
+ local identifier = "CapitalsTableCell"
27
+ local cell = tableView:dequeueReusableCellWithIdentifier(identifier) or
28
+ UITableViewCell:initWithStyle_reuseIdentifier(UITableViewCellStyleValue1, identifier)
29
+
30
+ local key = table.keys(self.state)[indexPath:row() + 1]
31
+ cell:detailTextLabel():setText(tostring(self.state[key]))
32
+ cell:textLabel():setText(key)
33
+ cell:setSelectionStyle(UITableViewCellSelectionStyleNone)
34
+
35
+ return cell
36
+ end
@@ -0,0 +1,50 @@
1
+
2
+
3
+ waxClass{"StatesTable", UITableViewController, protocols = {"UITableViewDataSource", "UITableViewDelegate"}}
4
+
5
+ function init(self)
6
+ self.super:init()
7
+
8
+ -- Loads plist from bundle
9
+ self.states = NSArray:arrayWithContentsOfFile("states.plist")
10
+
11
+ self:setTitle("States")
12
+ return self
13
+ end
14
+
15
+ function viewDidLoad(self)
16
+ self:tableView():setDataSource(self)
17
+ self:tableView():setDelegate(self)
18
+ end
19
+
20
+ -- DataSource
21
+ -------------
22
+ function numberOfSectionsInTableView(self, tableView)
23
+ return 1
24
+ end
25
+
26
+ function tableView_numberOfRowsInSection(self, tableView, section)
27
+ return #self.states
28
+ end
29
+
30
+ function tableView_cellForRowAtIndexPath(self, tableView, indexPath)
31
+ local identifier = "StateCell"
32
+ local cell = tableView:dequeueReusableCellWithIdentifier(identifier) or
33
+ UITableViewCell:initWithStyle_reuseIdentifier(UITableViewCellStyleDefault, identifier)
34
+
35
+ local state = self.states[indexPath:row() + 1]
36
+ cell:textLabel():setText(state["name"]) -- Must +1 because lua arrays are 1 based
37
+ cell:setAccessoryType(UITableViewCellAccessoryDisclosureIndicator)
38
+
39
+ return cell
40
+ end
41
+
42
+ -- Delegate
43
+ -----------
44
+ function tableView_didSelectRowAtIndexPath(self, tableView, indexPath)
45
+ self:tableView():deselectRowAtIndexPath_animated(indexPath, true)
46
+ local state = self.states[indexPath:row() + 1]
47
+
48
+ local viewController = CapitalsTable:init(state)
49
+ self:navigationController():pushViewController_animated(viewController, true)
50
+ end