exception_overflow 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/lib/exception_overflow.rb +7 -0
- data/lib/exception_overflow/exception.rb +9 -0
- data/lib/exception_overflow/message.rb +28 -0
- data/lib/exception_overflow/stack_overflow.rb +20 -0
- data/lib/exception_overflow/version.rb +3 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ad2b69c8cd99e3e9552e8a91b7b708fe31ceadb1
|
4
|
+
data.tar.gz: 6d74282e8c7d676cff1fb34170c014c2d76a670e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4f57015e63982ed6971551bccf2cc51c1894607ce8431525384d143cc4f64da7d1b13c64ad667b78f7bfa1df281395f0e00798bc604b755516bcc486df1eb58a
|
7
|
+
data.tar.gz: 0d82058af2b6736ba5b59c72174a24a5ded6ea834c44640ed3ae442e38123d07179f9ca2a0400c2cf3f524a0fa238634f420cbfef448142f9c0f034ae210fcff
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Sergey Novikov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# ExceptionOverflow
|
2
|
+
|
3
|
+
Find exceptions on StackOverflow inside your terminal.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'exception_overflow'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install exception_overflow
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'exception_overflow'
|
25
|
+
```
|
26
|
+
|
27
|
+
## License
|
28
|
+
|
29
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module ExceptionOverflow
|
2
|
+
class Message
|
3
|
+
def initialize(q)
|
4
|
+
@q = q
|
5
|
+
end
|
6
|
+
|
7
|
+
def render
|
8
|
+
@q + "\n\n#{links}"
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def links
|
14
|
+
ExceptionOverflow::StackOverflow.search(q: @q)
|
15
|
+
.parsed_response['items'].map{ |i| template(i['title'], i['link']) }
|
16
|
+
.first(5).join
|
17
|
+
end
|
18
|
+
|
19
|
+
# Formatted link for output:
|
20
|
+
#
|
21
|
+
# <b>Which is the best graphical ruby profiler?</b>
|
22
|
+
# http://stackoverflow.com/questions/8448705/which-is-the-best-graphical-ruby-profiler
|
23
|
+
#
|
24
|
+
def template(title, link)
|
25
|
+
"\t\e[1m#{title}\e[22m\n\t#{link}\n\n"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module ExceptionOverflow
|
4
|
+
class StackOverflow
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
base_uri('api.stackexchange.com/2.2')
|
8
|
+
|
9
|
+
def self.search(options = {})
|
10
|
+
options.merge!({
|
11
|
+
answers: 1,
|
12
|
+
site: 'stackoverflow',
|
13
|
+
sort: 'relevance',
|
14
|
+
tagged: 'ruby'
|
15
|
+
})
|
16
|
+
|
17
|
+
get('/search/advanced', { query: options })
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: exception_overflow
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sergey Novikov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: webmock
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- novikov359@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- MIT-LICENSE
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
65
|
+
- lib/exception_overflow.rb
|
66
|
+
- lib/exception_overflow/exception.rb
|
67
|
+
- lib/exception_overflow/message.rb
|
68
|
+
- lib/exception_overflow/stack_overflow.rb
|
69
|
+
- lib/exception_overflow/version.rb
|
70
|
+
homepage: https://github.com/droptheplot/exception_overflow
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
74
|
+
post_install_message:
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.4.8
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Find exceptions on StackOverflow
|
94
|
+
test_files: []
|
95
|
+
has_rdoc:
|