rodbot 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a44274520f74f3723997267f1e2a456200e9f5118c6941dea6fc4704325bcf2b
4
- data.tar.gz: 24462b4cbc3c4751c18d1277950f6e3e0deeb7834d65d6ea43edb98ccc7f4223
3
+ metadata.gz: 02bef1b6cd772c6ee27a563d3c27c8829adcbce822bc0f4ab5862061b65db2bf
4
+ data.tar.gz: 94d596091931920e92bd6d1e12273241143fe8cd3e1289c14c6c14523f41518e
5
5
  SHA512:
6
- metadata.gz: f74b0b028597c229d5fec8b57f39ae36f62035974e87425dc6c6e4aeafc24df7e2a93ec7f298afe35983ff3d3cf91aae77049040b208c85df9c5ee89140f46ab
7
- data.tar.gz: abd243858266c2c9e13b810803e63539539be30511a3f490581512d895d4d7a3ca63f07c45d23eb27afde0e163353de01374ab8ac3a9b8a7ac0a72abc553d436
6
+ metadata.gz: cc623cf74e5538dfa2d4c203aa17e1e3e5c5071705bef05f526418dfa6d22e3b1db0b169249dd322eb94e5a2198244ff8d0dc8c2e627efe1834da0c1a0f679d7
7
+ data.tar.gz: 0b79a2c6ab679dfbcf7145e11b7ef491109d399ce88113ef1d93b914c1ee26f321e27bdc6fc5cf2441126335f72e6b8d50bc9fcd864dc4833cabe09c9c270aaf
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,21 @@
1
+ name: Test
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ os: [ubuntu-latest]
9
+ ruby: ['3.0', '3.1', '3.2']
10
+ name: test (Ruby ${{ matrix.ruby }} on ${{ matrix.os }})
11
+ runs-on: ${{ matrix.os }}
12
+ steps:
13
+ - name: Check out
14
+ uses: actions/checkout@v3
15
+ - name: Set up Ruby ${{ matrix.ruby }}
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ bundler-cache: true
20
+ - name: Run tests
21
+ run: SPEC_SCOPE=all bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ # macOS
2
+ .DS_Store
3
+
4
+ # Ruby
5
+ gems.locked
6
+ pkg/*
7
+ *.gem
8
+ .bundle
9
+ .yardoc
10
+
11
+ # Temporary
12
+ tmp/*
13
+ *.pid
14
+
15
+ # Empty dirs
16
+ !.keep
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2
data/.yardopts ADDED
@@ -0,0 +1,9 @@
1
+ --exclude /lib/templates/
2
+ -
3
+ CHANGELOG.md
4
+ LICENSE.txt
5
+ lib/rodbot/plugins/github_webhook/README.github_webhook.md
6
+ lib/rodbot/plugins/gitlab_webhook/README.gitlab_webhook.md
7
+ lib/rodbot/plugins/hal/README.hal.md
8
+ lib/rodbot/plugins/matrix/README.matrix.md
9
+ lib/rodbot/plugins/word_of_the_day/README.word_of_the_day.md
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Nothing so far
4
4
 
5
+ ## 0.2.0
6
+
7
+ #### Fixes
8
+ * Fix OTP verification
9
+ * Drop futile files from packaged gem
10
+
5
11
  ## 0.1.1
6
12
 
7
13
  #### Fixes
data/bin/console ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "rodbot"
6
+
7
+ using Rodbot::Refinements
8
+ Dir.chdir('lib/templates/new')
9
+ Rodbot.boot
10
+ Rodbot::SERVICES.each { "rodbot/services/#{_1}".constantize }
11
+
12
+ require "irb"
13
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1 @@
1
+ d75b98b17f6a274bbdae50d9dcc68696ccf534d4c0485fcb2833a23f551fac6a58cba2618fa8a3292a672000b5de0aefd26176377924f29004e9c789e7849e3f
@@ -0,0 +1 @@
1
+ bc07b0a01d848a821866ea0fad551c8321449322dbbe78909de56dcd929630931b4e41ae45a1737666c43514e7f4cafa0ed50ec5e5f6ddd1153edab54aa61605
@@ -0,0 +1 @@
1
+ 35f7ea0ac794b1664e1edfb4519a754d4b9eecde3649bb6b1cd0c36a083933fc9160ebcb1d4403cc5af14591a1460a9124c478e5c7907422ebe351ef8e21b355
@@ -0,0 +1 @@
1
+ 1df2ab362f74264c995861d820cfd41e9c3a465cd9bca60c5214ccaf9b9525ed7eca057e9863eeedf224b2e9d205d03526241d47ac47013f5468e212bbc4233e
@@ -0,0 +1 @@
1
+ 06123138b60dea4874f7344836dee04db1d04bc2cbc58ae66a0aba6b085930b50cb8ed152ba8f57f9044b8ceb9f16aef6588b00ade9d7eeb4410cb02c127d47a
@@ -0,0 +1 @@
1
+ dc5f19a7c1abd0ff24ae2b36199d1dcbe4619a4cf2a6ef3e27a8e758a35c111459cb246d92da139d69c9add381cdd47d4a8c8289b96e762ce477bd611669894c
@@ -0,0 +1 @@
1
+ 9b0b762987df83559962df55170d14148cb6b2790e0b608ed09eb4e67ccf2173f04bbd9fd577eff1077cb0184cf80f0af7f1b4b394aa5ebc294dd1c72ac069eb
@@ -0,0 +1 @@
1
+ f3d04271a35bbddff4005a41b6cfbe181ba732a9570f63d863e44f6bc9ca3ceff5e5318996eb8a9bfb4bc684e58465a837900a7a872449a7d4f2db7e98c4bebd
@@ -0,0 +1 @@
1
+ b02edd192928202aa459f81d024d5992100572b1298265578e9ba1d9347ebc0636226379be446a391eca8f1cce6ff2a85c5d7aeb3b256c52b1a407aef25b4d9d
@@ -0,0 +1 @@
1
+ e1ec4f97b856ece49c0c576255cc15dca50f1a6b04a087721c72994a8d54f1946ca977ee470faa70b43bbea5b062823da50c80a687ebd259be4d72ef4b089bc9
@@ -0,0 +1 @@
1
+ 2fb19f1cb90af6a68103bffa740452d5b67c553cdf10b546fcd46e76adcaf07ab8aabe330e06a14a6d7a75d5b8bc7794943e8c891261144741e043c4a404f453
@@ -0,0 +1 @@
1
+ 0967301f902d1461e206ccaae8e61f811c5e58f4136e03c654a081279d9585673c37413e4ad71a2430fe9ffe39b37b03ee0a5cc1f6780170856c334502062e82
Binary file
data/doc/rodbot.avif ADDED
Binary file
data/gems.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in rodbot.gemspec
6
+ gemspec
data/guardfile.rb ADDED
@@ -0,0 +1,8 @@
1
+ clearing :on
2
+
3
+ guard :minitest do
4
+ watch(%r{^spec/(.+)_spec\.rb})
5
+ watch(%r{^lib/(.+)\.rb}) { "spec/lib/#{_1[1]}_spec.rb" }
6
+ watch(%r{shared_specs\.rb}) { 'spec' }
7
+ watch(%r{^spec/spec_helper\.rb}) { 'spec' }
8
+ end
@@ -69,7 +69,7 @@ module Rodbot
69
69
 
70
70
  # Dispatch all registered tasks
71
71
  def dispatch
72
- tasks.each_value { fork &_1 }
72
+ tasks.each_value { fork(&_1) }
73
73
  end
74
74
 
75
75
  # Supervise all dispatched tasks
@@ -77,7 +77,7 @@ module Rodbot
77
77
  loop do
78
78
  pid = Process.wait
79
79
  sleep @refork_delay
80
- fork &tasks[task(pid)]
80
+ fork(&tasks[task(pid)])
81
81
  end
82
82
  end
83
83
 
@@ -82,5 +82,5 @@ module Rodbot
82
82
  end
83
83
  end
84
84
 
85
- end
85
+ end
86
86
 
@@ -13,10 +13,8 @@ module Rodbot
13
13
  def valid_otp?
14
14
  return false unless password
15
15
  return false if Rodbot.db.get(:otp, password) # already used
16
- valid = totp.verify(password, drift_behind: Rodbot.config(:otp, :drift).to_i)
17
- !!if
16
+ !!if totp.verify(password, drift_behind: Rodbot.config(:otp, :drift).to_i)
18
17
  Rodbot.db.set(:otp, password) { true }
19
- true
20
18
  end
21
19
  end
22
20
 
@@ -36,8 +34,10 @@ module Rodbot
36
34
  #
37
35
  # @return [String, nil] extracted password if any
38
36
  memoize def password
39
- params['arguments'] = params['arguments']&.sub(/\s*(\d{6})\s*\z/, '')
40
- $1
37
+ if params['arguments']
38
+ params['arguments'] = params['arguments'].sub(/\s*(\d{6})\s*\z/, '')
39
+ $1
40
+ end
41
41
  end
42
42
  end
43
43
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rodbot
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -0,0 +1,9 @@
1
+ # macOS
2
+ .DS_Store
3
+
4
+ # Temporary
5
+ tmp/*
6
+ *.pid
7
+
8
+ # Empty dirs
9
+ !.keep
@@ -0,0 +1 @@
1
+ 3.2
File without changes
File without changes
File without changes
data/rakefile.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['spec/lib/**/*_spec.rb']
8
+ t.verbose = false
9
+ t.warning = !ENV['RUBYOPT']&.match?(/-W0/)
10
+ end
11
+
12
+ namespace :yard do
13
+ desc "Run local YARD documentation server"
14
+ task :server do
15
+ `rm -rf ./.yardoc`
16
+ Thread.new do
17
+ sleep 2
18
+ `open http://localhost:8808`
19
+ end
20
+ `yard server -r`
21
+ end
22
+ end
23
+
24
+ Rake::Task[:test].enhance do
25
+ if ENV['RUBYOPT']&.match?(/-W0/)
26
+ puts "⚠️ Ruby warnings are disabled, remove -W0 from RUBYOPT to enable."
27
+ end
28
+ end
29
+
30
+ task default: :test
data/rodbot.gemspec ADDED
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/rodbot/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rodbot'
7
+ spec.version = Rodbot::VERSION
8
+ spec.summary = 'Minimalistic framework to build chat bots on top of a Roda backend'
9
+ spec.description = <<~END
10
+ Just the bare minimum of what's needed to create bi-directional chat bots
11
+ using Roda as backend, sucker_punch and Clockwork for async and timed jobs.
12
+ END
13
+ spec.authors = ['Sven Schwyn']
14
+ spec.email = ['ruby@bitcetera.com']
15
+ spec.homepage = 'https://github.com/svoop/rodbot'
16
+ spec.license = 'MIT'
17
+
18
+ spec.metadata = {
19
+ 'homepage_uri' => spec.homepage,
20
+ 'changelog_uri' => 'https://github.com/svoop/rodbot/blob/main/CHANGELOG.md',
21
+ 'source_code_uri' => 'https://github.com/svoop/rodbot',
22
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/rodbot',
23
+ 'bug_tracker_uri' => 'https://github.com/svoop/rodbot/issues'
24
+ }
25
+
26
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
27
+ `git ls-files -z`.split("\x0").reject { _1.match? %r{^spec/} }
28
+ end
29
+ spec.require_paths = %w(lib)
30
+ spec.bindir = 'exe'
31
+ spec.executables = %w(rodbot)
32
+
33
+ spec.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt']
34
+ spec.rdoc_options += [
35
+ '--title', 'Rodbot',
36
+ '--main', 'README.md',
37
+ '--line-numbers',
38
+ '--inline-source',
39
+ '--quiet'
40
+ ]
41
+
42
+ spec.required_ruby_version = '>= 3.0.0'
43
+
44
+ spec.add_runtime_dependency 'zeitwerk', '~> 2'
45
+ spec.add_runtime_dependency 'dry-cli', '~> 1'
46
+ spec.add_runtime_dependency 'dry-credentials', '~> 0'
47
+ spec.add_runtime_dependency 'tty-markdown', '~> 0'
48
+ spec.add_runtime_dependency 'pastel', '~> 0'
49
+ spec.add_runtime_dependency 'httparty', '~> 0'
50
+ spec.add_runtime_dependency 'puma', '~> 6', '>= 6.2'
51
+ spec.add_runtime_dependency 'roda', '~> 3'
52
+ spec.add_runtime_dependency 'tilt', '~> 2'
53
+ spec.add_runtime_dependency 'kramdown', '~> 2'
54
+ spec.add_runtime_dependency 'kramdown-parser-gfm', '~> 1'
55
+ spec.add_runtime_dependency 'clockwork', '~> 3'
56
+ spec.add_runtime_dependency 'sucker_punch', '~> 3'
57
+ spec.add_runtime_dependency 'debug'
58
+
59
+ # Sync versions with lib/templates/new/gems.rb
60
+ spec.add_development_dependency 'redis', '~> 5'
61
+ spec.add_development_dependency 'matrix_sdk', '~> 2'
62
+ spec.add_development_dependency 'rotp', '~> 6'
63
+
64
+ spec.add_development_dependency 'rake'
65
+ spec.add_development_dependency 'minitest'
66
+ spec.add_development_dependency 'minitest-flash'
67
+ spec.add_development_dependency 'minitest-focus'
68
+ spec.add_development_dependency 'minitest-substitute'
69
+ spec.add_development_dependency 'guard'
70
+ spec.add_development_dependency 'guard-minitest'
71
+ spec.add_development_dependency 'yard'
72
+ end
data/tmp/.keep ADDED
File without changes
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
@@ -29,7 +29,7 @@ cert_chain:
29
29
  kAyiRqgxF4dJviwtqI7mZIomWL63+kXLgjOjMe1SHxfIPo/0ji6+r1p4KYa7o41v
30
30
  fwIwU1MKlFBdsjkd
31
31
  -----END CERTIFICATE-----
32
- date: 2023-09-12 00:00:00.000000000 Z
32
+ date: 2023-09-14 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: zeitwerk
@@ -400,10 +400,32 @@ extra_rdoc_files:
400
400
  - CHANGELOG.md
401
401
  - LICENSE.txt
402
402
  files:
403
+ - ".github/workflows/test.yml"
404
+ - ".gitignore"
405
+ - ".ruby-version"
406
+ - ".yardopts"
403
407
  - CHANGELOG.md
404
408
  - LICENSE.txt
405
409
  - README.md
410
+ - bin/console
411
+ - bin/setup
412
+ - checksums/rodbot-0.1.0.gem.sha512
413
+ - checksums/rodbot-0.1.0.pre1.gem.sha512
414
+ - checksums/rodbot-0.1.0.pre2.gem.sha512
415
+ - checksums/rodbot-0.1.0.pre3.gem.sha512
416
+ - checksums/rodbot-0.1.0.pre4.gem.sha512
417
+ - checksums/rodbot-0.1.0.pre5.gem.sha512
418
+ - checksums/rodbot-0.1.0.pre6.gem.sha512
419
+ - checksums/rodbot-0.1.0.pre7.gem.sha512
420
+ - checksums/rodbot-0.1.0.pre8.gem.sha512
421
+ - checksums/rodbot-0.1.0.pre9.gem.sha512
422
+ - checksums/rodbot-0.1.1.gem.sha512
423
+ - checksums/rodbot-0.2.0.gem.sha512
424
+ - doc/rodbot.afphoto
425
+ - doc/rodbot.avif
406
426
  - exe/rodbot
427
+ - gems.rb
428
+ - guardfile.rb
407
429
  - lib/roda/plugins/rodbot.rb
408
430
  - lib/rodbot.rb
409
431
  - lib/rodbot/async.rb
@@ -457,20 +479,27 @@ files:
457
479
  - lib/templates/deploy/procfile/Procfile.gerb
458
480
  - lib/templates/deploy/render-split/render.yaml.gerb
459
481
  - lib/templates/deploy/render/render.yaml.gerb
482
+ - lib/templates/new/.gitignore
483
+ - lib/templates/new/.ruby-version
460
484
  - lib/templates/new/README.md
461
485
  - lib/templates/new/app/app.rb
462
486
  - lib/templates/new/app/routes/help.rb
463
487
  - lib/templates/new/app/views/layout.erb
464
488
  - lib/templates/new/app/views/root.erb
465
489
  - lib/templates/new/config.ru
490
+ - lib/templates/new/config/credentials/.keep
466
491
  - lib/templates/new/config/rodbot.rb
467
492
  - lib/templates/new/config/schedule.rb
468
- - lib/templates/new/gems.locked
469
493
  - lib/templates/new/gems.rb
470
494
  - lib/templates/new/guardfile.rb
495
+ - lib/templates/new/lib/.keep
471
496
  - lib/templates/new/public/assets/images/rodbot.avif
472
497
  - lib/templates/new/public/assets/stylesheets/base.css
473
498
  - lib/templates/new/rakefile.rb
499
+ - lib/templates/new/tmp/.keep
500
+ - rakefile.rb
501
+ - rodbot.gemspec
502
+ - tmp/.keep
474
503
  homepage: https://github.com/svoop/rodbot
475
504
  licenses:
476
505
  - MIT
metadata.gz.sig CHANGED
Binary file
@@ -1,104 +0,0 @@
1
- PATH
2
- remote: ../../..
3
- specs:
4
- rodbot (0.1.0.pre1)
5
- clockwork (~> 3)
6
- debug
7
- dry-cli (~> 1)
8
- dry-credentials (~> 0)
9
- httparty (~> 0)
10
- kramdown (~> 2)
11
- kramdown-parser-gfm (~> 1)
12
- matrix_sdk (~> 2)
13
- pastel (~> 0)
14
- puma (~> 6, >= 6.2)
15
- roda (~> 3)
16
- rotp (~> 6)
17
- sucker_punch (~> 3)
18
- tilt (~> 2)
19
- tty-markdown (~> 0)
20
- zeitwerk (~> 2)
21
-
22
- GEM
23
- remote: https://rubygems.org/
24
- specs:
25
- activesupport (7.0.4.3)
26
- concurrent-ruby (~> 1.0, >= 1.0.2)
27
- i18n (>= 1.6, < 2)
28
- minitest (>= 5.1)
29
- tzinfo (~> 2.0)
30
- clockwork (3.0.2)
31
- activesupport
32
- tzinfo
33
- concurrent-ruby (1.2.2)
34
- debug (1.8.0)
35
- irb (>= 1.5.0)
36
- reline (>= 0.3.1)
37
- dry-cli (1.0.0)
38
- dry-credentials (0.1.0)
39
- httparty (0.21.0)
40
- mini_mime (>= 1.0.0)
41
- multi_xml (>= 0.5.2)
42
- i18n (1.12.0)
43
- concurrent-ruby (~> 1.0)
44
- io-console (0.6.0)
45
- irb (1.6.4)
46
- reline (>= 0.3.0)
47
- kramdown (2.4.0)
48
- rexml
49
- kramdown-parser-gfm (1.1.0)
50
- kramdown (~> 2.0)
51
- little-plugger (1.1.4)
52
- logging (2.3.1)
53
- little-plugger (~> 1.1)
54
- multi_json (~> 1.14)
55
- matrix_sdk (2.8.0)
56
- logging (~> 2)
57
- mini_mime (1.1.2)
58
- minitest (5.18.0)
59
- multi_json (1.15.0)
60
- multi_xml (0.6.0)
61
- nio4r (2.5.8)
62
- pastel (0.8.0)
63
- tty-color (~> 0.5)
64
- puma (6.2.0)
65
- nio4r (~> 2.0)
66
- rack (3.0.7)
67
- reline (0.3.3)
68
- io-console (~> 0.5)
69
- rexml (3.2.5)
70
- roda (3.66.0)
71
- rack
72
- rotp (6.2.2)
73
- rouge (4.1.0)
74
- strings (0.2.1)
75
- strings-ansi (~> 0.2)
76
- unicode-display_width (>= 1.5, < 3.0)
77
- unicode_utils (~> 1.4)
78
- strings-ansi (0.2.0)
79
- sucker_punch (3.1.0)
80
- concurrent-ruby (~> 1.0)
81
- tilt (2.1.0)
82
- tty-color (0.6.0)
83
- tty-markdown (0.7.2)
84
- kramdown (>= 1.16.2, < 3.0)
85
- pastel (~> 0.8)
86
- rouge (>= 3.14, < 5.0)
87
- strings (~> 0.2.0)
88
- tty-color (~> 0.5)
89
- tty-screen (~> 0.8)
90
- tty-screen (0.8.1)
91
- tzinfo (2.0.6)
92
- concurrent-ruby (~> 1.0)
93
- unicode-display_width (2.4.2)
94
- unicode_utils (1.4.0)
95
- zeitwerk (2.6.7)
96
-
97
- PLATFORMS
98
- arm64-darwin-22
99
-
100
- DEPENDENCIES
101
- rodbot!
102
-
103
- BUNDLED WITH
104
- 2.4.12