Sha256: 38b86cc7defcf61ad606ce1683105b307f3f76ed6df450aea2477283c2738b98

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

#
# Rake / Cordova
#
task default: [:compile]

task :greet do
  puts Paint["Cordova Rake [#{env}] #{ENV['CORDOVA_PLATFORMS']}", :red]
  puts Paint['        ----', :red]
end

desc 'Setup env for development'
task :setup do
  sh 'npm -g install phonegap cordova coffee-script '
  sh 'npm -g install ios-deploy ios-sim ' if RUBY_PLATFORM =~ /darwin/
  sh 'gem install haml sass yamg guard guard-coffeelint'
end

task :report do
  puts Paint['----', :red]
  puts Paint["Rake done! #{format('%.2f', Time.now - START)}s", :black]
end

desc 'Phonegap Dev App, optional: port.'
task :serve do
  port = ARGV.last.to_i
  port = 4000 if port.zero?
  sh "phonegap serve -p #{port}"
end

desc 'Prepare & Ripple emulate'
task :ripple do
  sh 'cordova prepare'
  sh 'ripple emulate'
end

desc 'Prepare & Ripple emulate'
task :guard do
  if File.exist?('Guardfile')
    puts 'Guardfile already exists.'
  else
    puts 'Creating Guardfile...'
    FileUtils.cp(File.join(__FILE__, '..', 'templates', 'Guardfile'), '.')
  end
end

namespace :emulate do
  desc 'Run on Android emulator'
  task :android do
    sh 'cordova build android'
    sh "cordova emulate android --target #{ARGV[1]}"
  end
  task android: :compile

  desc 'Run on iOS emulator'
  task :ios do
    sh 'cordova build ios'
    sh 'cordova emulate ios'
  end
  task ios: :compile
end

namespace :run do
  desc 'Run on Android device or emulator'
  task :android do
    sh 'cordova build android'
    sh 'cordova run android'
  end
  task android: :compile

  desc 'Run on iOS plugged device or emulator'
  task :ios do
    sh 'cordova build ios'
    sh 'cordova run ios --device'
  end
  task ios: :compile
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cordova-rake-0.3.0 lib/tasks/cordova.rake