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

Update asset structure with webpacker gem #1962

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 20 additions & 8 deletions .gitignore
@@ -1,4 +1,3 @@

# Ignore rbenv files
.ruby-version

Expand All @@ -25,7 +24,6 @@ public/videos/*

# Ignore branded content
app/views/branded/*
app/assets
config/locales/static_pages/*.yml


Expand Down Expand Up @@ -55,7 +53,7 @@ config/branding.yml

# Ignore some of the initializers
config/initializers/recaptcha.rb
config/initializers/devise.rb
# config/initializers/devise.rb
config/initializers/wicked_pdf.rb
config/initializers/fingerprint.rb

Expand Down Expand Up @@ -84,14 +82,28 @@ config/locale/*/app.edit.po
config/locale/*/app.po.time_stamp

# Front-end related
lib/assets/node_modules
lib/assets/npm-debug.log
lib/assets/.eslintcache
!.keep
.byebug_history
lib/data_cleanup/rules/org/fix_blank_abbreviation.yml
.rspec
node_modules

yarn-error.log
yarn-debug.log*

.yarn-integrity
.env
public/packs
package-lock.json
node_modules
/public/packs
/public/packs-test

spec/examples.txt
.babelrc
.eslintignore
.eslintrc.json
.postcssrc.yml
/public/packs
/public/packs-test
/node_modules
yarn-debug.log*
.yarn-integrity
20 changes: 18 additions & 2 deletions .travis.yml
Expand Up @@ -18,7 +18,6 @@ addons:
chrome: stable
apt:
packages:
- nodejs
- wkhtmltopdf

# artifacts:
Expand All @@ -42,12 +41,25 @@ env:
- DB_ADAPTER=postgresql
- DB_ADAPTER=mysql2

before_install:
- nvm install 10.10.0

install:
- bundle install --with development,ci --path=${BUNDLE_PATH:-vendor/bundle}
- yarn install --ignore-optional

# This is a temporary bug fix for Karma tests
# See here: https://github.com/travis-ci/travis-ci/issues/9024
before_script:
- "sudo chown root /opt/google/chrome/chrome-sandbox"
- "sudo chmod 4755 /opt/google/chrome/chrome-sandbox"

# Main test script
script:
- export WICKED_PDF_PATH=./vendor/bundle/ruby/2.4.0/bin/wkhtmltopdf
# Copy over config files needed for setup, and create DB
- bin/setup
# Precompile the assets
- bundle exec rake webpacker:compile
- bundle exec rake assets:precompile
# Default test stage: Run all specs, listing the 10 slowest.
- bundle exec rspec spec --profile=10
Expand All @@ -70,6 +82,10 @@ jobs:
name: "Bundle audit"
script: bundle exec bundle-audit check --update

- stage: test
name: "Karma JS tests"
script: yarn run eslint --ext .js --ext .jsx app/assets/javascripts/**/*.js

- stage: hygiene
name: "Check seeds are valid"
script: bin/setup && bundle exec rake db:seed
52 changes: 46 additions & 6 deletions Gemfile
Expand Up @@ -5,9 +5,14 @@ ruby '>= 2.4.0'
# ------------------------------------------------
# RAILS
# Full-stack web application framework. (http://www.rubyonrails.org)
# Full-stack web application framework. (http://rubyonrails.org)
gem 'rails', '~> 4.2.10'

# Rake is a Make-like program implemented in Ruby (https://github.com/ruby/rake)
gem "rake"

# Tools for creating, working with, and running Rails applications. (http://www.rubyonrails.org)
# Tools for creating, working with, and running Rails applications. (http://rubyonrails.org)
gem 'railties'

# GEMS ADDED TO HELP HANDLE RAILS MIGRATION FROM 3.x to 4.2
Expand All @@ -26,12 +31,14 @@ end

group :mysql do
# A simple, fast Mysql library for Ruby, binding to libmysql (http://github.com/brianmario/mysql2)
# A simple, fast Mysql library for Ruby, binding to libmysql (https://github.com/brianmario/mysql2)
gem 'mysql2', '~> 0.4.10'
end

group :pgsql do
# Pg is the Ruby interface to the {PostgreSQL
# RDBMS}[http://www.postgresql.org/](https://bitbucket.org/ged/ruby-pg)
# Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/] (https://bitbucket.org/ged/ruby-pg)
gem 'pg', '~> 0.19.0'
end

Expand Down Expand Up @@ -76,6 +83,7 @@ gem 'ruby_dig' # for omniauth-orcid

# Gems for repository integration
# OO authorization for Rails (https://github.com/elabs/pundit)
# OO authorization for Rails (https://github.com/varvet/pundit)
gem 'pundit'

# ------------------------------------------------
Expand All @@ -96,11 +104,37 @@ gem 'recaptcha'
# Ideal gem for handling attachments in Rails, Sinatra and Rack applications. (http://github.com/markevans/dragonfly)
gem 'dragonfly'

# bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications. (https://github.com/twbs/bootstrap-sass)
gem 'bootstrap-sass', '~> 3.3.7'

# This is required for Font-Awesome, but not used as the main sass compiler

# Sass adapter for the Rails asset pipeline. (https://github.com/rails/sass-rails)
gem "sass-rails", require: false

# Integrate SassC-Ruby into Rails. (https://github.com/sass/sassc-rails)
gem "sassc-rails"

# Font-Awesome SASS (https://github.com/FortAwesome/font-awesome-sass)
gem 'font-awesome-sass', '~> 4.2.0'

# Use webpack to manage app-like JavaScript modules in Rails (https://github.com/rails/webpacker)
gem 'webpacker', '~> 3.5'

# Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website. (https://github.com/ai/autoprefixer-rails)
gem "autoprefixer-rails"

# Minimal embedded v8 for Ruby (https://github.com/discourse/mini_racer)
gem 'mini_racer'

# ------------------------------------------------
# EXPORTING
# Provides binaries for WKHTMLTOPDF project in an easily accessible package.
gem 'wkhtmltopdf-binary'

# Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications (http://puma.io)
gem 'puma'

# PDF generator (from HTML) gem for Ruby on Rails (https://github.com/mileszs/wicked_pdf)
gem 'wicked_pdf'

Expand All @@ -126,8 +160,15 @@ gem 'gettext', require: false, group: :development
# A pagination engine plugin for Rails 4+ and other modern frameworks (https://github.com/kaminari/kaminari)
gem 'kaminari'

# Following best practices from http://12factor.net run a maintainable, clean, and scalable app on Rails (https://github.com/heroku/rails_12factor)
gem "rails_12factor", group: [:production]

# Autoload dotenv in Rails. (https://github.com/bkeepers/dotenv)
gem "dotenv-rails"

gem 'activerecord-session_store'


# ------------------------------------------------
# ENVIRONMENT SPECIFIC DEPENDENCIES
group :development, :test do
Expand All @@ -138,10 +179,7 @@ group :development, :test do
gem "rspec-rails"

# factory_bot_rails provides integration between factory_bot and rails 3 or newer (http://github.com/thoughtbot/factory_bot_rails)
# rspec-collection_matchers-1.1.3 (https://github.com/rspec/rspec-collection_matchers)
gem "rspec-collection_matchers"

# factory_bot_rails provides integration between factory_bot and rails 3 or newer (http://github.com/thoughtbot/factory_bot_rails)
# factory_bot_rails provides integration between factory_bot and rails 3 or newer (https://github.com/thoughtbot/factory_bot_rails)
gem "factory_bot_rails"

# Easily generate fake data (https://github.com/stympy/faker)
Expand All @@ -156,8 +194,6 @@ group :development, :test do
# Guard gem for RSpec (https://github.com/guard/guard-rspec)
gem "guard-rspec"

gem "dotenv-rails"

end

group :test do
Expand Down Expand Up @@ -193,6 +229,9 @@ group :test do

# Easy installation and use of chromedriver. (https://github.com/flavorjones/chromedriver-helper)
gem "chromedriver-helper", ">= 1.2.0"

gem "rspec-collection_matchers"

end

group :ci, :development do
Expand All @@ -216,6 +255,7 @@ group :development do
gem "text", require: false

# Better error page for Rails and other Rack apps (https://github.com/charliesome/better_errors)
# Better error page for Rails and other Rack apps (https://github.com/BetterErrors/better_errors)
gem "better_errors"

# Retrieve the binding of a method's caller. Can also retrieve bindings even further up the stack. (http://github.com/banister/binding_of_caller)
Expand Down