ADB 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,12 @@
1
+ === Release 0.4 / 2012-9-8
2
+ * Enhancements
3
+ * Added ability to pass options to the install command
4
+
5
+ === Release 0.3 / 2012-8-22
6
+ * Bug Fixes
7
+ * DateTime adjustment bug on Linux
8
+ * Add wait-for-device for install on Linux
9
+
1
10
  === Release 0.3 / 2012-8-22
2
11
  * Enhancements
3
12
  * Added remount method (mounts /system as root)
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rake'
4
4
  gem 'fuubar'
5
+ gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
5
6
  gem 'growl'
6
7
  gem 'guard-rspec'
7
8
  gem 'guard-cucumber'
data/Guardfile CHANGED
@@ -7,7 +7,7 @@ guard 'rspec', :version => 2, :cli => '--color --format Fuubar' do
7
7
  watch('spec/spec_helper.rb') { "spec" }
8
8
  end
9
9
 
10
- guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile default' do
10
+ guard 'cucumber', :notification => true, :all_after_pass => false, :cli => '--profile focus' do
11
11
  watch(%r{^features/.+\.feature$})
12
12
  watch(%r{^features/support/.+$}) { 'features' }
13
13
  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
@@ -1 +1,2 @@
1
1
  default: --no-source --color --format pretty
2
+ focus: --no-source --color --format pretty --tags @focus
@@ -17,6 +17,11 @@ Feature: Using the ADB module
17
17
  Given the adb server is started
18
18
  And I am connected to the local device
19
19
  Then I should be able to install the sample application
20
+
21
+ Scenario: Providing command line options for installation
22
+ Given the adb server is started
23
+ And I am connected to the local device
24
+ Then I should be able to install the sample application using the "-r" option
20
25
 
21
26
  Scenario: Uninstalling the application
22
27
  Given the adb server is started
@@ -25,10 +25,16 @@ end
25
25
  Then /^I should be able to install the sample application$/ do
26
26
  sn = devices[0]
27
27
  wait_for_device({:serial => sn}, 60)
28
- install 'features/support/ApiDemos.apk', {:serial => sn}, 60
28
+ install 'features/support/ApiDemos.apk', nil, {:serial => sn}, 60
29
29
  last_stdout.should include 'Success'
30
30
  end
31
31
 
32
+ Then /^I should be able to install the sample application using the "(.*?)" option$/ do |option|
33
+ sn = devices[0]
34
+ wait_for_device({:serial => sn}, 60)
35
+ install 'features/support/ApiDemos.apk', option, {:serial => sn}, 60
36
+ end
37
+
32
38
  Then /^I should be able to uninstall the sample application$/ do
33
39
  sn = devices[0]
34
40
  uninstall 'com.example.android.apis', {:serial => sn}
@@ -6,11 +6,11 @@ require 'ADB'
6
6
 
7
7
  World(ADB)
8
8
 
9
- emulator = ChildProcess.build('emulator', '-avd', 'Android_4.0.3', '-port', '5554')
10
- emulator.start
9
+ #emulator = ChildProcess.build('emulator', '-avd', 'Android_4.0.3', '-port', '5554')
10
+ #emulator.start
11
11
 
12
12
  at_exit do
13
- emulator.stop
13
+ # emulator.stop
14
14
  end
15
15
 
16
16
 
data/lib/ADB.rb CHANGED
@@ -2,7 +2,7 @@ require 'ADB/version'
2
2
  require 'ADB/errors'
3
3
  require 'childprocess'
4
4
  require 'tempfile'
5
-
5
+ require 'date'
6
6
  #
7
7
  # Mixin that provides access to the commands of the adb executable
8
8
  # which is a part of the android toolset.
@@ -91,8 +91,8 @@ module ADB
91
91
  # @param timeout value for the command to complete. Defaults to 30
92
92
  # seconds.
93
93
  #
94
- def install(installable, target={}, timeout=30)
95
- execute_adb_with(timeout, "#{which_one(target)} install #{installable}")
94
+ def install(installable, options=nil, target={}, timeout=30)
95
+ execute_adb_with(timeout, "#{which_one(target)} wait-for-device install #{options} #{installable}")
96
96
  raise ADBError, "Could not install #{installable}" unless stdout_contains "Success"
97
97
  end
98
98
 
@@ -1,3 +1,3 @@
1
1
  module ADB
2
- VERSION = "0.3"
2
+ VERSION = "0.4"
3
3
  end
@@ -129,33 +129,39 @@ describe ADB do
129
129
  context "when installing an apk" do
130
130
  it "should be able to install an application" do
131
131
  ADB.should_receive(:last_stdout).and_return("Success")
132
- should_call_adb_with('install', 'Test.apk')
132
+ should_call_adb_with('wait-for-device', 'install', 'Test.apk')
133
133
  ADB.install 'Test.apk'
134
134
  end
135
135
 
136
136
  it "should install to the only connected device" do
137
137
  ADB.should_receive(:last_stdout).and_return("Success")
138
- should_call_adb_with('-d', 'install', 'Test.apk')
139
- ADB.install 'Test.apk', :device => 'blah'
138
+ should_call_adb_with('-d', 'wait-for-device', 'install', 'Test.apk')
139
+ ADB.install 'Test.apk', nil, :device => 'blah'
140
140
  end
141
141
 
142
142
  it "should install to the only emulator" do
143
143
  ADB.should_receive(:last_stdout).and_return("Success")
144
- should_call_adb_with('-e', 'install', 'Test.apk')
145
- ADB.install 'Test.apk', :emulator => 'blah'
144
+ should_call_adb_with('-e', 'wait-for-device', 'install', 'Test.apk')
145
+ ADB.install 'Test.apk', nil, :emulator => 'blah'
146
146
  end
147
147
 
148
148
  it "should install to a target using serial number" do
149
149
  ADB.should_receive(:last_stdout).and_return("Success")
150
- should_call_adb_with('-s', 'sernum', 'install', 'Test.apk')
151
- ADB.install 'Test.apk', :serial => 'sernum'
150
+ should_call_adb_with('-s', 'sernum', 'wait-for-device', 'install', 'Test.apk')
151
+ ADB.install 'Test.apk', nil, :serial => 'sernum'
152
152
  end
153
153
 
154
154
  it "should raise an error when the install fails" do
155
155
  ADB.should_receive(:last_stdout).and_return("some error")
156
- should_call_adb_with('install', 'Test.apk')
156
+ should_call_adb_with('wait-for-device', 'install', 'Test.apk')
157
157
  expect { ADB.install('Test.apk') }.to raise_error(ADBError)
158
158
  end
159
+
160
+ it "should accept an optional parameter" do
161
+ ADB.should_receive(:last_stdout).and_return("Success")
162
+ should_call_adb_with('-s', 'sernum', 'wait-for-device', 'install', '-r', 'Test.apk')
163
+ ADB.install 'Test.apk', '-r', :serial => 'sernum'
164
+ end
159
165
  end
160
166
 
161
167
  context "when uninstalling an apk" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ADB
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-22 00:00:00.000000000 Z
13
+ date: 2012-09-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: childprocess
@@ -100,12 +100,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  - - ! '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
+ segments:
104
+ - 0
105
+ hash: -3420063598173628702
103
106
  required_rubygems_version: !ruby/object:Gem::Requirement
104
107
  none: false
105
108
  requirements:
106
109
  - - ! '>='
107
110
  - !ruby/object:Gem::Version
108
111
  version: '0'
112
+ segments:
113
+ - 0
114
+ hash: -3420063598173628702
109
115
  requirements: []
110
116
  rubyforge_project:
111
117
  rubygems_version: 1.8.24