From 4efcd4420d043f29fe3107dd0fedf589f9d144ab Mon Sep 17 00:00:00 2001 From: Petr Nikolas Prokop Date: Fri, 29 Nov 2019 12:27:46 +0100 Subject: [PATCH] new project init --- .ci/.gitlab-ci.yml | 58 --- .ci/.travis.yml | 22 -- .editorconfig | 10 + .env.development | 4 - .env.test | 4 - .gitattributes | 12 + .gitignore | 30 +- .hanamirc | 3 - .rspec | 2 - .rubocop.yml | 54 +++ .ruby-version | 1 + .vscode/extensions.json | 9 + .vscode/settings.json | 13 + DEPLOYMENT.md | 21 - Gemfile | 70 +++- Gemfile.lock | 363 +++++++++--------- Procfile | 1 + Procfile.dev | 1 + README.md | 71 ++-- Rakefile | 13 +- app/channels/application_cable/channel.rb | 4 + app/channels/application_cable/connection.rb | 4 + app/controllers/application_controller.rb | 2 + .../controllers/concerns/.keep | 0 app/jobs/application_job.rb | 2 + app/mailers/application_mailer.rb | 4 + app/models/application_record.rb | 3 + .../.gitkeep => app/models/concerns/.keep | 0 app/views/layouts/mailer.html.erb | 13 + app/views/layouts/mailer.text.erb | 1 + apps/web/application.rb | 326 ---------------- apps/web/assets/favicon.ico | Bin 15086 -> 0 bytes apps/web/assets/stylesheets/main.scss | 20 - apps/web/assets/stylesheets/reset.scss | 83 ---- apps/web/config/routes.rb | 8 - apps/web/controllers/home/index.rb | 12 - apps/web/controllers/posts/index.rb | 15 - apps/web/templates/application.html.erb | 54 --- apps/web/templates/home/index.html.erb | 11 - apps/web/templates/posts/index.html.erb | 39 -- apps/web/templates/shared/_navbar.html.erb | 14 - apps/web/views/application_layout.rb | 7 - apps/web/views/home/index.rb | 9 - apps/web/views/posts/index.rb | 9 - bin/bundle | 3 + bin/rails | 9 + bin/rake | 9 + bin/setup | 34 ++ bin/spring | 17 + bin/update | 29 ++ config.ru | 6 +- config/application.rb | 30 ++ config/boot.rb | 5 +- config/cable.yml | 9 + config/database.yml | 33 ++ config/environment.rb | 52 +-- config/environments/development.rb | 47 +++ config/environments/production.rb | 78 ++++ config/environments/test.rb | 42 ++ .../application_controller_renderer.rb | 8 + config/initializers/backtrace_silencers.rb | 7 + config/initializers/cors.rb | 16 + .../initializers/filter_parameter_logging.rb | 4 + config/initializers/inflections.rb | 16 + config/initializers/mime_types.rb | 4 + config/initializers/new_framework_defaults.rb | 20 + config/initializers/wrap_parameters.rb | 14 + config/locales/en.yml | 23 ++ config/puma.rb | 47 +++ config/routes.rb | 3 + config/secrets.yml | 22 ++ config/spring.rb | 6 + db/migrations/20181201142007_create_posts.rb | 15 - db/schema.rb | 18 + db/seeds.rb | 7 + lib/flick.rb | 2 - lib/flick/entities/post.rb | 2 - lib/flick/repositories/post_repository.rb | 2 - .../initializers/.gitkeep => lib/tasks/.keep | 0 license | 21 + db/schema.sql => log/.keep | 0 spec/features_helper.rb | 12 - spec/flick/entities/post_spec.rb | 6 - .../repositories/post_repository_spec.rb | 3 - spec/spec_helper.rb | 103 ----- spec/support/capybara.rb | 8 - spec/web/controllers/posts/index_spec.rb | 23 -- spec/web/features/list_posts_spec.rb | 19 - spec/web/features/visit_home_spec.rb | 9 - spec/web/views/application_layout_spec.rb | 10 - spec/web/views/posts/index_spec.rb | 34 -- .../.gitkeep => test/controllers/.keep | 0 .../templates/.gitkeep => test/fixtures/.keep | 0 public/.gitkeep => test/fixtures/files/.keep | 0 .../.gitkeep => test/integration/.keep | 0 .../.gitkeep => test/mailers/.keep | 0 spec/support/.gitkeep => test/models/.keep | 0 test/test_helper.rb | 10 + tmp/.keep | 0 99 files changed, 1053 insertions(+), 1246 deletions(-) delete mode 100644 .ci/.gitlab-ci.yml delete mode 100644 .ci/.travis.yml create mode 100644 .editorconfig delete mode 100644 .env.development delete mode 100644 .env.test create mode 100644 .gitattributes delete mode 100644 .hanamirc delete mode 100644 .rspec create mode 100644 .rubocop.yml create mode 100644 .ruby-version create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json delete mode 100644 DEPLOYMENT.md create mode 100644 Procfile create mode 100644 Procfile.dev create mode 100644 app/channels/application_cable/channel.rb create mode 100644 app/channels/application_cable/connection.rb create mode 100644 app/controllers/application_controller.rb rename apps/web/assets/images/.gitkeep => app/controllers/concerns/.keep (100%) create mode 100644 app/jobs/application_job.rb create mode 100644 app/mailers/application_mailer.rb create mode 100644 app/models/application_record.rb rename apps/web/assets/javascripts/.gitkeep => app/models/concerns/.keep (100%) create mode 100644 app/views/layouts/mailer.html.erb create mode 100644 app/views/layouts/mailer.text.erb delete mode 100644 apps/web/application.rb delete mode 100644 apps/web/assets/favicon.ico delete mode 100644 apps/web/assets/stylesheets/main.scss delete mode 100644 apps/web/assets/stylesheets/reset.scss delete mode 100644 apps/web/config/routes.rb delete mode 100644 apps/web/controllers/home/index.rb delete mode 100644 apps/web/controllers/posts/index.rb delete mode 100644 apps/web/templates/application.html.erb delete mode 100644 apps/web/templates/home/index.html.erb delete mode 100644 apps/web/templates/posts/index.html.erb delete mode 100644 apps/web/templates/shared/_navbar.html.erb delete mode 100644 apps/web/views/application_layout.rb delete mode 100644 apps/web/views/home/index.rb delete mode 100644 apps/web/views/posts/index.rb create mode 100755 bin/bundle create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/setup create mode 100755 bin/spring create mode 100755 bin/update create mode 100644 config/application.rb create mode 100644 config/cable.yml create mode 100644 config/database.yml create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/initializers/application_controller_renderer.rb create mode 100644 config/initializers/backtrace_silencers.rb create mode 100644 config/initializers/cors.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/new_framework_defaults.rb create mode 100644 config/initializers/wrap_parameters.rb create mode 100644 config/locales/en.yml create mode 100644 config/puma.rb create mode 100644 config/routes.rb create mode 100644 config/secrets.yml create mode 100644 config/spring.rb delete mode 100644 db/migrations/20181201142007_create_posts.rb create mode 100644 db/schema.rb create mode 100644 db/seeds.rb delete mode 100644 lib/flick.rb delete mode 100644 lib/flick/entities/post.rb delete mode 100644 lib/flick/repositories/post_repository.rb rename config/initializers/.gitkeep => lib/tasks/.keep (100%) create mode 100644 license rename db/schema.sql => log/.keep (100%) delete mode 100644 spec/features_helper.rb delete mode 100644 spec/flick/entities/post_spec.rb delete mode 100644 spec/flick/repositories/post_repository_spec.rb delete mode 100644 spec/spec_helper.rb delete mode 100644 spec/support/capybara.rb delete mode 100644 spec/web/controllers/posts/index_spec.rb delete mode 100644 spec/web/features/list_posts_spec.rb delete mode 100644 spec/web/features/visit_home_spec.rb delete mode 100644 spec/web/views/application_layout_spec.rb delete mode 100644 spec/web/views/posts/index_spec.rb rename lib/flick/mailers/.gitkeep => test/controllers/.keep (100%) rename lib/flick/mailers/templates/.gitkeep => test/fixtures/.keep (100%) rename public/.gitkeep => test/fixtures/files/.keep (100%) rename spec/flick/mailers/.gitkeep => test/integration/.keep (100%) rename spec/flick/repositories/.gitkeep => test/mailers/.keep (100%) rename spec/support/.gitkeep => test/models/.keep (100%) create mode 100644 test/test_helper.rb create mode 100644 tmp/.keep diff --git a/.ci/.gitlab-ci.yml b/.ci/.gitlab-ci.yml deleted file mode 100644 index 591736b..0000000 --- a/.ci/.gitlab-ci.yml +++ /dev/null @@ -1,58 +0,0 @@ -image: ruby:2.4.0 - -before_script: - - > - : "${HEROKU_EMAIL:?Please set HEROKU_EMAIL in your CI/CD config vars}" - - > - : "${HEROKU_AUTH_TOKEN:?Please set HEROKU_AUTH_TOKEN in your CI/CD config vars}" - - curl https://cli-assets.heroku.com/install-standalone.sh | sh - - | - cat >~/.netrc < 1.3' -gem 'hanami-model', '~> 1.3' +git_source(:github) do |repo_name| + repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/') + "https://github.com/#{repo_name}.git" +end + +ruby '~> 2.6.3' +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '~> 5.0.7', '>= 5.0.7.2' + +# Ruby interface to the PostgreSQL RDBMS. gem 'pg' -group :development do - # Code reloading - # See: http://hanamirb.org/guides/projects/code-reloading - gem 'shotgun', platforms: :ruby - gem 'hanami-webconsole' -end +# Use sqlite3 as the database for Active Record +gem 'sqlite3' -group :test, :development do - gem 'dotenv', '~> 2.4' -end +# Use Puma as the app server +gem 'puma', '~> 3.0' + +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +# gem 'jbuilder', '~> 2.5' +# Use Redis adapter to run Action Cable in production +# gem 'redis', '~> 3.0' +# Use ActiveModel has_secure_password +# gem 'bcrypt', '~> 3.1.7' -group :test do - gem 'rspec' - gem 'capybara' +# Use Capistrano for deployment +# gem 'capistrano-rails', group: :development + +# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible +# gem 'rack-cors' + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug', platform: :mri end -group :production do - gem 'puma' +group :development do + gem 'listen', '~> 3.0.5' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'rufo', '~> 0.7.0', require: false + gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' + # A Ruby static code analyzer + gem 'rubocop', '~> 0.70.0', require: false + gem 'rubocop-rails', require: false + # Code smell detector for Ruby + gem 'reek' + + # A code metric tool for rails projects + gem 'rails_best_practices' + + # A static analysis security vulnerability scanner for Ruby on Rails applications + gem 'brakeman', require: false + + # Annotate Rails classes with schema and routes info + gem 'annotate' end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] diff --git a/Gemfile.lock b/Gemfile.lock index d61ec48..94fb9b3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,191 +1,206 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - better_errors (2.5.0) - coderay (>= 1.0.0) - erubi (>= 1.0.0) - rack (>= 0.9.0) - binding_of_caller (0.8.0) - debug_inspector (>= 0.0.1) - capybara (3.12.0) - addressable - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (~> 1.2) - xpath (~> 3.2) - coderay (1.1.2) - concurrent-ruby (1.1.3) - debug_inspector (0.0.3) - diff-lcs (1.3) - dotenv (2.5.0) - dry-configurable (0.7.0) - concurrent-ruby (~> 1.0) - dry-container (0.6.0) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.4.7) - concurrent-ruby (~> 1.0) - dry-equalizer (0.2.1) - dry-initializer (1.4.1) - dry-logic (0.4.2) - dry-container (~> 0.2, >= 0.2.6) - dry-core (~> 0.2) - dry-equalizer (~> 0.2) - dry-struct (0.3.1) - dry-configurable (~> 0.1) - dry-core (~> 0.3) - dry-equalizer (~> 0.2) - dry-types (~> 0.9, >= 0.9.0) - ice_nine (~> 0.11) - dry-types (0.11.1) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1) - dry-container (~> 0.3) - dry-core (~> 0.2, >= 0.2.1) - dry-equalizer (~> 0.2) - dry-logic (~> 0.4, >= 0.4.0) - inflecto (~> 0.0.0, >= 0.0.2) - dry-validation (0.11.0) - concurrent-ruby (~> 1.0) - dry-configurable (~> 0.1, >= 0.1.3) - dry-core (~> 0.2, >= 0.2.1) - dry-equalizer (~> 0.2) - dry-logic (~> 0.4, >= 0.4.0) - dry-types (~> 0.11.0) - erubi (1.7.1) - hanami (1.3.0) - bundler - concurrent-ruby (~> 1.0) - hanami-assets (~> 1.3) - hanami-cli (~> 0.3) - hanami-controller (~> 1.3) - hanami-helpers (~> 1.3) - hanami-mailer (~> 1.3) - hanami-router (~> 1.3) - hanami-utils (~> 1.3) - hanami-validations (~> 1.3) - hanami-view (~> 1.3) - hanami-assets (1.3.0) - hanami-helpers (~> 1.3) - hanami-utils (~> 1.3) - tilt (~> 2.0, >= 2.0.2) - hanami-cli (0.3.0) - concurrent-ruby (~> 1.0) - hanami-utils (~> 1.3) - hanami-controller (1.3.0) - hanami-utils (~> 1.3) - rack (~> 2.0) - hanami-helpers (1.3.0) - hanami-utils (~> 1.3) - hanami-mailer (1.3.0) - hanami-utils (~> 1.3) - mail (~> 2.6) - tilt (~> 2.0, >= 2.0.1) - hanami-model (1.3.0) - concurrent-ruby (~> 1.0) - dry-types (~> 0.11.0) - hanami-utils (~> 1.3) - rom (~> 3.3, >= 3.3.3) - rom-repository (~> 1.4) - rom-sql (~> 1.3, >= 1.3.5) - hanami-router (1.3.0) - hanami-utils (~> 1.3) - http_router (= 0.11.2) + actioncable (5.0.7.2) + actionpack (= 5.0.7.2) + nio4r (>= 1.2, < 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.0.7.2) + actionview (= 5.0.7.2) + activesupport (= 5.0.7.2) rack (~> 2.0) - hanami-utils (1.3.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.0.7.2) + activesupport (= 5.0.7.2) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.7.2) + activesupport (= 5.0.7.2) + globalid (>= 0.3.6) + activemodel (5.0.7.2) + activesupport (= 5.0.7.2) + activerecord (5.0.7.2) + activemodel (= 5.0.7.2) + activesupport (= 5.0.7.2) + arel (~> 7.0) + activesupport (5.0.7.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + annotate (3.0.3) + activerecord (>= 3.2, < 7.0) + rake (>= 10.4, < 14.0) + arel (7.1.4) + ast (2.4.0) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) + brakeman (4.7.2) + builder (3.2.3) + byebug (11.0.1) + code_analyzer (0.4.8) + sexp_processor + codeclimate-engine-rb (0.4.1) + virtus (~> 1.0) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) + concurrent-ruby (1.1.5) + crass (1.0.5) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + equalizer (0.0.11) + erubis (2.7.0) + ffi (1.11.3) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.7.0) concurrent-ruby (~> 1.0) - transproc (~> 1.0) - hanami-validations (1.3.0) - dry-validation (~> 0.11, < 0.12) - hanami-utils (~> 1.3) - hanami-view (1.3.0) - hanami-utils (~> 1.3) - tilt (~> 2.0, >= 2.0.1) - hanami-webconsole (0.1.0) - better_errors (~> 2.4) - binding_of_caller (~> 0.8) - http_router (0.11.2) - rack (>= 1.0.0) - url_mount (~> 0.2.1) ice_nine (0.11.2) - inflecto (0.0.2) + jaro_winkler (1.5.4) + json (2.2.0) + kwalify (0.7.2) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + loofah (2.4.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - mini_mime (1.0.1) - mini_portile2 (2.3.0) - nokogiri (1.8.5) - mini_portile2 (~> 2.3.0) - pg (1.1.3) - public_suffix (3.0.3) - puma (3.12.0) - rack (2.0.6) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rake (12.3.1) - regexp_parser (1.3.0) - rom (3.3.3) - concurrent-ruby (~> 1.0) - dry-core (~> 0.3) - dry-equalizer (~> 0.2) - dry-initializer (~> 1.3) - dry-types (~> 0.9, >= 0.9.4) - rom-mapper (~> 0.5, >= 0.5.1) - rom-mapper (0.5.1) - dry-core (~> 0.2, >= 0.2.3) - dry-equalizer (~> 0.2) - transproc (~> 1.0) - rom-repository (1.4.0) - dry-core (~> 0.3, >= 0.3.1) - dry-struct (~> 0.3) - rom (~> 3.3) - rom-mapper (~> 0.5) - rom-sql (1.3.5) - dry-core (~> 0.3) - dry-equalizer (~> 0.2) - dry-types (~> 0.11.0) - rom (~> 3.2, >= 3.2.2) - sequel (~> 4.43) - rspec (3.8.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - sequel (4.49.0) - shotgun (0.9.2) + method_source (0.9.2) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.13.0) + nio4r (2.5.2) + nokogiri (1.10.5) + mini_portile2 (~> 2.4.0) + parallel (1.19.1) + parser (2.6.5.0) + ast (~> 2.4.0) + pg (1.1.4) + psych (3.1.0) + puma (3.12.1) + rack (2.0.7) + rack-test (0.6.3) rack (>= 1.0) - tilt (2.0.9) - transproc (1.0.2) - url_mount (0.2.1) - rack - xpath (3.2.0) - nokogiri (~> 1.8) + rails (5.0.7.2) + actioncable (= 5.0.7.2) + actionmailer (= 5.0.7.2) + actionpack (= 5.0.7.2) + actionview (= 5.0.7.2) + activejob (= 5.0.7.2) + activemodel (= 5.0.7.2) + activerecord (= 5.0.7.2) + activesupport (= 5.0.7.2) + bundler (>= 1.3.0) + railties (= 5.0.7.2) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + rails_best_practices (1.19.4) + activesupport + code_analyzer (>= 0.4.8) + erubis + i18n + json + require_all (~> 2.0) + ruby-progressbar + railties (5.0.7.2) + actionpack (= 5.0.7.2) + activesupport (= 5.0.7.2) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rainbow (3.0.0) + rake (13.0.1) + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) + reek (5.5.0) + codeclimate-engine-rb (~> 0.4.0) + kwalify (~> 0.7.0) + parser (>= 2.5.0.0, < 2.7, != 2.5.1.1) + psych (~> 3.1.0) + rainbow (>= 2.0, < 4.0) + require_all (2.0.0) + rubocop (0.70.0) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.6) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 1.7) + rubocop-rails (2.0.1) + rack (>= 1.1) + rubocop (>= 0.70.0) + ruby-progressbar (1.10.1) + rufo (0.7.0) + sexp_processor (4.13.0) + spring (2.0.2) + activesupport (>= 4.2) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.1) + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + unicode-display_width (1.6.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) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) PLATFORMS ruby DEPENDENCIES - capybara - dotenv (~> 2.4) - hanami (~> 1.3) - hanami-model (~> 1.3) - hanami-webconsole + annotate + brakeman + byebug + listen (~> 3.0.5) pg - puma - rake - rspec - shotgun + puma (~> 3.0) + rails (~> 5.0.7, >= 5.0.7.2) + rails_best_practices + reek + rubocop (~> 0.70.0) + rubocop-rails + rufo (~> 0.7.0) + spring + spring-watcher-listen (~> 2.0.0) + sqlite3 + tzinfo-data + +RUBY VERSION + ruby 2.6.3p62 BUNDLED WITH - 1.15.4 + 1.17.3 diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..0719848 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bin/rails s -p 5000 diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 0000000..0719848 --- /dev/null +++ b/Procfile.dev @@ -0,0 +1 @@ +web: bin/rails s -p 5000 diff --git a/README.md b/README.md index be30d3d..80c74ff 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,81 @@ # Flick -Flick is a fullstack development platform to generate, develop and deploy web applications and microservices. +Rails Versioned API starter template for hipsters! * Version 0.0.1 ## Table of Contents * [Prerequisites](#prerequisites) -* [Setup](#setup) -* [Resources](#resources) -* [Deployment](#deployment) -* [Docker](#docker) -* [Test API with Postman](#test-api-with-postman) +* [Project Setup](#project-setup) +* [Development](#development) +* [Tools](#tools) ## Prerequisites * [Ruby](https://www.ruby-lang.org/en/downloads/) -* [Hanami](https://guides.hanamirb.org/introduction/getting-started/) +* [Ruby on Rails](http://guides.rubyonrails.org/getting_started.html) * [RVM](https://rvm.io/) -* [PostgreSQL](https://www.postgresql.org/docs/) +* [PostgreSQL DB](https://www.postgresql.org/docs/) -## Setup +## Project Setup -How to run tests: +* For production, you need to replace the asterisk with the URL of your client-side application in ./config/initializers/cors.rb file. + +1. Clone or download this repo +2. Run `bundle install` +3. Run `rake db:create` +4. Run `bin/rails db:migrate RAILS_ENV=development` +5. Run `bin/rails db:seed RAILS_ENV=development` +6. Run `brew install overmind` (for MacOS users) +7. Run `overmind start` +8. Visit --> [http://localhost:5000/](http://localhost:5000/). That's it!. + +## Tools + +* Run `rubocop` for Ruby lint. +* Run `rubocop -a` for fixed some issues automatically. +* Run `reek .` for analyzing code. +* Run `brakeman` for static analysis and for security vulnerabilities. +* Run `rails_best_practices .` in root app directory. Helps to find unused methods, missing indexes into database tables and many other things. + +### Annotate (aka AnnotateModels) usage + +To annotate all your models, tests, fixtures, and factories: ```bash -% bundle exec rake +cd /path/to/app +annotate ``` -How to run the development console: +To annotate just your models, tests, and factories: ```bash -% bundle exec hanami console +annotate --exclude fixtures ``` -How to run the development server: +To annotate just your models: ```bash -% bundle exec hanami server +annotate --exclude tests,fixtures,factories,serializers ``` -How to prepare (create and migrate) DB for `development` and `test` environments: +To annotate routes.rb: ```bash -% bundle exec hanami db prepare - -% HANAMI_ENV=test bundle exec hanami db prepare +annotate --routes ``` -## Resources +To remove model/test/fixture/factory/serializer annotations: -Explore Hanami [guides](http://hanamirb.org/guides/), [API docs](http://docs.hanamirb.org/1.3.0/), or jump in [chat](http://chat.hanamirb.org) for help. Enjoy! 🌸 +```bash +annotate --delete +``` + +To remove routes.rb annotations: -## Deployment +```bash +annotate --routes --delete +``` -* Mainly for Heroku hosting. -* See [documentation](./DEPLOYMENT.md). +To automatically annotate every time you run db:migrate, either run rails g annotate:install or add Annotate.load_tasks to your `Rakefile`. See the configuration in Rails section for more info. diff --git a/Rakefile b/Rakefile index 5000dfa..e85f913 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,6 @@ -require 'rake' -require 'hanami/rake_tasks' +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -begin - require 'rspec/core/rake_task' - RSpec::Core::RakeTask.new(:spec) - task default: :spec -rescue LoadError -end +require_relative 'config/application' + +Rails.application.load_tasks diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb new file mode 100644 index 0000000..d672697 --- /dev/null +++ b/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb new file mode 100644 index 0000000..0ff5442 --- /dev/null +++ b/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..4ac8823 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::API +end diff --git a/apps/web/assets/images/.gitkeep b/app/controllers/concerns/.keep similarity index 100% rename from apps/web/assets/images/.gitkeep rename to app/controllers/concerns/.keep diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000..a009ace --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 0000000..286b223 --- /dev/null +++ b/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000..10a4cba --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/apps/web/assets/javascripts/.gitkeep b/app/models/concerns/.keep similarity index 100% rename from apps/web/assets/javascripts/.gitkeep rename to app/models/concerns/.keep diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 0000000..cbd34d2 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 0000000..37f0bdd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/apps/web/application.rb b/apps/web/application.rb deleted file mode 100644 index 9793db2..0000000 --- a/apps/web/application.rb +++ /dev/null @@ -1,326 +0,0 @@ -require 'hanami/helpers' -require 'hanami/assets' - -module Web - class Application < Hanami::Application - configure do - ## - # BASIC - # - - # Define the root path of this application. - # All paths specified in this configuration are relative to path below. - # - root __dir__ - - # Relative load paths where this application will recursively load the - # code. - # - # When you add new directories, remember to add them here. - # - load_paths << [ - 'controllers', - 'views' - ] - - # Handle exceptions with HTTP statuses (true) or don't catch them (false). - # Defaults to true. - # See: http://www.rubydoc.info/gems/hanami-controller/#Exceptions_management - # - # handle_exceptions true - - ## - # HTTP - # - - # Routes definitions for this application - # See: http://www.rubydoc.info/gems/hanami-router#Usage - # - routes 'config/routes' - - # URI scheme used by the routing system to generate absolute URLs - # Defaults to "http" - # - # scheme 'https' - - # URI host used by the routing system to generate absolute URLs - # Defaults to "localhost" - # - # host 'example.org' - - # URI port used by the routing system to generate absolute URLs - # Argument: An object coercible to integer, defaults to 80 if the scheme - # is http and 443 if it's https - # - # This should only be configured if app listens to non-standard ports - # - # port 443 - - # Enable cookies - # Argument: boolean to toggle the feature - # A Hash with options - # - # Options: - # :domain - The domain (String - nil by default, not required) - # :path - Restrict cookies to a relative URI - # (String - nil by default) - # :max_age - Cookies expiration expressed in seconds - # (Integer - nil by default) - # :secure - Restrict cookies to secure connections - # (Boolean - Automatically true when using HTTPS) - # See #scheme and #ssl? - # :httponly - Prevent JavaScript access (Boolean - true by default) - # - # cookies true - # or - # cookies max_age: 300 - - # Enable sessions - # Argument: Symbol the Rack session adapter - # A Hash with options - # - # See: http://www.rubydoc.info/gems/rack/Rack/Session/Cookie - # - # sessions :cookie, secret: ENV['WEB_SESSIONS_SECRET'] - - # Configure Rack middleware for this application - # - # middleware.use Rack::Protection - - # Default format for the requests that don't specify an HTTP_ACCEPT header - # Argument: A symbol representation of a mime type, defaults to :html - # - # default_request_format :html - - # Default format for responses that don't consider the request format - # Argument: A symbol representation of a mime type, defaults to :html - # - # default_response_format :html - - # HTTP Body parsers - # Parse non GET responses body for a specific mime type - # Argument: Symbol, which represent the format of the mime type - # (only `:json` is supported) - # Object, the parser - # - # body_parsers :json - - # When it's true and the router receives a non-encrypted request (http), - # it redirects to the secure equivalent (https). Disabled by default. - # - # force_ssl true - - ## - # TEMPLATES - # - - # The layout to be used by all views - # - layout :application # It will load Web::Views::ApplicationLayout - - # The relative path to templates - # - templates 'templates' - - ## - # ASSETS - # - assets do - # JavaScript compressor - # - # Supported engines: - # - # * :builtin - # * :uglifier - # * :yui - # * :closure - # - # See: http://hanamirb.org/guides/assets/compressors - # - # In order to skip JavaScript compression comment the following line - javascript_compressor :builtin - - # Stylesheet compressor - # - # Supported engines: - # - # * :builtin - # * :yui - # * :sass - # - # See: http://hanamirb.org/guides/assets/compressors - # - # In order to skip stylesheet compression comment the following line - stylesheet_compressor :sass - - # Specify sources for assets - # - sources << [ - 'assets' - ] - end - - ## - # SECURITY - # - - # X-Frame-Options is a HTTP header supported by modern browsers. - # It determines if a web page can or cannot be included via and - #