synack 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -13,11 +13,11 @@ To start synack:
13
13
 
14
14
  To send a message to your local Notification Center:
15
15
 
16
- synack -m "Watson, come here, I need you."
16
+ synack "Watson, come here, I need you."
17
17
 
18
18
  You can send messages to remote machines by specifying a host and port in the client:
19
19
 
20
- synack -h my_remote_machine -m "I'm here, what did you want?"
20
+ synack -h my_remote_machine -p 1013 "I'm here, what did you want?"
21
21
 
22
22
  You can even use UNIX pipes to send messages (first line of input only, for now):
23
23
 
@@ -12,11 +12,11 @@ To start synack:
12
12
 
13
13
  To send a message to your local Notification Center:
14
14
 
15
- synack -m "Watson, come here, I need you."
15
+ synack "Watson, come here, I need you."
16
16
 
17
17
  You can send messages to remote machines by specifying a host and port in the client:
18
18
 
19
- synack -h my_remote_machine -p 11113 -m "I'm here, what did you want?"
19
+ synack -h my_remote_machine -p 11113 "I'm here, what did you want?"
20
20
 
21
21
  You can even use UNIX pipes to send messages (first line of input only, for now):
22
22
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
data/bin/synack CHANGED
@@ -1,19 +1,22 @@
1
1
  #!/usr/bin/env ruby -wKU
2
2
 
3
- require 'getopt/long'
3
+ require 'optparse'
4
4
  require 'synack'
5
5
 
6
- options = Getopt::Long.getopts(
7
- ["--message", "-m", Getopt::REQUIRED],
8
- ["--server", "-s", Getopt::OPTIONAL],
9
- ["--host", "-h", Getopt::OPTIONAL],
10
- ["--port", "-p", Getopt::OPTIONAL]
11
- )
6
+ config = {}
12
7
 
13
- @host = options['host'] || 'localhost'
14
- @port = options['port'] || 11113
8
+ options = OptionParser.new do |opt|
9
+ opt.on('-s') { config[:server] = true }
10
+ opt.on('-h HOST') { |host| config[:host] = host }
11
+ opt.on('-p PORT') { |port| config[:port] = port }
12
+ end
13
+
14
+ options.parse!
15
+
16
+ @host = config[:host] || 'localhost'
17
+ @port = config[:port] || 11113
15
18
 
16
- if options["server"]
19
+ if config[:server]
17
20
  Synack::Server.start(
18
21
  host: @host,
19
22
  port: @port
@@ -25,7 +28,7 @@ else
25
28
  port: @port
26
29
  )
27
30
 
28
- _input = options['message']
31
+ _input = ARGV[0] ? ARGV[0] : STDIN.read
29
32
  client.say _input
30
33
  rescue DRb::DRbConnError => e
31
34
  puts "Some kind of connection error occurred: #{e}"
@@ -31,7 +31,7 @@ module Synack
31
31
  # Instance methods =============================================================================
32
32
 
33
33
  def sanitize(message)
34
- message.to_s.gsub(/[^0-9A-z\.\-\' ]/, '_')
34
+ message && message.gsub(/[^0-9A-z\.\-\'\, ]/, '_')
35
35
  end
36
36
 
37
37
  def say(message)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "synack"
8
- s.version = "1.1.0"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Corey Ehmke", "Max Thom Stahl"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -167,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  segments:
169
169
  - 0
170
- hash: 309323358682620341
170
+ hash: -2608069044233777158
171
171
  required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  none: false
173
173
  requirements: