dryrun 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56ec56b375eacf6ee115b8d7f6659d4d7165e920
4
- data.tar.gz: 3a2807a1fc8cc5e54fc25dd6b80df8e87640f993
3
+ metadata.gz: 31a7a350f5f35e5214aad6a9cff0b5ca61cf0331
4
+ data.tar.gz: 9415dd1e35bbbc086a14439b0fc9eabf7a18ba51
5
5
  SHA512:
6
- metadata.gz: 7ae9e2139b40fd0e7d6ec3de75d09552d5b0f3ffbcdf307728da4989c220b818610d3d5b3df0c6a975bade1814a9aa00b35b5ced27a0e8f73f8e4f1028ec6594
7
- data.tar.gz: 9dac1dff1bf37f1704d6450ac97abc16ac07db10b2c8ef34d0d23d10c1d25d7f49890fc72dd893378b7ff1460f6c10ca60a830dd698c391e4e7bf02868c48ea0
6
+ metadata.gz: 936abaf3c71d7c2097065fcb0bef60a3e6b7eedcf70bc8d23662e8f30f6e602a93d6885f3ecdc6020e1cb952a7226a2efbce4b86c6ef1386f9529c59f70010ff
7
+ data.tar.gz: 6ca7768fbfa671b5e3b90c434f4787d767854784c2b5b74a041e2e379c038b35bc8f6837833c8c84c86ef436b14f1706c5e36912d7343be2042af387e50d205a
@@ -11,7 +11,7 @@ module DryRun
11
11
  def initialize(arguments)
12
12
 
13
13
  @url = ['-h', '--help', '-v', '--version'].include?(arguments.first) ? nil : arguments.shift
14
-
14
+
15
15
  # defaults
16
16
  @app_path = nil
17
17
  @custom_module = nil
@@ -102,7 +102,7 @@ module DryRun
102
102
  # clean and install the apk
103
103
  android_project.install
104
104
 
105
- puts "\n> If you want to remove the app you just installed, execute:\n#{android_project.get_uninstall_command.red}\n\n"
105
+ puts "\n> If you want to remove the app you just installed, execute:\n#{android_project.get_uninstall_command.yellow}\n\n"
106
106
  end
107
107
  end
108
108
  end
@@ -1,6 +1,7 @@
1
1
  require 'oga'
2
2
  require 'fileutils'
3
3
  require 'tempfile'
4
+ require 'find'
4
5
  require_relative 'dryrun_utils'
5
6
 
6
7
  module DryRun
@@ -152,15 +153,13 @@ module DryRun
152
153
  end
153
154
 
154
155
  def get_execution_line_command(path_to_sample)
155
- path_to_manifest = File.join(path_to_sample, 'src/main/AndroidManifest.xml')
156
+ manifest_file = get_manifest(path_to_sample)
156
157
 
157
- if !File.exist?(path_to_manifest)
158
+ if manifest_file.nil?
158
159
  return false
159
160
  end
160
161
 
161
- f = File.open(path_to_manifest)
162
-
163
- doc = Oga.parse_xml(f)
162
+ doc = Oga.parse_xml(manifest_file)
164
163
 
165
164
  @package = get_package(doc)
166
165
  @launcher_activity = get_launcher_activity(doc)
@@ -169,11 +168,22 @@ module DryRun
169
168
  return false
170
169
  end
171
170
 
172
- f.close
171
+ manifest_file.close
173
172
 
174
173
  "adb shell am start -n \"#{get_launchable_activity}\" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER"
175
174
  end
176
175
 
176
+ def get_manifest(path_to_sample)
177
+ default_path = File.join(path_to_sample, 'src/main/AndroidManifest.xml')
178
+ if File.exist?(default_path)
179
+ return File.open(default_path)
180
+ else
181
+ Find.find(path_to_sample) do |path|
182
+ return File.open(path) if path =~ /.*AndroidManifest.xml$/
183
+ end
184
+ end
185
+ end
186
+
177
187
  def get_launchable_activity
178
188
  full_path_to_launcher = "#{@package}#{@launcher_activity.gsub(@package,'')}"
179
189
  "#{@package}/#{full_path_to_launcher}"
@@ -189,7 +199,7 @@ module DryRun
189
199
  intent_filter = child.css('intent-filter')
190
200
 
191
201
  if intent_filter != nil and intent_filter.length != 0
192
- return child.xpath("//activity").attr("android:name").last.value
202
+ return child.attr("android:name").value
193
203
  end
194
204
  end
195
205
  false
@@ -1,3 +1,3 @@
1
1
  module DryRun
2
- VERSION = '0.6.3'
2
+ VERSION = '0.6.4'
3
3
  end
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.6.3
4
+ version: 0.6.4
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-04-25 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake