snorkel 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/snorkel +6 -0
  3. data/lib/snorkel.rb +39 -0
  4. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 814c08173a58ad930cb524e076fd6b90a82ad200
4
+ data.tar.gz: eaebd2c6afaf5c039678fccda17e9a9b26493626
5
+ SHA512:
6
+ metadata.gz: f90ecfa45e4ad3a1c58b026e93db7074da40b43ae6bbfc74130b0a0952705c8a2322dd45915945f7c87a96fb94d09d97b28bf5618238027327d4706e6a9eb098
7
+ data.tar.gz: a27d1b1b718ddee8910cfd8ba3b35496385c22e4d1bcf32f38321fd09310951affb360d083410adebb571aafb697b658768f9c48c7ad0ccffd093ce2fe4a69df
data/bin/snorkel ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'snorkel'
4
+
5
+ file = ARGV.join(" ")
6
+ n = ErrorRescue.new(file)
data/lib/snorkel.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'launchy'
2
+ require 'colored'
3
+
4
+ class ErrorRescue
5
+ def initialize(file)
6
+ @file = File.open(file, "rb")
7
+ track_method
8
+ ask_response
9
+ end
10
+
11
+ def track_method
12
+ begin
13
+ eval(@file.read)
14
+ rescue Exception => ex
15
+ @message = ex.message
16
+ end
17
+ return if @message == nil
18
+ end
19
+
20
+ def ask_response
21
+ puts @message.capitalize.red
22
+ puts "Would you like to search your error?"
23
+ @response = $stdin.gets.chomp
24
+ launch_search
25
+ end
26
+
27
+ def launch_search
28
+ new_message = @message.split(" ").join("+").downcase
29
+ if @response.start_with? 'y'
30
+ Launchy.open("https://www.google.com/#q=#{new_message}+ruby")
31
+ else
32
+ puts "Have a nice day!"
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+
39
+
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: snorkel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Danielle Adams, Ken Sin, Jessica Tatham, Vic Schaeperkoetter, Timothy McClung, Hallo
8
+ Jaf
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-05-30 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Rescue error messages and auto-search Google upon prompt.
15
+ email: dadams18@gmail.com
16
+ executables:
17
+ - snorkel
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/snorkel
22
+ - lib/snorkel.rb
23
+ homepage: http://rubygems.org/gems/snorkel
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.2.2
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Snorkeling for errors!
47
+ test_files: []