Skip to content

Commit

Permalink
Adds rubocop (#2)
Browse files Browse the repository at this point in the history
Adds rubocop
  • Loading branch information
Thiru Njuguna committed Oct 27, 2018
1 parent 81fe6f9 commit 58762cd
Show file tree
Hide file tree
Showing 14 changed files with 319 additions and 68 deletions.
66 changes: 66 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
AllCops:
TargetRubyVersion: 2.5
Exclude:
- lib/swaggering.rb
- api/**
- Guardfile
- my_app.rb
- spec/spec_helper.rb
- tmp/**
- db/schema.rb

Documentation:
# don't require classes to be documented
Enabled: false

Style/FrozenStringLiteralComment:
# don't require frozen literal comment
Enabled: false

Encoding:
# no need to always specify encoding
Enabled: false

AlignParameters:
# allow for multi-line methods to have normal indentation.
# for example:
#
# Person.where(
# first_name: 'tom',
# last_name: 'foolery'
# )
EnforcedStyle: with_fixed_indentation

Layout/AlignParameters:
# allow for end of if to be aligned with a variable.
# for example:
#
# foo = if a == b
# 'bar'
# else
# 'baz'
# end
EnforcedStyle: with_fixed_indentation

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Lint/EndAlignment:
EnforcedStyleAlignWith: variable

ClassAndModuleChildren:
# ok to use compact style when modules are predefined.
# for example the following is fine so long as we're sure that
# module MDB has already been required/defined.
#
# class MDB::Person; end
Enabled: false

Style/PercentLiteralDelimiters:
PreferredDelimiters:
default: ()
"%i": ()
"%w": ()

Style/FormatString:
Enabled: false
22 changes: 5 additions & 17 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
# base layer
FROM ruby:2.5.1 AS base

WORKDIR /usr/src/app
WORKDIR /easy_rental

RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs && apt-get install yarn -qq

RUN gem install bundler

COPY Gemfile /usr/src/app/Gemfile
COPY Gemfile /easy_rental/Gemfile

COPY Gemfile.lock /usr/src/app/Gemfile.lock
COPY Gemfile.lock /easy_rental/Gemfile.lock

# development and test layer with all dependencies
FROM base AS development
RUN bundle install

RUN bundle install -j5 --without staging production

COPY . /usr/src/app

# release layer
FROM base AS release

RUN bundle install -j5 --without development test

COPY . /usr/src/app

CMD puma
COPY . /easy_rental
7 changes: 4 additions & 3 deletions Gemfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ gem 'jquery-rails'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
gem "rolify"
gem "rubocop"
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'paginate'
Expand All @@ -41,18 +42,18 @@ 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 'rspec-rails'
gem 'guard-rspec', require: false
end

gem 'listen', '>= 3.0.5', '< 3.2'
group :development do
gem 'guard-rubocop'
# 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'
end


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

Expand Down
59 changes: 59 additions & 0 deletions Gemfile.lock
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.2.0)
execjs
bcrypt (3.1.12)
Expand All @@ -60,6 +61,7 @@ GEM
sass (>= 3.5.2)
builder (3.2.3)
byebug (10.0.2)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
Expand Down Expand Up @@ -92,12 +94,32 @@ GEM
ffi (1.9.25-java)
ffi (1.9.25-x64-mingw32)
ffi (1.9.25-x86-mingw32)
formatador (0.2.5)
globalid (0.4.1)
activesupport (>= 4.2.0)
guard (2.14.2)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
guard-rubocop (1.3.0)
guard (~> 2.0)
rubocop (~> 0.20)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.1.1)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.1)
jaro_winkler (1.5.1-java)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand All @@ -114,6 +136,7 @@ GEM
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.13)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
Expand All @@ -131,6 +154,7 @@ GEM
msgpack (1.2.4-x64-mingw32)
msgpack (1.2.4-x86-mingw32)
multi_json (1.13.1)
nenv (0.3.0)
netrc (0.11.0)
nio4r (2.3.1)
nio4r (2.3.1-java)
Expand All @@ -141,12 +165,26 @@ GEM
mini_portile2 (~> 2.3.0)
nokogiri (1.8.5-x86-mingw32)
mini_portile2 (~> 2.3.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
orm_adapter (0.5.0)
paginate (4.0.1)
parallel (1.12.1)
parser (2.5.1.2)
ast (~> 2.4.0)
pg (1.1.3)
pg (1.1.3-x64-mingw32)
pg (1.1.3-x86-mingw32)
popper_js (1.14.3)
powerpack (0.1.2)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry (0.11.3-java)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
spoon (~> 0.0)
puma (3.12.0)
puma (3.12.0-java)
rack (2.0.5)
Expand Down Expand Up @@ -176,6 +214,7 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
Expand Down Expand Up @@ -203,6 +242,10 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rolify (5.2.0)
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)
Expand All @@ -220,6 +263,15 @@ GEM
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.60.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.4.0)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
sass (3.6.0)
sass-listen (~> 4.0.0)
Expand All @@ -232,11 +284,14 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
shellany (0.0.1)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
spoon (0.0.6)
ffi
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
Expand Down Expand Up @@ -271,6 +326,7 @@ GEM
unf_ext (0.0.7.5)
unf_ext (0.0.7.5-x64-mingw32)
unf_ext (0.0.7.5-x86-mingw32)
unicode-display_width (1.4.0)
warden (1.2.7)
rack (>= 1.0)
web-console (3.7.0)
Expand Down Expand Up @@ -298,6 +354,8 @@ DEPENDENCIES
coffee-rails (~> 4.2)
coveralls
devise
guard-rspec
guard-rubocop
jbuilder (~> 2.5)
jquery-rails
listen (>= 3.0.5, < 3.2)
Expand All @@ -307,6 +365,7 @@ DEPENDENCIES
rails (~> 5.2.1)
rolify
rspec-rails
rubocop
sass-rails (~> 5.0)
spring
spring-watcher-listen (~> 2.0.0)
Expand Down
20 changes: 20 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
guard :rspec, cmd: 'rspec', all_after_pass: true, all_on_start: true do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)

# RSpec files
rspec = dsl.rspec
watch(rspec.spec_helper) { rspec.spec_dir }
watch(rspec.spec_support) { rspec.spec_dir }
watch(rspec.spec_files)
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }

# Ruby files
ruby = dsl.ruby
dsl.watch_spec_files_for(ruby.lib_files)
end

guard :rubocop, cli: ['--display-cop-names'] do
watch(/.+\.rb$/)
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified Rakefile
100644 → 100755
Empty file.
7 changes: 7 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ chdir APP_ROOT do
# Install JavaScript dependencies if using Yarn
system('bin/yarn')

puts "\n== Remove tmp file =="
system('chmod 777 tmp/*')
system('chmod 777 tmp/db/*')

puts "\n== Copying sample files =="
unless File.exist?('config/database.yml')
cp 'config/database.yml.sample', 'config/database.yml'
end

puts "\n== Create database =="
system! 'bin/rails db:create'

puts "\n== Preparing database =="
system! 'bin/rails db:setup'

Expand Down
Empty file modified config.ru
100644 → 100755
Empty file.
Loading

0 comments on commit 58762cd

Please sign in to comment.