Class: Cova

Inherits:
Thor
  • Object
show all
Defined in:
lib/cova.rb

Instance Method Summary collapse

Instance Method Details

#buildObject



312
313
314
315
316
317
318
# File 'lib/cova.rb', line 312

def build
  if  options[:dependencies]
  _buildall
    else
      _build
    end
end

#create(name) ⇒ Object



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/cova.rb', line 263

def create (name)

    _start "Creating app #{name}"

    if status
app_home = File.expand_path("./#{name}")
        if File.directory?(app_home)
          _msg "Cannot create directory #{app_home} as it already exists"
          _error
          _fail
          exit
        end

_msg "Creating app home in #{app_home}"
FileUtils.mkdir app_home
        if File.directory?(app_home)
  _ok
  _msg "Adding Xcode project"
  cova_dir = _covadir

  FileUtils.cp_r cova_dir + "/cova/ios/xcode-template", app_home + "/ios"
  if File.directory?(app_home + "/ios/cova")
_ok
       if  options[:build]
        FileUtils.cd app_home + "/ios"
  _buildall
   else
        _success
   end
          else
_error
_fail
_exit
          end              
else
  _error
          _fail
  exit
   end
        else
_msg "Cova not installed. Run install -f to install it"
_error
_fail
exit
        end
end

#installObject



246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/cova.rb', line 246

def install
  user_home_dir = File.expand_path("~")
  cova_dir = user_home_dir + "/.cova"

  if File.directory?(cova_dir)
    if  options[:force]
    _init
  else
    _info "Cova is already installed. Run install -f to force a re-install"          
  end
  else
    _init
  end
end

#statusObject



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/cova.rb', line 190

def status
  _start "Checking if Cova is installed"
  cova_dir = _covadir
  if File.directory?(cova_dir)
    _msg "Found Cova in #{cova_dir}"
    _ok
  else
    puts "Expecting Cova in #{cova_dir} not found".red
    _failed
    return false
  end

  cova_mods_dir = _covamodsdir
  if File.directory?(cova_mods_dir)
    _msg "Found Cova Mods in #{cova_mods_dir}"
    _ok
    _success
  else
    puts "Expected Cova Mods in #{cova_mods_dir} not found".red
    return false
  end

  return true
end

#uninstallObject



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/cova.rb', line 216

def uninstall

  _start "Uninstalling Cova"

    cova_dir = _covadir
    _msg "Removing Cova from #{cova_dir}"
    FileUtils.rm_r cova_dir, :force => true
  if File.directory?(cova_dir)
    _error
_fail
    exit
  else
    _ok
  end

  cova_mods_dir = _covamodsdir
    _msg "Removing Cova Mods from #{cova_mods_dir}"
    FileUtils.rm_r cova_mods_dir, :force => true       
  if File.directory?(cova_mods_dir)
    _error
_fail
    exit
  else
    _ok
  _success
  end
end