itamae-plugin-recipe-android_sdk 0.1.0
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +67 -0
- data/Rakefile +6 -0
- data/itamae-plugin-recipe-android_sdk.gemspec +29 -0
- data/lib/itamae/plugin/recipe/android_sdk.rb +11 -0
- data/lib/itamae/plugin/recipe/android_sdk/dependency.rb +29 -0
- data/lib/itamae/plugin/recipe/android_sdk/install.rb +61 -0
- data/lib/itamae/plugin/recipe/android_sdk/update_sdk.rb +36 -0
- data/lib/itamae/plugin/recipe/android_sdk/version.rb +9 -0
- data/lib/itamae/plugin/recipe/templates/android-update-sdk.sh.erb +18 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6de6d72f6abd41cd7f31ba8a9a3d6c55726ed8dc
|
4
|
+
data.tar.gz: 8043653af1b397f73cbfecb222027ad01ab51e2e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1b3c5c4335fd8a61ef24f1c986fbc269bf4dcb1df510178d235b38f547f1545774f6f0ac0477325fa50c92b5835132783ea2963d3c19e0a6bf4764e247dd9dc3
|
7
|
+
data.tar.gz: 4f685ad9ce1a42b7fce88a3f54c5637085e1256b0414c7d914c48114ba060f106045d8fc3b58d835c05f3ffb9a322b0b49bc8ea7f18cf45dea36473d52e858c5
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 slowhand0309
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Itamae::Plugin::Recipe::AndroidSdk
|
2
|
+
|
3
|
+
Require JDK.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
※ **Not yet published in 'RubyGems.org'**
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'itamae-plugin-recipe-android_sdk'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install itamae-plugin-recipe-android_sdk
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
#### android_sdk::install
|
26
|
+
|
27
|
+
Install Android SDK.
|
28
|
+
|
29
|
+
* recipe
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
include_recipe 'android_sdk::install'
|
33
|
+
```
|
34
|
+
|
35
|
+
* node.json
|
36
|
+
|
37
|
+
```json
|
38
|
+
{
|
39
|
+
"sdk": {
|
40
|
+
"version" : "r24.4.1",
|
41
|
+
"install_path" : "/hoge"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
```
|
45
|
+
|
46
|
+
Default install path `/usr/local`, if not set 'install_path'
|
47
|
+
|
48
|
+
#### android sdk update
|
49
|
+
|
50
|
+
Update Android SDK at like node.json following:
|
51
|
+
|
52
|
+
```json
|
53
|
+
{
|
54
|
+
"sdk": {
|
55
|
+
...
|
56
|
+
"update_list" : [
|
57
|
+
"build-tools-23.0.3",
|
58
|
+
"android-22"
|
59
|
+
]
|
60
|
+
}
|
61
|
+
}
|
62
|
+
```
|
63
|
+
|
64
|
+
|
65
|
+
## License
|
66
|
+
|
67
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'itamae/plugin/recipe/android_sdk/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "itamae-plugin-recipe-android_sdk"
|
8
|
+
spec.version = Itamae::Plugin::Recipe::AndroidSdk::VERSION
|
9
|
+
spec.authors = ["slowhand0309"]
|
10
|
+
spec.email = ["slowhand0309@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Itamae plugin for Android SDK.}
|
13
|
+
spec.description = %q{Itamae plugin for Android SDK.}
|
14
|
+
spec.homepage = "https://github.com/Slowhand0309/itamae-plugin-recipe-android_sdk"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "bin"
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
# Runtime Dependencies
|
23
|
+
spec.add_runtime_dependency "itamae", "~> 1.7"
|
24
|
+
|
25
|
+
# Development Dependencies
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
spec.add_development_dependency "serverspec", "~> 2.3"
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
case node[:platform]
|
5
|
+
when 'redhat'
|
6
|
+
|
7
|
+
# resolve aapt 32bit problem for 64bit
|
8
|
+
if node[:kernel][:machine] == 'x86_64'
|
9
|
+
#sudo yum update libstdc++ zlib
|
10
|
+
execute "yum -y update libstdc++ zlib" do
|
11
|
+
user "root"
|
12
|
+
end
|
13
|
+
# sudo yum install libstdc++.i686 zlib.i686
|
14
|
+
%w(libstdc++.i686 zlib.i686).each do |pkg|
|
15
|
+
package pkg
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
when 'debian', 'ubuntu'
|
20
|
+
|
21
|
+
# resolve aapt 32bit problem for 64bit
|
22
|
+
if node[:kernel][:machine] == 'x86_64'
|
23
|
+
# sudo apt-get install lib32stdc++6 lib32z1
|
24
|
+
%w(lib32stdc++6 lib32z1).each do |pkg|
|
25
|
+
package pkg
|
26
|
+
end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Run dependency.
|
4
|
+
include_recipe 'android_sdk::dependency'
|
5
|
+
|
6
|
+
node[:sdk] ||= {}
|
7
|
+
|
8
|
+
# Install path.
|
9
|
+
node[:sdk][:install_path] ||= '/usr/local'
|
10
|
+
|
11
|
+
# Default sdk version.
|
12
|
+
node[:sdk][:version] ||= 'r24.4.1'
|
13
|
+
|
14
|
+
TEMP_DIR = '/tmp/android_sdk'.freeze
|
15
|
+
|
16
|
+
# Android SDK download file.
|
17
|
+
case node[:platform]
|
18
|
+
when 'osx', 'darwin'
|
19
|
+
ANDROID_SDK_ARCHIVE = "android-sdk_#{node[:sdk][:version]}-macosx.zip".freeze
|
20
|
+
node[:sdk][:directory] = 'android-sdk-macosx'.freeze
|
21
|
+
else
|
22
|
+
ANDROID_SDK_ARCHIVE = "android-sdk_#{node[:sdk][:version]}-linux.tgz".freeze
|
23
|
+
node[:sdk][:directory] = 'android-sdk-linux'.freeze
|
24
|
+
end
|
25
|
+
|
26
|
+
# Android SDK download URL.
|
27
|
+
ANDROID_SDK_URL = "http://dl.google.com/android/#{ANDROID_SDK_ARCHIVE}".freeze
|
28
|
+
|
29
|
+
package 'wget'
|
30
|
+
|
31
|
+
directory TEMP_DIR do
|
32
|
+
action :create
|
33
|
+
end
|
34
|
+
|
35
|
+
# Download.
|
36
|
+
execute "wget #{ANDROID_SDK_URL} -O #{TEMP_DIR}/#{ANDROID_SDK_ARCHIVE}" do
|
37
|
+
not_if "test -e #{TEMP_DIR}/#{ANDROID_SDK_ARCHIVE}"
|
38
|
+
end
|
39
|
+
|
40
|
+
# Extract.
|
41
|
+
case node[:platform]
|
42
|
+
when 'osx', 'darwin'
|
43
|
+
cmd = "unzip #{TEMP_DIR}/#{ANDROID_SDK_ARCHIVE} -d #{node[:sdk][:install_path]}"
|
44
|
+
else
|
45
|
+
cmd = "tar xvf #{TEMP_DIR}/#{ANDROID_SDK_ARCHIVE} -C #{node[:sdk][:install_path]}"
|
46
|
+
end
|
47
|
+
|
48
|
+
execute cmd do
|
49
|
+
not_if "test -d #{node[:sdk][:install_path]}/#{node[:sdk][:directory]}"
|
50
|
+
end
|
51
|
+
|
52
|
+
# Set 'ANDROID_HOME'
|
53
|
+
execute "echo 'export ANDROID_HOME=#{node[:sdk][:install_path]}/#{node[:sdk][:directory]}' >> /etc/profile" do
|
54
|
+
user "root"
|
55
|
+
not_if "grep -qs ANDROID_HOME /etc/profile"
|
56
|
+
end
|
57
|
+
|
58
|
+
# Update sdk list.
|
59
|
+
if node[:sdk][:update_list]
|
60
|
+
include_recipe 'android_sdk::update_sdk'
|
61
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
ANDROID_SDK_ROOT = "#{node[:sdk][:install_path]}/#{node[:sdk][:directory]}"
|
4
|
+
|
5
|
+
# Interactive android sdk update shell.
|
6
|
+
TEMPLATE_SRC_PATH = "#{File.expand_path('../../', __FILE__)}/templates/android-update-sdk.sh.erb"
|
7
|
+
TEMPLATE_DEST_PATH = "#{ANDROID_SDK_ROOT}/tools/android-update-sdk.sh"
|
8
|
+
|
9
|
+
case node[:platform]
|
10
|
+
when 'osx', 'darwin'
|
11
|
+
# Already installed.
|
12
|
+
else
|
13
|
+
package 'expect'
|
14
|
+
end
|
15
|
+
|
16
|
+
template TEMPLATE_DEST_PATH do
|
17
|
+
mode "0755"
|
18
|
+
source TEMPLATE_SRC_PATH
|
19
|
+
end
|
20
|
+
|
21
|
+
update_list = node[:sdk][:update_list].join(',')
|
22
|
+
|
23
|
+
# Prepare.
|
24
|
+
case node[:platform]
|
25
|
+
when 'osx', 'darwin'
|
26
|
+
option = '-e'
|
27
|
+
else
|
28
|
+
option = '-i'
|
29
|
+
end
|
30
|
+
execute "sed #{option} 's/\r//' #{TEMPLATE_DEST_PATH}" do
|
31
|
+
end
|
32
|
+
|
33
|
+
# Update sdk.
|
34
|
+
execute "#{TEMPLATE_DEST_PATH} #{update_list}" do
|
35
|
+
cwd File.dirname(TEMPLATE_DEST_PATH)
|
36
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
expect -c "
|
4
|
+
set timeout -1
|
5
|
+
spawn <%= "#{node[:sdk][:install_path]}/#{node[:sdk][:directory]}" %>/tools/android update sdk -u -a -t $@
|
6
|
+
expect {
|
7
|
+
\"Do you accept the license\" {
|
8
|
+
send \"y\n\"
|
9
|
+
exp_continue
|
10
|
+
}
|
11
|
+
Downloading {
|
12
|
+
exp_continue
|
13
|
+
}
|
14
|
+
Installing {
|
15
|
+
exp_continue
|
16
|
+
}
|
17
|
+
}
|
18
|
+
"
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itamae-plugin-recipe-android_sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- slowhand0309
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: itamae
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: serverspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.3'
|
69
|
+
description: Itamae plugin for Android SDK.
|
70
|
+
email:
|
71
|
+
- slowhand0309@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- itamae-plugin-recipe-android_sdk.gemspec
|
83
|
+
- lib/itamae/plugin/recipe/android_sdk.rb
|
84
|
+
- lib/itamae/plugin/recipe/android_sdk/dependency.rb
|
85
|
+
- lib/itamae/plugin/recipe/android_sdk/install.rb
|
86
|
+
- lib/itamae/plugin/recipe/android_sdk/update_sdk.rb
|
87
|
+
- lib/itamae/plugin/recipe/android_sdk/version.rb
|
88
|
+
- lib/itamae/plugin/recipe/templates/android-update-sdk.sh.erb
|
89
|
+
homepage: https://github.com/Slowhand0309/itamae-plugin-recipe-android_sdk
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.6
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Itamae plugin for Android SDK.
|
113
|
+
test_files: []
|