apu 0.2.2 → 0.3.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 +4 -4
- data/README.md +3 -1
- data/apu.gemspec +1 -1
- data/lib/apu/version.rb +1 -1
- data/lib/apu.rb +91 -51
- metadata +4 -6
- data/extras/apu2.gif +0 -0
- data/extras/apu3.gif +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79a4291c2d7d4fa0182bd9820bae6dc572638a95
|
|
4
|
+
data.tar.gz: a1b89f71ff77a1e5b029b6143ef80f530ce458dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 186c43a987624768a5bea9a63d10d7985f7f1a2e0b43502bf5401e708f5eb484bada85cb3a8554fbd0f2a4897a7f326ab1aa496fbae41c894ba9b793890acf3b
|
|
7
|
+
data.tar.gz: 609602635b7625be3b02efbf25befb6c0f71284a934991392d521e0336f13de00194a819c6080e6c1e25492a44771a453bd989e2e0f203a4707b5e03f698a9ae
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# apu
|
|
2
2
|
[](https://travis-ci.org/cesarferreira/apu) [](http://badge.fury.io/rb/apu)
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
**A**ndroid a**p**plication **u**tils
|
|
5
5
|
|
|
6
6
|
> A set of useful tools for android developers
|
|
@@ -33,6 +33,8 @@ Options
|
|
|
33
33
|
-p, --path PATH Custom path to android project
|
|
34
34
|
-r, --run Run the build on the device
|
|
35
35
|
-c, --clear Clear app data
|
|
36
|
+
-h, --help Displays help
|
|
37
|
+
-v, --version Displays version
|
|
36
38
|
```
|
|
37
39
|
|
|
38
40
|
## Installation
|
data/apu.gemspec
CHANGED
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
|
26
26
|
spec.required_ruby_version = '>= 2.0.0'
|
|
27
27
|
|
|
28
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
29
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.
|
|
29
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.2'
|
|
30
30
|
spec.add_development_dependency 'rspec'
|
|
31
31
|
|
|
32
32
|
spec.add_dependency 'bundler', '~> 1.7'
|
data/lib/apu/version.rb
CHANGED
data/lib/apu.rb
CHANGED
|
@@ -3,85 +3,138 @@ require 'colorize'
|
|
|
3
3
|
require 'fileutils'
|
|
4
4
|
require 'apu/version'
|
|
5
5
|
require 'apu/android_project'
|
|
6
|
+
require 'pry'
|
|
6
7
|
|
|
7
8
|
module Apu
|
|
8
9
|
class MainApp
|
|
9
10
|
def initialize(arguments)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
# defaults
|
|
13
|
+
@app_path = Dir.pwd
|
|
14
|
+
@package_flag = false
|
|
15
|
+
@uninstall_flag = false
|
|
16
|
+
@install_flag = false
|
|
17
|
+
@android_home_flag = false
|
|
18
|
+
@launcher_flag = false
|
|
19
|
+
@run_flag = false
|
|
20
|
+
@clear_flag = false
|
|
12
21
|
|
|
13
|
-
|
|
14
|
-
@line = ['-h', '--help', '-v', '--version'].include?(arguments.first) ? nil : arguments.shift
|
|
22
|
+
@require_analyses = true
|
|
15
23
|
|
|
16
|
-
|
|
24
|
+
if !!arguments
|
|
25
|
+
arguments.push '-h'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Parse Options
|
|
29
|
+
create_options_parser(arguments)
|
|
30
|
+
|
|
31
|
+
manage_opts
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
## Manage options
|
|
37
|
+
##
|
|
38
|
+
def manage_opts
|
|
39
|
+
puts "manage_opts"
|
|
40
|
+
|
|
41
|
+
if @require_analyses
|
|
42
|
+
puts "I REQUIRE ANALYSIES"
|
|
43
|
+
# instatiate android project
|
|
44
|
+
android_project = AndroidProject.new(@app_path)
|
|
45
|
+
|
|
46
|
+
# is a valid android project?
|
|
47
|
+
unless android_project.is_valid
|
|
48
|
+
puts "#{@app_path.red} is not a valid android project"
|
|
49
|
+
exit
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
puts @package_flag # TODO DELETE
|
|
54
|
+
|
|
55
|
+
if @package_flag
|
|
56
|
+
puts android_project.get_package_name.green
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if @uninstall_flag
|
|
60
|
+
android_project.uninstall_application
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
if @install_flag
|
|
64
|
+
android_project.install
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if @android_home_flag
|
|
68
|
+
puts android_home_is_defined
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if @launcher_flag
|
|
72
|
+
puts android_project.get_launchable_activity.green
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if @run_flag
|
|
76
|
+
android_project.install
|
|
77
|
+
system(android_project.get_execute_line)
|
|
78
|
+
end
|
|
17
79
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
exit
|
|
80
|
+
if @clear_flag
|
|
81
|
+
android_project.clear_app_data
|
|
21
82
|
end
|
|
22
83
|
end
|
|
23
84
|
|
|
24
|
-
def create_options_parser
|
|
25
|
-
|
|
26
|
-
|
|
85
|
+
def create_options_parser(args)
|
|
86
|
+
#@opt_parser = OptionParser.new do |opts|
|
|
87
|
+
args.options do |opts|
|
|
88
|
+
opts.banner = "Usage: apu [OPTIONS]"
|
|
27
89
|
opts.separator ''
|
|
28
90
|
opts.separator "Options"
|
|
29
91
|
|
|
30
|
-
opts.on('-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
92
|
+
opts.on('-p PATH', '--path PATH', 'Custom path to android project') do |app_path|
|
|
93
|
+
puts "Path #{app_path}"
|
|
94
|
+
@app_path = app_path if @app_path != '.'
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
opts.on('-k', '--package', 'Retrieves package name (eg. com.example.app)') do |value|
|
|
98
|
+
puts "--package"
|
|
99
|
+
@package_flag = true
|
|
34
100
|
end
|
|
35
101
|
|
|
36
102
|
opts.on('-u', '--uninstall', 'Uninstalls the apk from your device') do |app_path|
|
|
37
|
-
|
|
38
|
-
android_project.uninstall_application
|
|
39
|
-
exit
|
|
103
|
+
@uninstall_flag = true
|
|
40
104
|
end
|
|
41
105
|
|
|
42
|
-
opts.on('-i', '--install', 'Installs the apk on your device') do |
|
|
43
|
-
|
|
44
|
-
android_project.install
|
|
45
|
-
exit
|
|
106
|
+
opts.on('-i', '--install', 'Installs the apk on your device') do |install|
|
|
107
|
+
@install_flag = true
|
|
46
108
|
end
|
|
47
109
|
|
|
48
110
|
opts.on('-a', '--android-home', 'Checks if the ANDROID_HOME variable is defined') do |home|
|
|
49
|
-
|
|
50
|
-
|
|
111
|
+
@android_home_flag = true
|
|
112
|
+
@require_analyses = false
|
|
51
113
|
end
|
|
52
114
|
|
|
53
115
|
opts.on('-l', '--launcher', 'Get the launcher activity path') do |app_path|
|
|
54
|
-
|
|
55
|
-
puts android_project.get_launchable_activity.green
|
|
56
|
-
exit
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
opts.on('-p PATH', '--path PATH', 'Custom path to android project') do |app_path|
|
|
60
|
-
@app_path = app_path if @app_path != '.'
|
|
116
|
+
@launcher_flag = true
|
|
61
117
|
end
|
|
62
118
|
|
|
63
119
|
opts.on('-r', '--run', 'Run the build on the device') do |flavour|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
android_project.install
|
|
67
|
-
system(android_project.get_execute_line)
|
|
68
|
-
exit
|
|
120
|
+
@run_flag = true
|
|
69
121
|
end
|
|
70
122
|
|
|
71
123
|
opts.on('-c', '--clear', 'Clear app data') do |flavour|
|
|
72
|
-
|
|
73
|
-
android_project.clear_app_data
|
|
124
|
+
@clear_flag = true
|
|
74
125
|
end
|
|
75
126
|
|
|
76
127
|
opts.on('-h', '--help', 'Displays help') do
|
|
128
|
+
@require_analyses = false
|
|
77
129
|
puts opts.help
|
|
78
130
|
exit
|
|
79
131
|
end
|
|
80
132
|
opts.on('-v', '--version', 'Displays version') do
|
|
133
|
+
@require_analyses = false
|
|
81
134
|
puts Apu::VERSION
|
|
82
135
|
exit
|
|
83
136
|
end
|
|
84
|
-
|
|
137
|
+
opts.parse!
|
|
85
138
|
|
|
86
139
|
end
|
|
87
140
|
end
|
|
@@ -91,17 +144,6 @@ module Apu
|
|
|
91
144
|
!sdk.empty?
|
|
92
145
|
end
|
|
93
146
|
|
|
94
|
-
def get_android_project_object
|
|
95
|
-
android_project = AndroidProject.new(@app_path)
|
|
96
|
-
|
|
97
|
-
# is a valid android project?
|
|
98
|
-
unless android_project.is_valid
|
|
99
|
-
puts "#{@app_path.red} is not a valid android project"
|
|
100
|
-
exit
|
|
101
|
-
end
|
|
102
|
-
return android_project
|
|
103
|
-
end
|
|
104
|
-
|
|
105
147
|
def call
|
|
106
148
|
unless android_home_is_defined
|
|
107
149
|
puts "\nWARNING: your #{'$ANDROID_HOME'.yellow} is not defined\n"
|
|
@@ -109,8 +151,6 @@ module Apu
|
|
|
109
151
|
puts "\nNow type #{'source ~/.bashrc'.yellow}\n\n"
|
|
110
152
|
exit 1
|
|
111
153
|
end
|
|
112
|
-
|
|
113
|
-
|
|
114
154
|
end
|
|
115
155
|
end
|
|
116
156
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- cesar ferreira
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-10-
|
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -30,14 +30,14 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '3.
|
|
33
|
+
version: '3.2'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '3.
|
|
40
|
+
version: '3.2'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,8 +114,6 @@ files:
|
|
|
114
114
|
- apu.gemspec
|
|
115
115
|
- bin/apu
|
|
116
116
|
- extras/apu.gif
|
|
117
|
-
- extras/apu2.gif
|
|
118
|
-
- extras/apu3.gif
|
|
119
117
|
- lib/apu.rb
|
|
120
118
|
- lib/apu/android_project.rb
|
|
121
119
|
- lib/apu/version.rb
|
data/extras/apu2.gif
DELETED
|
Binary file
|
data/extras/apu3.gif
DELETED
|
Binary file
|