cova 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cova +2 -0
- data/lib/cova.rb +2 -0
- data/lib/covamain.rb +133 -11
- metadata +33 -5
data/bin/cova
CHANGED
data/lib/cova.rb
CHANGED
data/lib/covamain.rb
CHANGED
@@ -203,7 +203,7 @@ class Cova < Thor
|
|
203
203
|
return false
|
204
204
|
end
|
205
205
|
|
206
|
-
if not
|
206
|
+
if not _io_cpdir @dir_cova_home + "/cova/store", dir + "/store"
|
207
207
|
_log_block_error
|
208
208
|
return false
|
209
209
|
end
|
@@ -213,7 +213,7 @@ class Cova < Thor
|
|
213
213
|
config_content = config_content.gsub(/%cova_home%/, @dir_cova_home)
|
214
214
|
File.open(dir + "/www/config.php", 'w') { |file| file.puts config_content }
|
215
215
|
end
|
216
|
-
|
216
|
+
|
217
217
|
if _io_cpdir @dir_cova_home + "/cova/ios", dir + "/ios"
|
218
218
|
Dir.chdir(@dir_cova_apps_home + "/" + name + "/ios")
|
219
219
|
|
@@ -250,6 +250,131 @@ class Cova < Thor
|
|
250
250
|
return false
|
251
251
|
end
|
252
252
|
|
253
|
+
desc 'bye NAME', 'Say bye to an app and stop responding to activities'
|
254
|
+
def bye (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
|
+
pid_file = @dir_cova_apps_home + "/" + name + "/store/hi.lock"
|
267
|
+
if not _io_isfile pid_file
|
268
|
+
_log_info "How rude. Say hi first."
|
269
|
+
return false
|
270
|
+
end
|
271
|
+
|
272
|
+
pid = File.read(pid_file)
|
273
|
+
Process.kill("TERM", pid.to_i)
|
274
|
+
`rm -rf #{pid_file}`
|
275
|
+
|
276
|
+
if not _io_isfile pid_file, false
|
277
|
+
_log_info "Bye!"
|
278
|
+
return true
|
279
|
+
end
|
280
|
+
|
281
|
+
_log_line_error
|
282
|
+
return false
|
283
|
+
end
|
284
|
+
|
285
|
+
desc 'log NAME', 'A log of all activities'
|
286
|
+
def log (name)
|
287
|
+
if not _cova_installed
|
288
|
+
_cova_prompt_install
|
289
|
+
return false
|
290
|
+
end
|
291
|
+
|
292
|
+
if not _io_app_exists name
|
293
|
+
_log_line "App #{name} does not exist"
|
294
|
+
_log_line_error
|
295
|
+
return false
|
296
|
+
end
|
297
|
+
|
298
|
+
db_file = @dir_cova_apps_home + "/" + name + "/store/log.db"
|
299
|
+
if File.exist?(db_file)
|
300
|
+
db = SQLite3::Database.new db_file
|
301
|
+
db.execute "select * from changelog" do |row|
|
302
|
+
puts "[" + row[2] + "] " + row[1] + " " + row[0]
|
303
|
+
end
|
304
|
+
return true
|
305
|
+
end
|
306
|
+
|
307
|
+
_log_info "Looks like there's no activity yet. So do something first."
|
308
|
+
return false
|
309
|
+
end
|
310
|
+
|
311
|
+
desc 'hi NAME', 'Say hi to an app and respond to activities'
|
312
|
+
def hi (name)
|
313
|
+
if not _cova_installed
|
314
|
+
_cova_prompt_install
|
315
|
+
return false
|
316
|
+
end
|
317
|
+
|
318
|
+
if not _io_app_exists name
|
319
|
+
_log_line "App #{name} does not exist"
|
320
|
+
_log_line_error
|
321
|
+
return false
|
322
|
+
end
|
323
|
+
|
324
|
+
pid_file = @dir_cova_apps_home + "/" + name + "/store/hi.lock"
|
325
|
+
if _io_isfile pid_file, false
|
326
|
+
_log_info "You already said hi. Say bye first."
|
327
|
+
return true
|
328
|
+
end
|
329
|
+
|
330
|
+
db_file = @dir_cova_apps_home + "/" + name + "/store/log.db"
|
331
|
+
|
332
|
+
monitor = FSSM::Monitor.new
|
333
|
+
monitor.path @dir_cova_apps_home + "/" + name do
|
334
|
+
create do |b, r, t|
|
335
|
+
if File.exist?(db_file) and not r == "store/log.db"
|
336
|
+
db = SQLite3::Database.new db_file
|
337
|
+
db.execute "insert into changelog values ('#{r}', 'created', '" + Time.new.strftime("%Y-%m-%d %H:%M:%S") + "')"
|
338
|
+
end
|
339
|
+
end
|
340
|
+
update do |b, r, t|
|
341
|
+
if File.exist?(db_file) and not r == "store/log.db"
|
342
|
+
db = SQLite3::Database.new db_file
|
343
|
+
db.execute "insert into changelog values ('#{r}', 'updated', '" + Time.new.strftime("%Y-%m-%d %H:%M:%S") + "')"
|
344
|
+
end
|
345
|
+
end
|
346
|
+
delete do |b, r, t|
|
347
|
+
if File.exist?(db_file) and not r == "store/log.db"
|
348
|
+
db = SQLite3::Database.new db_file
|
349
|
+
db.execute "insert into changelog values ('#{r}', 'deleted', '" + Time.new.strftime("%Y-%m-%d %H:%M:%S") + "')"
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
pid = fork do
|
355
|
+
monitor.run
|
356
|
+
end
|
357
|
+
|
358
|
+
File.open(@dir_cova_apps_home + "/" + name + "/store/hi.lock", 'w') {|f| f.write(pid)}
|
359
|
+
Process.detach(pid)
|
360
|
+
|
361
|
+
if _io_isfile pid_file
|
362
|
+
if not File.exist?(db_file)
|
363
|
+
db = SQLite3::Database.new db_file
|
364
|
+
db.execute("CREATE TABLE changelog(file, event, date)")
|
365
|
+
_log_info "Hi!"
|
366
|
+
return true
|
367
|
+
end
|
368
|
+
|
369
|
+
_log_info "Hi again!"
|
370
|
+
return true
|
371
|
+
end
|
372
|
+
|
373
|
+
_log_line "Oops, something went wrong."
|
374
|
+
_log_line_error
|
375
|
+
return false
|
376
|
+
end
|
377
|
+
|
253
378
|
desc 'deploy NAME', 'Builds an app'
|
254
379
|
def deploy (name)
|
255
380
|
if not _cova_installed
|
@@ -273,24 +398,21 @@ class Cova < Thor
|
|
273
398
|
|
274
399
|
config = _config_load "app.config"
|
275
400
|
deploy_dir = config['local.www']
|
276
|
-
if not deploy_dir
|
401
|
+
if not deploy_dir + "/#{name}"
|
277
402
|
_log_line "Expecting the local.www path to be configured."
|
278
403
|
_log_line_error
|
279
404
|
_log_info "Please set the local.www path in your app.config file."
|
280
405
|
return false
|
281
406
|
end
|
282
407
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
`cp www/.htaccess #{deploy_dir}/.htaccess`
|
288
|
-
_log_line "Deploying the app to #{deploy_dir}"
|
289
|
-
_log_line_ok
|
408
|
+
`rm -rf #{deploy_dir}/#{name}`
|
409
|
+
if _io_cpdir "www", "#{deploy_dir}/#{name}"
|
410
|
+
_log_line "Deploying the app to #{deploy_dir}/#{name}"
|
411
|
+
_log_line_ok
|
290
412
|
return true
|
291
413
|
end
|
292
414
|
|
293
|
-
_log_line "Deploying the app to #{deploy_dir}"
|
415
|
+
_log_line "Deploying the app to #{deploy_dir}/#{name}"
|
294
416
|
_log_line_error
|
295
417
|
return false
|
296
418
|
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: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
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-06-
|
18
|
+
date: 2013-06-06 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: logger
|
@@ -101,6 +101,34 @@ dependencies:
|
|
101
101
|
version: "0"
|
102
102
|
type: :runtime
|
103
103
|
version_requirements: *id006
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: fssm
|
106
|
+
prerelease: false
|
107
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
hash: 3
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
version: "0"
|
116
|
+
type: :runtime
|
117
|
+
version_requirements: *id007
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: sqlite3
|
120
|
+
prerelease: false
|
121
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
130
|
+
type: :runtime
|
131
|
+
version_requirements: *id008
|
104
132
|
description: Cova removes a lot of the complexity that comes with designing, coding, testing, prototyping and publishing mobile applications.
|
105
133
|
email: dan@cova.io
|
106
134
|
executables:
|