dryrun 0.3.6 → 0.4.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 +2 -2
- data/dryrun.gemspec +2 -2
- data/lib/dryrun.rb +14 -14
- data/lib/dryrun/android_project.rb +48 -6
- data/lib/dryrun/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10d011b7a25d63325257ca136b7cc4ab0c0c91c9
|
4
|
+
data.tar.gz: e1748d67462043c41fc210b32332e04708bebdbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2f560b1066b631ecc531dd601b40b176b739e03329177b65d42818021ef629975cc5313c30d442afc6d8b4f4ed4dd2b2114cbe467babf29e207be3cdfce8c4e
|
7
|
+
data.tar.gz: e4f679f242bd348c6f9a19c2e4f7a02b9ac38bae414a06d33a4045b01443734cbb4d83682c42a360958e8780349a31861451316e8070bdb0962cb9db56eebec9
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# dryrun
|
2
|
-
[](https://travis-ci.org/cesarferreira/dryrun) [](http://badge.fury.io/rb/dryrun)
|
2
|
+
[](https://travis-ci.org/cesarferreira/dryrun) [](http://badge.fury.io/rb/dryrun) [](https://android-arsenal.com/details/1/2361)
|
3
3
|
|
4
4
|
**Try** any **android library** on your **smartphone** **directly** from the **command line**
|
5
5
|
|
@@ -31,7 +31,7 @@ Wait a few seconds... and `voilà`! The app is opened on your phone :smiley:
|
|
31
31
|
|
32
32
|
## Alternative scenario (if you don't use `dryrun`)
|
33
33
|
|
34
|
-
1. Find the github url
|
34
|
+
1. Find the github's repository url
|
35
35
|
2. Click the `download zip`
|
36
36
|
3. Extract the `zip file`
|
37
37
|
4. Open Android Studio
|
data/dryrun.gemspec
CHANGED
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.authors = ["cesar ferreira"]
|
15
15
|
spec.email = ["cesar.manuel.ferreira@gmail.com"]
|
16
16
|
|
17
|
-
spec.summary = %q{Tool which allows to quickly try the demo project of
|
18
|
-
spec.description = %q{Tool which allows to quickly try the demo project of
|
17
|
+
spec.summary = %q{Tool which allows to quickly try the demo project of any Android Library}
|
18
|
+
spec.description = %q{Tool which allows to quickly try the demo project of any Android Library}
|
19
19
|
spec.homepage = "https://github.com/cesarferreira/dryrun"
|
20
20
|
|
21
21
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
data/lib/dryrun.rb
CHANGED
@@ -8,43 +8,43 @@ module DryRun
|
|
8
8
|
|
9
9
|
class MainApp
|
10
10
|
|
11
|
-
def self.
|
12
|
-
|
11
|
+
def self.ANDROID_HOME_is_defined
|
12
|
+
sdk = `echo $ANDROID_HOME`.gsub("\n",'')
|
13
|
+
!sdk.empty?
|
13
14
|
end
|
14
15
|
|
15
16
|
|
16
17
|
def self.initialize(url)
|
17
18
|
|
18
|
-
|
19
|
-
#
|
19
|
+
unless self.ANDROID_HOME_is_defined
|
20
|
+
puts "\nWARNING: your #{'$ANDROID_HOME'.yellow} is not defined\n"
|
21
|
+
puts "\nhint: in your #{'~/.bashrc'.yellow} add:\n #{"export ANDROID_HOME=\"/Users/cesarferreira/Library/Android/sdk/\"".yellow}"
|
22
|
+
puts "\nNow type #{'source ~/.bashrc'.yellow}\n\n"
|
23
|
+
exit 1
|
20
24
|
end
|
21
25
|
|
22
26
|
github = Github.new(url)
|
23
27
|
|
24
|
-
|
28
|
+
unless github.is_valid
|
25
29
|
puts "#{url.red} is not a valid github url"
|
26
30
|
exit 1
|
27
31
|
end
|
28
32
|
|
29
33
|
# clone the repository
|
30
|
-
|
31
|
-
|
32
|
-
repository = github.clone
|
33
|
-
|
34
|
-
Dir.chdir repository
|
34
|
+
repository_path = github.clone
|
35
35
|
|
36
|
-
|
36
|
+
android_project = AndroidProject.new(repository_path)
|
37
37
|
|
38
38
|
# is a valid android project?
|
39
|
-
|
39
|
+
unless android_project.is_valid
|
40
40
|
puts "#{url.red} is not a valid android project"
|
41
41
|
exit 1
|
42
42
|
end
|
43
43
|
|
44
44
|
# clean and install the apk
|
45
|
-
|
45
|
+
android_project.install
|
46
46
|
|
47
|
-
puts "\n> If you want to remove the app you just installed, execute:\n#{
|
47
|
+
puts "\n> If you want to remove the app you just installed, execute:\n#{android_project.get_uninstall_command.yellow}\n\n"
|
48
48
|
|
49
49
|
end
|
50
50
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'nokogiri'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'tempfile'
|
2
4
|
|
3
5
|
module DryRun
|
4
6
|
|
@@ -10,6 +12,32 @@ module DryRun
|
|
10
12
|
@modules = find_modules
|
11
13
|
end
|
12
14
|
|
15
|
+
def remove_local_properties
|
16
|
+
Dir.chdir @base_path
|
17
|
+
file_name = 'local.properties'
|
18
|
+
|
19
|
+
if File.exist?(file_name)
|
20
|
+
File.remove(file_name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove_application_id
|
25
|
+
# Open temporary file
|
26
|
+
tmp = Tempfile.new("extract")
|
27
|
+
|
28
|
+
file = "#{@path_to_sample}/build.gradle"
|
29
|
+
|
30
|
+
# Write good lines to temporary file
|
31
|
+
open(file, 'r').each { |l| tmp << l unless l.include? 'applicationId' }
|
32
|
+
|
33
|
+
# Close tmp, or troubles ahead
|
34
|
+
tmp.close
|
35
|
+
|
36
|
+
# Move temp file to origin
|
37
|
+
FileUtils.mv(tmp.path, file)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
13
41
|
def settings_gradle
|
14
42
|
"#{@base_path}/settings.gradle"
|
15
43
|
end
|
@@ -29,7 +57,7 @@ module DryRun
|
|
29
57
|
end
|
30
58
|
|
31
59
|
# ./gradlew clean installDebug
|
32
|
-
def
|
60
|
+
def install
|
33
61
|
|
34
62
|
Dir.chdir @base_path
|
35
63
|
|
@@ -42,17 +70,26 @@ module DryRun
|
|
42
70
|
|
43
71
|
builder = "gradle"
|
44
72
|
|
45
|
-
if File.exist?(
|
46
|
-
system(
|
47
|
-
|
73
|
+
if File.exist?('gradlew')
|
74
|
+
system('chmod +x gradlew')
|
75
|
+
|
76
|
+
builder = 'sh gradlew'
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
# Generate the gradle/ folder
|
81
|
+
if File.exist?('gradlew') and !File.directory?('gradle/')
|
82
|
+
system('gradle wrap')
|
48
83
|
end
|
49
84
|
|
50
85
|
self.uninstall
|
86
|
+
self.remove_application_id
|
87
|
+
self.remove_local_properties
|
51
88
|
|
52
89
|
system("#{builder} clean assembleDebug installDebug")
|
53
90
|
|
54
91
|
puts "Installing #{@package.green}...\n"
|
55
|
-
puts "executing: #{execute_line}"
|
92
|
+
puts "executing: #{execute_line.green}\n\n"
|
56
93
|
system(execute_line)
|
57
94
|
|
58
95
|
end
|
@@ -61,6 +98,7 @@ module DryRun
|
|
61
98
|
|
62
99
|
@modules.each do |child|
|
63
100
|
full_path = "#{@base_path}#{child.first}"
|
101
|
+
@path_to_sample = full_path
|
64
102
|
|
65
103
|
execute_line = get_execute_line("#{full_path}/src/main/AndroidManifest.xml")
|
66
104
|
return full_path, execute_line if execute_line
|
@@ -96,10 +134,14 @@ module DryRun
|
|
96
134
|
|
97
135
|
f.close
|
98
136
|
|
99
|
-
"adb shell am start -n #{
|
137
|
+
"adb shell am start -n \"#{get_launchable_activity}\" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER"
|
100
138
|
|
101
139
|
end
|
102
140
|
|
141
|
+
def get_launchable_activity
|
142
|
+
full_path_to_launcher = "#{@package}#{@launcher_activity.gsub(@package,'')}"
|
143
|
+
"#{@package}/#{full_path_to_launcher}"
|
144
|
+
end
|
103
145
|
|
104
146
|
def get_package(doc)
|
105
147
|
doc.xpath("//manifest").attr('package').value
|
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.4.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-08-
|
11
|
+
date: 2015-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.6.6.2
|
97
|
-
description: Tool which allows to quickly try the demo project of
|
97
|
+
description: Tool which allows to quickly try the demo project of any Android Library
|
98
98
|
email:
|
99
99
|
- cesar.manuel.ferreira@gmail.com
|
100
100
|
executables:
|
@@ -139,5 +139,5 @@ rubyforge_project:
|
|
139
139
|
rubygems_version: 2.4.8
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
|
-
summary: Tool which allows to quickly try the demo project of
|
142
|
+
summary: Tool which allows to quickly try the demo project of any Android Library
|
143
143
|
test_files: []
|