Module: NewclearHelper
- Defined in:
- lib/newclear_helper.rb
Constant Summary collapse
- NUKE_MESSAGE =
" *********************************\n N U K E COMPLETE\n *********************************\n"
Instance Method Summary collapse
- #build_project ⇒ Object
- #has_task?(task_name) ⇒ Boolean
- #is_android? ⇒ Boolean
- #nuke_project ⇒ Object
-
#running_genymotion? ⇒ Boolean
We assume they keep their API in the emulator name.
Instance Method Details
#build_project ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/newclear_helper.rb', line 37 def build_project puts "Building project..." if is_android? and !running_genymotion? puts "for device" `rake device` else `rake` end end |
#has_task?(task_name) ⇒ Boolean
47 48 49 |
# File 'lib/newclear_helper.rb', line 47 def has_task?(task_name) Rake.application.tasks.count{ |rt| rt.name == task_name} > 0 end |
#is_android? ⇒ Boolean
51 52 53 |
# File 'lib/newclear_helper.rb', line 51 def is_android? @android ||= system("rake -T | grep -q .apk") end |
#nuke_project ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/newclear_helper.rb', line 9 def nuke_project puts "\nCleaning Project..." `rake clean:all` unless is_android? puts "\nResetting simulator..." `reset-sim` end # Fast bundle puts "\nBundling..." `bundle install --jobs=3 --retry=3` # iOS Depencies if has_task? "pod:install" puts "\nSetting up cocoapods..." `pod setup` puts "\nInstalling cocoapod dependencies..." `rake pod:install` end # Android Dependencies if has_task? "gradle:install" puts "\nSetting up gradle automation dependencies..." `rake gradle:install` end end |
#running_genymotion? ⇒ Boolean
We assume they keep their API in the emulator name
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/newclear_helper.rb', line 56 def running_genymotion? genymotion_active = false if system("which VBoxManage > /dev/null") running_vms = `VboxManage list runningvms` vm_ids = running_vms.scan(/({[^}]+})\n/).flatten # get all VM IDs # check all to see if any are Genymotion VMs vm_ids.each do |vm_id| genymotion_active = true if system("VBoxManage showvminfo #{vm_id} | grep -q Genymotion") end end # Return our findings genymotion_active end |