Skip to content
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

Dzmitry Monich - Hw 3 #56

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dzmitry-Monich/3/fasteng/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.bundle/
/vendor/bundle
.DS_Store
*.gem
/tmp/
/.rubocop.yml
.env
.solargraph.yml
/log/*
3 changes: 3 additions & 0 deletions Dzmitry-Monich/3/fasteng/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--require spec_helper
--color
--format documentation
34 changes: 34 additions & 0 deletions Dzmitry-Monich/3/fasteng/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

source 'https://rubygems.org'

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

gem 'telegram-bot-ruby', '~> 0.15.0'

gem 'dotenv', '~> 2.7'

gem 'rspec', '~> 3.10'

gem 'activerecord', '~> 6.0'

gem 'standalone_migrations', '~> 6.0'

gem 'rake', '~> 13.0'

gem 'pg', '~> 1.2'

gem 'pry', '~> 0.14.1'

gem 'shoulda-matchers', require: false

gem 'factory_bot'

gem 'database_cleaner-active_record'

gem 'whenever', require: false
gem 'whenever-test'

gem 'timecop', '~> 0.9.4'

gem 'faker', git: 'https://github.com/faker-ruby/faker.git', branch: 'master'
161 changes: 161 additions & 0 deletions Dzmitry-Monich/3/fasteng/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
GIT
remote: https://github.com/faker-ruby/faker.git
revision: aa31845ed54c25eb2638d716bfddf59771b502aa
branch: master
specs:
faker (2.18.0)
i18n (>= 1.6, < 2)

GEM
remote: https://rubygems.org/
specs:
actionpack (6.0.3.6)
actionview (= 6.0.3.6)
activesupport (= 6.0.3.6)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (6.0.3.6)
activesupport (= 6.0.3.6)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activemodel (6.0.3.6)
activesupport (= 6.0.3.6)
activerecord (6.0.3.6)
activemodel (= 6.0.3.6)
activesupport (= 6.0.3.6)
activesupport (6.0.3.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
builder (3.2.4)
chronic (0.10.2)
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concurrent-ruby (1.1.8)
crass (1.0.6)
database_cleaner-active_record (2.0.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
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)
erubi (1.10.0)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
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)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
inflecto (0.0.2)
loofah (2.9.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
method_source (1.0.0)
minitest (5.14.4)
multipart-post (2.1.1)
nokogiri (1.11.3-x86_64-darwin)
racc (~> 1.4)
pg (1.2.3)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
racc (1.5.2)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.6)
actionpack (= 6.0.3.6)
activesupport (= 6.0.3.6)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (13.0.3)
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)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
standalone_migrations (6.0.0)
activerecord (>= 4.2.7, < 6.1.0, != 5.2.3.rc1, != 5.2.3)
railties (>= 4.2.7, < 6.1.0, != 5.2.3.rc1, != 5.2.3)
rake (>= 10.0)
telegram-bot-ruby (0.15.0)
faraday
inflecto
virtus
thor (1.1.0)
thread_safe (0.3.6)
timecop (0.9.4)
tzinfo (1.2.9)
thread_safe (~> 0.1)
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-darwin-18

DEPENDENCIES
activerecord (~> 6.0)
database_cleaner-active_record
dotenv (~> 2.7)
factory_bot
faker!
pg (~> 1.2)
pry (~> 0.14.1)
rake (~> 13.0)
rspec (~> 3.10)
shoulda-matchers
standalone_migrations (~> 6.0)
telegram-bot-ruby (~> 0.15.0)
timecop (~> 0.9.4)
whenever
whenever-test

BUNDLED WITH
2.2.16
28 changes: 28 additions & 0 deletions Dzmitry-Monich/3/fasteng/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
install:
bundle install

run:
bin/bot

test:
bundle exec rspec

tasks:
bundle exec rake --tasks

db-migrate:
bundle exec rake db:migrate

db-create:
bundle exec rake db:new_migration name=$(N)

# cron-setup:
# bundle exec whenever

cron-start:
bundle exec whenever --update-crontab --set environment=development

cron-stop:
bundle exec whenever --clear-crontab

.PHONY: test
1 change: 1 addition & 0 deletions Dzmitry-Monich/3/fasteng/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Bot
18 changes: 18 additions & 0 deletions Dzmitry-Monich/3/fasteng/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# rubocop:disable Lint/RedundantCopDisableDirective
# rubocop:disable Rails/RakeEnvironment

require 'standalone_migrations'
StandaloneMigrations::Tasks.load_tasks

require_relative 'lib/fasteng'

namespace :cron do
task :notify do
Fasteng::NotifyHandler.call
end
end

# rubocop:enable Rails/RakeEnvironment
# rubocop:enable Lint/RedundantCopDisableDirective
8 changes: 8 additions & 0 deletions Dzmitry-Monich/3/fasteng/bin/bot
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'rubygems'
require 'bundler/setup'
require_relative '../lib/fasteng'

Fasteng::App.new.init.run
114 changes: 114 additions & 0 deletions Dzmitry-Monich/3/fasteng/bin/bundle
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'bundle' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "rubygems"

m = Module.new do
module_function

def invoked_as_script?
File.expand_path($0) == File.expand_path(__FILE__)
end

def env_var_version
ENV["BUNDLER_VERSION"]
end

def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
bundler_version = nil
update_index = nil
ARGV.each_with_index do |a, i|
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
bundler_version = a
end
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
bundler_version = $1
update_index = i
end
bundler_version
end

def gemfile
gemfile = ENV["BUNDLE_GEMFILE"]
return gemfile if gemfile && !gemfile.empty?

File.expand_path("../../Gemfile", __FILE__)
end

def lockfile
lockfile =
case File.basename(gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
else "#{gemfile}.lock"
end
File.expand_path(lockfile)
end

def lockfile_version
return unless File.file?(lockfile)
lockfile_contents = File.read(lockfile)
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
Regexp.last_match(1)
end

def bundler_version
@bundler_version ||=
env_var_version || cli_arg_version ||
lockfile_version
end

def bundler_requirement
return "#{Gem::Requirement.default}.a" unless bundler_version

bundler_gem_version = Gem::Version.new(bundler_version)

requirement = bundler_gem_version.approximate_recommendation

return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")

requirement += ".a" if bundler_gem_version.prerelease?

requirement
end

def load_bundler!
ENV["BUNDLE_GEMFILE"] ||= gemfile

activate_bundler
end

def activate_bundler
gem_error = activation_error_handling do
gem "bundler", bundler_requirement
end
return if gem_error.nil?
require_error = activation_error_handling do
require "bundler/version"
end
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
exit 42
end

def activation_error_handling
yield
nil
rescue StandardError, LoadError => e
e
end
end

m.load_bundler!

if m.invoked_as_script?
load Gem.bin_path("bundler", "bundle")
end
Loading