-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vilena Aleksandrova - 3 #58
Open
crazyhedgehog
wants to merge
6
commits into
rubyroidlabs:master
Choose a base branch
from
crazyhedgehog:Aleksandrova_Vilena_3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b84bdc6
[task-3] telegram bot with base functionality (without tests)
crazyhedgehog a1947d3
[task-3] tests for telegram bot
crazyhedgehog 45af76c
[task-3] changed test data
crazyhedgehog d554a33
[task-3] robocop/rename the class NotifyHandler
crazyhedgehog f51a090
[task-3] robocop
crazyhedgehog 5222fbd
[task-3] changed update query
crazyhedgehog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea/ | ||
/.env | ||
lib/ruby/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } | ||
|
||
# gem "rails" | ||
gem 'activerecord' | ||
gem 'dotenv' # for using env. variables | ||
gem 'multi_json' | ||
gem 'nanoc', '~> 4.12' | ||
gem 'pry', '~> 0.14.1' | ||
gem 'puma' | ||
gem 'rake', '~> 13.0.3' | ||
gem 'recursive-open-struct', '~> 1.1.3' | ||
gem 'robocop' | ||
gem 'rspec' # for running tests | ||
gem 'sinatra' | ||
gem 'sinatra-activerecord', '~> 2.0' | ||
gem 'singleton' | ||
gem 'sqlite3' # db for devtesting | ||
gem 'telegram-bot-ruby' | ||
gem 'whenever', require: false | ||
gem 'whenever-test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
activemodel (6.1.3.2) | ||
activesupport (= 6.1.3.2) | ||
activerecord (6.1.3.2) | ||
activemodel (= 6.1.3.2) | ||
activesupport (= 6.1.3.2) | ||
activesupport (6.1.3.2) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (>= 1.6, < 2) | ||
minitest (>= 5.1) | ||
tzinfo (~> 2.0) | ||
zeitwerk (~> 2.3) | ||
addressable (2.7.0) | ||
public_suffix (>= 2.0.2, < 5.0) | ||
axiom-types (0.1.1) | ||
descendants_tracker (~> 0.0.4) | ||
ice_nine (~> 0.11.0) | ||
thread_safe (~> 0.3, >= 0.3.1) | ||
chronic (0.10.2) | ||
coderay (1.1.3) | ||
coercible (1.0.0) | ||
descendants_tracker (~> 0.0.1) | ||
colored (1.2) | ||
concurrent-ruby (1.1.8) | ||
cri (2.15.11) | ||
ddmemoize (1.0.0) | ||
ddmetrics (~> 1.0) | ||
ref (~> 2.0) | ||
ddmetrics (1.0.1) | ||
ddplugin (1.0.3) | ||
descendants_tracker (0.0.4) | ||
thread_safe (~> 0.3, >= 0.3.1) | ||
diff-lcs (1.4.4) | ||
dotenv (2.7.6) | ||
equalizer (0.0.11) | ||
faraday (1.4.1) | ||
faraday-excon (~> 1.1) | ||
faraday-net_http (~> 1.0) | ||
faraday-net_http_persistent (~> 1.1) | ||
multipart-post (>= 1.2, < 3) | ||
ruby2_keywords (>= 0.0.4) | ||
faraday-excon (1.1.0) | ||
faraday-net_http (1.0.1) | ||
faraday-net_http_persistent (1.1.0) | ||
hamster (3.0.0) | ||
concurrent-ruby (~> 1.0) | ||
i18n (1.8.10) | ||
concurrent-ruby (~> 1.0) | ||
ice_nine (0.11.2) | ||
inflecto (0.0.2) | ||
json_schema (0.21.0) | ||
method_source (1.0.0) | ||
minitest (5.14.4) | ||
multi_json (1.15.0) | ||
multipart-post (2.1.1) | ||
mustermann (1.1.1) | ||
ruby2_keywords (~> 0.0.1) | ||
nanoc (4.12.1) | ||
addressable (~> 2.5) | ||
colored (~> 1.2) | ||
nanoc-checking (~> 1.0) | ||
nanoc-cli (= 4.12.1) | ||
nanoc-core (= 4.12.1) | ||
nanoc-deploying (~> 1.0) | ||
parallel (~> 1.12) | ||
tty-command (~> 0.8) | ||
tty-which (~> 0.4) | ||
nanoc-checking (1.0.1) | ||
nanoc-cli (~> 4.11, >= 4.11.15) | ||
nanoc-core (~> 4.11, >= 4.11.15) | ||
nanoc-cli (4.12.1) | ||
cri (~> 2.15) | ||
diff-lcs (~> 1.3) | ||
nanoc-core (= 4.12.1) | ||
zeitwerk (~> 2.1) | ||
nanoc-core (4.12.1) | ||
concurrent-ruby (~> 1.1) | ||
ddmemoize (~> 1.0) | ||
ddmetrics (~> 1.0) | ||
ddplugin (~> 1.0) | ||
hamster (~> 3.0) | ||
json_schema (~> 0.19) | ||
slow_enumerator_tools (~> 1.0) | ||
tty-platform (~> 0.2) | ||
zeitwerk (~> 2.1) | ||
nanoc-deploying (1.0.1) | ||
nanoc-checking (~> 1.0) | ||
nanoc-cli (~> 4.11, >= 4.11.15) | ||
nanoc-core (~> 4.11, >= 4.11.15) | ||
nio4r (2.5.7) | ||
parallel (1.20.1) | ||
pastel (0.8.0) | ||
tty-color (~> 0.5) | ||
pry (0.14.1) | ||
coderay (~> 1.1) | ||
method_source (~> 1.0) | ||
public_suffix (4.0.6) | ||
puma (5.2.2) | ||
nio4r (~> 2.0) | ||
rack (2.2.3) | ||
rack-protection (2.1.0) | ||
rack | ||
rake (13.0.3) | ||
recursive-open-struct (1.1.3) | ||
ref (2.0.0) | ||
robocop (0.1.1) | ||
rack | ||
rspec (3.10.0) | ||
rspec-core (~> 3.10.0) | ||
rspec-expectations (~> 3.10.0) | ||
rspec-mocks (~> 3.10.0) | ||
rspec-core (3.10.1) | ||
rspec-support (~> 3.10.0) | ||
rspec-expectations (3.10.1) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.10.0) | ||
rspec-mocks (3.10.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.10.0) | ||
rspec-support (3.10.2) | ||
ruby2_keywords (0.0.4) | ||
sinatra (2.1.0) | ||
mustermann (~> 1.0) | ||
rack (~> 2.2) | ||
rack-protection (= 2.1.0) | ||
tilt (~> 2.0) | ||
sinatra-activerecord (2.0.22) | ||
activerecord (>= 4.1) | ||
sinatra (>= 1.0) | ||
singleton (0.1.1) | ||
slow_enumerator_tools (1.1.0) | ||
sqlite3 (1.4.2) | ||
telegram-bot-ruby (0.15.0) | ||
faraday | ||
inflecto | ||
virtus | ||
thread_safe (0.3.6) | ||
tilt (2.0.10) | ||
tty-color (0.6.0) | ||
tty-command (0.10.1) | ||
pastel (~> 0.8) | ||
tty-platform (0.3.0) | ||
tty-which (0.4.2) | ||
tzinfo (2.0.4) | ||
concurrent-ruby (~> 1.0) | ||
virtus (1.0.5) | ||
axiom-types (~> 0.1) | ||
coercible (~> 1.0) | ||
descendants_tracker (~> 0.0, >= 0.0.3) | ||
equalizer (~> 0.0, >= 0.0.9) | ||
whenever (1.0.0) | ||
chronic (>= 0.6.3) | ||
whenever-test (1.0.1) | ||
whenever | ||
zeitwerk (2.4.2) | ||
|
||
PLATFORMS | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
activerecord | ||
dotenv | ||
multi_json | ||
nanoc (~> 4.12) | ||
pry (~> 0.14.1) | ||
puma | ||
rake (~> 13.0.3) | ||
recursive-open-struct (~> 1.1.3) | ||
robocop | ||
rspec | ||
sinatra | ||
sinatra-activerecord (~> 2.0) | ||
singleton | ||
sqlite3 | ||
telegram-bot-ruby | ||
whenever | ||
whenever-test | ||
|
||
BUNDLED WITH | ||
2.2.17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Telegram Bot | ||
|
||
A simple telegram bot that allows to study endlish words. | ||
|
||
## Description | ||
|
||
Bot has the following functionality: | ||
- A user can start/stop the studying process. | ||
|
||
## Getting Started | ||
|
||
### Gems | ||
``` | ||
gem 'activerecord' | ||
gem 'dotenv' # for using env. variables | ||
gem 'multi_json' | ||
gem 'nanoc', '~> 4.12' | ||
gem 'pry', '~> 0.14.1' | ||
gem 'puma' | ||
gem 'rake', '~> 13.0.3' | ||
gem 'robocop' | ||
gem 'rspec' # for running tests | ||
gem 'sinatra' | ||
gem 'sinatra-activerecord', '~> 2.0' | ||
gem 'singleton' | ||
gem 'sqlite3' # db for testing | ||
gem 'telegram-bot-ruby' | ||
gem 'whenever', require: false | ||
gem 'whenever-test' | ||
``` | ||
### Before executing | ||
``` | ||
1. Run tunels using ngrok tool for server emulating: | ||
./ngrok authtoken {ngrok_token} | ||
./ngrok http {port} | ||
2. Send post request to telegram API that allows to redirect | ||
curl --location --request POST 'https://api.telegram.org/bot{token}/setWebhook' --header 'Content-Type: application/json' --data-raw '{"url": {url}}' | ||
``` | ||
|
||
### Executing program | ||
|
||
* Run ``` bundle install ``` | ||
* Run ``` bundle exec rake db:seed ``` | ||
* Run ``` bundle exec rake db:migrate ``` | ||
* Run ``` bundle exec rake db:seed ``` | ||
* Run ``` rackup -p {port} ``` | ||
|
||
``` | ||
P.S. In this case it's enough to run: 'bundle install', 'rackup -p {port}' | ||
``` | ||
|
||
### Task for cron | ||
* Start ``` whenever --update-crontab --set environment='development' ``` | ||
* Stop ``` whenever --clear-crontab ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'config/environment' | ||
require 'sinatra/activerecord/rake' | ||
require_relative 'lib/cron_worker' | ||
|
||
namespace :payload do | ||
desc 'Send out lesson messages' | ||
task :send_messages do | ||
CronWorker.perform | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rails/RakeEnvironment: Include :environment task as a dependency for all Rake tasks.