del 0.1.18 → 0.1.19

This diff has not been reviewed by any users.
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
  SHA256:
3
- metadata.gz: a517a2de1ee45be6c6e9ef395f6a63d6d71cacdaccda80d88ea0af092ef46699
4
- data.tar.gz: 3f299b22fe9c0363b10edb60bfa90d15686f44dfe04efe809838770dbf2ca922
3
+ metadata.gz: 0c23b5131569bc386a7ccbba641a171830479bf82d8a0a9e1c2057fe968901d8
4
+ data.tar.gz: 48c0f274b829c98fc0bc829b4066fcbd1b17ea263887b41269bcb29121390753
5
5
  SHA512:
6
- metadata.gz: bc5dfafc0e8887eff499f00a9f7963d081d43aa1c12dee8096153b0c111c649ef63a082163119db3c706359de201aeededcfac167c2cf83f512e0db5188aca3c
7
- data.tar.gz: 19204ae64b7abae7ff0dbb65c3b926a1eb3f54361dd5df6bb4d4cddc56267693179cdd6575f794276ec30435ca6b4d0bb417e93f80936565019d3f684a210ef8
6
+ metadata.gz: 91233dd6b0c5935c649c2e86bd99688b716960f5e5b4d04e0ded67e5c83c460ae9e1ab64676f63f5c66dac598eb3479875b4553a6cd0a546b38a3377cf4362db
7
+ data.tar.gz: ceb0ee9f3dfafbceae013e1ef559b47c9f98fd30298dd2d1fbca8a58eeb42ea4fe406cd406e1513e101258c433c4fdea45b081342df797fbb6706a8a9a45794b
@@ -1,4 +1,3 @@
1
-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  lib = File.expand_path('lib', __dir__)
@@ -13,7 +12,7 @@ Gem::Specification.new do |spec|
13
12
 
14
13
  spec.summary = 'Del is a funky robosapien.'
15
14
  spec.description = 'Del is a funky robosapien.'
16
- spec.homepage = 'https://www.mokhan.ca'
15
+ spec.homepage = 'https://github.com/mokhan/del'
17
16
  spec.license = 'MIT'
18
17
 
19
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -27,7 +26,7 @@ Gem::Specification.new do |spec|
27
26
  'source_code_uri' => 'https://github.com/mokhan/del'
28
27
  }
29
28
 
30
- spec.add_dependency 'net-hippie', '~> 0.1'
29
+ spec.add_dependency 'net-hippie', '~> 0.2'
31
30
  spec.add_dependency 'thor', '~> 0.20'
32
31
  spec.add_dependency 'xmpp4r', '~> 0.5'
33
32
  spec.add_development_dependency 'bundler', '~> 1.16'
@@ -14,6 +14,8 @@ module Del
14
14
  desc 'server <routes.rb>', 'start server'
15
15
  def server(startup_file = nil)
16
16
  Del.start(load_settings(start_server: true, startup_file: startup_file))
17
+ rescue Psych::DisallowedClass => error
18
+ say error.message, :red
17
19
  rescue Errno::ENOENT => error
18
20
  say error.message, :red
19
21
  say "run 'del setup'", :yellow
@@ -104,7 +106,7 @@ module Del
104
106
  def load_settings(additional_settings)
105
107
  settings = YAML.safe_load(
106
108
  IO.read(options[:configuration_file]),
107
- symbolize_names: true
109
+ [Symbol], symbolize_names: true
108
110
  )
109
111
  if blank?(settings[:password])
110
112
  settings[:password] = ask('Password:', echo: false)
@@ -61,6 +61,7 @@ module Del
61
61
  def load(file)
62
62
  return if file.nil?
63
63
  return Kernel.load(file) if File.exist?(file)
64
+
64
65
  download(file)
65
66
  end
66
67
 
@@ -70,10 +71,12 @@ module Del
70
71
 
71
72
  def download(url)
72
73
  Net::Hippie.logger = logger
73
- content = Net::Hippie::Api.new(url).get
74
74
 
75
+ response = Net::Hippie::Client.new.yield_self do |x|
76
+ x.with_retry { |y| y.get(url) }
77
+ end
75
78
  path = Tempfile.new('del').path
76
- IO.write(path, content)
79
+ IO.write(path, response.body)
77
80
  load(path)
78
81
  end
79
82
  end
@@ -15,6 +15,7 @@ module Del
15
15
  def route(message)
16
16
  @routes.each do |route|
17
17
  next unless (matches = route[:pattern].match(message.text))
18
+
18
19
  begin
19
20
  route[:command].call(message, matches)
20
21
  rescue StandardError => error
@@ -24,6 +24,7 @@ module Del
24
24
 
25
25
  def receive(message, source:)
26
26
  return if source.from?(self)
27
+
27
28
  configuration.router.route(
28
29
  Message.new(message, robot: self, source: source)
29
30
  )
@@ -20,6 +20,7 @@ module Del
20
20
 
21
21
  def self.map_from(attributes)
22
22
  return nil if attributes.nil?
23
+
23
24
  new(attributes['jid'], attributes)
24
25
  end
25
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Del
4
- VERSION = '0.1.18'
4
+ VERSION = '0.1.19'
5
5
  end
@@ -91,6 +91,7 @@ module Del
91
91
  def listen_for_direct_messages(robot)
92
92
  client.add_message_callback do |message|
93
93
  next if message.type == :error || message.body.nil?
94
+
94
95
  user = configuration.users.find(message.from.strip)
95
96
  robot.receive(message.body, source: Source.new(user: user))
96
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: del
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-20 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-hippie
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '0.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: '0.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +179,7 @@ files:
179
179
  - lib/del/user.rb
180
180
  - lib/del/version.rb
181
181
  - lib/del/xmpp_connection.rb
182
- homepage: https://www.mokhan.ca
182
+ homepage: https://github.com/mokhan/del
183
183
  licenses:
184
184
  - MIT
185
185
  metadata: