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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8309c6be22ec8e7c5c8f3f84f6f6821cd6cb5b8
4
- data.tar.gz: f63d664d10d4d230be61613ab41522969985c215
3
+ metadata.gz: a52ba1562cfe37b2d5ac0ebf7bc5fa7321fd4fa1
4
+ data.tar.gz: 30f24f683a63316190b2fce01929a6b72b113795
5
5
  SHA512:
6
- metadata.gz: cd7a35657366b4ab599b2a455c4cf7e1b1bf66aa9b659d6b26adf4f9caf46087e666ab4dda00aa8dae24224097e9d7e77d25b64049a4a20d620112717edc3fcd
7
- data.tar.gz: 32da7707e122689d756fd2e137bd6521f4c1c59ea44c7142e9da0e91c86025cf56b5939fb2bdc15fe5f79bf74e8ae0a3052daff4afb16c90177c486032ae5c41
6
+ metadata.gz: a793ac60082bc24c74ab33504bdfe4a092490cefba3910891c88c72f26166e8b5ee174e9de5b8fe430eba81a5c2e7b523c3239b00318c338e1d2208c1e0af555
7
+ data.tar.gz: 1da1738f402f1c3179469cb0963a4ccde07d6dda5e3994c7013cd5e03915cae45a95bab48d205b15d6a17aa7f4b11aaee0c6d14ec55dd98b0053f0c2d736cf66
@@ -1,3 +1,7 @@
1
+ # 1.0.1
2
+ ### Feature
3
+ * Load environments variables `HPS_HIPCHAT_TOKEN` instead of the file `~/.hps`
4
+
1
5
  # 1.0.0
2
6
  ### Feature
3
7
  * Newer search result is output to the upstream
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
- echo {access_token} > ~/.hps
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 since target date
71
+ * Search the words the date of latest from the target date
65
72
 
66
73
  ```
67
74
  hps word -d 2014-01-01
@@ -1,5 +1,5 @@
1
1
  require 'hipchat_searcher/command'
2
- require 'hipchat_searcher/config'
2
+ require 'hipchat_searcher/token'
3
3
  require 'hipchat_searcher/item_extention'
4
4
  require 'hipchat_searcher/message'
5
5
  require 'hipchat_searcher/options'
@@ -3,9 +3,7 @@ module HipchatSearcher
3
3
  def initialize(pattern, options)
4
4
  @pattern = pattern
5
5
  @options = options
6
- @options.config = Config.new
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.config.token, @options.room_options).all_room
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.config.token, @options.message_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
@@ -1,3 +1,3 @@
1
1
  module HipchatSearcher
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  describe HipchatSearcher do
3
3
  it 'has a version number' do
4
- HipchatSearcher::VERSION.should == '1.0.0'
4
+ HipchatSearcher::VERSION.should == '1.0.1'
5
5
  end
6
6
  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.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-07-14 00:00:00.000000000 Z
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