ruboto 0.12.0 → 0.13.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/Rakefile +20 -14
- data/assets/rakelib/ruboto.rake +53 -54
- data/lib/ruboto/commands/base.rb +15 -2
- data/lib/ruboto/sdk_locations.rb +4 -2
- data/lib/ruboto/util/setup.rb +283 -120
- data/lib/ruboto/version.rb +1 -1
- metadata +37 -26
- checksums.yaml +0 -7
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruboto (0.
|
4
|
+
ruboto (0.13.0.dev)
|
5
5
|
main (>= 4.7.2)
|
6
|
+
rake
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
@@ -15,7 +16,7 @@ GEM
|
|
15
16
|
chronic (>= 0.6.2)
|
16
17
|
fattr (>= 2.2.0)
|
17
18
|
map (>= 5.1.0)
|
18
|
-
map (6.
|
19
|
+
map (6.3.0)
|
19
20
|
rake (10.0.4)
|
20
21
|
|
21
22
|
PLATFORMS
|
@@ -23,5 +24,4 @@ PLATFORMS
|
|
23
24
|
ruby
|
24
25
|
|
25
26
|
DEPENDENCIES
|
26
|
-
rake
|
27
27
|
ruboto!
|
data/Rakefile
CHANGED
@@ -4,7 +4,6 @@ require 'rexml/document'
|
|
4
4
|
require 'ruboto/version'
|
5
5
|
require 'ruboto/description'
|
6
6
|
require 'ruboto/sdk_versions'
|
7
|
-
require 'ruboto/sdk_locations'
|
8
7
|
require 'uri'
|
9
8
|
require 'net/https'
|
10
9
|
|
@@ -16,7 +15,6 @@ PLATFORM_CURRENT_RELEASE_APK = File.expand_path('tmp/RubotoCore-release.apk', Fi
|
|
16
15
|
MANIFEST_FILE = 'AndroidManifest.xml'
|
17
16
|
GEM_FILE = "ruboto-#{Ruboto::VERSION}.gem"
|
18
17
|
GEM_SPEC_FILE = 'ruboto.gemspec'
|
19
|
-
EXAMPLE_FILE = File.expand_path("examples/RubotoTestApp_#{Ruboto::VERSION}_tools_r#{Ruboto::SdkLocations::ANDROID_TOOLS_REVISION}.tgz", File.dirname(__FILE__))
|
20
18
|
|
21
19
|
CLEAN.include('ruboto-*.gem', 'tmp')
|
22
20
|
|
@@ -65,9 +63,11 @@ end
|
|
65
63
|
task :reinstall => [:uninstall, :clean, :install]
|
66
64
|
|
67
65
|
desc 'Generate an example app'
|
68
|
-
task :example =>
|
69
|
-
|
70
|
-
|
66
|
+
task :example => :install do
|
67
|
+
require 'ruboto/sdk_locations'
|
68
|
+
EXAMPLE_FILE = File.expand_path("examples/RubotoTestApp_#{Ruboto::VERSION}_tools_r#{Ruboto::SdkLocations::ANDROID_TOOLS_REVISION}.tgz", File.dirname(__FILE__))
|
69
|
+
examples_glob = "#{EXAMPLE_FILE.slice(/^.*?_\d+\.\d+\.\d+/)}*"
|
70
|
+
sh "git rm #{examples_glob}" unless Dir[examples_glob].empty?
|
71
71
|
puts "Creating example app #{EXAMPLE_FILE}"
|
72
72
|
app_name = 'RubotoTestApp'
|
73
73
|
Dir.chdir File.dirname(EXAMPLE_FILE) do
|
@@ -78,6 +78,12 @@ file EXAMPLE_FILE => :install do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
class String
|
82
|
+
def wrap(indent = 0)
|
83
|
+
scan(/\S.{0,72}\S(?=\s|$)|\S+/).join("\n" + ' ' * indent)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
81
87
|
desc 'Generate release docs for a given milestone'
|
82
88
|
task :release_docs do
|
83
89
|
raise "\n This task requires Ruby 1.9 or newer to parse JSON as YAML.\n\n" if RUBY_VERSION == '1.8.7'
|
@@ -122,6 +128,7 @@ task :release_docs do
|
|
122
128
|
issues = YAML.load(res.body).sort_by { |i| i['number'] }
|
123
129
|
milestone_name = issues[0] ? issues[0]['milestone']['title'] : "No issues for milestone #{milestone}"
|
124
130
|
milestone_description = issues[0] ? issues[0]['milestone']['description'] : "No issues for milestone #{milestone}"
|
131
|
+
milestone_description = milestone_description.split("\r\n").map(&:wrap).join("\r\n")
|
125
132
|
categories = {'Features' => 'feature', 'Bugfixes' => 'bug', 'Internal' => 'internal', 'Support' => 'support', 'Documentation' => 'documentation', 'Pull requests' => nil, 'Other' => nil}
|
126
133
|
grouped_issues = issues.group_by do |i|
|
127
134
|
labels = i['labels'].map { |l| l['name'] }
|
@@ -180,7 +187,7 @@ EOF
|
|
180
187
|
puts
|
181
188
|
puts "The Ruboto team is pleased to announce the release of Ruboto #{milestone_name}."
|
182
189
|
puts
|
183
|
-
puts Ruboto::DESCRIPTION
|
190
|
+
puts Ruboto::DESCRIPTION.gsub("\n", ' ').wrap
|
184
191
|
puts
|
185
192
|
puts "New in version #{milestone_name}:\n"
|
186
193
|
puts
|
@@ -188,7 +195,7 @@ EOF
|
|
188
195
|
puts
|
189
196
|
(categories.keys & grouped_issues.keys).each do |cat|
|
190
197
|
puts "#{cat}:\n\n"
|
191
|
-
grouped_issues[cat].each { |i| puts %Q{* Issue ##{i['number']} #{i['title']}} }
|
198
|
+
grouped_issues[cat].each { |i| puts %Q{* Issue ##{i['number']} #{i['title']}}.wrap(2) }
|
192
199
|
puts
|
193
200
|
end
|
194
201
|
puts "You can find a complete list of issues here:\n\n"
|
@@ -197,7 +204,8 @@ EOF
|
|
197
204
|
puts <<EOF
|
198
205
|
Installation:
|
199
206
|
|
200
|
-
To use Ruboto, you need to install a Ruby implementation. Then do
|
207
|
+
To use Ruboto, you need to install a Ruby implementation. Then do
|
208
|
+
(possibly as root/administrator)
|
201
209
|
|
202
210
|
gem install ruboto
|
203
211
|
ruboto setup
|
@@ -218,7 +226,8 @@ To run your project
|
|
218
226
|
cd <project directory>
|
219
227
|
rake install start
|
220
228
|
|
221
|
-
You can find an introductory tutorial at
|
229
|
+
You can find an introductory tutorial at
|
230
|
+
https://github.com/ruboto/ruboto/wiki
|
222
231
|
|
223
232
|
If you have any problems or questions, come see us at http://ruboto.org/
|
224
233
|
|
@@ -312,14 +321,11 @@ end
|
|
312
321
|
|
313
322
|
desc 'Push the gem to RubyGems'
|
314
323
|
task :release => [:clean, :gem] do
|
315
|
-
|
316
|
-
|
324
|
+
output = `git status --porcelain`
|
325
|
+
raise "Workspace not clean!\n#{output}" unless output.empty?
|
317
326
|
sh "git tag #{Ruboto::VERSION}"
|
318
327
|
sh 'git push --tags'
|
319
328
|
sh "gem push #{GEM_FILE}"
|
320
|
-
|
321
|
-
examples_glob = "#{EXAMPLE_FILE.slice(/^.*?_\d+\.\d+\.\d+/)}*"
|
322
|
-
sh "git rm #{examples_glob}" unless Dir[examples_glob].empty?
|
323
329
|
Rake::Task[:example].invoke
|
324
330
|
sh "git add #{EXAMPLE_FILE}"
|
325
331
|
sh "git commit -m '* Added example app for Ruboto #{Ruboto::VERSION} tools r#{Ruboto::SdkLocations::ANDROID_TOOLS_REVISION}' \"#{examples_glob}\""
|
data/assets/rakelib/ruboto.rake
CHANGED
@@ -15,42 +15,50 @@ if `#{ANT_CMD} -version` !~ /version (\d+)\.(\d+)\.(\d+)/ || $1.to_i < 1 || ($1.
|
|
15
15
|
exit 1
|
16
16
|
end
|
17
17
|
|
18
|
+
#
|
19
|
+
# OS independent "which"
|
20
|
+
# From: http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
21
|
+
#
|
22
|
+
def which(cmd)
|
23
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
24
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
25
|
+
exts.each do |ext|
|
26
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
27
|
+
return exe if File.executable? exe
|
28
|
+
end
|
29
|
+
end
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
18
33
|
adb_version_str = `adb version`
|
19
34
|
(puts 'Android SDK platform tools not in PATH (adb command not found).'; exit 1) unless $? == 0
|
20
35
|
(puts "Unrecognized adb version: #$1"; exit 1) unless adb_version_str =~ /Android Debug Bridge version (\d+\.\d+\.\d+)/
|
21
36
|
(puts "adb version 1.0.31 or later required. Version found: #$1"; exit 1) unless Gem::Version.new($1) >= Gem::Version.new('1.0.31')
|
22
|
-
|
23
|
-
|
24
|
-
begin
|
25
|
-
adb_path = `which adb`
|
26
|
-
ENV['ANDROID_HOME'] = File.dirname(File.dirname(adb_path)) if $? == 0
|
27
|
-
rescue Errno::ENOENT
|
28
|
-
puts "Unable to detect adb location: #$!"
|
29
|
-
end
|
30
|
-
end
|
37
|
+
if ENV['ANDROID_HOME'].nil? && (adb_path = which('adb'))
|
38
|
+
ENV['ANDROID_HOME'] = File.dirname(File.dirname(adb_path))
|
31
39
|
end
|
32
40
|
(puts 'You need to set the ANDROID_HOME environment variable.'; exit 1) unless ENV['ANDROID_HOME']
|
33
41
|
|
34
|
-
# FIXME(uwe):
|
35
|
-
dx_filename = File.join(ENV['ANDROID_HOME'], 'platform-tools', ON_WINDOWS ? 'dx.bat' : 'dx')
|
36
|
-
|
37
|
-
|
42
|
+
# FIXME(uwe): Simplify when we stop supporting Android SDK < 22: Don't look in pltform-tools for dx
|
43
|
+
dx_filename = Dir[File.join(ENV['ANDROID_HOME'], '{build-tools/*,platform-tools}', ON_WINDOWS ? 'dx.bat' : 'dx')][-1]
|
44
|
+
# EMXIF
|
45
|
+
|
46
|
+
unless dx_filename
|
47
|
+
puts 'You need to install the Android SDK Build-tools!'
|
38
48
|
exit 1
|
39
49
|
end
|
40
50
|
new_dx_content = File.read(dx_filename).dup
|
41
51
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
xmx_pattern = /^defaultMx="-Xmx(\d+)(M|m|G|g|T|t)"/
|
46
|
-
MINIMUM_DX_HEAP_SIZE = 2048
|
52
|
+
xmx_pattern = ON_WINDOWS ? /^set defaultXmx=-Xmx(\d+)(M|m|G|g|T|t)/ : /^defaultMx="-Xmx(\d+)(M|m|G|g|T|t)"/
|
53
|
+
MINIMUM_DX_HEAP_SIZE = 1536
|
47
54
|
if new_dx_content =~ xmx_pattern &&
|
48
55
|
($1.to_i * 1024 ** {'M' => 2, 'G' => 3, 'T' => 4}[$2.upcase]) < MINIMUM_DX_HEAP_SIZE*1024**2
|
49
56
|
puts "Increasing max heap space from #$1#$2 to #{MINIMUM_DX_HEAP_SIZE}M in #{dx_filename}"
|
50
|
-
|
57
|
+
new_xmx_value = ON_WINDOWS ? %Q{set defaultXmx=-Xmx#{MINIMUM_DX_HEAP_SIZE}M} : %Q{defaultMx="-Xmx#{MINIMUM_DX_HEAP_SIZE}M"}
|
58
|
+
new_dx_content.sub!(xmx_pattern, new_xmx_value)
|
51
59
|
|
52
60
|
# FIXME(uwe): For travis debugging Remove when travis is stable.
|
53
|
-
new_dx_content.sub!(/^exec/, "free\necho Virtual:\nps -e -ovsize=,args= | sort -b -k1,1n | tail -n10\necho RSS:\nps -e -orss=,args= | sort -b -k1,1n | tail -n10\necho $javaOpts\necho $@\nexec") if RbConfig::CONFIG['host_os'] =~ /linux/
|
61
|
+
new_dx_content.sub!(/^exec/, "free\ncat /proc/meminfo\necho Virtual:\nps -e -ovsize=,args= | sort -b -k1,1n | tail -n10\necho RSS:\nps -e -orss=,args= | sort -b -k1,1n | tail -n10\necho $javaOpts\necho $@\njava -XX:+PrintFlagsFinal -version | grep InitialHeapSize\nexec") if RbConfig::CONFIG['host_os'] =~ /linux/
|
54
62
|
# EMXIF
|
55
63
|
|
56
64
|
File.open(dx_filename, 'w') { |f| f << new_dx_content } rescue puts "\n!!! Unable to increase dx heap size !!!\n\n"
|
@@ -504,31 +512,10 @@ def package_installed?(test = false)
|
|
504
512
|
package_name = "#{package}#{'.tests' if test}"
|
505
513
|
loop do
|
506
514
|
path_line = `adb shell pm path #{package_name}`.chomp
|
507
|
-
|
508
|
-
# FIXME(uwe): Debug travis CI. Remove when Travis CI is OK.
|
509
|
-
puts '*' * 80
|
510
|
-
puts 'Output from pm path'
|
511
|
-
puts '*' * 80
|
512
|
-
puts $?.inspect
|
513
|
-
puts '*' * 80
|
514
|
-
puts path_line
|
515
|
-
puts '*' * 80
|
516
|
-
# EMXIF
|
517
|
-
|
518
515
|
return nil if $? == 0 && path_line.empty?
|
519
516
|
break if $? == 0 && path_line =~ /^package:(.*)$/
|
520
|
-
|
521
|
-
# FIXME(uwe): Debug travis CI. Remove when Travis CI is OK.
|
522
|
-
puts '*' * 80
|
523
|
-
puts 'Unexpected output from pm path'
|
524
|
-
puts '*' * 80
|
525
|
-
puts path_line
|
526
|
-
puts '*' * 80
|
527
|
-
# EMXIF
|
528
|
-
|
529
517
|
sleep 0.5
|
530
518
|
end
|
531
|
-
|
532
519
|
path = $1
|
533
520
|
o = `adb shell ls -l #{path}`.chomp
|
534
521
|
raise "Unexpected ls output: #{o}" if o !~ APK_FILE_REGEXP
|
@@ -567,7 +554,11 @@ def build_apk(t, release)
|
|
567
554
|
if release
|
568
555
|
sh "#{ANT_CMD} release"
|
569
556
|
else
|
557
|
+
|
558
|
+
# FIXME(uwe): For travis debugging Remove when travis is stable.
|
570
559
|
sh 'free' if RbConfig::CONFIG['host_os'] =~ /linux/
|
560
|
+
# EMXIF
|
561
|
+
|
571
562
|
sh "#{ANT_CMD} debug"
|
572
563
|
end
|
573
564
|
true
|
@@ -674,15 +665,14 @@ end
|
|
674
665
|
|
675
666
|
def start_emulator(sdk_level)
|
676
667
|
STDOUT.sync = true
|
677
|
-
|
678
|
-
if `uname -m`.chomp == 'x86_64'
|
668
|
+
if RbConfig::CONFIG['host_cpu'] == 'x86_64'
|
679
669
|
emulator_cmd = 'emulator64-arm'
|
680
670
|
else
|
681
671
|
emulator_cmd = 'emulator-arm'
|
682
672
|
end
|
683
673
|
|
684
674
|
emulator_opts = '-partition-size 256'
|
685
|
-
if ENV['DISPLAY'].nil?
|
675
|
+
if !ON_WINDOWS && ENV['DISPLAY'].nil?
|
686
676
|
emulator_opts << ' -no-window -no-audio'
|
687
677
|
end
|
688
678
|
|
@@ -690,10 +680,12 @@ def start_emulator(sdk_level)
|
|
690
680
|
new_snapshot = false
|
691
681
|
|
692
682
|
if `adb devices` =~ /emulator-5554/
|
693
|
-
t = Net::Telnet.new('Host' => 'localhost', 'Port' => 5554, 'Prompt' => /^OK/)
|
683
|
+
t = Net::Telnet.new('Host' => 'localhost', 'Port' => 5554, 'Prompt' => /^OK\n/)
|
684
|
+
t.waitfor(/^OK\n/)
|
694
685
|
output = ''
|
695
686
|
t.cmd('avd name') { |c| output << c }
|
696
|
-
|
687
|
+
t.close
|
688
|
+
if output =~ /(.*)\nOK\n/
|
697
689
|
running_avd_name = $1
|
698
690
|
if running_avd_name == avd_name
|
699
691
|
puts "Emulator #{avd_name} is already running."
|
@@ -702,8 +694,10 @@ def start_emulator(sdk_level)
|
|
702
694
|
puts "Emulator #{running_avd_name} is running."
|
703
695
|
end
|
704
696
|
else
|
705
|
-
|
697
|
+
raise "Unexpected response from emulator: #{output.inspect}"
|
706
698
|
end
|
699
|
+
else
|
700
|
+
puts 'No emulator is running.'
|
707
701
|
end
|
708
702
|
|
709
703
|
loop do
|
@@ -739,17 +733,22 @@ def start_emulator(sdk_level)
|
|
739
733
|
|
740
734
|
unless File.exists? "#{ENV['HOME']}/.android/avd/#{avd_name}.avd"
|
741
735
|
puts "Creating AVD #{avd_name}"
|
736
|
+
puts `echo n | android create avd -a -n #{avd_name} -t android-#{sdk_level} #{abi_opt} -c 64M -s HVGA`
|
737
|
+
if $? != 0
|
738
|
+
puts 'Failed to create AVD.'
|
739
|
+
exit 3
|
740
|
+
end
|
741
|
+
avd_config_file_name = "#{ENV['HOME']}/.android/avd/#{avd_name}.avd/config.ini"
|
742
|
+
old_avd_config = File.read(avd_config_file_name)
|
742
743
|
heap_size = (File.read('AndroidManifest.xml') =~ /largeHeap/) ? 256 : 48
|
743
|
-
|
744
|
-
|
745
|
-
# `sed -i.bak -e "s/vm.heapSize=[0-9]*/vm.heapSize=#{heap_size}/" #{ENV['ANDROID_HOME']}/platforms/*/*/*/hardware.ini`
|
746
|
-
`echo n | android create avd -a -n #{avd_name} -t android-#{sdk_level} #{abi_opt} -c 64M -s HVGA`
|
747
|
-
`sed -i.bak -e "s/vm.heapSize=[0-9]*/vm.heapSize=#{heap_size}/" #{ENV['HOME']}/.android/avd/#{avd_name}.avd/config.ini`
|
744
|
+
new_avd_config = old_avd_config.gsub(/vm.heapSize=([0-9]*)/){|m| p m ; m.to_i < heap_size ? "vm.heapSize=#{heap_size}" : m}
|
745
|
+
File.write(avd_config_file_name, new_avd_config) if new_avd_config != old_avd_config
|
748
746
|
new_snapshot = true
|
749
747
|
end
|
750
748
|
|
751
749
|
puts 'Start emulator'
|
752
|
-
system "emulator -avd #{avd_name} #{emulator_opts} &"
|
750
|
+
system "emulator -avd #{avd_name} #{emulator_opts} #{'&' unless ON_WINDOWS}"
|
751
|
+
return if ON_WINDOWS
|
753
752
|
|
754
753
|
3.times do |i|
|
755
754
|
sleep 1
|
@@ -767,7 +766,7 @@ def start_emulator(sdk_level)
|
|
767
766
|
`killall -0 #{emulator_cmd} 2> /dev/null`
|
768
767
|
if $? != 0
|
769
768
|
puts 'Unable to start the emulator. Retrying without loading snapshot.'
|
770
|
-
system "emulator -no-snapshot-load -avd #{avd_name} #{emulator_opts} &"
|
769
|
+
system "emulator -no-snapshot-load -avd #{avd_name} #{emulator_opts} #{'&' unless ON_WINDOWS}"
|
771
770
|
10.times do |i|
|
772
771
|
`killall -0 #{emulator_cmd} 2> /dev/null`
|
773
772
|
if $? == 0
|
data/lib/ruboto/commands/base.rb
CHANGED
@@ -82,7 +82,7 @@ module Ruboto
|
|
82
82
|
root = File.expand_path(path)
|
83
83
|
puts "\nGenerating Android app #{name} in #{root}..."
|
84
84
|
system "android create project -n #{name} -t #{target} -p #{path} -k #{package} -a #{activity}"
|
85
|
-
exit
|
85
|
+
exit $?.to_i unless $? == 0
|
86
86
|
unless File.exists? path
|
87
87
|
puts 'Android project was not created'
|
88
88
|
exit_failure!
|
@@ -362,6 +362,8 @@ module Ruboto
|
|
362
362
|
when 'ruboto' then
|
363
363
|
puts "\nThe 'ruboto update ruboto' command has been deprecated. Use\n\n ruboto update app\n\ninstead.\n\n"
|
364
364
|
update_ruboto(params['force'].value) || abort
|
365
|
+
else
|
366
|
+
raise "Unknown update target: #{params['what'].value.inspect}"
|
365
367
|
end
|
366
368
|
end
|
367
369
|
end
|
@@ -370,8 +372,19 @@ module Ruboto
|
|
370
372
|
require 'ruboto/util/setup'
|
371
373
|
include Ruboto::Util::Setup
|
372
374
|
|
375
|
+
option('target', 't') {
|
376
|
+
description 'sets the target Android API level to set up for (example: -t android-16)'
|
377
|
+
argument :required
|
378
|
+
default Ruboto::SdkVersions::DEFAULT_TARGET_SDK
|
379
|
+
arity -1
|
380
|
+
}
|
381
|
+
|
382
|
+
option('yes', 'y') {
|
383
|
+
description 'answer "yes" to all interactive questions. Will automatically install needed components.'
|
384
|
+
}
|
385
|
+
|
373
386
|
def run
|
374
|
-
setup_ruboto
|
387
|
+
setup_ruboto(params['yes'].value, params['target'].values)
|
375
388
|
end
|
376
389
|
end
|
377
390
|
|
data/lib/ruboto/sdk_locations.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'ruboto/util/setup'
|
2
3
|
|
3
4
|
module Ruboto
|
4
5
|
module SdkLocations
|
6
|
+
extend Ruboto::Util::Setup
|
5
7
|
if ENV['ANDROID_HOME']
|
6
8
|
ANDROID_HOME = ENV['ANDROID_HOME']
|
7
9
|
else
|
8
|
-
adb_location =
|
9
|
-
|
10
|
+
adb_location = which('adb')
|
11
|
+
unless adb_location
|
10
12
|
raise 'Unable to locate the "adb" command. Either set the ANDROID_HOME environment variable or add the location of the "adb" command to your path.'
|
11
13
|
end
|
12
14
|
ANDROID_HOME = File.dirname(File.dirname(Pathname.new(adb_location).realpath))
|
data/lib/ruboto/util/setup.rb
CHANGED
@@ -1,32 +1,41 @@
|
|
1
|
+
require 'pty'
|
1
2
|
require 'ruboto/sdk_versions'
|
2
3
|
|
3
4
|
module Ruboto
|
4
5
|
module Util
|
5
6
|
module Setup
|
6
|
-
|
7
|
-
|
8
|
-
ANDROID_SDK_VERSION = '21.1'
|
7
|
+
REPOSITORY_BASE = 'https://dl-ssl.google.com/android/repository'
|
8
|
+
REPOSITORY_URL = "#{REPOSITORY_BASE}/repository-8.xml"
|
9
9
|
|
10
10
|
#########################################
|
11
11
|
#
|
12
12
|
# Core Set up Method
|
13
13
|
#
|
14
14
|
|
15
|
-
def setup_ruboto
|
16
|
-
|
15
|
+
def setup_ruboto(accept_all, api_levels = [SdkVersions::DEFAULT_TARGET_SDK])
|
16
|
+
@platform_sdk_loc = {}
|
17
|
+
api_levels = [read_project_api_level, *api_levels].compact.uniq
|
18
|
+
install_all(accept_all, api_levels) unless check_all(api_levels)
|
19
|
+
config_path(accept_all)
|
20
|
+
end
|
17
21
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
#
|
23
|
+
# OS independent "which"
|
24
|
+
# From: http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
25
|
+
#
|
26
|
+
def which(cmd)
|
27
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
28
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
29
|
+
exts.each do |ext|
|
30
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
31
|
+
return exe if File.executable? exe
|
32
|
+
end
|
24
33
|
end
|
25
|
-
|
26
|
-
install_all if not check
|
27
|
-
config_path
|
34
|
+
nil
|
28
35
|
end
|
29
36
|
|
37
|
+
private
|
38
|
+
|
30
39
|
#########################################
|
31
40
|
#
|
32
41
|
# Utility Methods
|
@@ -54,13 +63,12 @@ module Ruboto
|
|
54
63
|
end
|
55
64
|
end
|
56
65
|
|
57
|
-
def
|
66
|
+
def read_project_api_level
|
58
67
|
begin
|
59
68
|
return $1 if File.read('project.properties') =~ /target=(.*)/
|
60
69
|
rescue
|
61
70
|
# ignored
|
62
71
|
end
|
63
|
-
DEFAULT_TARGET_SDK
|
64
72
|
end
|
65
73
|
|
66
74
|
def path_setup_file
|
@@ -78,19 +86,17 @@ module Ruboto
|
|
78
86
|
end
|
79
87
|
end
|
80
88
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
nil
|
89
|
+
def get_tools_version(type="tool")
|
90
|
+
require 'rexml/document'
|
91
|
+
require 'open-uri'
|
92
|
+
|
93
|
+
doc = REXML::Document.new(open(REPOSITORY_URL))
|
94
|
+
version = doc.root.elements["sdk:#{type}/sdk:revision/sdk:major"].text
|
95
|
+
minor = doc.root.elements["sdk:#{type}/sdk:revision/sdk:minor"]
|
96
|
+
micro = doc.root.elements["sdk:#{type}/sdk:revision/sdk:micro"]
|
97
|
+
version += ".#{minor.text}" if minor
|
98
|
+
version += ".#{micro.text}" if micro
|
99
|
+
version
|
94
100
|
end
|
95
101
|
|
96
102
|
#########################################
|
@@ -98,55 +104,69 @@ module Ruboto
|
|
98
104
|
# Check Methods
|
99
105
|
#
|
100
106
|
|
101
|
-
def check_all
|
107
|
+
def check_all(api_levels)
|
108
|
+
@existing_paths = []
|
102
109
|
@missing_paths = []
|
103
110
|
|
104
|
-
@java_loc = check_for('java', 'Java')
|
111
|
+
@java_loc = check_for('java', 'Java runtime')
|
105
112
|
@javac_loc = check_for('javac', 'Java Compiler')
|
106
113
|
@ant_loc = check_for('ant', 'Apache ANT')
|
107
|
-
|
108
|
-
|
109
|
-
|
114
|
+
check_for_android_sdk
|
115
|
+
check_for_emulator
|
116
|
+
check_for_platform_tools
|
117
|
+
check_for_build_tools
|
118
|
+
api_levels.each { |api_level| check_for_android_platform(api_level) }
|
119
|
+
|
120
|
+
puts
|
121
|
+
ok = @java_loc && @javac_loc && @ant_loc && @android_loc && @emulator_loc && @adb_loc && @dx_loc && @platform_sdk_loc.all? { |_, path| !path.nil? }
|
122
|
+
puts " #{ok ? '*** Ruboto setup is OK! ***' : '!!! Ruboto setup is NOT OK !!!'}\n\n"
|
123
|
+
ok
|
124
|
+
end
|
125
|
+
|
126
|
+
def check_for_emulator
|
127
|
+
@emulator_loc = check_for('emulator', 'Android Emulator',
|
128
|
+
File.join(File.expand_path('~'), android_package_directory, 'tools', 'emulator'))
|
129
|
+
end
|
130
|
+
|
131
|
+
def check_for_platform_tools
|
110
132
|
@adb_loc = check_for('adb', 'Android SDK Command adb',
|
111
133
|
File.join(File.expand_path('~'), android_package_directory, 'platform-tools', 'adb'))
|
112
|
-
|
113
|
-
check_for_android_platform
|
134
|
+
end
|
114
135
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
136
|
+
def check_for_build_tools
|
137
|
+
@dx_loc = check_for('dx', 'Android SDK Command dx',
|
138
|
+
Dir[File.join(File.expand_path('~'), android_package_directory, 'build-tools', '*', 'dx')][-1])
|
139
|
+
end
|
140
|
+
|
141
|
+
def check_for_android_sdk
|
142
|
+
@android_loc = check_for('android', 'Android Package Installer',
|
143
|
+
File.join(File.expand_path('~'), android_package_directory, 'tools', 'android'))
|
123
144
|
end
|
124
145
|
|
125
146
|
def check_for(cmd, pretty_name=nil, alt_dir=nil)
|
126
147
|
rv = which(cmd)
|
127
148
|
rv = nil if rv.nil? or rv.empty?
|
128
149
|
|
129
|
-
if rv
|
150
|
+
if rv
|
151
|
+
@existing_paths << File.dirname(rv)
|
152
|
+
elsif alt_dir and File.exists?(alt_dir)
|
130
153
|
rv = alt_dir
|
131
154
|
ENV['PATH'] = "#{File.dirname(rv)}:#{ENV['PATH']}"
|
132
155
|
@missing_paths << "#{File.dirname(rv)}"
|
133
156
|
end
|
134
157
|
|
135
|
-
puts "#{pretty_name || cmd}:
|
158
|
+
puts "#{'%-25s' % (pretty_name || cmd)}: #{(rv ? 'Found' : 'Not found')}"
|
136
159
|
rv
|
137
160
|
end
|
138
161
|
|
139
|
-
def check_for_android_platform
|
162
|
+
def check_for_android_platform(api_level)
|
140
163
|
begin
|
141
|
-
@platform_sdk_loc = File.expand_path "#{@
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
puts 'Android platform SDK: Not found'
|
146
|
-
@platform_sdk_loc = nil
|
147
|
-
end
|
164
|
+
@platform_sdk_loc[api_level] = File.expand_path "#{@android_loc}/../../platforms/#{api_level}"
|
165
|
+
found = File.exists? @platform_sdk_loc[api_level]
|
166
|
+
@platform_sdk_loc[api_level] = nil unless found
|
167
|
+
puts "#{'%-25s' % "Platform SDK #{api_level}"}: #{(found ? 'Found' : 'Not found')}"
|
148
168
|
rescue
|
149
|
-
@platform_sdk_loc = nil
|
169
|
+
@platform_sdk_loc[api_level] = nil
|
150
170
|
end
|
151
171
|
end
|
152
172
|
|
@@ -155,14 +175,19 @@ module Ruboto
|
|
155
175
|
# Install Methods
|
156
176
|
#
|
157
177
|
|
158
|
-
def install_all
|
159
|
-
install_java
|
160
|
-
|
161
|
-
|
162
|
-
|
178
|
+
def install_all(accept_all, api_levels)
|
179
|
+
install_java(accept_all) unless @java_loc && @javac_loc
|
180
|
+
install_ant(accept_all) unless @ant_loc
|
181
|
+
install_android_sdk(accept_all) unless @android_loc
|
182
|
+
install_android_tools(accept_all) unless @dx_loc && @adb_loc && @emulator_loc # build-tools, platform-tools and tools
|
183
|
+
if @android_loc
|
184
|
+
api_levels.each do |api_level|
|
185
|
+
install_platform(accept_all, api_level) unless @platform_sdk_loc[api_level]
|
186
|
+
end
|
187
|
+
end
|
163
188
|
end
|
164
189
|
|
165
|
-
def install_java
|
190
|
+
def install_java(accept_all)
|
166
191
|
case RbConfig::CONFIG['host_os']
|
167
192
|
when /^darwin(.*)/
|
168
193
|
when /^linux(.*)/
|
@@ -175,23 +200,105 @@ module Ruboto
|
|
175
200
|
# exit /b 1
|
176
201
|
#)
|
177
202
|
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
203
|
+
puts 'Java JDK was not found.'
|
204
|
+
unless accept_all
|
205
|
+
print 'Would you like to download and install it? (Y/n): '
|
206
|
+
a = STDIN.gets.chomp.upcase
|
207
|
+
end
|
208
|
+
if accept_all || a == 'Y' || a.empty?
|
209
|
+
java_installer_file_name = 'jdk-7-windows-x64.exe'
|
210
|
+
require 'net/http'
|
211
|
+
require 'net/https'
|
212
|
+
resp = nil
|
213
|
+
@cookies = %w(gpw_e24=http%3A%2F%2Fwww.oracle.com)
|
214
|
+
puts 'Downloading...'
|
215
|
+
Net::HTTP.start('download.oracle.com') do |http|
|
216
|
+
resp, _ = http.get("/otn-pub/java/jdk/7/#{java_installer_file_name}", cookie_header)
|
217
|
+
resp.body
|
218
|
+
end
|
219
|
+
resp = process_response(resp)
|
220
|
+
open(java_installer_file_name, 'wb') { |file| file.write(resp.body) }
|
221
|
+
puts "Installing #{java_installer_file_name}..."
|
222
|
+
system java_installer_file_name
|
223
|
+
raise "Unexpected exit code while installing Java: #{$?}" unless $? == 0
|
224
|
+
FileUtils.rm_f java_installer_file_name
|
225
|
+
else
|
226
|
+
puts
|
227
|
+
puts 'You can download and install the Java JDK manually from'
|
228
|
+
puts 'http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html'
|
229
|
+
puts
|
230
|
+
end
|
231
|
+
unless check_for('javac')
|
232
|
+
ENV['JAVA_HOME'] = 'c:\\Program Files\\Java\\jdk1.7.0'
|
233
|
+
if Dir.exists?(ENV['JAVA_HOME'])
|
234
|
+
@javac_loc = "#{ENV['JAVA_HOME'].gsub('\\', '/')}/bin/javac"
|
235
|
+
puts "Setting the JAVA_HOME environment variable to #{ENV['JAVA_HOME']}"
|
236
|
+
system %Q{setx JAVA_HOME "#{ENV['JAVA_HOME']}"}
|
237
|
+
@missing_paths << "#{File.dirname(@javac_loc)}"
|
238
|
+
end
|
239
|
+
end
|
240
|
+
else
|
241
|
+
raise "Unknown host os: #{RbConfig::CONFIG['host_os']}"
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def install_ant(accept_all)
|
246
|
+
case RbConfig::CONFIG['host_os']
|
247
|
+
when /^darwin(.*)/
|
248
|
+
when /^linux(.*)/
|
249
|
+
when /^mswin32|windows(.*)/
|
250
|
+
# FIXME(uwe): Detect and warn if we are not "elevated" with adminstrator rights.
|
251
|
+
#set IS_ELEVATED=0
|
252
|
+
#whoami /groups | findstr /b /c:"Mandatory Label\High Mandatory Level" | findstr /c:"Enabled group" > nul: && set IS_ELEVATED=1
|
253
|
+
#if %IS_ELEVATED%==0 (
|
254
|
+
# echo You must run the command prompt as administrator to install.
|
255
|
+
# exit /b 1
|
256
|
+
#)
|
257
|
+
|
258
|
+
puts 'Apache ANT was not found.'
|
259
|
+
unless accept_all
|
260
|
+
print 'Would you like to download and install it? (Y/n): '
|
261
|
+
a = STDIN.gets.chomp.upcase
|
262
|
+
end
|
263
|
+
if accept_all || a == 'Y' || a.empty?
|
264
|
+
Dir.chdir Dir.home do
|
265
|
+
ant_package_file_name = 'apache-ant-1.9.0-bin.tar.gz'
|
266
|
+
require 'net/http'
|
267
|
+
require 'net/https'
|
268
|
+
puts 'Downloading...'
|
269
|
+
Net::HTTP.start('apache.vianett.no') do |http|
|
270
|
+
resp, _ = http.get("/ant/binaries/#{ant_package_file_name}")
|
271
|
+
open(ant_package_file_name, 'wb') { |file| file.write(resp.body) }
|
272
|
+
end
|
273
|
+
puts "Installing #{ant_package_file_name}..."
|
274
|
+
require 'rubygems/package'
|
275
|
+
require 'zlib'
|
276
|
+
Gem::Package::TarReader.new(Zlib::GzipReader.open(ant_package_file_name)).each do |entry|
|
277
|
+
puts entry.full_name
|
278
|
+
if entry.directory?
|
279
|
+
FileUtils.mkdir_p entry.full_name
|
280
|
+
elsif entry.file?
|
281
|
+
FileUtils.mkdir_p File.dirname(entry.full_name)
|
282
|
+
File.open(entry.full_name, 'wb') { |f| f << entry.read }
|
283
|
+
end
|
284
|
+
end
|
285
|
+
FileUtils.rm_f ant_package_file_name
|
286
|
+
end
|
287
|
+
else
|
288
|
+
puts
|
289
|
+
puts 'You can download and install Apache ANT manually from'
|
290
|
+
puts 'http://ant.apache.org/bindownload.cgi'
|
291
|
+
puts
|
292
|
+
end
|
293
|
+
unless check_for('ant')
|
294
|
+
ENV['ANT_HOME'] = File.expand_path(File.join('~', 'apache-ant-1.9.0')).gsub('/', '\\')
|
295
|
+
if Dir.exists?(ENV['ANT_HOME'])
|
296
|
+
@ant_loc = "#{ENV['ANT_HOME'].gsub('\\', '/')}/bin/ant"
|
297
|
+
puts "Setting the ANT_HOME environment variable to #{ENV['ANT_HOME']}"
|
298
|
+
system %Q{setx ANT_HOME "#{ENV['ANT_HOME']}"}
|
299
|
+
@missing_paths << "#{File.dirname(@ant_loc)}"
|
300
|
+
end
|
187
301
|
end
|
188
|
-
resp = process_response(resp)
|
189
|
-
open(java_installer_file_name, 'wb') { |file| file.write(resp.body) }
|
190
|
-
puts "Installing #{java_installer_file_name}..."
|
191
|
-
system java_installer_file_name
|
192
|
-
raise "Unexpected exit code while installing Java: #{$?}" unless $? == 0
|
193
|
-
FileUtils.rm_f java_installer_file_name
|
194
|
-
return
|
195
302
|
else
|
196
303
|
raise "Unknown host os: #{RbConfig::CONFIG['host_os']}"
|
197
304
|
end
|
@@ -201,7 +308,6 @@ module Ruboto
|
|
201
308
|
return {} if @cookies.empty?
|
202
309
|
{'Cookie' => @cookies.join(';')}
|
203
310
|
end
|
204
|
-
private :cookie_header
|
205
311
|
|
206
312
|
def store_cookie(response)
|
207
313
|
return unless response['set-cookie']
|
@@ -217,7 +323,6 @@ module Ruboto
|
|
217
323
|
end
|
218
324
|
@cookies.uniq!
|
219
325
|
end
|
220
|
-
private :store_cookie
|
221
326
|
|
222
327
|
def process_response(response)
|
223
328
|
store_cookie(response)
|
@@ -243,23 +348,24 @@ module Ruboto
|
|
243
348
|
end
|
244
349
|
response
|
245
350
|
end
|
246
|
-
private :process_response
|
247
351
|
|
248
|
-
def
|
352
|
+
def install_android_sdk(accept_all)
|
249
353
|
unless @android_loc
|
250
354
|
puts 'Android package installer not found.'
|
251
|
-
|
252
|
-
|
253
|
-
|
355
|
+
unless accept_all
|
356
|
+
print 'Would you like to download and install it? (Y/n): '
|
357
|
+
a = STDIN.gets.chomp.upcase
|
358
|
+
end
|
359
|
+
if accept_all || a == 'Y' || a.empty?
|
254
360
|
Dir.chdir File.expand_path('~/') do
|
255
361
|
case RbConfig::CONFIG['host_os']
|
256
362
|
when /^darwin(.*)/
|
257
|
-
asdk_file_name = "android-sdk_r#{
|
363
|
+
asdk_file_name = "android-sdk_r#{get_tools_version}-#{android_package_os_id}.zip"
|
258
364
|
system "wget http://dl.google.com/android/#{asdk_file_name}"
|
259
|
-
system "unzip #{asdk_file_name}"
|
365
|
+
system "unzip #{'-o ' if accept_all}#{asdk_file_name}"
|
260
366
|
system "rm #{asdk_file_name}"
|
261
367
|
when /^linux(.*)/
|
262
|
-
asdk_file_name = "android-sdk_r#{
|
368
|
+
asdk_file_name = "android-sdk_r#{get_tools_version}-#{android_package_os_id}.tgz"
|
263
369
|
system "wget http://dl.google.com/android/#{asdk_file_name}"
|
264
370
|
system "tar -xzf #{asdk_file_name}"
|
265
371
|
system "rm #{asdk_file_name}"
|
@@ -272,7 +378,7 @@ module Ruboto
|
|
272
378
|
# exit /b 1
|
273
379
|
#)
|
274
380
|
|
275
|
-
asdk_file_name = "installer_r#{
|
381
|
+
asdk_file_name = "installer_r#{get_tools_version}-#{android_package_os_id}.exe"
|
276
382
|
require 'net/http'
|
277
383
|
Net::HTTP.start('dl.google.com') do |http|
|
278
384
|
puts 'Downloading...'
|
@@ -288,36 +394,72 @@ module Ruboto
|
|
288
394
|
raise "Unknown host os: #{RbConfig::CONFIG['host_os']}"
|
289
395
|
end
|
290
396
|
end
|
291
|
-
|
292
|
-
|
397
|
+
end
|
398
|
+
check_for_android_sdk
|
399
|
+
unless @android_loc
|
400
|
+
ENV['ANDROID_HOME'] = @android_loc.gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
|
401
|
+
puts "Setting the ANDROID_HOME environment variable to #{ENV['ANDROID_HOME']}"
|
402
|
+
system %Q{setx ANDROID_HOME "#{ENV['ANDROID_HOME']}"}
|
293
403
|
@missing_paths << "#{File.dirname(@android_loc)}"
|
294
404
|
end
|
295
405
|
end
|
296
406
|
end
|
297
407
|
|
298
|
-
def
|
299
|
-
if @android_loc and
|
300
|
-
puts 'Android
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
408
|
+
def install_android_tools(accept_all)
|
409
|
+
if @android_loc and (@dx_loc.nil? || @adb_loc.nil? || @emulator_loc.nil?)
|
410
|
+
puts 'Android tools not found.'
|
411
|
+
unless accept_all
|
412
|
+
print 'Would you like to download and install it? (Y/n): '
|
413
|
+
a = STDIN.gets.chomp.upcase
|
414
|
+
end
|
415
|
+
if accept_all || a == 'Y' || a.empty?
|
416
|
+
update_cmd = "android --silent update sdk --no-ui --filter build-tools-#{get_tools_version('build-tool')},platform-tool,tool --force"
|
417
|
+
update_sdk(update_cmd, accept_all)
|
418
|
+
check_for_build_tools
|
419
|
+
check_for_platform_tools
|
420
|
+
check_for_emulator
|
308
421
|
end
|
309
422
|
end
|
310
423
|
end
|
311
424
|
|
312
|
-
def install_platform
|
313
|
-
|
314
|
-
|
425
|
+
def install_platform(accept_all, api_level)
|
426
|
+
puts "Android platform SDK for #{api_level} not found."
|
427
|
+
unless accept_all
|
315
428
|
print 'Would you like to download and install it? (Y/n): '
|
316
429
|
a = STDIN.gets.chomp.upcase
|
317
|
-
|
318
|
-
|
319
|
-
|
430
|
+
end
|
431
|
+
if accept_all || a == 'Y' || a.empty?
|
432
|
+
update_cmd = "android --silent update sdk --no-ui --filter #{api_level},sysimg-#{api_level.slice(/\d+$/)} --all"
|
433
|
+
update_sdk(update_cmd, accept_all)
|
434
|
+
check_for_android_platform(api_level)
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
def update_sdk(update_cmd, accept_all)
|
439
|
+
if accept_all
|
440
|
+
begin
|
441
|
+
PTY.spawn(update_cmd) do |stdin, stdout, pid|
|
442
|
+
begin
|
443
|
+
output = ''
|
444
|
+
question_pattern = /.*Do you accept the license '[a-z-]+-[0-9a-f]{8}' \[y\/n\]: /m
|
445
|
+
STDOUT.sync = true
|
446
|
+
stdin.each_char do |text|
|
447
|
+
print text
|
448
|
+
output << text
|
449
|
+
if output =~ question_pattern
|
450
|
+
stdout.puts 'y'
|
451
|
+
output.sub! question_pattern, ''
|
452
|
+
end
|
453
|
+
end
|
454
|
+
rescue Errno::EIO
|
455
|
+
# This probably just means that the process has finished giving output.
|
456
|
+
end
|
457
|
+
end
|
458
|
+
rescue PTY::ChildExited
|
459
|
+
puts 'The child process exited!'
|
320
460
|
end
|
461
|
+
else
|
462
|
+
system update_cmd
|
321
463
|
end
|
322
464
|
end
|
323
465
|
|
@@ -326,32 +468,53 @@ module Ruboto
|
|
326
468
|
# Path Config Method
|
327
469
|
#
|
328
470
|
|
329
|
-
def config_path
|
471
|
+
def config_path(accept_all)
|
330
472
|
unless @missing_paths.empty?
|
331
473
|
if RbConfig::CONFIG['host_os'] =~ /^mswin32|windows(.*)/
|
332
474
|
puts "\nYou are missing some paths. Execute these lines to add them:\n\n"
|
333
475
|
@missing_paths.each do |path|
|
334
476
|
puts %Q{ set PATH="#{path.gsub '/', '\\'};%PATH%"}
|
335
477
|
end
|
336
|
-
system %Q{setx PATH "%PATH%;#{@missing_paths.map{|path| path.gsub '/', '\\'}.join(';')}"}
|
478
|
+
system %Q{setx PATH "%PATH%;#{@missing_paths.map { |path| path.gsub '/', '\\' }.join(';')}"}
|
337
479
|
else
|
338
480
|
puts "\nYou are missing some paths. Execute these lines to add them:\n\n"
|
339
481
|
@missing_paths.each do |path|
|
340
482
|
puts %Q{ export PATH="#{path}:$PATH"}
|
341
483
|
end
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
484
|
+
puts
|
485
|
+
unless accept_all
|
486
|
+
print "\nWould you like to append these lines to your configuration script? (Y/n): "
|
487
|
+
a = STDIN.gets.chomp.upcase
|
488
|
+
end
|
489
|
+
if accept_all || a == 'Y' || a.empty?
|
490
|
+
unless accept_all
|
491
|
+
print "What script do you use to configure your PATH? (#{path_setup_file}): "
|
492
|
+
a = STDIN.gets.chomp.downcase
|
493
|
+
end
|
494
|
+
rubotorc = '~/.rubotorc'
|
495
|
+
File.open(File.expand_path(rubotorc), 'w') do |f|
|
496
|
+
(@existing_paths + @missing_paths - %w(/usr/bin)).uniq.sort.each do |path|
|
497
|
+
f << %Q{PATH="#{path}:$PATH"\n}
|
498
|
+
end
|
353
499
|
end
|
354
|
-
|
500
|
+
config_file_name = File.expand_path("~/#{a.nil? || a.empty? ? path_setup_file : a}")
|
501
|
+
old_config = File.read(config_file_name)
|
502
|
+
new_config = old_config.dup
|
503
|
+
|
504
|
+
# FIXME(uwe): Remove for Ruboto > 0.13.0
|
505
|
+
new_config.gsub! /\n*# BEGIN Ruboto PATH setup\n.*?\n# END Ruboto PATH setup\n*/m, ''
|
506
|
+
# EMXIF
|
507
|
+
|
508
|
+
new_config.gsub! /\n*# BEGIN Ruboto setup\n.*?\n# END Ruboto setup\n*/m, ''
|
509
|
+
new_config << "\n\n# BEGIN Ruboto setup\n"
|
510
|
+
new_config << "source #{rubotorc}\n"
|
511
|
+
new_config << "# END Ruboto setup\n\n"
|
512
|
+
File.open(config_file_name, 'wb') { |f| f << new_config }
|
513
|
+
puts "Updated #{config_file_name} to load the #{rubotorc} config file."
|
514
|
+
puts 'Please close your command window and reopen, or run'
|
515
|
+
puts
|
516
|
+
puts " source #{rubotorc}"
|
517
|
+
puts
|
355
518
|
end
|
356
519
|
end
|
357
520
|
end
|
data/lib/ruboto/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0.rc.0
|
5
|
+
prerelease: 7
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Daniel Jackoway
|
@@ -11,41 +12,50 @@ authors:
|
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
|
-
date: 2013-05-
|
15
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
15
16
|
dependencies:
|
16
17
|
- !ruby/object:Gem::Dependency
|
17
18
|
name: main
|
18
19
|
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
19
21
|
requirements:
|
20
|
-
- - '>='
|
22
|
+
- - ! '>='
|
21
23
|
- !ruby/object:Gem::Version
|
22
24
|
version: 4.7.2
|
23
25
|
type: :runtime
|
24
26
|
prerelease: false
|
25
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
26
29
|
requirements:
|
27
|
-
- - '>='
|
30
|
+
- - ! '>='
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: 4.7.2
|
30
33
|
- !ruby/object:Gem::Dependency
|
31
34
|
name: rake
|
32
35
|
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
33
37
|
requirements:
|
34
|
-
- - '>='
|
38
|
+
- - ! '>='
|
35
39
|
- !ruby/object:Gem::Version
|
36
40
|
version: '0'
|
37
|
-
type: :
|
41
|
+
type: :runtime
|
38
42
|
prerelease: false
|
39
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
40
45
|
requirements:
|
41
|
-
- - '>='
|
46
|
+
- - ! '>='
|
42
47
|
- !ruby/object:Gem::Version
|
43
48
|
version: '0'
|
44
|
-
description:
|
45
|
-
|
49
|
+
description: ! 'Ruboto (JRuby on Android) is a platform for developing full stand-alone
|
50
|
+
apps for
|
51
|
+
|
46
52
|
Android using the Ruby language and libraries. It includes support libraries
|
53
|
+
|
47
54
|
and generators for creating projects, classes, tests, and more. The complete
|
55
|
+
|
48
56
|
APIs of Android, Java, and Ruby are available to you using the Ruby language.
|
57
|
+
|
58
|
+
'
|
49
59
|
email: ruboto@googlegroups.com
|
50
60
|
executables:
|
51
61
|
- ruboto
|
@@ -55,19 +65,15 @@ files:
|
|
55
65
|
- Gemfile
|
56
66
|
- Gemfile.lock
|
57
67
|
- LICENSE
|
58
|
-
- README.md
|
59
68
|
- Rakefile
|
60
|
-
-
|
61
|
-
- assets/.gitignore
|
62
|
-
- assets/Rakefile
|
69
|
+
- README.md
|
63
70
|
- assets/libs/dx.jar
|
71
|
+
- assets/Rakefile
|
64
72
|
- assets/rakelib/ruboto.rake
|
65
|
-
- assets/res
|
73
|
+
- assets/res/drawable/get_ruboto_core.png
|
66
74
|
- assets/res/drawable-hdpi/ic_launcher.png
|
67
75
|
- assets/res/drawable-ldpi/ic_launcher.png
|
68
76
|
- assets/res/drawable-mdpi/ic_launcher.png
|
69
|
-
- assets/res/drawable/.DS_Store
|
70
|
-
- assets/res/drawable/get_ruboto_core.png
|
71
77
|
- assets/res/layout/get_ruboto_core.xml
|
72
78
|
- assets/samples/sample_activity.rb
|
73
79
|
- assets/samples/sample_activity_test.rb
|
@@ -81,9 +87,6 @@ files:
|
|
81
87
|
- assets/src/InheritingBroadcastReceiver.java
|
82
88
|
- assets/src/InheritingClass.java
|
83
89
|
- assets/src/InheritingService.java
|
84
|
-
- assets/src/RubotoActivity.java
|
85
|
-
- assets/src/RubotoBroadcastReceiver.java
|
86
|
-
- assets/src/RubotoService.java
|
87
90
|
- assets/src/org/ruboto/EntryPointActivity.java
|
88
91
|
- assets/src/org/ruboto/JRubyAdapter.java
|
89
92
|
- assets/src/org/ruboto/Log.java
|
@@ -103,12 +106,18 @@ files:
|
|
103
106
|
- assets/src/ruboto/util/stack.rb
|
104
107
|
- assets/src/ruboto/util/toast.rb
|
105
108
|
- assets/src/ruboto/widget.rb
|
109
|
+
- assets/src/RubotoActivity.java
|
110
|
+
- assets/src/RubotoBroadcastReceiver.java
|
111
|
+
- assets/src/RubotoService.java
|
106
112
|
- assets/test/src/test_helper.rb
|
113
|
+
- assets/.DS_Store
|
114
|
+
- assets/.gitignore
|
115
|
+
- assets/res/.DS_Store
|
116
|
+
- assets/res/drawable/.DS_Store
|
107
117
|
- bin/ruboto
|
108
118
|
- lib/DalvikProxyClassFactory.java
|
109
119
|
- lib/DexClient.java
|
110
120
|
- lib/java_class_gen/android_api.xml
|
111
|
-
- lib/ruboto.rb
|
112
121
|
- lib/ruboto/api.rb
|
113
122
|
- lib/ruboto/commands/base.rb
|
114
123
|
- lib/ruboto/core_ext/array.rb
|
@@ -129,6 +138,7 @@ files:
|
|
129
138
|
- lib/ruboto/util/verify.rb
|
130
139
|
- lib/ruboto/util/xml_element.rb
|
131
140
|
- lib/ruboto/version.rb
|
141
|
+
- lib/ruboto.rb
|
132
142
|
- test/activity/call_super_activity.rb
|
133
143
|
- test/activity/call_super_activity_test.rb
|
134
144
|
- test/activity/dir_and_file_activity.rb
|
@@ -177,25 +187,26 @@ files:
|
|
177
187
|
homepage: http://ruboto.org/
|
178
188
|
licenses:
|
179
189
|
- MIT
|
180
|
-
metadata: {}
|
181
190
|
post_install_message:
|
182
191
|
rdoc_options: []
|
183
192
|
require_paths:
|
184
193
|
- lib
|
185
194
|
required_ruby_version: !ruby/object:Gem::Requirement
|
195
|
+
none: false
|
186
196
|
requirements:
|
187
|
-
- - '>='
|
197
|
+
- - ! '>='
|
188
198
|
- !ruby/object:Gem::Version
|
189
199
|
version: '0'
|
190
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
191
202
|
requirements:
|
192
|
-
- - '
|
203
|
+
- - ! '>'
|
193
204
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
205
|
+
version: 1.3.1
|
195
206
|
requirements: []
|
196
207
|
rubyforge_project: ruboto/ruboto
|
197
|
-
rubygems_version:
|
208
|
+
rubygems_version: 1.8.25
|
198
209
|
signing_key:
|
199
|
-
specification_version:
|
210
|
+
specification_version: 3
|
200
211
|
summary: A platform for developing apps using JRuby on Android.
|
201
212
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: e168f6e2a533fb4ab7c97406bed3abc55d9b2f8a
|
4
|
-
data.tar.gz: 617d03520fe138e398425e6e959524f98def6900
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: c61a80b14c92eb6fa98ef657928b8ba720cbde9dbd5a2c5b1d00926b0ea2be3d1809a62fb105f9f38ea261a6cfc9100bb5b8f7540e0410e7854f652ffe985fc5
|
7
|
-
data.tar.gz: 221be24b4f6ede0f49c4d6c9f05dfddd022b3a82d966998f94fb66800e0aec36ae2b0403959bede0b51d972df4b5bd9f36fded23e41a23f0296574185f482756
|