stack up & tweaked

This commit is contained in:
Mark Moser 2016-07-26 13:50:35 -05:00
parent ef47334853
commit 0fc8ec99b3
10 changed files with 132 additions and 60 deletions

49
.rubocop.yml Normal file
View File

@ -0,0 +1,49 @@
AllCops:
Exclude:
- db/schema.rb
- db/seeds.rb
- bin/**/*
Style/ClassAndModuleChildren:
Exclude:
- test/test_helper.rb
Style/Documentation:
Enabled: false
Style/EmptyLines:
Exclude:
- config/initializers/sorcery.rb
Style/ExtraSpacing:
Exclude:
- db/migrate/**/*
Style/IndentationConsistency:
EnforcedStyle: rails
Style/MethodDefParentheses:
Enabled: false
Style/SpaceBeforeFirstArg:
Exclude:
- config/routes.rb
Style/StringLiterals:
Enabled: false
Metrics/AbcSize:
Exclude:
- db/migrate/**/*
Metrics/LineLength:
Max: 110
Exclude:
- Rakefile
- config/**/*
- lib/tasks/**/*
- test/test_helper.rb
Metrics/MethodLength:
Exclude:
- db/migrate/*

11
.scss-lint.yml Normal file
View File

@ -0,0 +1,11 @@
scss_files: 'app/assets/stylesheets/**/*.scss'
linters:
StringQuotes:
enabled: false
LeadingZero:
style: 'include_zero'
SelectorFormat:
ignored_names:
QualifyingElement:
allow_element_with_attribute: true

View File

@ -10,6 +10,7 @@ ENV BUILD_PACKAGES="build-essential libmysqlclient-dev openssl graphviz nodejs c
RUN apt-get update \ RUN apt-get update \
&& apt-get install --fix-missing -y $BUILD_PACKAGES \ && apt-get install --fix-missing -y $BUILD_PACKAGES \
&& /usr/sbin/mysqld --initialize --user=mysql \ && /usr/sbin/mysqld --initialize --user=mysql \
&& service mysql start \
&& echo 'gem: --no-document' >> ~/.gemrc \ && echo 'gem: --no-document' >> ~/.gemrc \
&& cp ~/.gemrc /etc/gemrc \ && cp ~/.gemrc /etc/gemrc \
&& chmod uog+r /etc/gemrc \ && chmod uog+r /etc/gemrc \
@ -33,7 +34,7 @@ RUN cd /root \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 3000 3306 EXPOSE 3000 3306 35729
WORKDIR /usr/app WORKDIR /usr/app
CMD ["mysqld"] CMD ["mysqld"]

19
Gemfile
View File

@ -5,15 +5,21 @@ gem 'bcrypt', '~> 3.1.7'
gem 'mysql2', '>= 0.3.18', '< 0.5' gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'rails', '~> 5.0.0' gem 'rails', '~> 5.0.0'
gem 'autoprefixer-rails' # gem 'autoprefixer-rails'
gem 'jbuilder', '~> 2.5' gem 'jbuilder', '~> 2.6'
gem 'jquery-rails' gem 'jquery-rails'
gem 'json', '~> 2.0.1' gem 'json', '~> 2.0.2'
gem 'puma', '~> 3.0' gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'
gem 'turbolinks', '~> 5' gem 'turbolinks', '~> 5'
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
group :development do
gem 'rack-livereload'
gem 'rails-erd'
gem 'web-console'
end
group :development, :test do group :development, :test do
gem 'awesome_print' gem 'awesome_print'
gem 'binding_of_caller' gem 'binding_of_caller'
@ -23,16 +29,13 @@ group :development, :test do
gem 'guard-minitest' gem 'guard-minitest'
gem 'guard-rubocop' gem 'guard-rubocop'
gem 'guard-shell' gem 'guard-shell'
gem 'listen', '~> 3.0.5' gem 'listen', '~> 3.0'
gem 'minitest-reporters' gem 'minitest-reporters'
gem 'pry-byebug' gem 'pry-byebug'
gem 'pry-rails' gem 'pry-rails'
gem 'rack-livereload' gem 'rubocop', '~> 0.42.0'
gem 'rails-erd'
gem 'rubocop'
gem 'spring' gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0' gem 'spring-watcher-listen', '~> 2.0.0'
gem 'web-console'
end end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem # Windows does not include zoneinfo files, so bundle the tzinfo-data gem

View File

@ -39,10 +39,8 @@ GEM
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
ansi (1.5.0) ansi (1.5.0)
arel (7.0.0) arel (7.1.0)
ast (2.3.0) ast (2.3.0)
autoprefixer-rails (6.3.7)
execjs
awesome_print (1.7.0) awesome_print (1.7.0)
bcrypt (3.1.11) bcrypt (3.1.11)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
@ -91,17 +89,18 @@ GEM
guard-compat (~> 1.0) guard-compat (~> 1.0)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
i18n (0.7.0) i18n (0.7.0)
jbuilder (2.5.0) jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1) activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-rails (4.1.1) jquery-rails (4.1.1)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
json (2.0.1) json (2.0.2)
listen (3.0.8) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.0.3) loofah (2.0.3)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
lumberjack (1.0.10) lumberjack (1.0.10)
@ -141,7 +140,7 @@ GEM
pry (~> 0.10) pry (~> 0.10)
pry-rails (0.3.4) pry-rails (0.3.4)
pry (>= 0.9.10) pry (>= 0.9.10)
puma (3.4.0) puma (3.6.0)
rack (2.0.1) rack (2.0.1)
rack-livereload (0.3.16) rack-livereload (0.3.16)
rack rack
@ -180,7 +179,7 @@ GEM
rb-fsevent (0.9.7) rb-fsevent (0.9.7)
rb-inotify (0.9.7) rb-inotify (0.9.7)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rubocop (0.41.2) rubocop (0.42.0)
parser (>= 2.3.1.1, < 3.0) parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
@ -188,8 +187,9 @@ GEM
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
ruby-graphviz (1.2.2) ruby-graphviz (1.2.2)
ruby-progressbar (1.8.1) ruby-progressbar (1.8.1)
ruby_dep (1.3.1)
sass (3.4.22) sass (3.4.22)
sass-rails (5.0.5) sass-rails (5.0.6)
railties (>= 4.0.0, < 6) railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
@ -201,7 +201,7 @@ GEM
spring-watcher-listen (2.0.0) spring-watcher-listen (2.0.0)
listen (>= 2.7, < 4.0) listen (>= 2.7, < 4.0)
spring (~> 1.2) spring (~> 1.2)
sprockets (3.6.3) sprockets (3.7.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.1.1) sprockets-rails (3.1.1)
@ -232,7 +232,6 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
autoprefixer-rails
awesome_print awesome_print
bcrypt (~> 3.1.7) bcrypt (~> 3.1.7)
binding_of_caller binding_of_caller
@ -243,10 +242,10 @@ DEPENDENCIES
guard-minitest guard-minitest
guard-rubocop guard-rubocop
guard-shell guard-shell
jbuilder (~> 2.5) jbuilder (~> 2.6)
jquery-rails jquery-rails
json (~> 2.0.1) json (~> 2.0.2)
listen (~> 3.0.5) listen (~> 3.0)
minitest-reporters minitest-reporters
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
pry-byebug pry-byebug
@ -255,7 +254,7 @@ DEPENDENCIES
rack-livereload rack-livereload
rails (~> 5.0.0) rails (~> 5.0.0)
rails-erd rails-erd
rubocop rubocop (~> 0.42.0)
sass-rails (~> 5.0) sass-rails (~> 5.0)
spring spring
spring-watcher-listen (~> 2.0.0) spring-watcher-listen (~> 2.0.0)

View File

@ -1,24 +1,26 @@
# README # Skill Assessment Quiz
This README would normally document whatever steps are necessary to get the This application manages quizzes intended to be used as pre-interview skill assessments.
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies # dev
* you can dev native, or in docker
* use guard
* honor RuboCop
* keep tests green
* pull --rebase !always `git config --global pull.rebase true`
* Configuration # Docker
* Database creation * ./start-docker.sh
- will build source image, it not exist
- created contaier and starts
* ./start-dev.sh
- after connected to container, run this to spin up a dev session
- edit files from host in favorite editor
* ./start-server.sh
- starts up simple server for viewing/demo sans guard
* Database initialization visit http://localhost:3000
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...

View File

@ -1,3 +1,4 @@
if [ -d '/usr/app' ]; then
cd /usr/app cd /usr/app
bundle bundle
@ -7,6 +8,9 @@ rails db:migrate
rails db:fixtures:load rails db:fixtures:load
tmux new-session -d -s 'rails-dev' 'rails s -b 0.0.0.0' tmux new-session -d -s 'rails-dev' 'rails s -b 0.0.0.0'
tmux split-window -p 80 -v guard tmux split-window -p 85 -v 'bundle exec guard'
tmux split-window -p 25 -v tmux split-window -p 20 -v
tmux attach -t rails-dev tmux attach -t rails-dev
else
echo "Are you in docker container?"
fi

View File

@ -10,7 +10,7 @@ fi
STATUS=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null) STATUS=$(docker inspect --format="{{ .State.Running }}" $CONTAINER 2> /dev/null)
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
docker run --name $CONTAINER -it -p 3000:3000 -p 3306:3306 -v ${PWD}:/usr/app $IMAGE /bin/bash docker run --name $CONTAINER -it -p 3000:3000 -p 35729:35729 -p 3306:3306 -v ${PWD}:/usr/app $IMAGE /bin/bash
exit exit
fi fi

View File

@ -1,3 +1,4 @@
if [ -d '/usr/app' ]; then
cd /usr/app cd /usr/app
bundle bundle
@ -7,4 +8,6 @@ rails db:migrate
rails db:fixtures:load rails db:fixtures:load
rails s -b 0.0.0.0 rails s -b 0.0.0.0
else
echo "Are you in docker container?"
fi