stack_overlord 0.0.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 93c41de5818277450167faa30c2cca3c141e8be6
4
+ data.tar.gz: 94cf05f3e764ea79f76b379dfd198c766b163f2a
5
+ SHA512:
6
+ metadata.gz: ab82d3587b9de5efdc56448d831448a480da6082524fc0fdb27aaa7687e4659586784ab6230e70c4ca5d77be768d387d082ba3ca67b0d46e0c07f33eef47be40
7
+ data.tar.gz: ec6a979838e24229ecbea1e485ce9b829d78e9d1f1519c358533499f0c7d775018b5634dc87cc75169580583eecb59887b6ce407aebff7558939da254531fb4a
Binary file
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+ gem 'bundler'
5
+ gem 'rake'
6
+ gem 'json'
7
+ gem 'rest_client'
8
+ gem 'macaddr'
9
+ gem 'encrypted_strings'
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Michael Karouzos & Peter Soderberg
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # StackOverlord
2
+
3
+ This gem listens for exceptions raised by a ruby file and provides links to the the most relevent answers on StackOverflow as well as the Ruby-docs.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'stack_overlord'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install stack_overlord
20
+
21
+ ## Usage
22
+ Bear in mind that this is very much a work in progress. Currently, it only supports exceptions in plain ruby. We hope to add Rails functionality.
23
+ Require this gem in the ruby program you're writing. When an error is generated, a link will be displayed in the terminal window. It's easiest to launch the page by holding command and double-clicking the url in the terminal. Subsequent exceptions raised will update the page with new links.
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/stack_overlord/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1,44 @@
1
+ require "stack_overlord/version"
2
+ require "macaddr"
3
+ require "encrypted_strings"
4
+ require "json"
5
+ require "rest_client"
6
+
7
+ module StackOverlord
8
+
9
+ at_exit do
10
+ Overlord.make_overlord if $!
11
+ end
12
+
13
+ end
14
+
15
+ class Overlord
16
+ attr_reader :error
17
+
18
+ def initialize(collected_error)
19
+ @error = {message: collected_error.message, error_class: collected_error.class}
20
+ end
21
+
22
+ def self.make_overlord
23
+ @stack_master = Overlord.new($!)
24
+ @stack_master.run
25
+ end
26
+
27
+ def mash
28
+ Mac.addr.encrypt
29
+ end
30
+
31
+ def post_message
32
+ RestClient.post "http://www.stackoverlord.com/#{mash}", @error.to_json, :content_type => :json, :accept => :json
33
+ end
34
+
35
+ def puts_link
36
+ puts "\e[31m Your Overlord resides here: http://www.stackoverlord.com/#{mash} \e[0m"
37
+ end
38
+
39
+ def run
40
+ self.post_message
41
+ self.puts_link
42
+ end
43
+ end
44
+
@@ -0,0 +1,3 @@
1
+ module StackOverlord
2
+ VERSION = "0.0.92"
3
+ end
@@ -0,0 +1,56 @@
1
+ require 'spec_helper'
2
+ require 'stack_overlord'
3
+ require "macaddr"
4
+ require "encrypted_strings"
5
+ require "json"
6
+ require "rest_client"
7
+
8
+
9
+ describe Overlord do
10
+
11
+ let!(:test_lord) {Overlord.new(NoMethodError.new)}
12
+
13
+ describe '#self.make_overlord' do
14
+ it 'should make a new Overlord then run that overlord. This method is called by module StackOverLord at exit if $! is present.' do
15
+ end
16
+ end
17
+
18
+
19
+ describe '#initialize' do
20
+ it 'sets attr_reader @error to a hash with keys message and error_class and values from the error' do
21
+ expect(test_lord.error[:message]).to be_a(String)
22
+ expect(test_lord.error[:error_class]).to be(NoMethodError)
23
+ end
24
+ end
25
+
26
+ describe '#mash' do
27
+ it 'returns an encrypted MAC address' do
28
+ # test_lord = Overlord.new(NoMethodError.new)
29
+ expect(test_lord.mash).to be_a(String)
30
+ end
31
+ end
32
+
33
+ describe '#post_message' do
34
+ it 'should send the errors to our server as json' do
35
+ # RestClient = double
36
+ # response = double
37
+ # response.stub(:code) { 200 }
38
+ # RestClient.stub(:post) { response }
39
+ # expect(test_lord.post_message).to exist
40
+ end
41
+ end
42
+
43
+ describe '#puts_link' do
44
+ it 'should diplay the url of server/mash in the terminal' do
45
+ expect{test_lord.puts_link}.to output.to_stdout
46
+ end
47
+ end
48
+
49
+ describe '#run' do
50
+ it 'should call self.post_message and self.puts_link' do
51
+ # expect(subject).to receive(:post_message)
52
+ # expect(test_lord).to receive(:puts_link)
53
+ end
54
+ end
55
+
56
+ end
@@ -0,0 +1,5 @@
1
+ require 'stack_overlord'
2
+ require "macaddr"
3
+ require "encrypted_strings"
4
+ require "json"
5
+ require "rest_client"
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'stack_overlord/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "stack_overlord"
8
+ spec.version = StackOverlord::VERSION
9
+ spec.authors = ["Michael Karouzos & Peter Soderberg & Nick Brown & Richard Baptist"]
10
+ spec.email = ["StackOverlord@gmail.com"]
11
+ spec.summary = %q{Enlist an overlord to handle error messages}
12
+ spec.description = %q{This gem listens for exceptions raised by Ruby and provides links to the the most relevent answers on StackOverflow and Ruby-docs.}
13
+ spec.homepage = "http://www.stackoverlord.com"
14
+ spec.license = "MIT"
15
+ spec.platform = Gem::Platform::RUBY
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_dependency "json"
25
+ spec.add_dependency "rest_client"
26
+ spec.add_dependency "macaddr"
27
+ spec.add_dependency "encrypted_strings"
28
+ spec.add_development_dependency "rspec"
29
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stack_overlord
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.92
5
+ platform: ruby
6
+ authors:
7
+ - Michael Karouzos & Peter Soderberg & Nick Brown & Richard Baptist
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rest_client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: macaddr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: encrypted_strings
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: This gem listens for exceptions raised by Ruby and provides links to
112
+ the the most relevent answers on StackOverflow and Ruby-docs.
113
+ email:
114
+ - StackOverlord@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .DS_Store
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - lib/stack_overlord.rb
125
+ - lib/stack_overlord/version.rb
126
+ - spec/gem_overlord_spec.rb
127
+ - spec/spec_helper.rb
128
+ - stack_overlord.gemspec
129
+ homepage: http://www.stackoverlord.com
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.0.14
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Enlist an overlord to handle error messages
153
+ test_files:
154
+ - spec/gem_overlord_spec.rb
155
+ - spec/spec_helper.rb