android-sdk-installer 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e65b649a3300a1e933e02c7e34ea1ceb93ed3509
4
+ data.tar.gz: f5d6bb98320506339ec3047f03721b0710cbefe4
5
+ SHA512:
6
+ metadata.gz: df2cbea855f46c8e0b0eb1c065fd33d5e0baf9b1abbd7dd3de08b03c28276e9c8f06d431b120bcb01e27b8a24fc283700f12fde566ec0c9057d11e8778583a76
7
+ data.tar.gz: d50bbaafd0848bcfa1c4152a6396660398fa1a462106c55716ac8a37ee51b19828c326c903f1ade4e98c2c8708c3fad168e44a7ed8ec497e3d7eb7ba02157b04
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'android-sdk-installer'
4
+
5
+ installer = AndroidInstaller::Installer.new
6
+ installer.install
@@ -0,0 +1,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
+ 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
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: android-sdk-installer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Commit 451
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - commit451@gmail.com
16
+ executables:
17
+ - android-sdk-installer
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/android-sdk-installer
22
+ - lib/android-sdk-installer.rb
23
+ homepage: https://github.com/Commit451/android-sdk-installer
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 2.0.0
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.6.11
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Android SDK installer
48
+ test_files: []