candle 0.0.6 → 0.0.7

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 (24) hide show
  1. data/README.md +13 -1
  2. data/VERSION +1 -1
  3. data/lib/candle.rb +1 -1
  4. data/lib/candle/generators/help.rb +3 -1
  5. data/lib/candle/generators/map.rb +128 -0
  6. data/lib/candle/generators/table.rb +1 -1
  7. data/lib/candle/generators/templates/map/WaxApplication.xcodeproj/project.pbxproj +851 -0
  8. data/lib/candle/generators/templates/map/WaxApplication.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  9. data/lib/candle/generators/templates/map/WaxApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  10. data/lib/candle/generators/templates/map/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme +86 -0
  11. data/lib/candle/generators/templates/map/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
  12. data/lib/candle/generators/templates/map/WaxApplication/ProtocolLoader.h +12 -0
  13. data/lib/candle/generators/templates/map/WaxApplication/Rakefile +158 -0
  14. data/lib/candle/generators/templates/map/WaxApplication/WaxApplication-Info.plist.tt +36 -0
  15. data/lib/candle/generators/templates/map/WaxApplication/WaxApplication-Prefix.pch.tt +14 -0
  16. data/lib/candle/generators/templates/map/WaxApplication/en.lproj/InfoPlist.strings +2 -0
  17. data/lib/candle/generators/templates/map/WaxApplication/main.m.tt +20 -0
  18. data/lib/candle/generators/templates/map/scripts/AppDelegate.lua +14 -0
  19. data/lib/candle/generators/templates/map/scripts/SimpleAnnotation.lua +35 -0
  20. data/lib/candle/generators/templates/map/scripts/SimpleMapController.lua +28 -0
  21. data/lib/candle/generators/templates/map/scripts/tests/init.lua +6 -0
  22. data/lib/candle/generators/templates/map/scripts/tests/someTest.lua +12 -0
  23. data/lib/candle/generators/xib.rb +1 -1
  24. metadata +20 -3
@@ -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,12 @@
1
+ // Many protocols will work from wax out of the box. But some need to be preloaded.
2
+ // If the protocol you are using isn't found, just add the protocol to this object
3
+ //
4
+ // This seems to be a bug, or there is a runtime method I'm unaware of
5
+
6
+ #import <UIKit/UIKit.h>
7
+
8
+ @interface ProtocolLoader : NSObject <UIApplicationDelegate, UIWebViewDelegate, UIActionSheetDelegate, UIAlertViewDelegate, UISearchBarDelegate, UITextViewDelegate, UITabBarControllerDelegate, UISearchDisplayDelegate> {}
9
+ @end
10
+
11
+ @implementation ProtocolLoader
12
+ @end
@@ -0,0 +1,158 @@
1
+ TEXTMATE_FILE="TEXTMATE"
2
+ WAX_PATH = File.expand_path("../wax")
3
+
4
+ desc "Create a Wax TextMate project"
5
+ task :tm => "TEXTMATE" do
6
+ sh "mate #{TEXTMATE_FILE} ./scripts ./wax/lib/stdlib"
7
+ sh "mate #{TEXTMATE_FILE}"
8
+ end
9
+
10
+ namespace :tm do
11
+ desc "Install textmate lua & wax bundles"
12
+ task :install_bundles do
13
+ sh "mkdir -p ~/Library/Application\\ Support/TextMate/Bundles/"
14
+
15
+ lua_bundle_dir = "~/Library/Application\\ Support/TextMate/Bundles/Lua.tmbundle"
16
+ if not sh("test -e #{lua_bundle_dir}") {|ok, status| ok} # This is bad code...
17
+ sh "curl -L http://github.com/textmate/lua.tmbundle/tarball/master | tar xvz"
18
+ sh "mv textmate-lua.tmbundle* #{lua_bundle_dir}"
19
+ end
20
+
21
+ wax_bundle_dir = "~/Library/Application\\ Support/TextMate/Bundles/Wax.tmbundle"
22
+ if not sh("test -e #{wax_bundle_dir}") {|ok, status| ok}
23
+ sh "curl -L http://github.com/probablycorey/Wax.tmbundle/tarball/master | tar xvz"
24
+ sh "mv probablycorey-[Ww]ax.tmbundle* #{wax_bundle_dir}"
25
+ end
26
+ end
27
+
28
+ file TEXTMATE_FILE do |t|
29
+ open(t.name, "w") do |file|
30
+ file.write <<-TEXTMATE_HELP
31
+ Some tips to make life easier
32
+
33
+ 1) Install the Lua and Wax TextMate Bundles.
34
+ a) Either type "rake tm:install_bundles"
35
+
36
+ Or, you can manually install the bundles from
37
+ http://github.com/textmate/lua.tmbundle and
38
+ http://github.com/probablycorey/Wax.tmbundle
39
+ into ~/Library/Application\ Support/TextMate/Bundles
40
+
41
+ b) From TextMate click Bundles > Bundle Editor > Reload Bundles
42
+
43
+ TEXTMATE_HELP
44
+ end
45
+ end
46
+ end
47
+
48
+ desc "Update the wax lib with the lastest code"
49
+ task :update do
50
+ puts
51
+ puts "User Input Required!"
52
+ puts "--------------------"
53
+ print "About to remove wax directory '#{WAX_PATH}' and replace it with an updated version (y/n) "
54
+
55
+ if STDIN.gets !~ /^y/i
56
+ puts "Exiting... nothing was done!"
57
+ return
58
+ end
59
+
60
+ tmp_dir = "./_wax-download"
61
+ rm_rf tmp_dir
62
+ mkdir_p tmp_dir
63
+ sh "curl -L http://github.com/probablycorey/wax/tarball/master | tar -C #{tmp_dir} -x -z"
64
+ rm_rf WAX_PATH
65
+ sh "mv #{tmp_dir}/* \"#{WAX_PATH}\""
66
+ rm_rf tmp_dir
67
+ end
68
+
69
+ desc "Git specific tasks"
70
+ namespace :git do
71
+
72
+ desc "make the wax folder a submodule"
73
+ task :sub do
74
+ rm_rf WAX_PATH
75
+ sh "git init"
76
+ sh "git submodule add git@github.com:probablycorey/wax.git wax"
77
+ end
78
+ end
79
+
80
+ desc "Build and run tests on the app"
81
+ task :test do
82
+ sh "#{WAX_PATH}/bin/hammer --headless WAX_TEST=YES"
83
+ end
84
+
85
+ desc "Runs a REPL on the current app"
86
+ task :console do
87
+ sh "#{WAX_PATH}/bin/hammer --headless WAX_REPL=YES"
88
+ end
89
+
90
+ desc "Build"
91
+ task :build do
92
+ sh "#{WAX_PATH}/bin/hammer"
93
+ end
94
+
95
+ desc "Package an adhoc build"
96
+ task :adhoc do
97
+ #sh "#{WAX_PATH}/bin/hammer clean"
98
+ #rm_rf "build"
99
+
100
+ output = `#{WAX_PATH}/bin/hammer -c 'Ad\\ Hoc' -v`
101
+ success = ($? == 0)
102
+ if not success
103
+ puts output
104
+ else
105
+ puts output
106
+ provisioning_id = output[/PROVISIONING_PROFILE\s+([\w\-]+)/, 1]
107
+ provisioning_profile = `grep -rl '#{provisioning_id}' '#{ENV['HOME']}/Library/MobileDevice/Provisioning\ Profiles/'`.split("\n").first.strip
108
+ puts provisioning_id
109
+
110
+ raise "Could not find the Ad Hoc provisioning profile matching #{provisioning_id}" if not provisioning_profile or not provisioning_id
111
+
112
+ app_file = output[/CODESIGNING_FOLDER_PATH\s+(.*?)$/, 1]
113
+ executable_name = output[/EXECUTABLE_NAME\s+(.*?)$/, 1]
114
+ output_dir = "archive"
115
+ rm_rf output_dir
116
+ mkdir output_dir
117
+
118
+ sh "zip -r #{output_dir}/#{executable_name}.ipa '#{provisioning_profile}' #{app_file}"
119
+ sh "open #{output_dir}"
120
+ end
121
+ end
122
+
123
+ desc "Package a distribution build"
124
+ task :distribution do
125
+ if not ENV["sdk"]
126
+ raise "\nYou need to specify an sdk!\nUsage: rake adhoc sdk=iphoneos3.0\n"
127
+ end
128
+
129
+ sh "#{WAX_PATH}/bin/hammer clean"
130
+ rm_rf "build"
131
+
132
+ output = `#{WAX_PATH}/bin/hammer --sdk #{ENV["sdk"]} -c 'Distribution' -v`
133
+ success = ($? == 0)
134
+ if not success
135
+ puts output
136
+ else
137
+ timestamp = Time.now.strftime("%m-%d-%y")
138
+ dir = "distribution-builds/#{timestamp}"
139
+ rm_rf dir
140
+ mkdir_p dir
141
+
142
+ app_file = Dir["build/Distribution-iphoneos/*.app"]
143
+
144
+ sh "mv '#{app_file}' '#{dir}'"
145
+ sh "cd '#{dir}'; zip -r distribution.zip ./*"
146
+ sh "open #{dir}"
147
+ end
148
+ end
149
+
150
+ desc "Build and run the app"
151
+ task :run do
152
+ sh "#{WAX_PATH}/bin/hammer --run"
153
+ end
154
+
155
+ desc "Goes through your lua scripts and updates all the xibs to know about waxClasses"
156
+ task :ib do
157
+ sh "#{WAX_PATH}/bin/update-xibs"
158
+ end
@@ -0,0 +1,36 @@
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>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleDisplayName</key>
8
+ <string>${PRODUCT_NAME}</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>${EXECUTABLE_NAME}</string>
11
+ <key>CFBundleIdentifier</key>
12
+ <string>com.likenote.ios.${PRODUCT_NAME:rfc1034identifier}</string>
13
+ <key>CFBundleInfoDictionaryVersion</key>
14
+ <string>6.0</string>
15
+ <key>CFBundleName</key>
16
+ <string>${PRODUCT_NAME}</string>
17
+ <key>CFBundlePackageType</key>
18
+ <string>APPL</string>
19
+ <key>CFBundleShortVersionString</key>
20
+ <string>1.0</string>
21
+ <key>CFBundleSignature</key>
22
+ <string>????</string>
23
+ <key>CFBundleVersion</key>
24
+ <string>1.0</string>
25
+ <key>LSRequiresIPhoneOS</key>
26
+ <true/>
27
+ <key>UIRequiredDeviceCapabilities</key>
28
+ <array>
29
+ <string>armv7</string>
30
+ </array>
31
+ <key>UISupportedInterfaceOrientations</key>
32
+ <array>
33
+ <string>UIInterfaceOrientationPortrait</string>
34
+ </array>
35
+ </dict>
36
+ </plist>
@@ -0,0 +1,14 @@
1
+ //
2
+ // Prefix header for all source files of the 'WaxApplication' target in the 'WaxApplication' project
3
+ //
4
+
5
+ #import <Availability.h>
6
+
7
+ #ifndef __IPHONE_3_0
8
+ #warning "This project uses features only available in iOS SDK 3.0 and later."
9
+ #endif
10
+
11
+ #ifdef __OBJC__
12
+ #import <UIKit/UIKit.h>
13
+ #import <Foundation/Foundation.h>
14
+ #endif
@@ -0,0 +1,2 @@
1
+ /* Localized versions of Info.plist keys */
2
+
@@ -0,0 +1,20 @@
1
+ //
2
+ // main.m
3
+ // WaxApplication
4
+ //
5
+ // Created by eiffel on 3/5/13.
6
+ // Copyright (c) 2013 likenote. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+ #import "wax.h"
11
+ #import "wax_http.h"
12
+ #import "wax_json.h"
13
+ #import "wax_filesystem.h"
14
+ int main(int argc, char *argv[]) {
15
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
16
+ wax_start("AppDelegate.lua", luaopen_wax_http, luaopen_wax_json, luaopen_wax_filesystem, nil);
17
+ int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
18
+ [pool release];
19
+ return retVal;
20
+ }
@@ -0,0 +1,14 @@
1
+ require "SimpleMapController"
2
+
3
+ waxClass{"AppDelegate", protocols = {"UIApplicationDelegate"}}
4
+
5
+ function applicationDidFinishLaunching(self, application)
6
+ local frame = UIScreen:mainScreen():bounds()
7
+ self.window = UIWindow:initWithFrame(frame)
8
+ self.window:setBackgroundColor(UIColor:whiteColor())
9
+
10
+ self.controller = SimpleMapController:init()
11
+ self.window:addSubview(self.controller:view())
12
+
13
+ self.window:makeKeyAndVisible()
14
+ end
@@ -0,0 +1,35 @@
1
+ waxClass{"SimpleAnnotation", NSObject, protocols={"MKAnnotation"}}
2
+
3
+ function initWithLatLong(self, lat, long)
4
+ self.super:init()
5
+ self.lat = lat
6
+ self.long = long
7
+
8
+ -- These variables have underscores because they would have conflicted with
9
+ -- method names required by the MKAnnotation protocol.
10
+ self._title = 'Untitled'
11
+ self._subtitle = ''
12
+ return self
13
+ end
14
+
15
+ function coordinate(self)
16
+ return CLLocationCoordinate2D(self.lat, self.long)
17
+ end
18
+
19
+ function title(self)
20
+ return self._title
21
+ end
22
+
23
+ function setTitle(self, title)
24
+ self._title = title
25
+ return nil
26
+ end
27
+
28
+ function subtitle(self)
29
+ return self._subtitle
30
+ end
31
+
32
+ function setSubtitle(self, subtitle)
33
+ self._subtitle = subtitle
34
+ return nil
35
+ end
@@ -0,0 +1,28 @@
1
+ require "SimpleAnnotation"
2
+
3
+ waxClass{"SimpleMapController", UIViewController, protocols={"MKMapViewDelegate"}}
4
+
5
+ function init(self)
6
+ self.super:init()
7
+ -- San Francisco, CA
8
+ self.location = {
9
+ lat=37.7749295,
10
+ long=-122.4194155,
11
+ }
12
+ return self
13
+ end
14
+
15
+ function viewDidLoad(self)
16
+ self.super:viewDidLoad()
17
+
18
+ self.mapView = MKMapView:initWithFrame(self:view():bounds())
19
+ local region = MKCoordinateRegion(self.location.lat, self.location.long, 0.02, 0.02)
20
+ local annotation = SimpleAnnotation:initWithLatLong(self.location.lat, self.location.long)
21
+ annotation:setTitle('Downtown')
22
+
23
+ self.mapView:setScrollEnabled(true)
24
+ self.mapView:setRegion_animated(region, 1)
25
+ self.mapView:addAnnotation(annotation)
26
+
27
+ self:view():insertSubview_atIndex(self.mapView, 0)
28
+ end