hipchat_searcher 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +9 -2
- data/lib/hipchat_searcher.rb +1 -1
- data/lib/hipchat_searcher/command.rb +2 -23
- data/lib/hipchat_searcher/runner.rb +1 -1
- data/lib/hipchat_searcher/token.rb +30 -0
- data/lib/hipchat_searcher/version.rb +1 -1
- data/spec/hipchat_searcher_spec.rb +1 -1
- metadata +3 -3
- data/lib/hipchat_searcher/config.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a52ba1562cfe37b2d5ac0ebf7bc5fa7321fd4fa1
|
4
|
+
data.tar.gz: 30f24f683a63316190b2fce01929a6b72b113795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a793ac60082bc24c74ab33504bdfe4a092490cefba3910891c88c72f26166e8b5ee174e9de5b8fe430eba81a5c2e7b523c3239b00318c338e1d2208c1e0af555
|
7
|
+
data.tar.gz: 1da1738f402f1c3179469cb0963a4ccde07d6dda5e3994c7013cd5e03915cae45a95bab48d205b15d6a17aa7f4b11aaee0c6d14ec55dd98b0053f0c2d736cf66
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -17,13 +17,14 @@ You will be able to search hipchat log more easily.
|
|
17
17
|
* If you get access token, execute command like this.
|
18
18
|
|
19
19
|
```
|
20
|
-
|
20
|
+
export HPS_HIPCHAT_TOKEN={access_token}
|
21
21
|
```
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
25
|
`hipchat_searcher` search for a regular expression the words that you specify.
|
26
26
|
In the specifications of the [hipchat api](https://www.hipchat.com/docs/apiv2/), `hipchat_searcher` search of the upcoming 100 comments.
|
27
|
+
If you want to search the log older 100 recently, specify `-e` or `--deep` option.
|
27
28
|
|
28
29
|
* Search the words in all room. (but it searches ALL the room that user know, so there may be heavy)
|
29
30
|
|
@@ -37,6 +38,12 @@ hps word
|
|
37
38
|
hps word -r room-name
|
38
39
|
```
|
39
40
|
|
41
|
+
* Search the words older than 75 recently
|
42
|
+
|
43
|
+
```
|
44
|
+
hps word -e
|
45
|
+
```
|
46
|
+
|
40
47
|
* Search the words of trailing context after each match. Such as `grep` command option.
|
41
48
|
|
42
49
|
```
|
@@ -61,7 +68,7 @@ hps word -C 2
|
|
61
68
|
hps word -u user-name
|
62
69
|
```
|
63
70
|
|
64
|
-
* Search the words
|
71
|
+
* Search the words the date of latest from the target date
|
65
72
|
|
66
73
|
```
|
67
74
|
hps word -d 2014-01-01
|
data/lib/hipchat_searcher.rb
CHANGED
@@ -3,9 +3,7 @@ module HipchatSearcher
|
|
3
3
|
def initialize(pattern, options)
|
4
4
|
@pattern = pattern
|
5
5
|
@options = options
|
6
|
-
@options.
|
7
|
-
|
8
|
-
config_valid!
|
6
|
+
@options.token = Token.token
|
9
7
|
end
|
10
8
|
|
11
9
|
def self.run(pattern, options)
|
@@ -35,26 +33,7 @@ module HipchatSearcher
|
|
35
33
|
private
|
36
34
|
|
37
35
|
def all_room
|
38
|
-
Room.new(@options.
|
39
|
-
end
|
40
|
-
|
41
|
-
def config_valid!
|
42
|
-
unless @options.config.valid?
|
43
|
-
print_no_authorization_token
|
44
|
-
exit 1
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def print_no_authorization_token
|
49
|
-
puts <<-EOS
|
50
|
-
Authorization token required.
|
51
|
-
|
52
|
-
* To create config file, run this command
|
53
|
-
`echo {auth_token} > ~/.hps`
|
54
|
-
|
55
|
-
* To get new auth_token, visit and sign in.
|
56
|
-
https://www.hipchat.com/
|
57
|
-
EOS
|
36
|
+
Room.new(@options.token, @options.room_options).all_room
|
58
37
|
end
|
59
38
|
|
60
39
|
def rooms
|
@@ -4,7 +4,7 @@ module HipchatSearcher
|
|
4
4
|
@pattern = pattern
|
5
5
|
@room = room
|
6
6
|
@options = options
|
7
|
-
@message = Message.new(@options.
|
7
|
+
@message = Message.new(@options.token, @options.message_options)
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.run(pattern, room, options)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module HipchatSearcher
|
2
|
+
class Token
|
3
|
+
attr_reader :token
|
4
|
+
|
5
|
+
def self.token
|
6
|
+
new.token
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
print_not_exist! unless ENV['HPS_HIPCHAT_TOKEN']
|
11
|
+
@token = ENV['HPS_HIPCHAT_TOKEN']
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def print_not_exist!
|
17
|
+
puts <<-EOS
|
18
|
+
`HPS_HIPCHAT_TOKEN` is not exsited.
|
19
|
+
|
20
|
+
* Set environment variable HPS_HIPCHAT_TOKEN
|
21
|
+
`export HPS_HIPCHAT_TOKEN={auth_token}`
|
22
|
+
|
23
|
+
* To get new auth_token, visit and sign in.
|
24
|
+
https://www.hipchat.com/
|
25
|
+
EOS
|
26
|
+
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hipchat_searcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mgi166
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hipchat
|
@@ -156,7 +156,6 @@ files:
|
|
156
156
|
- hipchat_searcher.gemspec
|
157
157
|
- lib/hipchat_searcher.rb
|
158
158
|
- lib/hipchat_searcher/command.rb
|
159
|
-
- lib/hipchat_searcher/config.rb
|
160
159
|
- lib/hipchat_searcher/deep_runner.rb
|
161
160
|
- lib/hipchat_searcher/item_extention.rb
|
162
161
|
- lib/hipchat_searcher/message.rb
|
@@ -167,6 +166,7 @@ files:
|
|
167
166
|
- lib/hipchat_searcher/search_proxy.rb
|
168
167
|
- lib/hipchat_searcher/search_proxy/grep.rb
|
169
168
|
- lib/hipchat_searcher/search_proxy/simple.rb
|
169
|
+
- lib/hipchat_searcher/token.rb
|
170
170
|
- lib/hipchat_searcher/version.rb
|
171
171
|
- spec/data/item-list-100.json
|
172
172
|
- spec/data/item-list-empty.json
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module HipchatSearcher
|
2
|
-
class Config
|
3
|
-
attr_reader :token
|
4
|
-
def initialize
|
5
|
-
print_not_exist! unless File.exist?(config_path)
|
6
|
-
@token = File.read(config_path).chomp
|
7
|
-
end
|
8
|
-
|
9
|
-
def valid?
|
10
|
-
!!@token
|
11
|
-
end
|
12
|
-
|
13
|
-
def print_not_exist!
|
14
|
-
puts <<-EOS
|
15
|
-
Config file is not exsited.
|
16
|
-
|
17
|
-
* To create config file, run this command
|
18
|
-
`echo {auth_token} > ~/.hps`
|
19
|
-
|
20
|
-
* To get new auth_token, visit and sign in.
|
21
|
-
https://www.hipchat.com/
|
22
|
-
EOS
|
23
|
-
|
24
|
-
exit 1
|
25
|
-
end
|
26
|
-
|
27
|
-
def config_path
|
28
|
-
File.expand_path(File.join('~', '.hps'))
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|