Crota 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/exe/crota +98 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8608afe4e6ea7fbb8d3f591ad8b183f447235c5a
|
4
|
+
data.tar.gz: a04b06c513c775b62961d9afad208eb38e50689e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 528dd10a72933460dd8fce0aa8fd6f51bb9b1b4667397c587f9c009c80e8a7e383a6375cb96c199b37d131d2bbf7f6acfcc0c239ee79f4ac9dd2523914b2025d
|
7
|
+
data.tar.gz: 8b86dbb7eb5b4f78a29c582da07d794125fc21afbcf3a6cea3dd1d74f7a7786fa04f5d75b2ea1adcbb9b4bd6863b0338363e94d5776aee08c7d145db12d8fa38
|
data/exe/crota
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'em/pure_ruby'
|
4
|
+
require 'smpp'
|
5
|
+
require 'escort'
|
6
|
+
require 'crota/server'
|
7
|
+
require 'crota/config'
|
8
|
+
|
9
|
+
def main
|
10
|
+
Escort::App.create do |app|
|
11
|
+
app.version Crota::VERSION
|
12
|
+
app.description "SMPP server"
|
13
|
+
app.summary <<-SUMMARY
|
14
|
+
Crota is an SMPP server that will connect to
|
15
|
+
any SMPP capable aggregator to send and receive messages.
|
16
|
+
A list of aggregators are retrieved from Dispatch.
|
17
|
+
A list of messages is then retrieved for each of these aggregators for a given number of queues.
|
18
|
+
All of these values are specified in the config.yml
|
19
|
+
SUMMARY
|
20
|
+
|
21
|
+
app.options do |opts|
|
22
|
+
opts.opt :daemonize, 'Run SMPP server in the background',
|
23
|
+
short: '-d', long: '--daemonize', type: :boolean, default: false
|
24
|
+
opts.opt :console, 'Open a console',
|
25
|
+
short: '-k', long: '--console', type: :boolean, default: false
|
26
|
+
opts.opt :verbosity, 'Verbosity level of output (DEBUG, INFO, WARN, ERROR, FATAL)',
|
27
|
+
short: '-v', long: '--verbose', type: :string, default: 'INFO'
|
28
|
+
opts.opt :log, 'Set default log file',
|
29
|
+
short: '-l', long: '--log', type: :string, default: 'STDOUT'
|
30
|
+
opts.opt :config, 'Pass your own config.yml. Must follow the same convention as detailed in repo',
|
31
|
+
short: '-c', long: '--config', type: :string, default: Crota::DEFAULT_CONFIG_FILE
|
32
|
+
end
|
33
|
+
|
34
|
+
app.action do |options, arguments|
|
35
|
+
run_crota options, arguments
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def run_crota options, arguments
|
41
|
+
opts = options[:global][:options]
|
42
|
+
logger = Logger.new(opts[:log] == 'STDOUT' ? STDOUT : opts[:log])
|
43
|
+
logger.level = opts[:verbosity].downcase.to_sym
|
44
|
+
Smpp::Base.logger = logger
|
45
|
+
|
46
|
+
Crota.config_file = opts[:config]
|
47
|
+
Crota.config.validate!
|
48
|
+
|
49
|
+
server = Crota::Server.new
|
50
|
+
|
51
|
+
puts "Welcome to Crota's Realm. Your light is mine."
|
52
|
+
|
53
|
+
if opts[:console]
|
54
|
+
start_console logger
|
55
|
+
elsif opts[:daemonize]
|
56
|
+
fork do
|
57
|
+
logger.info("Running in BACKGROUND. You have entered Crota's realm. Beware the blight")
|
58
|
+
server.start
|
59
|
+
end
|
60
|
+
else
|
61
|
+
logger.info("Running in FOREGROUND. You have entered Crota's realm. Beware the blight")
|
62
|
+
server.start
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def start_console logger
|
67
|
+
require 'irb'
|
68
|
+
require 'irb/completion'
|
69
|
+
require 'irb/ext/save-history'
|
70
|
+
|
71
|
+
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
72
|
+
files = Dir[File.join(lib_dir, "/**/*.rb")]
|
73
|
+
files.each { |f| require f }
|
74
|
+
|
75
|
+
irbrc = File.join(ENV['HOME'], '.irbrc')
|
76
|
+
unless File.exists?(irbrc)
|
77
|
+
File.open(irbrc, 'w') do |f|
|
78
|
+
f.write("IRB.conf[:SAVE_HISTORY] = 100\r\n")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
ARGV.clear
|
83
|
+
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
|
84
|
+
logger.info("Starting Crota in console mode")
|
85
|
+
IRB.start
|
86
|
+
end
|
87
|
+
|
88
|
+
def reload!
|
89
|
+
warn_level = $VERBOSE
|
90
|
+
$VERBOSE = nil
|
91
|
+
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
|
92
|
+
files = Dir[File.join(lib_dir, "/**/*.rb")]
|
93
|
+
files.each { |f| load f }
|
94
|
+
$VERBOSE = warn_level
|
95
|
+
"reloaded #{files.count} files"
|
96
|
+
end
|
97
|
+
|
98
|
+
main
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Crota
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Etsenake
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Creates and runs SMPP transceiver server based on configs to receive
|
14
|
+
and send messages to a specified SMPP agregator.
|
15
|
+
email:
|
16
|
+
- etsenake@gmail.com
|
17
|
+
executables:
|
18
|
+
- crota
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- exe/crota
|
23
|
+
homepage:
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata:
|
27
|
+
allowed_push_host: https://rubygems.org
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.6.14
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Creates SMPP transceiver server
|
48
|
+
test_files: []
|