bionic 0.0.2.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +80 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/bionic.gemspec +36 -0
  12. data/exe/bionic +5 -0
  13. data/lib/bionic/application/configuration.rb +37 -0
  14. data/lib/bionic/application.rb +47 -0
  15. data/lib/bionic/cli/new.rb +78 -0
  16. data/lib/bionic/cli/start.rb +22 -0
  17. data/lib/bionic/cli/template/.env +2 -0
  18. data/lib/bionic/cli/template/.standalone_migrations +2 -0
  19. data/lib/bionic/cli/template/Gemfile +5 -0
  20. data/lib/bionic/cli/template/README.md +22 -0
  21. data/lib/bionic/cli/template/Rakefile +2 -0
  22. data/lib/bionic/cli/template/app/handlers/.keep +0 -0
  23. data/lib/bionic/cli/template/app/models/.keep +0 -0
  24. data/lib/bionic/cli/template/app/services/.keep +0 -0
  25. data/lib/bionic/cli/template/bin/run +6 -0
  26. data/lib/bionic/cli/template/config/boot.rb +3 -0
  27. data/lib/bionic/cli/template/config/database.yml +15 -0
  28. data/lib/bionic/cli/template/config/locales/en.yml +2 -0
  29. data/lib/bionic/cli/template/db/migrate/.keep +0 -0
  30. data/lib/bionic/cli/template/log/.keep +0 -0
  31. data/lib/bionic/cli.rb +12 -0
  32. data/lib/bionic/environment.rb +15 -0
  33. data/lib/bionic/handle.rb +46 -0
  34. data/lib/bionic/handler.rb +28 -0
  35. data/lib/bionic/initializers/bot.rb +21 -0
  36. data/lib/bionic/initializers/database.rb +14 -0
  37. data/lib/bionic/initializers/localization.rb +15 -0
  38. data/lib/bionic/version.rb +5 -0
  39. data/lib/bionic.rb +38 -0
  40. metadata +209 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 05c7eafeab23bee88bee79eb9d71ce3cb3ce2c1353d4df71b6993b4d37637d9c
4
+ data.tar.gz: a12da3f2f376991d559decca1e64a4fda23e93d16993105dc2dd4d97a7f390d3
5
+ SHA512:
6
+ metadata.gz: '089c46d05ddfe11619208e1f5f70aa6811e72105c6969e39ba1618c7bc5526719aa52eb69e0813a15a6cbb24ecfe404456fdae4ffcc88907481a62c41fd381c0'
7
+ data.tar.gz: ff745a6503a28f5e62f7412354fd7bf4501d9648159e59d0e7784a127a260746892f306e7bb09a8d58445ba59f56cf4542cc71bb87628732a251121d42e788dc
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /lib/bionic/cli/templates
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.4
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bionic.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Taras Shpachenko
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Bionic
2
+ Telegram bots building tool.
3
+
4
+ The library provides next features:
5
+ * Easy configuration;
6
+ * Built-in message parser into command and arguments;
7
+ * Internationalization and localization using [i18n](https://github.com/svenfuchs/i18n) gem;
8
+ * Handlers for every command;
9
+ * Database connection.
10
+
11
+ ## Installation
12
+
13
+ 1. Install Bionic at the command prompt if you haven't yet:
14
+
15
+ $ gem install bionic
16
+
17
+ 2. At the command prompt, create a new Bionic application:
18
+
19
+ $ bionic new app
20
+
21
+ where "app" is the application name.
22
+
23
+ 3. Change directory to `app` and run:
24
+
25
+ $ cd myapp
26
+ $ bundle install
27
+
28
+ 4. Paste your your [bot token and username](https://core.telegram.org/bots#6-botfather) to `.env`.
29
+
30
+ 5. Start the application with:
31
+
32
+ $ bionic start
33
+
34
+
35
+ ## Usage
36
+
37
+ For handling new command you need to create new handler called like a command.
38
+ For example, if command sent from a user is `/bye`, you need to create handler called `Bye` under `handlers` directory.
39
+ This handler should be inherited from `Bionic::Handler` and override `answer` method, which is a message that will be sent back.
40
+
41
+ ```ruby
42
+ module Handlers
43
+ class Bye < Bionic::Handler
44
+ private
45
+
46
+ def answer
47
+ 'Bye!'
48
+ end
49
+ end
50
+ end
51
+ ```
52
+
53
+ All text after base part of command will be split with `,` and passed to a handler as an array called `args`.
54
+
55
+ If there is no necessary handler you will see a corresponding message in logs.
56
+
57
+ ## Additional info
58
+
59
+ More information about bot wrapper you can find [here](https://github.com/atipugin/telegram-bot-ruby).
60
+
61
+ ## Development
62
+
63
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
64
+
65
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
66
+
67
+ ## Contributing
68
+
69
+ If you have some proposals how to improve this boilerplate feel free to open issues and send pull requests!
70
+
71
+ 1. Fork it
72
+ 2. Create your feature branch (git checkout -b my-new-feature)
73
+ 3. Commit your changes (git commit -am 'Add some feature')
74
+ 4. Push to the branch (git push origin my-new-feature)
75
+ 5. Create new Pull Request
76
+
77
+ ## License
78
+
79
+ Bionic is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
80
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'bionic'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bionic.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'bionic/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'bionic'
9
+ spec.version = Bionic::VERSION
10
+ spec.authors = ['Taras Shpachenko']
11
+ spec.email = ['taras.shpachenko@gmail.com']
12
+
13
+ spec.summary = 'Telegram bots framework.'
14
+ spec.description = 'Framework for creating telegram bots.'
15
+ spec.homepage = 'https://github.com/floor114/bionic'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+
26
+ 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
+ spec.add_runtime_dependency 'dotenv', '~> 2.2'
30
+ spec.add_runtime_dependency 'standalone_migrations', '~> 5.2'
31
+ spec.add_runtime_dependency 'thor', '~> 0.20'
32
+
33
+ spec.add_development_dependency 'bundler', '~> 1.16'
34
+ spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'rspec', '~> 3.0'
36
+ end
data/exe/bionic ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bionic/cli'
4
+
5
+ Bionic::CLI.start(ARGV)
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'erb'
5
+
6
+ module Bionic
7
+ class Application
8
+ class Configuration
9
+ attr_accessor :initializers, :config_files, :log_files, :locale, :autoload_files, :root
10
+
11
+ def initialize
12
+ @initializers = [Bionic::Initializers::Database, Bionic::Initializers::Localization]
13
+ @root = Pathname.new(Dir.pwd)
14
+ @autoload_files = [
15
+ root.join('app/handlers/**/*.rb'),
16
+ root.join('app/models/**/*.rb'),
17
+ root.join('app/services/**/*.rb')
18
+ ].flat_map { |dir| Dir[dir].sort }
19
+ @config_files = { database: 'config/database.yml', i18n: Dir['config/locales/*.yml'] }
20
+ @log_files = { database: 'log/database.log' }
21
+ @locale = :en
22
+ end
23
+
24
+ def database
25
+ @database ||= begin
26
+ file = Pathname.new(config_files[:database]) if config_files[:database]
27
+
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
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bionic/application/configuration'
4
+ require 'bionic/initializers/database'
5
+ require 'bionic/initializers/localization'
6
+ require 'bionic/initializers/bot'
7
+
8
+ module Bionic
9
+ class Application
10
+ include Singleton
11
+
12
+ class << self
13
+ def inherited(base)
14
+ super
15
+ Bionic.app_class = base
16
+ end
17
+
18
+ def config
19
+ instance.config
20
+ end
21
+ end
22
+
23
+ def run
24
+ load_files!
25
+ run_initializers!
26
+ run_bot!
27
+ end
28
+
29
+ def run_bot!
30
+ Bionic::Initializers::Bot.run
31
+ end
32
+
33
+ def run_initializers!
34
+ config.initializers.each do |initializer|
35
+ initializer.run
36
+ end
37
+ end
38
+
39
+ def load_files!
40
+ config.autoload_files.each { |f| require f }
41
+ end
42
+
43
+ def config
44
+ @config ||= Application::Configuration.new
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bionic
4
+ class Cli
5
+ class New < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :name, required: true
9
+
10
+ def self.source_root
11
+ File.expand_path('../template', __FILE__)
12
+ end
13
+
14
+ def create_app_folders
15
+ create_file "#{name}/app/handlers/.keep"
16
+ create_file "#{name}/app/models/.keep"
17
+ create_file "#{name}/app/services/.keep"
18
+ end
19
+
20
+ def create_bin
21
+ copy_file 'bin/run', "#{name}/bin/run"
22
+ end
23
+
24
+ def create_locales
25
+ copy_file 'config/locales/en.yml', "#{name}/config/locales/en.yml"
26
+ end
27
+
28
+ def create_application
29
+ app_name = name.split('_').map(&:capitalize).join
30
+ create_file "#{name}/config/application.rb" do
31
+ <<~EOS
32
+ # frozen_string_literal: true
33
+
34
+ require_relative 'boot'
35
+ require 'bionic'
36
+ Bundler.require(*Bionic.groups)
37
+
38
+ class #{app_name} < Bionic::Application
39
+ end
40
+ EOS
41
+ end
42
+ end
43
+
44
+ def create_configs
45
+ copy_file 'config/boot.rb', "#{name}/config/boot.rb"
46
+ copy_file 'config/database.yml', "#{name}/config/database.yml"
47
+ end
48
+
49
+ def create_db_folders
50
+ create_file "#{name}/db/migrate/.keep"
51
+ end
52
+
53
+ def create_log_folder
54
+ create_file "#{name}/log/.keep"
55
+ end
56
+
57
+ def create_env
58
+ copy_file '.env', "#{name}/.env"
59
+ end
60
+
61
+ def migrations_config
62
+ copy_file '.standalone_migrations', "#{name}/.standalone_migrations"
63
+ end
64
+
65
+ def gemfile
66
+ copy_file 'Gemfile', "#{name}/Gemfile"
67
+ end
68
+
69
+ def rakefile
70
+ copy_file 'Rakefile', "#{name}/Rakefile"
71
+ end
72
+
73
+ def readme
74
+ copy_file 'README.md', "#{name}/README.md"
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pry'
4
+
5
+ module Bionic
6
+ class Cli
7
+ class Start < Thor::Group
8
+ include Thor::Actions
9
+
10
+ def start
11
+ app_file = Pathname.new("#{Dir.pwd}/config/application.rb")
12
+
13
+ raise "Application file 'config/application.rb' was not found" unless app_file.exist?
14
+
15
+ require app_file
16
+ raise "Application class was not found" unless Bionic.application
17
+
18
+ Bionic.run
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,2 @@
1
+ BOT_TOKEN=your_bot_token
2
+ BOT_NAME=your_bot_name
@@ -0,0 +1,2 @@
1
+ config:
2
+ database: config/database.yml
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'bionic'
@@ -0,0 +1,22 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Handlers
21
+
22
+ * Deployment instructions
@@ -0,0 +1,2 @@
1
+ require 'standalone_migrations'
2
+ StandaloneMigrations::Tasks.load_tasks
File without changes
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../config/application'
4
+ require_relative '../config/boot'
5
+
6
+ Bionic.run
@@ -0,0 +1,3 @@
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
+
3
+ require 'bundler/setup'
@@ -0,0 +1,15 @@
1
+ default: &default
2
+ adapter: postgresql
3
+ pool: 5
4
+
5
+ development:
6
+ <<: *default
7
+ database: development
8
+
9
+ test:
10
+ <<: *default
11
+ database: test
12
+
13
+ production:
14
+ <<: *default
15
+ database: production
@@ -0,0 +1,2 @@
1
+ en:
2
+ hello: 'Hello!'
File without changes
File without changes
data/lib/bionic/cli.rb ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'bionic/cli/new'
5
+ require 'bionic/cli/start'
6
+
7
+ module Bionic
8
+ class CLI < Thor
9
+ register(Bionic::Cli::New, 'new', 'new NAME', 'Generates new project.')
10
+ register(Bionic::Cli::Start, 'start', 'start', 'Start project.')
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bionic
4
+ class Environment < String
5
+ def initialize(env)
6
+ super(env || 'development')
7
+ end
8
+
9
+ private
10
+
11
+ def method_missing(method, *args)
12
+ method[-1] == '?' ? self == method[0..-2] : super
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bionic
4
+ class Handle
5
+ COMMAND_REGEX = %r(\A/([a-z\d_]{,31})(@(\S+))?(\s|$))
6
+
7
+ class << self
8
+ def call(*args)
9
+ new(*args).call
10
+ end
11
+ end
12
+
13
+ def initialize(message, bot)
14
+ @message = message
15
+ @bot = bot
16
+ @command, @args = parse_message
17
+ end
18
+
19
+ def call
20
+ return if message.text.blank? || command.blank?
21
+
22
+ handler_class_name.constantize.call(message, bot, args)
23
+ rescue NameError => e
24
+ Bionic.logger.error("Unknown handler: #{handler_class_name} (#{e.message})")
25
+ end
26
+
27
+
28
+ private
29
+
30
+ attr_reader :message, :bot, :command, :args
31
+
32
+ def handler_class_name
33
+ @handler_class_name ||= "Handlers::#{command.split('_').map(&:capitalize).join}"
34
+ end
35
+
36
+ def parse_message
37
+ return if message.text.blank?
38
+ base_part, command, _, mention = message.text.match(COMMAND_REGEX).to_a
39
+
40
+ return if base_part.blank?
41
+ return if mention && ENV['BOT_USERNAME'] && mention != ENV['BOT_USERNAME']
42
+
43
+ [command, message.text.gsub(base_part, '').split(',').map(&:strip)]
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bionic
4
+ class Handler
5
+ def self.call(*args)
6
+ new(*args).call
7
+ end
8
+
9
+ def initialize(message, bot, args)
10
+ @message = message
11
+ @bot = bot
12
+ @args = args
13
+ end
14
+
15
+ def call
16
+ bot.api.send_message(chat_id: message.chat.id, text: answer)
17
+ Bionic.logger.info("Sended message to @#{message.chat.username}")
18
+ end
19
+
20
+ private
21
+
22
+ attr_reader :message, :bot, :args
23
+
24
+ def answer
25
+ raise NotImplementedError
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'telegram/bot'
4
+ require 'bionic/handle'
5
+ require 'pry'
6
+
7
+ module Bionic
8
+ module Initializers
9
+ class Bot
10
+ def self.run
11
+ Bionic.logger.info("Running bot...")
12
+ Telegram::Bot::Client.run(ENV['BOT_TOKEN']) do |bot|
13
+ bot.listen do |message|
14
+ Bionic.logger.info("Received `#{message.text}` from @#{message.from.username}.")
15
+ Bionic::Handle.call(message, bot)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_record'
4
+
5
+ module Bionic
6
+ module Initializers
7
+ class Database
8
+ def self.run
9
+ ActiveRecord::Base.logger = Logger.new(Bionic.application.config.log_files[:database])
10
+ ActiveRecord::Base.establish_connection(Bionic.application.config.database[Bionic.env])
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'i18n'
4
+
5
+ module Bionic
6
+ module Initializers
7
+ class Localization
8
+ def self.run
9
+ I18n.load_path = Bionic.application.config.config_files[:i18n]
10
+ I18n.locale = Bionic.application.config.locale
11
+ I18n.backend.load_translations
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bionic
4
+ VERSION = '0.0.2.rc1'
5
+ end
data/lib/bionic.rb ADDED
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bionic/version'
4
+ require 'bionic/environment'
5
+ require 'bionic/application'
6
+ require 'bionic/handler'
7
+ require 'dotenv/load'
8
+ require 'thor'
9
+
10
+ module Bionic
11
+ class << self
12
+ @application = @app_class = nil
13
+
14
+ attr_accessor :app_class
15
+
16
+ def application
17
+ @application ||= app_class&.instance
18
+ end
19
+
20
+ def root
21
+ application&.config&.root
22
+ end
23
+
24
+ delegate :run, to: :application
25
+
26
+ def env
27
+ @env ||= Environment.new(ENV['RACK_ENV'])
28
+ end
29
+
30
+ def logger
31
+ @logger ||= Logger.new(STDOUT, Logger::DEBUG)
32
+ end
33
+
34
+ def groups
35
+ ['default', Bionic.env]
36
+ end
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,209 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bionic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2.rc1
5
+ platform: ruby
6
+ authors:
7
+ - Taras Shpachenko
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: telegram-bot-ruby
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.6
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.8.6
55
+ - !ruby/object:Gem::Dependency
56
+ name: dotenv
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: standalone_migrations
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: thor
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.20'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.20'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.16'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.16'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '10.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '10.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.0'
139
+ description: Framework for creating telegram bots.
140
+ email:
141
+ - taras.shpachenko@gmail.com
142
+ executables:
143
+ - bionic
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".travis.yml"
150
+ - Gemfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - bin/console
155
+ - bin/setup
156
+ - bionic.gemspec
157
+ - exe/bionic
158
+ - lib/bionic.rb
159
+ - lib/bionic/application.rb
160
+ - lib/bionic/application/configuration.rb
161
+ - lib/bionic/cli.rb
162
+ - lib/bionic/cli/new.rb
163
+ - lib/bionic/cli/start.rb
164
+ - lib/bionic/cli/template/.env
165
+ - lib/bionic/cli/template/.standalone_migrations
166
+ - lib/bionic/cli/template/Gemfile
167
+ - lib/bionic/cli/template/README.md
168
+ - lib/bionic/cli/template/Rakefile
169
+ - lib/bionic/cli/template/app/handlers/.keep
170
+ - lib/bionic/cli/template/app/models/.keep
171
+ - lib/bionic/cli/template/app/services/.keep
172
+ - lib/bionic/cli/template/bin/run
173
+ - lib/bionic/cli/template/config/boot.rb
174
+ - lib/bionic/cli/template/config/database.yml
175
+ - lib/bionic/cli/template/config/locales/en.yml
176
+ - lib/bionic/cli/template/db/migrate/.keep
177
+ - lib/bionic/cli/template/log/.keep
178
+ - lib/bionic/environment.rb
179
+ - lib/bionic/handle.rb
180
+ - lib/bionic/handler.rb
181
+ - lib/bionic/initializers/bot.rb
182
+ - lib/bionic/initializers/database.rb
183
+ - lib/bionic/initializers/localization.rb
184
+ - lib/bionic/version.rb
185
+ homepage: https://github.com/floor114/bionic
186
+ licenses:
187
+ - MIT
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">"
201
+ - !ruby/object:Gem::Version
202
+ version: 1.3.1
203
+ requirements: []
204
+ rubyforge_project:
205
+ rubygems_version: 2.7.6
206
+ signing_key:
207
+ specification_version: 4
208
+ summary: Telegram bots framework.
209
+ test_files: []