adb-peco 0.1.0 → 2.0.0

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: 80e3f9750c7ae4b7386c6966f835b53f4bfdb75e
4
- data.tar.gz: dd66ee229bf7ef6affdaf5182db435307f0f973d
3
+ metadata.gz: 20061fdb131ecf29c3dd3affd517af4374018999
4
+ data.tar.gz: 3b93c7d02fd7da23743f73d8c1afc8574aa03cb7
5
5
  SHA512:
6
- metadata.gz: b3c6c0f3a9cca03e8bb5da9e5e7f3cc4093113f079ce947eb720c70babe008bcb1e3c956974d7d14d265f5e9491e6ecf89723c682678b103a77340daec0718fa
7
- data.tar.gz: da3f49f7835a8ed31dd4232dc79ce6ecc443568bf9af7c9c9f4c00c136e4a711c19b221e5ca00ff237db366ad760d91fcf589afcdf53bef359291c00a7b6ca9f
6
+ metadata.gz: 0d6a5133f4a9c2998ebc7bc32663e9ae7689c7a27da3db6e4ce1182f30c1bd81e725023c9fecbdc184eed41f944c379fd401cdb329d991ed802e31b085e492d9
7
+ data.tar.gz: 09d1358e2625f31dfae1e5a672a7a8bcb60ec0be9294ada6325527023774099bc10302141e0c65670637f8ac2e9e70092b6d7f34a42527f7b82c54ccf79a8497
data/.gitignore CHANGED
@@ -7,4 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- /vendor/bundle/
10
+ /vendor/bundle/
data/README.md CHANGED
@@ -3,20 +3,32 @@ adb-peco
3
3
 
4
4
  adb-peco is a extension for adb.
5
5
 
6
- When you command `adb shell` on the terminal that more than one devices are connected, the terminal is said like this.
6
+ When you command `adb shell` on a terminal with several device and emulator are connected, the terminal said like following.
7
7
 
8
- ![](static/adbshell.gif)
8
+ ![](static/command-with-adb.gif)
9
9
 
10
- adb-peco make available to choose device after command adb, if more than one devices are connected. like this.
10
+ adb-peco make available to choose a device before run the command.
11
11
 
12
- ![](static/adbpshell.gif)
12
+ ![](static/command-with-adb-peco.gif)
13
+
14
+ ## Installation
15
+
16
+ ### Peco is available on your environment?
17
+
18
+ `adb-peco` require [peco](https://github.com/peco/peco). So install [peco](https://github.com/peco/peco) at first.
19
+
20
+ ### Installation gem
21
+
22
+ ```bash
23
+ gem install adb-peco
24
+ ```
25
+
26
+ ## Tips
27
+
28
+ Replace adb command to use adb-peco always.
13
29
 
14
- ## Quick start
15
- `adb-peco` require [peco](https://github.com/peco/peco) so install [peco](https://github.com/peco/peco) at first.
16
30
  ```bash
17
- git clone git@github.com:tomorrowkey/adb-peco.git
18
- cd adb-peco/bin
19
- adbp shell
31
+ alias adb='adb-peco'
20
32
  ```
21
33
 
22
34
  ## Lincense
@@ -4,6 +4,8 @@ require 'peco_selector'
4
4
 
5
5
  module Adb
6
6
  module Peco
7
+ AdbUnavailableError = Class.new(StandardError)
8
+
7
9
  def self.serial_option
8
10
  return nil unless adb_action
9
11
  return nil unless need_serial_option?
@@ -15,6 +17,20 @@ module Adb
15
17
  ["#{device.model} (#{device.serial})", device]
16
18
  }).first
17
19
  "-s #{device.serial}"
20
+
21
+ rescue PecoSelector::PecoUnavailableError => e
22
+ puts e.message
23
+ exit 1
24
+ end
25
+
26
+ def self.adb_available?
27
+ system('which', 'adb', out: File::NULL)
28
+ end
29
+
30
+ def self.ensure_adb_available
31
+ unless adb_available?
32
+ raise AdbUnavailableError, 'adb command is not available.'
33
+ end
18
34
  end
19
35
 
20
36
  def self.adb_action
@@ -30,7 +46,23 @@ module Adb
30
46
  ].include?(adb_action)
31
47
  end
32
48
 
33
- command = ['adb', serial_option, ARGV].flatten.join(' ')
34
- system(command)
49
+ def self.quote(args)
50
+ args.map{|a| a.include?(' ') ? %Q{"#{a}"} : a }
51
+ end
52
+
53
+ begin
54
+ ensure_adb_available
55
+ rescue AdbUnavailableError => e
56
+ puts e.message
57
+ exit 1
58
+ end
59
+
60
+ command = ['adb', serial_option, quote(ARGV)].flatten.join(' ')
61
+ begin
62
+ puts "+ #{command}"
63
+ system(command)
64
+ rescue Interrupt
65
+ # Ignore
66
+ end
35
67
  end
36
68
  end
@@ -1,5 +1,5 @@
1
1
  module Adb
2
2
  module Peco
3
- VERSION = '0.1.0'
3
+ VERSION = '2.0.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adb-peco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomoki Yamashita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-22 00:00:00.000000000 Z
11
+ date: 2016-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: device_api-android
@@ -114,8 +114,8 @@ files:
114
114
  - exe/adb-peco
115
115
  - lib/adb/peco.rb
116
116
  - lib/adb/peco/version.rb
117
- - static/adbpshell.gif
118
- - static/adbshell.gif
117
+ - static/command-with-adb-peco.gif
118
+ - static/command-with-adb.gif
119
119
  homepage: http://github.com/tomorrowkey/adb-peco
120
120
  licenses:
121
121
  - Apache License 2.0
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.4.5.1
139
+ rubygems_version: 2.5.1
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Run adb command with peco
Binary file
Binary file