cova 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cova +1 -0
- data/lib/cova.rb +1 -0
- data/lib/covaconfig.rb +29 -0
- data/lib/covaio.rb +8 -0
- data/lib/covamain.rb +55 -3
- metadata +4 -3
data/bin/cova
CHANGED
data/lib/cova.rb
CHANGED
data/lib/covaconfig.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module CovaConfig
|
2
|
+
|
3
|
+
def _config_load(conf_file)
|
4
|
+
line_sub = Regexp.new(/\s+|"|\[|\]/)
|
5
|
+
temp = Array.new
|
6
|
+
vars=Hash.new
|
7
|
+
|
8
|
+
unless File.exists?(conf_file) then
|
9
|
+
return vars
|
10
|
+
end
|
11
|
+
|
12
|
+
IO.foreach(conf_file) do |line|
|
13
|
+
if line.match(/^#/)
|
14
|
+
next
|
15
|
+
elsif
|
16
|
+
line.match(/^$/)
|
17
|
+
next
|
18
|
+
else
|
19
|
+
temp[0],temp[1] = line.to_s.scan(/^.*$/).to_s.split('=')
|
20
|
+
temp.collect! do |val|
|
21
|
+
val.gsub(line_sub, "")
|
22
|
+
end
|
23
|
+
vars[temp[0]] = temp[1]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
return vars
|
28
|
+
end
|
29
|
+
end
|
data/lib/covaio.rb
CHANGED
@@ -127,6 +127,14 @@ module CovaIO
|
|
127
127
|
return false
|
128
128
|
end
|
129
129
|
|
130
|
+
def _io_cpfile(src, targ)
|
131
|
+
if _io_isfile src and not _io_isfile targ, false
|
132
|
+
`cp #{src} #{targ}`
|
133
|
+
return _io_isfile targ
|
134
|
+
end
|
135
|
+
return false
|
136
|
+
end
|
137
|
+
|
130
138
|
def _io_mkdir(dir)
|
131
139
|
if File.directory?(dir)
|
132
140
|
return true
|
data/lib/covamain.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Cova < Thor
|
2
2
|
|
3
|
+
include CovaConfig
|
3
4
|
include CovaLog
|
4
5
|
include CovaIO
|
5
6
|
|
@@ -202,11 +203,18 @@ class Cova < Thor
|
|
202
203
|
return false
|
203
204
|
end
|
204
205
|
|
205
|
-
if
|
206
|
+
if not _io_cpfile @dir_cova_home + "/cova/config/app.config", dir + "/app.config"
|
207
|
+
_log_block_error
|
208
|
+
return false
|
209
|
+
end
|
210
|
+
|
211
|
+
if _io_cpdir @dir_cova_home + "/cova/web/app", dir + "/www"
|
212
|
+
config_content = File.read(dir + "/www/config.php")
|
213
|
+
config_content = config_content.gsub(/%cova_home%/, @dir_cova_home)
|
214
|
+
File.open(dir + "/www/config.php", 'w') { |file| file.puts config_content }
|
206
215
|
end
|
207
216
|
|
208
217
|
if _io_cpdir @dir_cova_home + "/cova/ios", dir + "/ios"
|
209
|
-
|
210
218
|
Dir.chdir(@dir_cova_apps_home + "/" + name + "/ios")
|
211
219
|
|
212
220
|
#project = Xcodeproj::Project.new "Cova.xcodeproj"
|
@@ -235,7 +243,6 @@ class Cova < Thor
|
|
235
243
|
end
|
236
244
|
|
237
245
|
_log_block_success
|
238
|
-
_io_open_app_source name
|
239
246
|
return true
|
240
247
|
end
|
241
248
|
|
@@ -243,6 +250,51 @@ class Cova < Thor
|
|
243
250
|
return false
|
244
251
|
end
|
245
252
|
|
253
|
+
desc 'deploy NAME', 'Builds an app'
|
254
|
+
def deploy (name)
|
255
|
+
if not _cova_installed
|
256
|
+
_cova_prompt_install
|
257
|
+
return false
|
258
|
+
end
|
259
|
+
|
260
|
+
if not _io_app_exists name
|
261
|
+
_log_line "App #{name} does not exist"
|
262
|
+
_log_line_error
|
263
|
+
return false
|
264
|
+
end
|
265
|
+
|
266
|
+
Dir.chdir(@dir_cova_apps_home + "/" + name)
|
267
|
+
if not _io_isfile "app.config"
|
268
|
+
_log_line "App configuration file app.config does not exist."
|
269
|
+
_log_line_error
|
270
|
+
_log_info "Please add the app.config file."
|
271
|
+
return false
|
272
|
+
end
|
273
|
+
|
274
|
+
config = _config_load "app.config"
|
275
|
+
deploy_dir = config['local.www']
|
276
|
+
if not deploy_dir
|
277
|
+
_log_line "Expecting the local.www path to be configured."
|
278
|
+
_log_line_error
|
279
|
+
_log_info "Please set the local.www path in your app.config file."
|
280
|
+
return false
|
281
|
+
end
|
282
|
+
|
283
|
+
if _io_isdir "www" and _io_isdir deploy_dir
|
284
|
+
`rm -rf #{deploy_dir}/*`
|
285
|
+
`rm -rf #{deploy_dir}/.htaccess`
|
286
|
+
`cp -r www/* #{deploy_dir}`
|
287
|
+
`cp www/.htaccess #{deploy_dir}/.htaccess`
|
288
|
+
_log_line "Deploying the app to #{deploy_dir}"
|
289
|
+
_log_line_ok
|
290
|
+
return true
|
291
|
+
end
|
292
|
+
|
293
|
+
_log_line "Deploying the app to #{deploy_dir}"
|
294
|
+
_log_line_error
|
295
|
+
return false
|
296
|
+
end
|
297
|
+
|
246
298
|
desc 'build [-d][-t] NAME', 'Builds an app (-d to build dependencies, -t to build and run tests)'
|
247
299
|
option :dependencies, :type => :boolean, :aliases => :d
|
248
300
|
option :tests, :type => :boolean, :aliases => :t
|
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: 9
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dan Calinescu
|
@@ -111,6 +111,7 @@ extra_rdoc_files: []
|
|
111
111
|
|
112
112
|
files:
|
113
113
|
- lib/cova.rb
|
114
|
+
- lib/covaconfig.rb
|
114
115
|
- lib/covaio.rb
|
115
116
|
- lib/covalog.rb
|
116
117
|
- lib/covamain.rb
|