sendxmpp 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 727afe5351444d8aeffcce48ffef45ffde53476b
4
- data.tar.gz: 437f238d2cf65f544a26b23ca45cc2b0acf8fdce
3
+ metadata.gz: 5cc050e0b5313028144349aee744b9e141529a79
4
+ data.tar.gz: fdf58b28ed0f48c920d37f0047b38338a35879e2
5
5
  SHA512:
6
- metadata.gz: e2ee32f8db58c583ab877e512dda685b12ebef5f750082b9002dd8948f9db76fd53b3d11cb4f0a37813affbf6c0f45f03c93ee422d071766ad1c95a3a243f40f
7
- data.tar.gz: c5567d460b9bda1342632de165c16b488cc91ff6647767516955aacf7b8ba71a9b674ef72c48ac71dd68e1e4b989fe6fef0b8e5c95df23d69b8cdd867461b788
6
+ metadata.gz: 8d873583af32693c81bf2360999174b03345523f222fd0f1c31cb1731366fb3aa89451f1dce98a48292d4659cd2a95d92d87c6e8c07ecc43e09a871b2193e1c1
7
+ data.tar.gz: 9f28f0b8beaa4c656cc97b27a01b37a705f55da2933a9895f8a6da1ae389c6d703b82b9fe26e35288820b66dd5f8b337d7fbaaeba91eaef47be94f63b603b5f2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sendxmpp (0.0.1)
4
+ sendxmpp (0.0.3)
5
5
  hashr
6
6
  inifile (~> 2.0)
7
7
  thor (~> 0.19, >= 0.19.1)
@@ -17,6 +17,7 @@ GEM
17
17
  xmpp4r (0.5.6)
18
18
 
19
19
  PLATFORMS
20
+ java
20
21
  ruby
21
22
 
22
23
  DEPENDENCIES
data/README.md CHANGED
@@ -0,0 +1,66 @@
1
+ # Sendxmpp
2
+ Send XMPP messages from the Commandline to a xmpp server.
3
+
4
+
5
+
6
+ ### Usage
7
+
8
+ Please read the wiki article [Usage](https://github.com/nirnanaaa/sendxmpprb/wiki/Usage) for a more detailed usage guilde.
9
+
10
+ #### Sending messages via a pipe
11
+
12
+ ```zsh
13
+ echo "Message from $HOST" |sendxmpprb user mosny@examplejabber.org -j from@example.com --password password
14
+ ```
15
+
16
+ #### Sending whole files over xmpp
17
+
18
+ ```zsh
19
+ sendxmpprb user mosny@examplejabber.org -j from@example.com --password password < /var/log/syslog
20
+ ```
21
+
22
+ #### Sending messages via the `-m` option
23
+ ```zsh
24
+ sendxmpprb user mosny@examplejabber.org -j from@example.com --password password -m "Message from $HOST"
25
+ ```
26
+
27
+ ### Supported Plaforms
28
+
29
+ * MRI on OsX
30
+ * MRI on Linux
31
+
32
+ ### Supported Ruby versions
33
+
34
+ The following MRI(Ruby) versions are supported:
35
+
36
+ * 1.9.1
37
+ * 1.9.2
38
+ * 1.9.3
39
+ * 2.0.0
40
+ * 2.1.1
41
+ * 2.1.2
42
+
43
+ This does currently not work under 1.8.7. Backward compability will be available on the 1.8.7 branch.
44
+
45
+ ### License
46
+ The MIT License (MIT)
47
+
48
+ Copyright (c) 2014 Florian Kasper
49
+
50
+ Permission is hereby granted, free of charge, to any person obtaining a copy
51
+ of this software and associated documentation files (the "Software"), to deal
52
+ in the Software without restriction, including without limitation the rights
53
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
54
+ copies of the Software, and to permit persons to whom the Software is
55
+ furnished to do so, subject to the following conditions:
56
+
57
+ The above copyright notice and this permission notice shall be included in
58
+ all copies or substantial portions of the Software.
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
63
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
64
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
65
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
66
+ THE SOFTWARE.
data/lib/sendxmpp/cli.rb CHANGED
@@ -27,8 +27,6 @@ module Sendxmpp
27
27
  class_option :config, default: "#{ENV['HOME']}/.sendxmpprbrc", type: :string, aliases: "-c", required: false
28
28
  class_option :logfile, default: nil, aliases: '-l', required: false
29
29
 
30
- # Public: logger
31
- attr_reader :log
32
30
 
33
31
  # Public: Initialize a new Object from CLI
34
32
  #
@@ -49,6 +47,7 @@ module Sendxmpp
49
47
  conf.merge!(local_conf)
50
48
  update_config(conf)
51
49
  end
50
+
52
51
  Log.logger.debug("finished loading configuration.")
53
52
  $stdout.sync = true
54
53
  end
@@ -67,12 +66,13 @@ module Sendxmpp
67
66
  # Returns 0 or 1 exit codes
68
67
  def user(*jids)
69
68
  Log.logger.debug("Received call for user method")
69
+ fetch_stdin
70
70
  unless jids.kind_of?(Array)
71
71
  Log.logger.error("Throwing ArgumentError because Jids is not an array.")
72
72
  raise ArgumentError, "Jids needs to be an Array got #{jids.class}"
73
73
  end
74
74
 
75
- if options.message.empty?
75
+ if config.message.empty?
76
76
  Log.logger.error("No message to send. Exiting.")
77
77
  Log.logger.error("See https://github.com/nirnanaaa/sendxmpprb/wiki/Sending-messages for available message formats.")
78
78
  exit 1
@@ -98,12 +98,13 @@ module Sendxmpp
98
98
  # Returns 0 or 1 exit codes
99
99
  def chat(*jids)
100
100
  Log.logger.debug("Received call for chat method")
101
+ fetch_stdin
101
102
  unless jids.kind_of?(Array)
102
103
  Log.logger.error("Throwing ArgumentError because Jids is not an array.")
103
104
  raise ArgumentError, "Jids needs to be an Array got #{jids.class}"
104
105
  end
105
106
 
106
- if options.message.empty?
107
+ if config.message.empty?
107
108
  Log.logger.error("No message to send. Exiting.")
108
109
  Log.logger.error("See https://github.com/nirnanaaa/sendxmpprb/wiki/Sending-messages for available message formats.")
109
110
  exit 1
@@ -116,6 +117,17 @@ module Sendxmpp
116
117
  end
117
118
 
118
119
  end
120
+ no_commands do
121
+ def fetch_stdin
122
+ if !config.message
123
+ Log.logger.info("messages empty. using stdin")
124
+ while $stdin.gets
125
+ config.message ||= ""
126
+ config.message << $_
127
+ end
128
+ end
129
+ end
130
+ end
119
131
 
120
132
  end
121
133
  end
@@ -1,5 +1,5 @@
1
1
  module Sendxmpp
2
2
 
3
3
  # Public: version number
4
- VERSION="0.0.3"
4
+ VERSION="0.0.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendxmpp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Kasper