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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e65b649a3300a1e933e02c7e34ea1ceb93ed3509
4
- data.tar.gz: f5d6bb98320506339ec3047f03721b0710cbefe4
3
+ metadata.gz: f656e032c4d07ee26c4e5ef56c28b6652c93d36e
4
+ data.tar.gz: a3e55863486002d1fd308b0208dfbacc68c2b892
5
5
  SHA512:
6
- metadata.gz: df2cbea855f46c8e0b0eb1c065fd33d5e0baf9b1abbd7dd3de08b03c28276e9c8f06d431b120bcb01e27b8a24fc283700f12fde566ec0c9057d11e8778583a76
7
- data.tar.gz: d50bbaafd0848bcfa1c4152a6396660398fa1a462106c55716ac8a37ee51b19828c326c903f1ade4e98c2c8708c3fad168e44a7ed8ec497e3d7eb7ba02157b04
6
+ metadata.gz: 5ba1729a3f71db078bb106f9b87dfd12d707d7f193f8e16d723aa174bfaf3fadc1ef5b3f4b91852f560e21d437da3eaacfbd779b0b3080cad7b4888ee18c2758
7
+ data.tar.gz: 34beb0fd5e6b7a41f91805449f054d367853d72c968e13e3aae1b802995267aa3c4bc1201c775ad10393c757148c923b6e604c0d2af1372dac391a9436528776
@@ -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
- key_sdk_tools = '{ANDROID_SDK_TOOLS}'
16
- key_platform = '{PLATFORM}'
17
- sdk_url = 'https://dl.google.com'
18
- sdk_path = '/android/repository/tools_r' + key_sdk_tools + '-' + key_platform + '.zip'
19
- # Validation
20
- unless File.file?('android-sdk-installer.yml')
21
- puts "\nNo config file found. You need a file called `android-sdk-installer.yml` with the configuration. See the README for details\n\n"
22
- exit(1)
23
- end
24
- config = YAML.load_file('android-sdk-installer.yml')
25
- unless config.has_key?('version')
26
- puts "\nError in config file! Build file must contain a `version` string.\n\n"
27
- exit(1)
28
- end
29
- if config['debug']
30
- @@logger.level = Logger::DEBUG
31
- @@logger.debug('We are in debug mode')
32
- end
33
- version = config['version']
34
- platform = config['platform']
35
- sdk_path[key_sdk_tools] = version
36
- sdk_path[key_platform] = platform
37
- @@logger.debug('Installing version ' + version + ' for platform ' + platform + ' with url ' + sdk_url + sdk_path)
38
- exec('wget --quiet --output-document=android-sdk.zip ' + sdk_url + sdk_path)
39
- exec('unzip -q android-sdk.zip -d android-sdk')
40
- exec('rm android-sdk.zip')
41
- exec('export ANDROID_HOME=$PWD/android-sdk')
42
- components = config['components']
43
- components.each {|component|
44
- @@logger.debug('Installing component ' + component)
45
- output = exec('echo y | $ANDROID_HOME/tools/bin/sdkmanager ' + component)
46
- @@logger.debug(output)
47
- puts output
48
- if output.include? 'Warning'
49
- puts "\nError installing component " + component + "\n"
50
- puts output
51
- end
52
- }
53
- end
54
- end
55
- end
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.2
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.11
44
+ rubygems_version: 2.6.8
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: Android SDK installer