android-sdk-installer 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/android-sdk-installer +6 -6
- data/lib/android-sdk-installer.rb +60 -55
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f656e032c4d07ee26c4e5ef56c28b6652c93d36e
|
4
|
+
data.tar.gz: a3e55863486002d1fd308b0208dfbacc68c2b892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ba1729a3f71db078bb106f9b87dfd12d707d7f193f8e16d723aa174bfaf3fadc1ef5b3f4b91852f560e21d437da3eaacfbd779b0b3080cad7b4888ee18c2758
|
7
|
+
data.tar.gz: 34beb0fd5e6b7a41f91805449f054d367853d72c968e13e3aae1b802995267aa3c4bc1201c775ad10393c757148c923b6e604c0d2af1372dac391a9436528776
|
data/bin/android-sdk-installer
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'android-sdk-installer'
|
4
|
-
|
5
|
-
installer = AndroidInstaller::Installer.new
|
6
|
-
installer.install
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'android-sdk-installer'
|
4
|
+
|
5
|
+
installer = AndroidInstaller::Installer.new
|
6
|
+
installer.install
|
@@ -1,55 +1,60 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
require 'logger'
|
3
|
-
|
4
|
-
module AndroidInstaller
|
5
|
-
# Installs components for building Android projects
|
6
|
-
# noinspection RubyClassVariableUsageInspection
|
7
|
-
class Installer
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@@logger = Logger.new(STDOUT)
|
11
|
-
@@logger.level = Logger::WARN
|
12
|
-
end
|
13
|
-
|
14
|
-
def install
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
@@logger.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
1
|
+
require 'yaml'
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
module AndroidInstaller
|
5
|
+
# Installs components for building Android projects
|
6
|
+
# noinspection RubyClassVariableUsageInspection
|
7
|
+
class Installer
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@@logger = Logger.new(STDOUT)
|
11
|
+
@@logger.level = Logger::WARN
|
12
|
+
end
|
13
|
+
|
14
|
+
def install
|
15
|
+
# Why is it formatted like this?
|
16
|
+
key_sdk_tools = '{ANDROID_SDK_TOOLS}'
|
17
|
+
key_platform = '{PLATFORM}'
|
18
|
+
sdk_url = 'https://dl.google.com'
|
19
|
+
sdk_path = '/android/repository/sdk-tools-' + key_platform + '-' + key_sdk_tools + '.zip'
|
20
|
+
# Validation
|
21
|
+
unless File.file?('android-sdk-installer.yml')
|
22
|
+
puts "\nNo config file found. You need a file called `android-sdk-installer.yml` with the configuration. See the README for details\n\n"
|
23
|
+
exit(1)
|
24
|
+
end
|
25
|
+
config = YAML.load_file('android-sdk-installer.yml')
|
26
|
+
version = '3859397'
|
27
|
+
if config.has_key?('version')
|
28
|
+
version = config['version']
|
29
|
+
end
|
30
|
+
if config['debug']
|
31
|
+
@@logger.level = Logger::DEBUG
|
32
|
+
@@logger.debug('We are in debug mode')
|
33
|
+
end
|
34
|
+
|
35
|
+
platform = 'linux'
|
36
|
+
if config.has_key?('platform')
|
37
|
+
platform = config['platform']
|
38
|
+
end
|
39
|
+
sdk_path[key_sdk_tools] = version
|
40
|
+
sdk_path[key_platform] = platform
|
41
|
+
@@logger.debug('Downloading version ' + version + ' for platform ' + platform + ' with url ' + sdk_url + sdk_path)
|
42
|
+
`wget --quiet --output-document=android-sdk.zip #{sdk_url + sdk_path}`
|
43
|
+
# TODO: error out here if file not found
|
44
|
+
@@logger.debug('Unzipping android-sdk.zip')
|
45
|
+
`unzip -q android-sdk.zip -d $PWD/android-sdk`
|
46
|
+
`rm android-sdk.zip`
|
47
|
+
`export ANDROID_HOME=$PWD/android-sdk`
|
48
|
+
components = config['components']
|
49
|
+
components.each do |component|
|
50
|
+
@@logger.debug('Installing component ' + component)
|
51
|
+
output = `echo y | $ANDROID_HOME/tools/bin/sdkmanager "#{component}"`
|
52
|
+
@@logger.debug(output)
|
53
|
+
if output.include? 'Warning'
|
54
|
+
puts "\nError installing component " + component + "\n"
|
55
|
+
puts output
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: android-sdk-installer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Commit 451
|
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
43
|
rubyforge_project:
|
44
|
-
rubygems_version: 2.6.
|
44
|
+
rubygems_version: 2.6.8
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Android SDK installer
|