emissary-ruby 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7dc0da3597e9064241a4a1b542ab0fc08ed5241c969fa52e584b90a431844d73
4
- data.tar.gz: dd46a45ef2cbb2269f3b73dc8650b6e9de1531b7b3984fd388521244747a49fd
3
+ metadata.gz: e079c3d6412aec1ff8fafa45be88815d1b7d9d21b2b6e1bdfa73fc7f3877655c
4
+ data.tar.gz: 11cb0ba431892f25777d7a81cb3d7ed74f80913536147ce5e6a361597e204aec
5
5
  SHA512:
6
- metadata.gz: 357fca61859ad7445dc30022902ca07ab3688f60801e23be312e8b437fc23c26da6d61c5b8068be586c3af6224000481918f1a85901004be813c05dd361306c1
7
- data.tar.gz: '095d257b47d27327e7846879e2e84fd8802d51ad77f47a5736afcdcba421d79adf6ed9f59cfb1d985a18ebcaa237b28cfda27afcfb51511b1adfc136e0220e37'
6
+ metadata.gz: 910d242d70f9dbd1ed7cc3561b81eb4469d2bb10564d071e7ac2830d3441b22e5d7c21bc0f3cbd644db32eb9b57e73448241fa8747a63932db2e89714ded6e24
7
+ data.tar.gz: 2d45556b04e7ef17700809d96c01b1dc6b5b28d7addf737d61054c911fe9eeb5e0073a3d31e05c87359489d0ebdc530c361cdf88ba376fa45746c93008b792c1
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
  Simple error catcher integrated with services like Discord and Trello, use chatbots to monitor your application and server.
3
3
  Receive error catching reports to a Discord Server Channel, and use chatbots to send commands and fetch reports.
4
4
 
5
+ # PRESENTATION
6
+ [![Watch the presentation](https://github.com/MakarovCode/Emissary/raw/main/thumb.png)](https://dms.licdn.com/playlist/C4E05AQHyxbCfCVGHYA/mp4-720p-30fp-crf28/0/1623710691404?e=1623808800&v=beta&t=gUzmyqiD7vgxfWC7KYeU53-us6buF-kf2o60RfZfxuQ)
7
+
5
8
  # Features
6
9
  * This tools allows you to configurate the errors or lines you want to capture from any log file, in this example you will find a configuration for catching HTTP ERROR 500.
7
10
  * You can configurate the timeframes in which the logs will be read, the conditions that triggers the errores, the lines to fetch from the files, the language to markup the error to discord, characters to ignore, how often the errors fetched would be clear, and how often you want a receive reports with error ocurrences.
@@ -22,38 +25,26 @@ Receive error catching reports to a Discord Server Channel, and use chatbots to
22
25
  * 4. Find your Trello **ListID**, you can do this by openning the web tools in your browser, click on the navigation tab and watch for the navigation log when editing the name of your list, the ID will be visible under the **Preview Tab**
23
26
  * 5. Use the Trello **ListID** in the loggr.json file under the configuration you want trello to work with.
24
27
 
25
- # 2. Download / Clone the code
26
- ```bash
27
-
28
- git clone git@github.com:MakarovCode/Emissary.git
29
-
30
- ```
31
-
32
- # 3. Make it run
33
- create runner.rb or config/initializer/emissary.rb file
34
-
28
+ # 2. Install gem and dependencies
35
29
  ```ruby
36
30
 
37
- require './emissary'
31
+ #Gemfile
32
+ gem "emissary-ruby"
33
+ gem "discordrb"
34
+ gem "ruby-trello"
38
35
 
39
- Emissary.configure do |config|
40
- config.server_name = "A name for chat titles"
41
- config.header_format = "__***{title}***__" #Any markup
42
- config.webhooks_url = '{discord webhooks_url}'
43
- config.bot_token = '{discord bot_token}'
44
- config.trello_public_key = '{trello public_key}'
45
- config.trello_member_token = '{trello member_token}'
46
- end
47
-
48
- emi = Emissary.new
36
+ #Or install each gem
37
+ gem install "discordrb"
38
+ gem install "ruby-trello"
39
+ gem install "emissary-ruby"
49
40
 
50
41
  ```
51
42
 
52
- # 4. Configure your log readers and commands in the loggr.json file
43
+ # 3. Configure your log readers and commands by creating a file emissary.json inside your project.
53
44
 
54
45
  See some examples
55
46
 
56
- ```javascript
47
+ ```json
57
48
  {
58
49
  "rails": {
59
50
  "name": "Rails Logger",
@@ -109,6 +100,14 @@ See some examples
109
100
  }
110
101
  ```
111
102
 
103
+ # 3. Make it run
104
+ Run the **bundle exec emissary** command and pass as parameter the path to the **emissary.json** file you just created
105
+
106
+ ```ruby
107
+ bundle exec emissary "/path/to/config/file.json"
108
+
109
+ ```
110
+
112
111
  # 5. If everything goes right
113
112
  You can type the next commands in your Discord Server Channel and the Chatbot will answer.
114
113
 
@@ -121,10 +120,17 @@ You can type the next commands in your Discord Server Channel and the Chatbot wi
121
120
 
122
121
  !emy rails {id} trello #Add message report to trello list
123
122
  ```
123
+
124
124
  # Roadmap
125
125
  This tools is in the making
126
- * Upload as Ruby Gem
126
+ * Multi server with the same BOT
127
+ * Better command params handling
128
+ * Convert the message HASH into a Ruby Class
129
+ * Change the JSON config file to a init class configuration for better customization
130
+ * Title dates formatting
131
+ * Gem dependencies
127
132
  * Regex conditioning
128
133
  * Slack Integration
129
134
  * Email reports Integration
130
- * Convert the message HASH into a Ruby Class
135
+ * Authy integration for TwoFactor authentication for sensible commands
136
+ * API Keys with ENV variables
data/bin/emissary ADDED
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/emissary'
4
+
5
+ file = File.open ARGV[0]
6
+ c_config = JSON.load file
7
+
8
+ Emissary.configure do |config|
9
+ # usuario transacional para sms instantaneos
10
+ config.server_name = c_config["server_name"]
11
+ config.header_format = c_config["header_format"]
12
+ config.webhooks_url = c_config["webhooks_url"]
13
+ config.bot_token = c_config["bot_token"]
14
+ config.trello_public_key = c_config["trello_public_key"]
15
+ config.trello_member_token = c_config["trello_member_token"],
16
+ config.json_file_path = ARGV[0]
17
+ end
18
+
19
+
20
+ begin
21
+ puts "====> Emissary is starting..."
22
+ puts "====> Server name #{Emissary.server_name}..."
23
+
24
+ emi = Emissary.new
25
+ rescue => e
26
+ puts "#{e}"
27
+ exit 1
28
+ end
data/emissary.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "emissary-ruby"
7
- spec.version = "0.0.6"
7
+ spec.version = "0.0.7"
8
8
  spec.authors = ["MakarovCode"]
9
9
  spec.email = ["simoncorreaocampo@gmail.com"]
10
10
 
@@ -14,11 +14,9 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  # Specify which files should be added to the gem when it is released.
16
16
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- end
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
+ spec.files = ["emissary.gemspec", "README.md", "CODE_OF_CONDUCT.md"] + `git ls-files | grep -E '^(bin|lib|web)'`.split("\n")
18
+ # spec.bindir = "exe"
19
+ spec.executables = ["emissary"]
22
20
  spec.require_paths = ["lib"]
23
21
 
24
22
  # spec.add_development_dependency "bundler", "~> 2.0"
data/lib/emissary.rb CHANGED
@@ -58,16 +58,24 @@ class Emissary
58
58
  if loggr.bash_command == ""
59
59
  if args.count > 1
60
60
  if args[1] == "report"
61
- loggr.report
62
- "#{Emissary.header}\nGenerating Last Report"
61
+ if args[2].nil? || (!args[2].nil? && args[2] == Emissary.server_name)
62
+ loggr.report
63
+ "#{Emissary.header}\nGenerating Last Report"
64
+ end
63
65
  elsif args[1] == "fetch"
64
- loggr.fetch
65
- "#{Emissary.header}\nFetching Report"
66
+ if args[2].nil? || (!args[2].nil? && args[2] == Emissary.server_name)
67
+ loggr.fetch
68
+ "#{Emissary.header}\nFetching Report"
69
+ end
66
70
  elsif args[1] == "clear"
67
- loggr.clear
68
- "#{Emissary.header}\nClearing Report"
71
+ if args[2].nil? || (!args[2].nil? && args[2] == Emissary.server_name)
72
+ loggr.clear
73
+ "#{Emissary.header}\nClearing Report"
74
+ end
69
75
  elsif args[1] == "last"
70
- loggr.message_to_chat loggr.last_message
76
+ if args[2].nil? || (!args[2].nil? && args[2] == Emissary.server_name)
77
+ loggr.message_to_chat loggr.last_message
78
+ end
71
79
  elsif ![nil, ""].include?(args[1]) && args[1].include?(loggr.alias)
72
80
  if args.count > 2
73
81
  if args[2] == "trello"
data/lib/loggr.rb CHANGED
@@ -72,7 +72,7 @@ class Loggr
72
72
  if @messages["#{file_lines[i+1]}"].nil?
73
73
  @last_id += 1
74
74
  @messages["#{file_lines[i+1]}"] = {
75
- id: "#{@alias}-#{@last_id}",
75
+ id: "#{Emissary.server_name}-#{@alias}-#{@last_id}",
76
76
  trigger: "Completed 500 Internal Server Error",
77
77
  lines: file_lines[i..(i+@lines)],
78
78
  count: 1,
@@ -93,7 +93,7 @@ class Loggr
93
93
  end
94
94
 
95
95
  def last_message
96
- message_by_id("#{@alias}-#{@last_id}")
96
+ message_by_id("#{Emissary.server_name}-#{@alias}-#{@last_id}")
97
97
  end
98
98
 
99
99
  def lines_to_code(message)
metadata CHANGED
@@ -1,28 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emissary-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - MakarovCode
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-13 00:00:00.000000000 Z
11
+ date: 2021-06-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
15
15
  - simoncorreaocampo@gmail.com
16
- executables: []
16
+ executables:
17
+ - emissary
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
- - ".gitignore"
21
21
  - CODE_OF_CONDUCT.md
22
- - Gemfile
23
- - LICENSE
24
22
  - README.md
25
- - Rakefile
23
+ - bin/emissary
26
24
  - bin/setup
27
25
  - emissary.gemspec
28
26
  - lib/emissary.rb
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /runner.rb
2
- /.bundle/
3
- /.yardoc
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.gem
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in frm_mercury.gemspec
4
- gemspec
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Simón
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec