Skip to content

Commit

Permalink
final commit v1.0-alpha3
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico committed May 21, 2020
1 parent 4c3930a commit 262a51f
Show file tree
Hide file tree
Showing 217 changed files with 1,234 additions and 5,368 deletions.
141 changes: 34 additions & 107 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,44 @@
version: 2.0

---
version: 2
jobs:
checkout_code:
build:
working_directory: ~/bbb-lti-broker
docker:
- image: circleci/ruby:2.5.1-node-browsers
working_directory: ~/repo
environment:
PGHOST: localhost
PGUSER: bbb-lti-broker
RAILS_ENV: test
DATABASE_URL: "postgresql://postgres:password@localhost"
- image: postgres:11
environment:
POSTGRES_PASSWORD: password
steps:
- checkout
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo

bundle_dependencies:
docker:
- image: circleci/ruby:2.5.1-node-browsers
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v1-bundle-{{ checksum "Gemfile.lock" }}
- run: bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
key: v1-bundle-{{ checksum "Gemfile.lock" }}
paths:
- ~/repo/vendor/bundle
# Restore Cached Dependencies
- type: cache-restore
name: Restore bundle cache
key: bbb-lti-broker-{{ checksum "Gemfile.lock" }}

rake_test:
docker:
- image: circleci/ruby:2.5.1-node-browsers
- image: circleci/postgres:9.5-alpine
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v1-bundle-{{ checksum "Gemfile.lock" }}
- run: bundle install --jobs=4 --retry=3 --path vendor/bundle
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: DB setup
environment:
DATABASE_URL: "postgres://postgres@localhost:5432/bbb_lti_broker_test"
command: bundle exec rake db:setup
- run:
name: Run tests
environment:
DATABASE_URL: "postgres://postgres@localhost:5432/bbb_lti_broker_test"
command: bundle exec rake
# Bundle install dependencies
- run: bundle install --path vendor/bundle

precompile_assets:
docker:
- image: circleci/ruby:2.5.1-node-browsers
working_directory: ~/repo
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v1-bundle-{{ checksum "Gemfile.lock" }}
- run: bundle --path vendor/bundle
- run:
name: Precompile assets
command: bundle exec rake assets:precompile
- save_cache:
key: v1-assets-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/public/assets
# Cache Dependencies
- type: cache-save
name: Store bundle cache
key: bbb-lti-broker-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle

build_image:
machine:
enabled: true
working_directory: ~/repo
environment:
- HEROKU_APP: still-shelf-38337
steps:
- restore_cache:
keys:
- v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- v1-bundle-{{ checksum "Gemfile.lock" }}
- restore_cache:
keys:
- v1-assets-{{ .Environment.CIRCLE_SHA1 }}
- checkout
- run:
name: Deploy Master to DockerHub
command: ./scripts/image_build.sh "$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" "$CIRCLE_BRANCH"
# Wait for DB
- run: dockerize -wait tcp://localhost:5432 -timeout 1m

# Setup the environment
- run: cp dotenv .env

# Setup the database
- run: bundle exec rake db:setup

workflows:
version: 2
build-and-deploy:
jobs:
- checkout_code
- bundle_dependencies:
requires:
- checkout_code
- rake_test:
requires:
- bundle_dependencies
- precompile_assets:
requires:
- bundle_dependencies
- build_image:
requires:
- rake_test
- precompile_assets
# Run the tests
- run: bundle exec rails test:db
28 changes: 28 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# git
.git
.gitignore
README.md

# Rails
.env
*.rbc
capybara-*.html
.rspec
log
tmp
/db/**/*.sqlite3
/db/**/*.sqlite3-journal
/db/production
/db/production-postgres
public/assets
public/b
coverage/
.rvmrc
vendor/bundle
.bundle
Dockerfile
.gitlab-ci.yml
.rubocop.yml
.travis.yml
spec
test
61 changes: 61 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
inherit_mode:
merge:
- Exclude
require:
- rubocop-rails
AllCops:
Exclude:
- bin/puma
- bin/pumactl
- bin/setup
- bin/rainbows
- bin/unicorn
- bin/unicorn_rails
- bin/update
- bin/yarn
- vendor/bundle/**/*
TargetRubyVersion: 2.6
Layout/HashAlignment:
EnforcedHashRocketStyle: [ key, table ]
EnforcedColonStyle: [ key, table ]
Layout/LineLength:
Max: 128
Metrics:
Enabled: false
Naming/AccessorMethodName:
Exclude:
- app/controllers/bigbluebutton_api_controller.rb
Naming/PredicateName:
Exclude:
- app/controllers/bigbluebutton_api_controller.rb
Rails:
Enabled: true
Rails/DynamicFindBy:
# The models used in this code aren't actually ActiveRecord
Enabled: false
Style/AsciiComments:
AllowedChars: [ © ]
Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/MethodCallWithArgsParentheses:
Enabled: true
IgnoredMethods:
- desc
- gem
- include
- require
- require_relative
- ruby
- raise
- source
- throw
Exclude:
- "**/*.xml.builder"
Style/SymbolArray:
MinSize: 6
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
13 changes: 6 additions & 7 deletions bbb-lti-broker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM ruby:2.7.0
FROM ruby:2.7.0-alpine

USER root

RUN apt-get update && apt-get install -y \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt install -y nodejs
RUN apk update \
&& apk upgrade \
&& apk add --update --no-cache \
build-base curl-dev git postgresql-dev \
yaml-dev zlib-dev nodejs yarn

ENV APP_HOME /usr/src/app
RUN mkdir -p $APP_HOME
Expand Down
16 changes: 13 additions & 3 deletions Gemfile
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

git_source(:github) do |repo_name|
Expand All @@ -19,7 +21,13 @@ gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 5.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'http'

gem 'faraday'
gem 'oauthenticator'
gem 'addressable', '~> 2.7'

gem 'bundler', '>=2.1.2'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
Expand All @@ -33,10 +41,10 @@ gem 'jbuilder', '~> 2.5'

gem 'ims-lti' # , path: '../ims-lti'
gem 'jwt'
gem 'oauth'
gem 'oauth', '~> 0.5.1'

# gem 'doorkeeper', '~> 4.2', '>= 4.2.6'
gem 'doorkeeper', '~> 5.2.2'
gem 'doorkeeper', '~> 5.2.5'

gem 'lodash-rails'
gem 'react-rails'
Expand All @@ -54,6 +62,8 @@ group :development, :test do
end

group :development do
gem 'rubocop', '~> 0.79.0', require: false
gem 'rubocop-rails', '~> 2.4.0', require: false
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'listen', '~> 3.0.5'
gem 'web-console', '>= 3.3.0'
Expand All @@ -63,4 +73,4 @@ group :development do
end

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

0 comments on commit 262a51f

Please sign in to comment.