dryrun 0.6.5 → 0.7.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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/dryrun.gemspec +3 -0
- data/lib/dryrun.rb +64 -2
- data/lib/dryrun/android_project.rb +9 -12
- data/lib/dryrun/dryrun_utils.rb +22 -3
- data/lib/dryrun/version.rb +1 -1
- metadata +45 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 036e595b962647744176802351d6e161da574fe9
|
4
|
+
data.tar.gz: 242399841f07ea231618a27f6b2c75ba7d83f5b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b397ce280f7d1584c3dd8111bf0ccfcf2a523624cde0ba16e14ded13d33857c7ff5f0671f090984d8aaa946292ec9e1428845f598f5f6d6f65c4c3f373bd155b
|
7
|
+
data.tar.gz: e4a92ddc5395763d8d6d12722f04d634b286480b26c57a32446530b9ab666b98a440039f7cea371ab7073eb4748ff44a372b461960094aa28cea0b555fa48e65
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
data/.travis.yml
CHANGED
data/dryrun.gemspec
CHANGED
@@ -33,5 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_dependency 'bundler', '~> 1.7'
|
34
34
|
spec.add_dependency 'colorize', '~> 0.7'
|
35
35
|
spec.add_dependency 'oga', '~> 1.3.1'
|
36
|
+
spec.add_dependency 'highline', '~> 1.7'
|
37
|
+
spec.add_dependency 'adb-sdklib', '~> 0.0.3'
|
38
|
+
spec.add_dependency 'rjb', '>= 1.5.4'
|
36
39
|
|
37
40
|
end
|
data/lib/dryrun.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'adb-sdklib'
|
1
2
|
require 'optparse'
|
2
3
|
require 'colorize'
|
3
4
|
require 'tmpdir'
|
@@ -5,11 +6,12 @@ require 'fileutils'
|
|
5
6
|
require 'dryrun/github'
|
6
7
|
require 'dryrun/version'
|
7
8
|
require 'dryrun/android_project'
|
9
|
+
require "highline/import"
|
8
10
|
|
9
11
|
module DryRun
|
10
12
|
class MainApp
|
11
13
|
def initialize(arguments)
|
12
|
-
|
14
|
+
outdated_verification
|
13
15
|
@url = ['-h', '--help', '-v', '--version'].include?(arguments.first) ? nil : arguments.shift
|
14
16
|
|
15
17
|
# defaults
|
@@ -65,6 +67,64 @@ module DryRun
|
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
70
|
+
def outdated_verification
|
71
|
+
is_up_to_date = DryrunUtils.is_up_to_date
|
72
|
+
|
73
|
+
if is_up_to_date
|
74
|
+
return
|
75
|
+
end
|
76
|
+
|
77
|
+
input = nil
|
78
|
+
|
79
|
+
begin
|
80
|
+
input = ask "\n#{'Your Dryrun version is outdated, want to update?'.yellow} #{'[Y/n]:'.white}"
|
81
|
+
end while !['y', 'n', 's'].include?(input.downcase)
|
82
|
+
|
83
|
+
if input.downcase.eql? 'y'
|
84
|
+
DryrunUtils.execute('gem update dryrun')
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
def pick_device()
|
90
|
+
if !Gem.win_platform?
|
91
|
+
sdk = `echo $ANDROID_HOME`.gsub("\n",'')
|
92
|
+
sdk = sdk + "/platform-tools/adb";
|
93
|
+
else
|
94
|
+
sdk = `echo %ANDROID_HOME%`.gsub("\n",'')
|
95
|
+
sdk = sdk + "/platform-tools/adb.exe"
|
96
|
+
end
|
97
|
+
|
98
|
+
puts "Searching for devices...".yellow
|
99
|
+
adb = AdbSdkLib::Adb.new(sdk)
|
100
|
+
devices = adb.devices;
|
101
|
+
|
102
|
+
if devices.empty?
|
103
|
+
puts "No devices attached, but I'll run anyway"
|
104
|
+
end
|
105
|
+
|
106
|
+
@device = nil
|
107
|
+
|
108
|
+
if devices.size >= 2
|
109
|
+
puts "Pick your device (1,2,3...):"
|
110
|
+
|
111
|
+
devices.each_with_index.map {|key, index| puts "#{index.to_s.green} - #{key} \n"}
|
112
|
+
|
113
|
+
a = gets.chomp
|
114
|
+
|
115
|
+
if a.match(/^\d+$/) && a.to_i <= (devices.length - 1) && a.to_i >= 0
|
116
|
+
@device = devices.to_a.at((a.to_i))[1]
|
117
|
+
else
|
118
|
+
@device = devices.first
|
119
|
+
end
|
120
|
+
else
|
121
|
+
@device = devices.first
|
122
|
+
end
|
123
|
+
|
124
|
+
puts "Picked #{@device.to_s.green}" if @device
|
125
|
+
end
|
126
|
+
|
127
|
+
|
68
128
|
def android_home_is_defined
|
69
129
|
if !Gem.win_platform?
|
70
130
|
sdk = `echo $ANDROID_HOME`.gsub("\n",'')
|
@@ -82,6 +142,8 @@ module DryRun
|
|
82
142
|
exit 1
|
83
143
|
end
|
84
144
|
|
145
|
+
pick_device()
|
146
|
+
|
85
147
|
github = Github.new(@url)
|
86
148
|
|
87
149
|
unless github.is_valid
|
@@ -92,7 +154,7 @@ module DryRun
|
|
92
154
|
# clone the repository
|
93
155
|
repository_path = github.clone(@branch, @tag)
|
94
156
|
|
95
|
-
android_project = AndroidProject.new(repository_path, @app_path, @custom_module, @flavour)
|
157
|
+
android_project = AndroidProject.new(repository_path, @app_path, @custom_module, @flavour, @device)
|
96
158
|
|
97
159
|
# is a valid android project?
|
98
160
|
unless android_project.is_valid
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'adb-sdklib'
|
1
2
|
require 'oga'
|
2
3
|
require 'fileutils'
|
3
4
|
require 'tempfile'
|
@@ -6,12 +7,13 @@ require_relative 'dryrun_utils'
|
|
6
7
|
|
7
8
|
module DryRun
|
8
9
|
class AndroidProject
|
9
|
-
def initialize(path, custom_app_path, custom_module, flavour)
|
10
|
+
def initialize(path, custom_app_path, custom_module, flavour, device)
|
10
11
|
|
11
12
|
@custom_app_path = custom_app_path
|
12
13
|
@custom_module = custom_module
|
13
14
|
@base_path = path
|
14
15
|
@flavour = flavour
|
16
|
+
@device = device
|
15
17
|
|
16
18
|
@settings_gradle_path = settings_gradle_file
|
17
19
|
|
@@ -113,10 +115,9 @@ module DryRun
|
|
113
115
|
clear_app_data
|
114
116
|
|
115
117
|
puts "Installing #{@package.green}...\n"
|
116
|
-
puts "executing: #{execute_line.green}\n
|
117
|
-
|
118
|
-
DryrunUtils.execute(execute_line)
|
118
|
+
puts "executing: #{execute_line.green}\n"
|
119
119
|
|
120
|
+
@device.shell("#{execute_line}")
|
120
121
|
end
|
121
122
|
|
122
123
|
def is_gradle_wrapped
|
@@ -141,20 +142,16 @@ module DryRun
|
|
141
142
|
[false, false]
|
142
143
|
end
|
143
144
|
|
144
|
-
def get_clear_app_command
|
145
|
-
"adb shell pm clear #{@package}"
|
146
|
-
end
|
147
|
-
|
148
145
|
def get_uninstall_command
|
149
|
-
|
146
|
+
"adb uninstall \"#{@package}\""
|
150
147
|
end
|
151
148
|
|
152
149
|
def clear_app_data
|
153
|
-
|
150
|
+
@device.shell("pm clear #{@package}")
|
154
151
|
end
|
155
152
|
|
156
153
|
def uninstall_application
|
157
|
-
|
154
|
+
@device.shell("pm uninstall #{@package}")
|
158
155
|
end
|
159
156
|
|
160
157
|
def get_execution_line_command(path_to_sample)
|
@@ -175,7 +172,7 @@ module DryRun
|
|
175
172
|
|
176
173
|
manifest_file.close
|
177
174
|
|
178
|
-
"
|
175
|
+
return "am start -n \"#{get_launchable_activity}\" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER"
|
179
176
|
end
|
180
177
|
|
181
178
|
def get_manifest(path_to_sample)
|
data/lib/dryrun/dryrun_utils.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'dryrun/version'
|
3
|
+
|
1
4
|
module DryRun
|
2
5
|
class DryrunUtils
|
3
6
|
|
@@ -9,7 +12,23 @@ module DryRun
|
|
9
12
|
puts " $ #{command}\n".yellow
|
10
13
|
puts "======================================================\n\n"
|
11
14
|
exit 1
|
12
|
-
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.get_latest_version
|
19
|
+
url = 'https://raw.githubusercontent.com/cesarferreira/dryrun/master/lib/dryrun/version.rb'
|
20
|
+
page_string = nil
|
21
|
+
|
22
|
+
open(url) do |f|
|
23
|
+
page_string = f.read
|
24
|
+
end
|
25
|
+
|
26
|
+
page_string[/#{Regexp.escape('\'')}(.*?)#{Regexp.escape('\'')}/m, 1]
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.is_up_to_date
|
30
|
+
latest = get_latest_version
|
31
|
+
latest.eql? DryRun::VERSION
|
13
32
|
end
|
14
|
-
end
|
15
|
-
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/dryrun/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dryrun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cesar ferreira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -94,6 +94,48 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.3.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: highline
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.7'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: adb-sdklib
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.0.3
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.0.3
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rjb
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.5.4
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.5.4
|
97
139
|
description: Tool to try any android library hosted online directly from the command
|
98
140
|
line
|
99
141
|
email:
|
@@ -144,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
186
|
version: '0'
|
145
187
|
requirements: []
|
146
188
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.5.1
|
148
190
|
signing_key:
|
149
191
|
specification_version: 4
|
150
192
|
summary: Tool to try any android library hosted online directly from the command line
|