cova 0.1.4 → 0.1.5
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/bin/cova +3 -3
- data/lib/cova.rb +3 -3
- data/lib/covaio.rb +24 -4
- data/lib/covamain.rb +100 -6
- metadata +4 -4
data/bin/cova
CHANGED
data/lib/cova.rb
CHANGED
data/lib/covaio.rb
CHANGED
@@ -9,7 +9,7 @@ module CovaIO
|
|
9
9
|
@dir_xcode_build_home = File.expand_path("~/Library/Developer/Xcode/DerivedData")
|
10
10
|
@dir_cova_apps_home = File.expand_path("~/.cova/apps")
|
11
11
|
|
12
|
-
@
|
12
|
+
@repo_cova_ios = "git://github.com/dancali/cova-ios.git"
|
13
13
|
@repo_cova_mods = "git://github.com/dancali/cova-mods.git"
|
14
14
|
@repo_xctool = "git://github.com/facebook/xctool.git"
|
15
15
|
end
|
@@ -23,7 +23,7 @@ module CovaIO
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def _io_exec_xctool(cmd="build", config="Debug", sdk="iphonesimulator")
|
26
|
-
_io_exec @dir_xctool_home + "/xctool.sh -workspace cova.xcworkspace -scheme
|
26
|
+
_io_exec @dir_xctool_home + "/xctool.sh -workspace cova.xcworkspace -scheme Cova -configuration #{config} -sdk #{sdk} #{cmd}"
|
27
27
|
end
|
28
28
|
|
29
29
|
def _io_pod_add_repo(name, repo)
|
@@ -65,6 +65,23 @@ module CovaIO
|
|
65
65
|
return File.directory?(@dir_cova_apps_home + "/" + name)
|
66
66
|
end
|
67
67
|
|
68
|
+
def _io_open_app_source(name)
|
69
|
+
if not _io_app_exists name
|
70
|
+
_log_info "Looks like the app #{name} does not exist. Please create if first."
|
71
|
+
_log_line_error
|
72
|
+
return false
|
73
|
+
end
|
74
|
+
|
75
|
+
app_project = "#{@dir_cova_apps_home}/#{name}/ios/cova.xcworkspace"
|
76
|
+
if not File.exist?(app_project)
|
77
|
+
_log_info "Looks like the app #{name} was never build. Please build it first."
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
|
81
|
+
_io_exec "open #{app_project}"
|
82
|
+
return true
|
83
|
+
end
|
84
|
+
|
68
85
|
def _io_ls(dir)
|
69
86
|
Dir.foreach(dir) {|entry| puts "#{entry}" unless (entry =='.' || entry == '..') }
|
70
87
|
end
|
@@ -73,8 +90,11 @@ module CovaIO
|
|
73
90
|
pwd = Dir.pwd
|
74
91
|
Dir.chdir(dir)
|
75
92
|
_io_exec "git clone #{repo}"
|
76
|
-
|
77
|
-
|
93
|
+
reponame = File.basename(repo, ".*")
|
94
|
+
Dir.chdir(reponame)
|
95
|
+
#_io_exec "git remote add upstream #{repo}"
|
96
|
+
#Dir.chdir(pwd)
|
97
|
+
return _io_isdir(dir + "/" + reponame)
|
78
98
|
end
|
79
99
|
|
80
100
|
def _io_rmdir(dir)
|
data/lib/covamain.rb
CHANGED
@@ -44,13 +44,13 @@ class Cova < Thor
|
|
44
44
|
end
|
45
45
|
|
46
46
|
if _io_mkdir @dir_cova_home and _io_mkdir @dir_cova_apps_home and _io_mkdir @dir_cocoapods_home
|
47
|
-
if _io_clone_repo @repo_xctool, @dir_cova_home and _io_clone_repo @
|
47
|
+
if _io_clone_repo @repo_xctool, @dir_cova_home and _io_clone_repo @repo_cova_ios, @dir_cova_home
|
48
48
|
if _io_pod_add_repo "cova", @repo_cova_mods
|
49
49
|
_log_block_success
|
50
50
|
puts
|
51
51
|
puts "Congrats! Cove is now installed. Enjoy and build the next great app sensation!".green
|
52
52
|
puts
|
53
|
-
puts "For more info check out http://cova.io"
|
53
|
+
puts "For more info check out http://cova.io"
|
54
54
|
puts
|
55
55
|
return true
|
56
56
|
end
|
@@ -89,6 +89,87 @@ class Cova < Thor
|
|
89
89
|
return false
|
90
90
|
end
|
91
91
|
|
92
|
+
desc 'newapp NAME', 'Creates a new app'
|
93
|
+
def newapp (name)
|
94
|
+
|
95
|
+
# `cp -r Cova #{name}`
|
96
|
+
# app_root = "#{name}"
|
97
|
+
# Dir.chdir app_root
|
98
|
+
|
99
|
+
# _io_exec "pod repo update cova"
|
100
|
+
# _io_exec "pod install"
|
101
|
+
# _io_exec "open Cova.xcworkspace"
|
102
|
+
|
103
|
+
# `mv app.xcodeproj #{name}.xcodeproj`
|
104
|
+
# project = Xcodeproj::Project.new "#{name}.xcodeproj"
|
105
|
+
# target = project.targets[0]
|
106
|
+
# target.name = name
|
107
|
+
# project.targets[1].name = "#{name}Tests"
|
108
|
+
|
109
|
+
# debug_build_settings = target.build_configuration_list.build_configurations[1].build_settings
|
110
|
+
|
111
|
+
# `cp ../cova/cova/cova-Info.plist #{name}-Info.plist`
|
112
|
+
# `cp ../cova/cova/AppDelegate.h AppDelegate.h`
|
113
|
+
# `cp ../cova/cova/AppDelegate.m AppDelegate.m`
|
114
|
+
# `cp ../cova/cova/cova-Prefix.pch #{name}-Prefix.pch`
|
115
|
+
# `cp ../cova/cova/main.m main.m`
|
116
|
+
#info_plist_file = project.new_file("app-Info.plist")
|
117
|
+
#pch_file = project.new_file("#{name}-Prefix.pch")
|
118
|
+
# main_file = project.new_file("main.m")
|
119
|
+
# delegate_h_file = project.new_file("AppDelegate.h")
|
120
|
+
# delegate_m_file = project.new_file("AppDelegate.m")
|
121
|
+
# target.add_file_references([main_file, delegate_h_file, delegate_m_file])
|
122
|
+
# release_build_settings = target.build_configuration_list.build_configurations[0].build_settings
|
123
|
+
# release_build_settings['INFOPLIST_FILE'] = "#{name}-Info.plist"
|
124
|
+
# release_build_settings['GCC_PREFIX_HEADER'] = "#{name}-Prefix.pch"
|
125
|
+
# debug_build_settings = target.build_configuration_list.build_configurations[1].build_settings
|
126
|
+
# debug_build_settings['INFOPLIST_FILE'] = "#{name}-Info.plist"
|
127
|
+
# debug_build_settings['GCC_PREFIX_HEADER'] = "#{name}-Prefix.pch"
|
128
|
+
# project.add_system_framework "CoreData", target
|
129
|
+
# project.add_system_framework "UIKit", target
|
130
|
+
# project.add_system_framework "Foundation", target
|
131
|
+
|
132
|
+
# project.save_as("#{name}.xcodeproj")
|
133
|
+
# _io_exec "open #{name}.xcodeproj"
|
134
|
+
|
135
|
+
#debug_build_settings['PRODUCT_NAME'] = name
|
136
|
+
#puts
|
137
|
+
#puts debug_build_settings['PRODUCT_NAME']
|
138
|
+
|
139
|
+
#puts project.pretty_print
|
140
|
+
|
141
|
+
#info_plist = project.main_group.new_file("#{name}-Info.plist")
|
142
|
+
#target.add_file_references([info_plist])
|
143
|
+
|
144
|
+
#debug = project.build_configurations
|
145
|
+
#pp debug
|
146
|
+
|
147
|
+
#config = project.configuration_list :ios
|
148
|
+
|
149
|
+
#project.add_system_framework "CoreData", target
|
150
|
+
#project.add_system_framework "UIKit", target
|
151
|
+
#project.add_system_framework "Foundation", target
|
152
|
+
|
153
|
+
#src = project.new_group "src"
|
154
|
+
#res = project.new_group "res"
|
155
|
+
#test = project.new_group "test"
|
156
|
+
|
157
|
+
#File.open("src/main.m", 'w') {|f| f.write("#import <UIKit/UIKit.h>\r\n#import \"AppDelegate.h\"\r\nint main(int argc, char *argv[]) {\r\n@autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); }\r\n}")}
|
158
|
+
#File.open("src/AppDelegate.h", 'w') {|f| f.write("#import <UIKit/UIKit.h>\r\n@interface AppDelegate : UIResponder <UIApplicationDelegate>\r\n @property (strong, nonatomic) UIWindow *window; \r\n@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; \r\n@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; \r\n@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; \r\n- (void)saveContext; \r\n- (NSURL *)applicationDocumentsDirectory; \r\n@end")}
|
159
|
+
#main_file = src.new_file("src/main.m")
|
160
|
+
#delegate_file = src.new_file("src/AppDelegate.h")
|
161
|
+
|
162
|
+
#project.save_as("#{name}.xcodeproj")
|
163
|
+
|
164
|
+
#File.open("Podfile", 'w') {|f| f.write("platform :ios, '5.0'\r\npod 'covamod-core'")}
|
165
|
+
#_io_exec "pod setup"
|
166
|
+
#_io_exec "pod repo update cova"
|
167
|
+
#_io_exec "pod install"
|
168
|
+
#_io_exec "open #{name}.xcworkspace"
|
169
|
+
|
170
|
+
#_io_exec "open #{name}.xcodeproj"
|
171
|
+
end
|
172
|
+
|
92
173
|
desc 'create [-b] NAME', 'Creates a new Cova app (-b to build it including tests)'
|
93
174
|
option :build, :type => :boolean, :aliases => :b
|
94
175
|
def create (name)
|
@@ -107,9 +188,18 @@ class Cova < Thor
|
|
107
188
|
return false
|
108
189
|
end
|
109
190
|
|
110
|
-
if _io_cpdir @dir_cova_home + "/cova
|
191
|
+
if _io_cpdir @dir_cova_home + "/cova-ios/Cova", dir + "/ios"
|
192
|
+
|
193
|
+
Dir.chdir(@dir_cova_apps_home + "/" + name + "/ios")
|
194
|
+
project = Xcodeproj::Project.new "Cova.xcodeproj"
|
195
|
+
target = project.targets[0]
|
196
|
+
target.name = name
|
197
|
+
project.targets[1].name = "#{name}Tests"
|
198
|
+
release_build_settings = target.build_configuration_list.build_configurations[0].build_settings
|
199
|
+
debug_build_settings = target.build_configuration_list.build_configurations[1].build_settings
|
200
|
+
project.save_as("Cova.xcodeproj")
|
201
|
+
|
111
202
|
if options[:build]
|
112
|
-
Dir.chdir(@dir_cova_apps_home + "/" + name + "/ios")
|
113
203
|
if not _cova_build_dependencies
|
114
204
|
_log_line "Attempted to build the app dependencies"
|
115
205
|
_log_line_error
|
@@ -117,10 +207,12 @@ class Cova < Thor
|
|
117
207
|
end
|
118
208
|
|
119
209
|
_io_exec_xctool "test"
|
210
|
+
_io_open_app_source name
|
120
211
|
return true
|
121
212
|
end
|
122
213
|
|
123
214
|
_log_block_success
|
215
|
+
_io_open_app_source name
|
124
216
|
return true
|
125
217
|
end
|
126
218
|
|
@@ -145,7 +237,7 @@ class Cova < Thor
|
|
145
237
|
|
146
238
|
Dir.chdir(@dir_cova_apps_home + "/" + name + "/ios")
|
147
239
|
_log_block_start "Building app #{name}"
|
148
|
-
if options[:dependencies] or not _io_isfile "
|
240
|
+
if options[:dependencies] or not _io_isfile "Cova.xcworkspace" or not _io_isdir "Pods"
|
149
241
|
if not _cova_build_dependencies
|
150
242
|
_log_block_error
|
151
243
|
return false
|
@@ -153,6 +245,7 @@ class Cova < Thor
|
|
153
245
|
end
|
154
246
|
|
155
247
|
_io_exec_xctool (options[:tests] ? "test" : "build")
|
248
|
+
_io_open_app_source name
|
156
249
|
end
|
157
250
|
|
158
251
|
no_commands do
|
@@ -170,8 +263,9 @@ class Cova < Thor
|
|
170
263
|
return false
|
171
264
|
end
|
172
265
|
|
266
|
+
_io_exec "pod repo update cova"
|
173
267
|
_io_exec "pod install"
|
174
|
-
return (_io_isfile "
|
268
|
+
return (_io_isfile "Cova.xcworkspace" and _io_isdir "Pods")
|
175
269
|
end
|
176
270
|
end
|
177
271
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cova
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dan Calinescu
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-05-
|
18
|
+
date: 2013-05-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: logger
|