-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRakefile
59 lines (50 loc) · 1.71 KB
/
Rakefile
1
2
3
4
5
6
7
8
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
$:.unshift('/Library/RubyMotion/lib')
$:.unshift("~/.rubymotion/rubymotion-templates")
template = ENV['template'] || 'ios'
# ENV["output"] ||= "tap" # spec output style
require "motion/project/template/#{template}"
require './lib/motion-http'
begin
require 'bundler'
require 'motion/project/template/gem/gem_tasks'
Bundler.require(:default, template.to_sym)
rescue LoadError
end
Motion::Project::App.setup do |app|
app.name = 'motion-http'
if template == 'android'
# app.api_version = '23'
# app.target_api_version = '23'
# app.archs = ['armv5s', 'x86']
app.files.delete_if { |path| path.is_a?(String) && path.start_with?('./app/cocoa') }
else
# Only iOS
app.files.delete_if {|path| path.is_a?(String) && path.start_with?('./app/android') }
app.info_plist['NSAppTransportSecurity'] = { 'NSAllowsArbitraryLoads' => true }
end
end
def invoke_rake(platform, task)
trace = Rake.application.options.trace == true
template = platform.to_s == 'android' ? 'android' : 'ios'
system "template=#{platform} rake \"#{task}\" #{trace ? '--trace' : ''}" or exit 1
end
desc 'Build the project, then run the simulator'
task 'ios' do
invoke_rake 'ios', 'default'
end
namespace 'ios' do
desc 'Run the specs'
task 'spec' do
invoke_rake 'ios', 'spec'
end
end
desc 'Build the project, then run the emulator'
task('android') { invoke_rake 'android', 'default' }
namespace 'android' do
task('device') { invoke_rake 'android', 'device' }
task('clean') { invoke_rake 'android', 'clean' }
task('spec') { invoke_rake 'android', 'spec' }
task('spec:emulator') { invoke_rake 'android', 'spec:emulator' }
task('spec:device') { invoke_rake 'android', 'spec:device' }
end