Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1. Rubocop, Simplecov, Mutant, Brakeman, Reek, Rspec
   Rails_best_practices integrations
2. Git hooks to run tools post/pre commit
   bin/setup script to copy hooks and database file
3. Changed default layout
   3.1 Split main Gemfile into context-specific Gemfiles
       3.1.1 Added a test to verify that context specific gemfiles have
              gems locked at the same version as a global one
   3.2 Divided application into three parts
       - Domain logic
       - Representations
       - Oters
   3.3 Changed `application.paths` to match changed application layout
   3.4 Changed ApplicationRecord and ApplicationController to be
       concerns
       3.4.1 Configured Draper to work without ApplicationController
   3.5 Moved `database.yml` to domain logic folder
   3.6 Moved `routes.rb` to representations folder
   3.7 Added ability to run context tests in isolation
   3.8 Moved Factories definitions to domain logic folder
  • Loading branch information
Bohdan Pohorilets committed Oct 26, 2018
1 parent 5e0b505 commit 51220e7
Show file tree
Hide file tree
Showing 101 changed files with 1,897 additions and 241 deletions.
17 changes: 13 additions & 4 deletions samples/domain_driven_rails_architecture_pattern/.gitignore
Expand Up @@ -7,10 +7,6 @@
# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
Expand All @@ -29,3 +25,16 @@

# Ignore master key for decrypting credentials and more.
/config/master.key

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

# SimpleCov
/coverage/*

# RSpec
spec/examples.txt
representations/spec/examples.txt
domain/spec/examples.txt
1 change: 1 addition & 0 deletions samples/domain_driven_rails_architecture_pattern/.rspec
@@ -0,0 +1 @@
--require spec_helper
89 changes: 89 additions & 0 deletions samples/domain_driven_rails_architecture_pattern/.rubocop.yml
@@ -0,0 +1,89 @@
inherit_from: .rubocop_todo.yml

Metrics/LineLength:
Max: 120

AllCops:
Exclude:
- 'vendor/**/*'
- 'spec/fixtures/**/*'
- 'tmp/**/*'
TargetRubyVersion: 2.5

Naming/PredicateName:
# Method define macros for dynamically generated method.
MethodDefinitionMacros:
- define_method
- define_singleton_method
- def_node_matcher
- def_node_search

Style/FrozenStringLiteralComment:
EnforcedStyle: always

Style/FormatStringToken:
# Because we parse a lot of source codes from strings. Percent arrays
# look like unannotated format string tokens to this cop.
Exclude:
- spec/**/*

Layout/EndOfLine:
EnforcedStyle: lf

Layout/ClassStructure:
Enabled: true
Categories:
module_inclusion:
- include
- prepend
- extend
ExpectedOrder:
- module_inclusion
- constants
- public_class_methods
- initializer
- instance_methods
- protected_methods
- private_methods

Layout/IndentHeredoc:
EnforcedStyle: powerpack

# Trailing white space is meaningful in code examples
Layout/TrailingWhitespace:
AllowInHeredoc: true

Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/**/*.rb'

Lint/InterpolationCheck:
Exclude:
- 'spec/**/*.rb'

Lint/UselessAccessModifier:
MethodCreatingMethods:
- 'def_matcher'
- 'def_node_matcher'

Metrics/BlockLength:
Exclude:
- 'Rakefile'
- '**/*.rake'
- 'spec/**/*.rb'

Metrics/ModuleLength:
Exclude:
- 'spec/**/*.rb'

Layout/SpaceInsideParens:
Enabled: false

Layout/SpaceInsideReferenceBrackets:
Enabled: false

Layout/SpaceInsideStringInterpolation:
Enabled: false

Layout/SpaceInsidePercentLiteralDelimiters:
Enabled: false
@@ -0,0 +1,7 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-10-12 06:49:56 +0300 using RuboCop version 0.59.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
71 changes: 40 additions & 31 deletions samples/domain_driven_rails_architecture_pattern/Gemfile
@@ -1,62 +1,71 @@
# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use postgresql as the database for Active Record
# gem 'pg', '>= 0.18', '< 2.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# gem 'sass-rails'
# 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', '~> 4.0'
# gem 'jbuilder'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
# gem 'bootsnap', require: false

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# gem 'byebug', platforms: %i[mri mingw x64_mingw]
end

group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
# gem 'web-console'
end

group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'capybara'
# gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
# gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

########################################################################
# #
# #
# Custom Gems #
# #
# #
########################################################################

%w[ representations/Gemfile domain/Gemfile ].each do |custom_gemfile|
eval_gemfile custom_gemfile
end

group :development do
gem 'brakeman'
gem 'rails_best_practices'
gem 'reek'
gem 'rubocop', require: false
gem 'rubocop-git'
end

group :development, :test do
gem 'mutant-rspec'
gem 'pry-byebug'
gem 'rspec-rails'
gem 'simplecov'
end

0 comments on commit 51220e7

Please sign in to comment.