Class: Cova
- Inherits:
-
Thor
- Object
- Thor
- Cova
- Defined in:
- lib/cova.rb
Instance Method Summary collapse
Instance Method Details
#build ⇒ Object
304 305 306 307 308 309 310 |
# File 'lib/cova.rb', line 304 def build if [:dependencies] _buildall else _build end end |
#create(name) ⇒ Object
255 256 257 258 259 260 261 262 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 |
# File 'lib/cova.rb', line 255 def create (name) _start "Creating app #{name}" if status app_home = File.("./#{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 [: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 |
#install ⇒ Object
238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/cova.rb', line 238 def install user_home_dir = File.("~") cova_dir = user_home_dir + "/.cova" if File.directory?(cova_dir) if [:force] _init else _info "Cova is already installed. Run install -f to force a re-install" end else _init end end |
#status ⇒ Object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/cova.rb', line 182 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 _fail 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 |
#uninstall ⇒ Object
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/cova.rb', line 208 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 |