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.
- 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
@@ -0,0 +1,128 @@
|
|
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 Xib < 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(:xib, 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/xib/scripts", "#{@project_name}/scripts"
|
63
|
+
directory "lua/wax", "#{@project_name}/wax"
|
64
|
+
|
65
|
+
directory "templates/xib/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/xib/WaxApplication/main.m.tt", "#{@project_name}/#{@project_name}/main.m"
|
116
|
+
template "templates/xib/WaxApplication/ProtocolLoader.h", "#{@project_name}/#{@project_name}/ProtocolLoader.h"
|
117
|
+
|
118
|
+
directory "templates/xib/WaxApplication/en.lproj", "#{@project_name}/#{@project_name}/en.lproj"
|
119
|
+
|
120
|
+
template "templates/xib/WaxApplication/WaxApplication-Info.plist.tt", "#{@project_name}/#{@project_name}/#{@project_name}-Info.plist"
|
121
|
+
template "templates/xib/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
|
+
|
128
|
+
system "chmod 777 #{@project_name}/wax/lib/build-scripts/*"
|
data/lib/candle/version.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
module Candle
|
2
2
|
module Version
|
3
|
-
|
4
|
-
MINOR =
|
5
|
-
PATCH = 4
|
6
|
-
|
3
|
+
VERSIONSTRING = File.read(File.join(File.dirname(__FILE__),'/../../VERSION'))
|
4
|
+
MAJOR, MINOR, PATCH = VERSIONSTRING.split('.')
|
7
5
|
STRING = [MAJOR, MINOR, PATCH].compact.join('.').chomp('.')
|
8
6
|
end
|
9
7
|
end
|
data/lib/candle.rb
CHANGED
@@ -62,7 +62,7 @@ end # Candle
|
|
62
62
|
##
|
63
63
|
# We add our generators to Candle::Genererator
|
64
64
|
#
|
65
|
-
Candle::Generators.load_paths << Dir[File.dirname(__FILE__) + '/candle/generators/{blank,help}.rb']
|
65
|
+
Candle::Generators.load_paths << Dir[File.dirname(__FILE__) + '/candle/generators/{blank,help,xib,table}.rb']
|
66
66
|
|
67
67
|
|
68
68
|
|