fastlane-plugin-avd_emulator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +53 -0
- data/lib/fastlane/plugin/avd_emulator.rb +16 -0
- data/lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb +55 -0
- data/lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb +50 -0
- data/lib/fastlane/plugin/avd_emulator/version.rb +5 -0
- metadata +175 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f0caf9e5cf53b3747ca8b0a2ebd8e2b096dfee3139e420a6b98a0e1da53d5603
|
4
|
+
data.tar.gz: 5ab9e830baff3d94971660cc29056e7866e2a5a3c5c9ed68eb513758463ce1ac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90dd55e1d0bbc421744e5419e36fa777f73ffa2d6bc16d79214b972f1378bb8b42d50a6d160409492a52867aecb50ec1c8ec2996ec241ff7b9535c7968012c1c
|
7
|
+
data.tar.gz: b6a35c692fa1cd8ecddfb4a95dda3299692d6fc1bf6c60cd8891ca541401f454fe429d1908a844ccdb7900c57cfa86f531fa0d814cb256a44c9ed36dabcbb806
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Guillaume Elloy <guillaume.elloy@gmail.com>
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# avd_emulator plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-avd_emulator)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-avd_emulator`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin avd_emulator
|
11
|
+
```
|
12
|
+
|
13
|
+
Make sure to have the `$ANDROID_HOME` environment variable set.
|
14
|
+
|
15
|
+
## About avd_emulator
|
16
|
+
|
17
|
+
This plugin is listing available android avd emulators, allowing you to select and start one.
|
18
|
+
You can also start a specific AVD device with the :name option.
|
19
|
+
|
20
|
+
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
|
21
|
+
|
22
|
+
## Action
|
23
|
+
|
24
|
+
### start_avd_emulator
|
25
|
+
|
26
|
+
List all available AVD emulators
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
start_avd_emulator # List all available AVD emulators and select one to start
|
30
|
+
start_avd_emulator(
|
31
|
+
name: Nexus_6_x86 # Start the Nexus_6_x86 emulator if available, else list all available AVD emulators
|
32
|
+
)
|
33
|
+
```
|
34
|
+
|
35
|
+
## Example
|
36
|
+
|
37
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test` or `bundle exec fastlane test name:[emulator_name]`.
|
38
|
+
|
39
|
+
## Issues and Feedback
|
40
|
+
|
41
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
42
|
+
|
43
|
+
## Troubleshooting
|
44
|
+
|
45
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
46
|
+
|
47
|
+
## Using _fastlane_ Plugins
|
48
|
+
|
49
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
50
|
+
|
51
|
+
## About _fastlane_
|
52
|
+
|
53
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/avd_emulator/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module AvdEmulator
|
5
|
+
# Return all .rb files inside the "actions" and "helper" directory
|
6
|
+
def self.all_classes
|
7
|
+
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# By default we want to import all available actions and helpers
|
13
|
+
# A plugin can contain any number of actions and plugins
|
14
|
+
Fastlane::AvdEmulator.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/start_avd_emulator_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class StartAvdEmulatorAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
Helper::StartAvdEmulatorHelper.check_for_environment_variable
|
9
|
+
|
10
|
+
emulator_name = params[:name]
|
11
|
+
emulator_list = Helper::StartAvdEmulatorHelper.get_emulator_list
|
12
|
+
|
13
|
+
is_emulator_available = emulator_list.include? emulator_name
|
14
|
+
if !emulator_name or !is_emulator_available
|
15
|
+
if emulator_name and !is_emulator_available
|
16
|
+
Helper::StartAvdEmulatorHelper.show_name_error(emulator_name)
|
17
|
+
end
|
18
|
+
emulator_name = Helper::StartAvdEmulatorHelper.show_emulator_selector(emulator_list)
|
19
|
+
end
|
20
|
+
|
21
|
+
Helper::StartAvdEmulatorHelper.start_emulator_in_background(emulator_name)
|
22
|
+
Helper::StartAvdEmulatorHelper.show_waiting_message
|
23
|
+
Helper::StartAvdEmulatorHelper.wait_for_emulator_to_be_started
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.description
|
27
|
+
"This plugin is listing available android avd emulators, allowing you to start the selected one."
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.authors
|
31
|
+
["Guillaume Elloy"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.details
|
35
|
+
"Run the plugin to list all avd emulators available in your environment. "\
|
36
|
+
"Select one to start it. "\
|
37
|
+
"It is also possible to start one directly by specifying his name with the :name option."
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.available_options
|
41
|
+
[
|
42
|
+
FastlaneCore::ConfigItem.new(key: :name,
|
43
|
+
env_name: "START_ANDROID_EMULATOR_NAME",
|
44
|
+
description: "The name of the emulator to start",
|
45
|
+
optional: true,
|
46
|
+
type: String)
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.is_supported?(platform)
|
51
|
+
true
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Helper
|
7
|
+
class StartAvdEmulatorHelper
|
8
|
+
def self.check_for_environment_variable
|
9
|
+
if !ENV['ANDROID_HOME']
|
10
|
+
error_str =
|
11
|
+
"\n-----------------------------------------------------"\
|
12
|
+
"\n--- $ANDROID_HOME environment variable is not set 🚨"\
|
13
|
+
"\n-----------------------------------------------------"
|
14
|
+
UI.user_error!(error_str)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
def self.show_name_error(emulator_name)
|
18
|
+
error_str =
|
19
|
+
"\n---------------------------------------------------"\
|
20
|
+
"\n--- No emulator named #{emulator_name} available 🚨"\
|
21
|
+
"\n---------------------------------------------------"
|
22
|
+
UI.error(error_str)
|
23
|
+
end
|
24
|
+
def self.show_emulator_selector(emulator_list)
|
25
|
+
select_str =
|
26
|
+
"\n------------------------------------"\
|
27
|
+
"\n--- Available Android emulators 📱🤖"\
|
28
|
+
"\n------------------------------------"
|
29
|
+
UI.select(select_str, emulator_list)
|
30
|
+
end
|
31
|
+
def self.show_waiting_message
|
32
|
+
waiting_str =
|
33
|
+
"\n---------------------------------------"\
|
34
|
+
"\n--- Waiting for selected emulator... ☕️"\
|
35
|
+
"\n---------------------------------------"
|
36
|
+
UI.important(waiting_str)
|
37
|
+
end
|
38
|
+
def self.get_emulator_list
|
39
|
+
`$ANDROID_HOME/tools/emulator -list-avds`.split("\n")
|
40
|
+
end
|
41
|
+
def self.start_emulator_in_background(emulator_name)
|
42
|
+
system("nohup $ANDROID_HOME/tools/emulator -avd #{emulator_name} > /dev/null 2>&1 &")
|
43
|
+
end
|
44
|
+
def self.wait_for_emulator_to_be_started
|
45
|
+
lines_to_trim = 2
|
46
|
+
system("while [ `$ANDROID_HOME/platform-tools/adb devices | grep -c '^'` -le #{lines_to_trim} ] ; do sleep 1; done")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-avd_emulator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Guillaume Elloy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '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: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-require_tools
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fastlane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.125.2
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.125.2
|
139
|
+
description:
|
140
|
+
email: guillaume.elloy@gmail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- lib/fastlane/plugin/avd_emulator.rb
|
148
|
+
- lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb
|
149
|
+
- lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb
|
150
|
+
- lib/fastlane/plugin/avd_emulator/version.rb
|
151
|
+
homepage: https://github.com/elloyg/fastlane-plugin-avd_emulator
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata: {}
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubygems_version: 3.0.2
|
171
|
+
signing_key:
|
172
|
+
specification_version: 4
|
173
|
+
summary: This plugin is listing available android avd emulators, allowing you to start
|
174
|
+
the selected one.
|
175
|
+
test_files: []
|