bionic 0.0.2.rc3 → 0.0.2.rc4

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: 4dba1a14d3b42332506df25a3b4c9329d240d526a46d96af5403a0ecf11b9e82
4
- data.tar.gz: 9c5925cc16ee4293a2c71e7d1f7ac605462ed7756bb50ac3e8273a775b9787c8
3
+ metadata.gz: 3d74df870448bb330f5b02a2f35a0dbb49c19d99d6e479097b6100d808ef55b5
4
+ data.tar.gz: 0b6c51b5875a1dc3c8cc5b90aa6ba2375aff73263d12cfefc106d70b699ae537
5
5
  SHA512:
6
- metadata.gz: 3baa0845b6a180ad37dc5de604ca5691c9b37dff1efc9c679bb4d98616d4d6b75397bb1e8832603b71ee7473311cac0ac1c85a1bc615503bc2af8fc6bb84476b
7
- data.tar.gz: f766e8c4b0d46b2ead2a46596bc38076351f68640c07727c447b2ac25c62faba55ad94489a1c012180b3679d7ab90a35a1b4217c10dc1a3d48b17d86d36b45fb
6
+ metadata.gz: 1fc64146b9a5551607797a059341ab5de9e33e33dd8a4bba297aabe98b88f0aad55ffe46a6389b7a6777bece9cfaadcc7e55fb400402d2aae45dd4c32aff5c77
7
+ data.tar.gz: 6f075322b3bdb51941c33599b4ac6cc03e15ad4fc97c81db816febc3aa2141bd41aeb91b41a5043828657ed32dee36a6cedd71a6471fd6c84f1284629761a290
data/.rubocop.yml ADDED
@@ -0,0 +1,29 @@
1
+ AllCops:
2
+ Include:
3
+ - !ruby/regexp /\.rb$/
4
+ Exclude:
5
+ - 'spec/fixtures/**/*'
6
+ - 'spec/cassettes/**/*'
7
+ - 'vendor/**/*'
8
+ - 'config/**/*'
9
+ - 'db/**/*'
10
+ - 'bin/*'
11
+ - 'Gemfile'
12
+ - 'Gemfile.lock'
13
+ - 'Rakefile'
14
+ - 'Guardfile'
15
+ - 'lib/bionic/cli/template/**/*'
16
+ - 'bin/*'
17
+ - 'exe/*'
18
+ TargetRubyVersion: 2.5
19
+ Documentation:
20
+ Enabled: false
21
+ LineLength:
22
+ Exclude:
23
+ - spec/**/*
24
+ Max: 120
25
+ BlockLength:
26
+ Exclude:
27
+ - spec/**/*
28
+ Metrics/AbcSize:
29
+ Max: 25
data/.travis.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.4
4
+ - 2.5.0
5
5
  before_install: gem install bundler -v 1.16.1
6
+ script:
7
+ - bundle exec rubocop
8
+ - bundle exec rspec
data/Gemfile.lock ADDED
@@ -0,0 +1,142 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bionic (0.0.2.rc3)
5
+ activerecord (~> 5.1)
6
+ dotenv (~> 2.2)
7
+ i18n (~> 0.7)
8
+ standalone_migrations (~> 5.2)
9
+ telegram-bot-ruby (~> 0.8.6)
10
+ thor (~> 0.20)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ actionpack (5.1.5)
16
+ actionview (= 5.1.5)
17
+ activesupport (= 5.1.5)
18
+ rack (~> 2.0)
19
+ rack-test (>= 0.6.3)
20
+ rails-dom-testing (~> 2.0)
21
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
22
+ actionview (5.1.5)
23
+ activesupport (= 5.1.5)
24
+ builder (~> 3.1)
25
+ erubi (~> 1.4)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
28
+ activemodel (5.1.5)
29
+ activesupport (= 5.1.5)
30
+ activerecord (5.1.5)
31
+ activemodel (= 5.1.5)
32
+ activesupport (= 5.1.5)
33
+ arel (~> 8.0)
34
+ activesupport (5.1.5)
35
+ concurrent-ruby (~> 1.0, >= 1.0.2)
36
+ i18n (~> 0.7)
37
+ minitest (~> 5.1)
38
+ tzinfo (~> 1.1)
39
+ arel (8.0.0)
40
+ ast (2.4.0)
41
+ axiom-types (0.1.1)
42
+ descendants_tracker (~> 0.0.4)
43
+ ice_nine (~> 0.11.0)
44
+ thread_safe (~> 0.3, >= 0.3.1)
45
+ builder (3.2.3)
46
+ coercible (1.0.0)
47
+ descendants_tracker (~> 0.0.1)
48
+ concurrent-ruby (1.0.5)
49
+ crass (1.0.3)
50
+ descendants_tracker (0.0.4)
51
+ thread_safe (~> 0.3, >= 0.3.1)
52
+ diff-lcs (1.3)
53
+ dotenv (2.2.1)
54
+ equalizer (0.0.11)
55
+ erubi (1.7.1)
56
+ faraday (0.14.0)
57
+ multipart-post (>= 1.2, < 3)
58
+ i18n (0.9.5)
59
+ concurrent-ruby (~> 1.0)
60
+ ice_nine (0.11.2)
61
+ inflecto (0.0.2)
62
+ loofah (2.2.0)
63
+ crass (~> 1.0.2)
64
+ nokogiri (>= 1.5.9)
65
+ method_source (0.9.0)
66
+ mini_portile2 (2.3.0)
67
+ minitest (5.11.3)
68
+ multipart-post (2.0.0)
69
+ nokogiri (1.8.2)
70
+ mini_portile2 (~> 2.3.0)
71
+ parallel (1.12.1)
72
+ parser (2.5.0.3)
73
+ ast (~> 2.4.0)
74
+ powerpack (0.1.1)
75
+ rack (2.0.4)
76
+ rack-test (0.8.3)
77
+ rack (>= 1.0, < 3)
78
+ rails-dom-testing (2.0.3)
79
+ activesupport (>= 4.2.0)
80
+ nokogiri (>= 1.6)
81
+ rails-html-sanitizer (1.0.3)
82
+ loofah (~> 2.0)
83
+ railties (5.1.5)
84
+ actionpack (= 5.1.5)
85
+ activesupport (= 5.1.5)
86
+ method_source
87
+ rake (>= 0.8.7)
88
+ thor (>= 0.18.1, < 2.0)
89
+ rainbow (3.0.0)
90
+ rake (10.5.0)
91
+ rspec (3.7.0)
92
+ rspec-core (~> 3.7.0)
93
+ rspec-expectations (~> 3.7.0)
94
+ rspec-mocks (~> 3.7.0)
95
+ rspec-core (3.7.1)
96
+ rspec-support (~> 3.7.0)
97
+ rspec-expectations (3.7.0)
98
+ diff-lcs (>= 1.2.0, < 2.0)
99
+ rspec-support (~> 3.7.0)
100
+ rspec-mocks (3.7.0)
101
+ diff-lcs (>= 1.2.0, < 2.0)
102
+ rspec-support (~> 3.7.0)
103
+ rspec-support (3.7.1)
104
+ rubocop (0.53.0)
105
+ parallel (~> 1.10)
106
+ parser (>= 2.5)
107
+ powerpack (~> 0.1)
108
+ rainbow (>= 2.2.2, < 4.0)
109
+ ruby-progressbar (~> 1.7)
110
+ unicode-display_width (~> 1.0, >= 1.0.1)
111
+ ruby-progressbar (1.9.0)
112
+ standalone_migrations (5.2.3)
113
+ activerecord (>= 4.2.7, < 5.2.0)
114
+ railties (>= 4.2.7, < 5.2.0)
115
+ rake (>= 10.0)
116
+ telegram-bot-ruby (0.8.6.1)
117
+ faraday
118
+ inflecto
119
+ virtus
120
+ thor (0.20.0)
121
+ thread_safe (0.3.6)
122
+ tzinfo (1.2.5)
123
+ thread_safe (~> 0.1)
124
+ unicode-display_width (1.3.0)
125
+ virtus (1.0.5)
126
+ axiom-types (~> 0.1)
127
+ coercible (~> 1.0)
128
+ descendants_tracker (~> 0.0, >= 0.0.3)
129
+ equalizer (~> 0.0, >= 0.0.9)
130
+
131
+ PLATFORMS
132
+ ruby
133
+
134
+ DEPENDENCIES
135
+ bionic!
136
+ bundler (~> 1.16)
137
+ rake (~> 10.0)
138
+ rspec (~> 3.0)
139
+ rubocop (~> 0.53)
140
+
141
+ BUNDLED WITH
142
+ 1.16.1
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Bionic
2
+ [![Gem Version](https://badge.fury.io/rb/bionic.svg)](https://badge.fury.io/rb/bionic) [![Build Status](https://travis-ci.org/floor114/bionic.svg?branch=master)](https://travis-ci.org/floor114/bionic)
3
+
2
4
  Telegram bots building tool.
3
5
 
6
+
4
7
  The library provides next features:
5
8
  * Easy configuration;
6
9
  * Built-in message parser into command and arguments;
data/bionic.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'bionic/version'
6
6
 
@@ -22,15 +22,15 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
-
26
25
  spec.add_runtime_dependency 'activerecord', '~> 5.1'
27
- spec.add_runtime_dependency 'i18n', '~> 0.7'
28
- spec.add_runtime_dependency 'telegram-bot-ruby', '~> 0.8.6'
29
26
  spec.add_runtime_dependency 'dotenv', '~> 2.2'
27
+ spec.add_runtime_dependency 'i18n', '~> 0.7'
30
28
  spec.add_runtime_dependency 'standalone_migrations', '~> 5.2'
29
+ spec.add_runtime_dependency 'telegram-bot-ruby', '~> 0.8.6'
31
30
  spec.add_runtime_dependency 'thor', '~> 0.20'
32
31
 
33
32
  spec.add_development_dependency 'bundler', '~> 1.16'
34
33
  spec.add_development_dependency 'rake', '~> 10.0'
35
34
  spec.add_development_dependency 'rspec', '~> 3.0'
35
+ spec.add_development_dependency 'rubocop', '~> 0.53'
36
36
  end
@@ -10,14 +10,12 @@ module Bionic
10
10
  include Singleton
11
11
 
12
12
  class << self
13
+ delegate :config, to: :instance
14
+
13
15
  def inherited(base)
14
16
  super
15
17
  Bionic.app_class = base
16
18
  end
17
-
18
- def config
19
- instance.config
20
- end
21
19
  end
22
20
 
23
21
  def run
@@ -31,9 +29,7 @@ module Bionic
31
29
  end
32
30
 
33
31
  def run_initializers!
34
- config.initializers.each do |initializer|
35
- initializer.run
36
- end
32
+ config.initializers.each(&:run)
37
33
  end
38
34
 
39
35
  def load_files!
@@ -24,12 +24,9 @@ module Bionic
24
24
  def database
25
25
  @database ||= begin
26
26
  file = Pathname.new(config_files[:database]) if config_files[:database]
27
+ raise "Could not load database configuration. No such file #{config_files[:database]}" unless file&.exist?
27
28
 
28
- if file && file.exist?
29
- YAML.load(ERB.new(file.read).result) || {}
30
- else
31
- raise "Could not load database configuration. No such file #{config_files[:database]}"
32
- end
29
+ YAML::Load(ERB.new(file.read).result) || {}
33
30
  end
34
31
  end
35
32
  end
@@ -8,7 +8,7 @@ module Bionic
8
8
  argument :name, required: true
9
9
 
10
10
  def self.source_root
11
- File.expand_path('../template', __FILE__)
11
+ File.expand_path('template', __dir__)
12
12
  end
13
13
 
14
14
  def create_app_folders
@@ -28,7 +28,7 @@ module Bionic
28
28
  def create_application
29
29
  app_name = name.split('_').map(&:capitalize).join
30
30
  create_file "#{name}/config/application.rb" do
31
- <<~EOS
31
+ <<~TXT
32
32
  # frozen_string_literal: true
33
33
 
34
34
  require_relative 'boot'
@@ -37,7 +37,7 @@ module Bionic
37
37
 
38
38
  class #{app_name} < Bionic::Application
39
39
  end
40
- EOS
40
+ TXT
41
41
  end
42
42
  end
43
43
 
@@ -11,7 +11,7 @@ module Bionic
11
11
  raise "Application file 'config/application.rb' was not found" unless app_file.exist?
12
12
 
13
13
  require app_file
14
- raise "Application class was not found" unless Bionic.application
14
+ raise 'Application class was not found' unless Bionic.application
15
15
 
16
16
  Bionic.run
17
17
  end
@@ -8,6 +8,10 @@ module Bionic
8
8
 
9
9
  private
10
10
 
11
+ def respond_to_missing?(method_name, _include_private = false)
12
+ method_name[-1] == '?'
13
+ end
14
+
11
15
  def method_missing(method, *args)
12
16
  method[-1] == '?' ? self == method[0..-2] : super
13
17
  end
data/lib/bionic/handle.rb CHANGED
@@ -24,7 +24,6 @@ module Bionic
24
24
  Bionic.logger.error("Unknown handler: #{handler_class_name} (#{e.message})")
25
25
  end
26
26
 
27
-
28
27
  private
29
28
 
30
29
  attr_reader :message, :bot, :command, :args
@@ -7,7 +7,7 @@ module Bionic
7
7
  module Initializers
8
8
  class Bot
9
9
  def self.run
10
- Bionic.logger.info("Running bot...")
10
+ Bionic.logger.info('Running bot...')
11
11
  Telegram::Bot::Client.run(ENV['BOT_TOKEN']) do |bot|
12
12
  bot.listen do |message|
13
13
  Bionic.logger.info("Received `#{message.text}` from @#{message.from.username}.")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bionic
4
- VERSION = '0.0.2.rc3'
4
+ VERSION = '0.0.2.rc4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bionic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.rc3
4
+ version: 0.0.2.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taras Shpachenko
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: i18n
28
+ name: dotenv
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.7'
33
+ version: '2.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.7'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: telegram-bot-ruby
42
+ name: i18n
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.8.6
47
+ version: '0.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.8.6
54
+ version: '0.7'
55
55
  - !ruby/object:Gem::Dependency
56
- name: dotenv
56
+ name: standalone_migrations
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.2'
61
+ version: '5.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.2'
68
+ version: '5.2'
69
69
  - !ruby/object:Gem::Dependency
70
- name: standalone_migrations
70
+ name: telegram-bot-ruby
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '5.2'
75
+ version: 0.8.6
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '5.2'
82
+ version: 0.8.6
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: thor
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.53'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.53'
139
153
  description: Framework for creating telegram bots.
140
154
  email:
141
155
  - taras.shpachenko@gmail.com
@@ -146,8 +160,10 @@ extra_rdoc_files: []
146
160
  files:
147
161
  - ".gitignore"
148
162
  - ".rspec"
163
+ - ".rubocop.yml"
149
164
  - ".travis.yml"
150
165
  - Gemfile
166
+ - Gemfile.lock
151
167
  - LICENSE.txt
152
168
  - README.md
153
169
  - Rakefile