mos-eisley 0.1.1 → 0.1.2

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: 7bcabaa68da8166ee15705358d036be3e4f4af58
4
- data.tar.gz: d1030692b827fecccd2bd145031caa9780b4e4a1
3
+ metadata.gz: 345e1b155662e980216df2f98aa79ca99add2c17
4
+ data.tar.gz: 8011e855084b385146c42160cef09fa75188469c
5
5
  SHA512:
6
- metadata.gz: 00107717c275700bdcbe957c15d1e6777bb526510426083e18d41a46e5351e0d2eed67f2684d483738fa3f1641e26e6da9741543787eb5209921b524a268f2e8
7
- data.tar.gz: def5281fe3b818226313eda18bbe308ed09c3debbdcdcb1af3d027231f4353a74c540b7c645a5c4b11c7f6af2a5576973b603a6e2743be9651b6a6964444a441
6
+ metadata.gz: 3ed78d1a910dae6c790bdbdafb8b1faab19b5fcd04c25d98151ef46fa91cf0bafbd22ccec636e1d914dee310e05f402da719bedd0a8d268e3e3ebbfd6b5ff005
7
+ data.tar.gz: e4961e9eb426f89631bcaf6dcdd3058eca28419dc38cedffe894ca35ad9d6c32a0fd5818bc76d71cded98bf79de4386e6f1b8a705764574d1a60694fd5ed2f68
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+ ---
2
+ Layout/SpaceInsideHashLiteralBraces:
3
+ Enabled: false
data/bin/mos-eisley CHANGED
@@ -11,7 +11,7 @@ Kajiki.run(opts) do |cmd|
11
11
  MosEisley::Config.load_config(opts[:config]) if opts[:config]
12
12
  MosEisley::Handler.autoload
13
13
  require 'http-server/server'
14
- MosEisley.logger.warn("Mos Eisley server starting... (v#{MosEisley::Version})")
14
+ MosEisley.logger.warn("Mos Eisley server starting... (v#{MosEisley::VERSION})")
15
15
  MosEisley::Server.run!({bind: opts[:address], port: opts[:port]})
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  module MosEisley
2
2
 
3
- Version = '0.1.1'
3
+ VERSION = '0.1.2'.freeze
4
4
 
5
5
  end
data/lib/s3po/action.rb CHANGED
@@ -1,9 +1,6 @@
1
1
  module MosEisley
2
-
3
2
  module S3PO
4
-
5
3
  class Action
6
-
7
4
  attr_reader :event
8
5
  attr_reader :original_message
9
6
 
@@ -45,9 +42,6 @@ module MosEisley
45
42
  def message_age
46
43
  Time.now.to_i - message_ts.to_i
47
44
  end
48
-
49
45
  end
50
-
51
46
  end
52
-
53
47
  end
data/lib/s3po/generic.rb CHANGED
@@ -1,17 +1,11 @@
1
1
  module MosEisley
2
-
3
2
  module S3PO
4
-
5
3
  class GenericEvent
6
-
7
4
  attr_reader :event
8
5
 
9
6
  def initialize(e)
10
7
  @event = e
11
8
  end
12
-
13
9
  end
14
-
15
10
  end
16
-
17
11
  end
data/lib/s3po/message.rb CHANGED
@@ -1,9 +1,6 @@
1
1
  module MosEisley
2
-
3
2
  module S3PO
4
-
5
3
  class Message
6
-
7
4
  attr_reader :event
8
5
 
9
6
  def initialize(e)
@@ -41,10 +38,19 @@ module MosEisley
41
38
  event[:text]
42
39
  end
43
40
 
41
+ # Defines text; existing string will be overwritten
42
+ # @param t [String] text to assign
44
43
  def text=(t)
45
44
  event[:text] = t
46
45
  end
47
46
 
47
+ # Adds text after a space if text already exists
48
+ # @param t [String] text to add
49
+ def add_text(t)
50
+ nt = [event[:text], t].compact.join(' ')
51
+ event[:text] = nt[0].upcase + nt[1..-1]
52
+ end
53
+
48
54
  def attachments
49
55
  event[:attachments]
50
56
  end
@@ -87,13 +93,16 @@ module MosEisley
87
93
  return obj
88
94
  end
89
95
 
96
+ # Create a new Message object for replying; pre-fills some attributes
97
+ # @param t [String] thread timestamp; only when replying as a thread (better to call #reply_in_thread instead)
98
+ # @return [MosEisley::S3PO::Message]
90
99
  def reply(t = nil)
91
100
  s = {
92
101
  channel: channel,
93
102
  as_user: true,
94
103
  attachments: []
95
104
  }
96
- s[:text] = "<@#{user}> " unless message_type == :im
105
+ s[:text] = "<@#{user}>" unless message_type == :im
97
106
  if thread_ts
98
107
  s[:thread_ts] = thread_ts
99
108
  elsif t
@@ -107,9 +116,6 @@ module MosEisley
107
116
  t ||= ts
108
117
  reply(t)
109
118
  end
110
-
111
119
  end
112
-
113
120
  end
114
-
115
121
  end
data/lib/s3po/s3po.rb CHANGED
@@ -5,9 +5,7 @@ require 's3po/action'
5
5
  require 's3po/message'
6
6
 
7
7
  module MosEisley
8
-
9
8
  module S3PO
10
-
11
9
  def self.parse_json(json)
12
10
  return JSON.parse(json, {symbolize_names: true})
13
11
  rescue => e
@@ -62,7 +60,5 @@ module MosEisley
62
60
  return GenericEvent.new(e)
63
61
  end
64
62
  end
65
-
66
63
  end
67
-
68
64
  end
data/mos-eisley.gemspec CHANGED
@@ -4,7 +4,7 @@ require 'mos-eisley/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'mos-eisley'
7
- s.version = MosEisley::Version
7
+ s.version = MosEisley::VERSION
8
8
  s.authors = ['Ken J.']
9
9
  s.email = ['kenjij@gmail.com']
10
10
  s.summary = %q{A Ruby based multi-purpose Slack app server}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mos-eisley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken J.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request
@@ -75,7 +75,7 @@ executables:
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - LICENSE
78
+ - ".rubocop.yml"
79
79
  - README.md
80
80
  - bin/mos-eisley
81
81
  - lib/http-client/client.rb
@@ -87,7 +87,6 @@ files:
87
87
  - lib/mos-eisley/handler.rb
88
88
  - lib/mos-eisley/logger.rb
89
89
  - lib/mos-eisley/version.rb
90
- - lib/mos-eisley/version.rb.orig
91
90
  - lib/s3po/action.rb
92
91
  - lib/s3po/generic.rb
93
92
  - lib/s3po/message.rb
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Ken J.
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.
@@ -1,9 +0,0 @@
1
- module MosEisley
2
-
3
- <<<<<<< HEAD
4
- Version = '0.0.4'
5
- =======
6
- Version = '0.1.0'
7
- >>>>>>> develop
8
-
9
- end