candle 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -2
- data/VERSION +1 -1
- data/lib/candle/generators/blank.rb +3 -2
- data/lib/candle/generators/help.rb +3 -1
- data/lib/candle/generators/table.rb +129 -0
- data/lib/candle/generators/{lua → templates/blank}/scripts/AppDelegate.lua +0 -0
- data/lib/candle/generators/{lua → templates/blank}/scripts/tests/init.lua +0 -0
- data/lib/candle/generators/{lua → templates/blank}/scripts/tests/someTest.lua +0 -0
- data/lib/candle/generators/templates/project.rake +158 -0
- data/lib/candle/generators/templates/table/WaxApplication/ProtocolLoader.h +12 -0
- data/lib/candle/generators/templates/table/WaxApplication/WaxApplication-Info.plist.tt +36 -0
- data/lib/candle/generators/templates/table/WaxApplication/WaxApplication-Prefix.pch.tt +14 -0
- data/lib/candle/generators/templates/table/WaxApplication/en.lproj/InfoPlist.strings +2 -0
- data/lib/candle/generators/templates/table/WaxApplication/main.m.tt +20 -0
- data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/project.pbxproj +851 -0
- data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme +86 -0
- data/lib/candle/generators/templates/table/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
- data/lib/candle/generators/templates/table/scripts/AppDelegate.lua +33 -0
- data/lib/candle/generators/templates/table/scripts/CapitalsTable.lua +36 -0
- data/lib/candle/generators/templates/table/scripts/StatesTable.lua +50 -0
- data/lib/candle/generators/templates/table/scripts/states.plist +606 -0
- data/lib/candle/generators/templates/table/scripts/tests/init.lua +6 -0
- data/lib/candle/generators/templates/table/scripts/tests/someTest.lua +12 -0
- data/lib/candle/generators/templates/xib/WaxApplication/ProtocolLoader.h +12 -0
- data/lib/candle/generators/templates/xib/WaxApplication/WaxApplication-Info.plist.tt +36 -0
- data/lib/candle/generators/templates/xib/WaxApplication/WaxApplication-Prefix.pch.tt +14 -0
- data/lib/candle/generators/templates/xib/WaxApplication/en.lproj/InfoPlist.strings +2 -0
- data/lib/candle/generators/templates/xib/WaxApplication/main.m.tt +20 -0
- data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/project.pbxproj +855 -0
- data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme +86 -0
- data/lib/candle/generators/templates/xib/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
- data/lib/candle/generators/templates/xib/scripts/AppDelegate.lua +32 -0
- data/lib/candle/generators/templates/xib/scripts/BlueViewController.lua +23 -0
- data/lib/candle/generators/templates/xib/scripts/BlueViewController.xib +176 -0
- data/lib/candle/generators/templates/xib/scripts/OrangeViewController.lua +24 -0
- data/lib/candle/generators/templates/xib/scripts/OrangeViewController.xib +177 -0
- data/lib/candle/generators/templates/xib/scripts/tests/init.lua +6 -0
- data/lib/candle/generators/templates/xib/scripts/tests/someTest.lua +12 -0
- data/lib/candle/generators/xib.rb +128 -0
- data/lib/candle/version.rb +2 -4
- data/lib/candle.rb +1 -1
- metadata +365 -307
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
candle
|
2
2
|
======
|
3
|
-
|
4
3
|
Candle is a rubygem for wax iOS framework which writes iOS application in lua.
|
5
4
|
|
5
|
+
![candle](http://eiffelqiu.github.com/candle/images/candle.png)
|
6
|
+
|
6
7
|
Prerequisites
|
7
8
|
=======
|
8
9
|
Ruby
|
@@ -27,7 +28,7 @@ Usage 1: candle help
|
|
27
28
|
|
28
29
|
![candle usage](http://eiffelqiu.github.com/candle/images/candle1.png)
|
29
30
|
|
30
|
-
Usage 2: generate
|
31
|
+
Usage 2: generate a blank wax iOS project
|
31
32
|
-------
|
32
33
|
$ candle blank demo
|
33
34
|
$ cd demo
|
@@ -39,6 +40,30 @@ Usage 2: generate wax iOS blank xcode application project
|
|
39
40
|
|
40
41
|
Xcode build and run
|
41
42
|
|
43
|
+
Usage 3: generate a wax iOS project using xib and core animation
|
44
|
+
-------
|
45
|
+
$ candle xib demo
|
46
|
+
$ cd demo
|
47
|
+
$ open demo.xcodeproj
|
48
|
+
|
49
|
+
![candle usage](http://eiffelqiu.github.com/candle/images/candle4.png)
|
50
|
+
|
51
|
+
![candle usage](http://eiffelqiu.github.com/candle/images/candle5.png)
|
52
|
+
|
53
|
+
Xcode build and run
|
54
|
+
|
55
|
+
Usage 4: generate a wax blank iOS project using tableview
|
56
|
+
-------
|
57
|
+
$ candle table demo
|
58
|
+
$ cd demo
|
59
|
+
$ open demo.xcodeproj
|
60
|
+
|
61
|
+
![candle usage](http://eiffelqiu.github.com/candle/images/candle6.png)
|
62
|
+
|
63
|
+
![candle usage](http://eiffelqiu.github.com/candle/images/candle7.png)
|
64
|
+
|
65
|
+
Xcode build and run
|
66
|
+
|
42
67
|
Contributing to candle
|
43
68
|
=======
|
44
69
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -59,7 +59,7 @@ end # Candle
|
|
59
59
|
__END__
|
60
60
|
empty_directory "#{@project_name}"
|
61
61
|
|
62
|
-
directory "
|
62
|
+
directory "templates/blank/scripts", "#{@project_name}/scripts"
|
63
63
|
directory "lua/wax", "#{@project_name}/wax"
|
64
64
|
|
65
65
|
directory "templates/blank/WaxApplication.xcodeproj", "#{@project_name}/#{@project_name}.xcodeproj"
|
@@ -110,7 +110,7 @@ system "mv #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/project
|
|
110
110
|
|
111
111
|
system "mv #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/eiffel.xcuserdatad #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad" if `whoami`.strip != 'eiffel'
|
112
112
|
|
113
|
-
system "mv #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad/xcschemes/WaxApplication.xcscheme #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad/xcschemes/#{@project_name}.xcscheme"
|
113
|
+
system "mv #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad/xcschemes/WaxApplication.xcscheme #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad/xcschemes/#{@project_name}.xcscheme"
|
114
114
|
|
115
115
|
template "templates/blank/WaxApplication/main.m.tt", "#{@project_name}/#{@project_name}/main.m"
|
116
116
|
template "templates/blank/WaxApplication/ProtocolLoader.h", "#{@project_name}/#{@project_name}/ProtocolLoader.h"
|
@@ -123,5 +123,6 @@ template "templates/blank/WaxApplication/WaxApplication-Prefix.pch.tt", "#{@proj
|
|
123
123
|
copy_file "templates/resources/Default-568h@2x.png", "#{@project_name}/#{@project_name}/Default-568h@2x.png"
|
124
124
|
copy_file "templates/resources/Default@2x.png", "#{@project_name}/#{@project_name}/Default@2x.png"
|
125
125
|
copy_file "templates/resources/Default.png", "#{@project_name}/#{@project_name}/Default.png"
|
126
|
+
copy_file "templates/project.rake", "#{@project_name}/#{@project_name}/Rakefile"
|
126
127
|
|
127
128
|
system "chmod 777 #{@project_name}/wax/lib/build-scripts/*"
|
@@ -35,7 +35,9 @@ module Candle
|
|
35
35
|
puts "Candle is a wax iOS code generators tool."
|
36
36
|
puts
|
37
37
|
puts colorize("Generator Options")
|
38
|
-
opt = [{ :category => "generators", :command => "candle blank
|
38
|
+
opt = [{ :category => "generators", :command => "candle blank demo", :description => "generate a blank wax iOS project"},
|
39
|
+
{ :category => "generators", :command => "candle xib demo", :description => "generate a wax iOS project using xib and core animation"},
|
40
|
+
{ :category => "generators", :command => "candle table demo", :description => "generate a wax blank iOS project using tableview"}
|
39
41
|
]
|
40
42
|
View.render(opt, RENDER_OPTIONS)
|
41
43
|
puts
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
require 'cli-colorize'
|
4
|
+
require 'hirb'
|
5
|
+
require File.dirname(__FILE__) + '/jam'
|
6
|
+
require File.dirname(__FILE__) + '/../view'
|
7
|
+
|
8
|
+
module Candle
|
9
|
+
module Generators
|
10
|
+
class Table < Jam
|
11
|
+
include CLIColorize
|
12
|
+
|
13
|
+
CLIColorize.default_color = :red
|
14
|
+
author 'Eiffel Qiu'
|
15
|
+
homepage 'http://www.likenote.com'
|
16
|
+
email 'eiffelqiu@gmail.com'
|
17
|
+
version Candle::Version::STRING
|
18
|
+
|
19
|
+
# Add this generator to our candle
|
20
|
+
Candle::Generators.add_generator(:table, self)
|
21
|
+
|
22
|
+
init_generator
|
23
|
+
|
24
|
+
desc "Description:\n\n\tcandle will generates an new wax iOS application"
|
25
|
+
|
26
|
+
argument :name, :desc => "The name of your wax application"
|
27
|
+
|
28
|
+
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
|
29
|
+
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
30
|
+
|
31
|
+
def create_project
|
32
|
+
valid_constant?(options[:project] || name)
|
33
|
+
@project_name = (options[:app] || name).gsub(/\W/, "_").downcase
|
34
|
+
@class_name = (options[:app] || name).gsub(/\W/, "_").capitalize
|
35
|
+
@developer = "#{`whoami`.strip}"
|
36
|
+
@created_on = Date.today.to_s
|
37
|
+
self.destination_root = options[:root]
|
38
|
+
project = options[:project]
|
39
|
+
self.behavior = :revoke if options[:destroy]
|
40
|
+
|
41
|
+
puts colorize( "Candle Version: #{Candle::Version::STRING}", { :foreground => :red, :background => :white, :config => :underline } )
|
42
|
+
puts
|
43
|
+
|
44
|
+
eval(File.read(__FILE__) =~ /^__END__\n/ && $' || '')
|
45
|
+
say (<<-TEXT).gsub(/ {10}/,'')
|
46
|
+
|
47
|
+
=================================================================
|
48
|
+
Your #{@project_name} wax application has been generated.
|
49
|
+
Open #{@project_name}.xcodeproj
|
50
|
+
Build and Run
|
51
|
+
=================================================================
|
52
|
+
|
53
|
+
TEXT
|
54
|
+
end
|
55
|
+
end # Project
|
56
|
+
end # Generators
|
57
|
+
end # Candle
|
58
|
+
|
59
|
+
__END__
|
60
|
+
empty_directory "#{@project_name}"
|
61
|
+
|
62
|
+
directory "templates/table/scripts", "#{@project_name}/scripts"
|
63
|
+
directory "lua/wax", "#{@project_name}/wax"
|
64
|
+
|
65
|
+
directory "templates/table/WaxApplication.xcodeproj", "#{@project_name}/#{@project_name}.xcodeproj"
|
66
|
+
|
67
|
+
fileName = "#{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/project.pbxproj"
|
68
|
+
aFile = File.open(fileName, "r")
|
69
|
+
aString = aFile.read
|
70
|
+
aFile.close
|
71
|
+
aString.gsub!('WaxApplication', "#{@project_name}")
|
72
|
+
File.open(fileName, "w") { |file| file << aString }
|
73
|
+
|
74
|
+
fileName = "#{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme"
|
75
|
+
aFile = File.open(fileName, "r")
|
76
|
+
aString = aFile.read
|
77
|
+
aFile.close
|
78
|
+
aString.gsub!('WaxApplication', "#{@project_name}")
|
79
|
+
File.open(fileName, "w") { |file| file << aString }
|
80
|
+
|
81
|
+
fileName = "#{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/xcschememanagement.plist"
|
82
|
+
aFile = File.open(fileName, "r")
|
83
|
+
aString = aFile.read
|
84
|
+
aFile.close
|
85
|
+
aString.gsub!('WaxApplication', "#{@project_name}")
|
86
|
+
File.open(fileName, "w") { |file| file << aString }
|
87
|
+
|
88
|
+
fileName = "#{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme"
|
89
|
+
aFile = File.open(fileName, "r")
|
90
|
+
aString = aFile.read
|
91
|
+
aFile.close
|
92
|
+
aString.gsub!('WaxApplication', "#{@project_name}")
|
93
|
+
File.open(fileName, "w") { |file| file << aString }
|
94
|
+
|
95
|
+
fileName = "#{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/project.xcworkspace/contents.xcworkspacedata"
|
96
|
+
aFile = File.open(fileName, "r")
|
97
|
+
aString = aFile.read
|
98
|
+
aFile.close
|
99
|
+
aString.gsub!('WaxApplication', "#{@project_name}")
|
100
|
+
File.open(fileName, "w") { |file| file << aString }
|
101
|
+
|
102
|
+
fileName = "#{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate"
|
103
|
+
aFile = File.open(fileName, "r")
|
104
|
+
aString = aFile.read.unpack("C*").pack("U*")
|
105
|
+
aFile.close
|
106
|
+
aString.gsub!('WaxApplication', "#{@project_name}")
|
107
|
+
File.open(fileName, "w") { |file| file << aString }
|
108
|
+
|
109
|
+
system "mv #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/project.xcworkspace/xcuserdata/#{`whoami`.strip}.xcuserdatad" if `whoami`.strip != 'eiffel'
|
110
|
+
|
111
|
+
system "mv #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/eiffel.xcuserdatad #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad" if `whoami`.strip != 'eiffel'
|
112
|
+
|
113
|
+
system "mv #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad/xcschemes/WaxApplication.xcscheme #{options[:root]}/#{@project_name}/#{@project_name}.xcodeproj/xcuserdata/#{`whoami`.strip}.xcuserdatad/xcschemes/#{@project_name}.xcscheme"
|
114
|
+
|
115
|
+
template "templates/table/WaxApplication/main.m.tt", "#{@project_name}/#{@project_name}/main.m"
|
116
|
+
template "templates/table/WaxApplication/ProtocolLoader.h", "#{@project_name}/#{@project_name}/ProtocolLoader.h"
|
117
|
+
|
118
|
+
directory "templates/table/WaxApplication/en.lproj", "#{@project_name}/#{@project_name}/en.lproj"
|
119
|
+
|
120
|
+
template "templates/table/WaxApplication/WaxApplication-Info.plist.tt", "#{@project_name}/#{@project_name}/#{@project_name}-Info.plist"
|
121
|
+
template "templates/table/WaxApplication/WaxApplication-Prefix.pch.tt", "#{@project_name}/#{@project_name}/#{@project_name}-Prefix.pch"
|
122
|
+
|
123
|
+
copy_file "templates/resources/Default-568h@2x.png", "#{@project_name}/#{@project_name}/Default-568h@2x.png"
|
124
|
+
copy_file "templates/resources/Default@2x.png", "#{@project_name}/#{@project_name}/Default@2x.png"
|
125
|
+
copy_file "templates/resources/Default.png", "#{@project_name}/#{@project_name}/Default.png"
|
126
|
+
copy_file "templates/project.rake", "#{@project_name}/#{@project_name}/Rakefile"
|
127
|
+
copy_file "templates/table/scripts/states.plist", "#{@project_name}/#{@project_name}/states.plist"
|
128
|
+
|
129
|
+
system "chmod 777 #{@project_name}/wax/lib/build-scripts/*"
|
File without changes
|
File without changes
|
File without changes
|
@@ -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,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,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,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
|
+
}
|