diff --git a/.docker/base/Dockerfile.base b/.docker/base/Dockerfile.base new file mode 100644 index 000000000..709809aed --- /dev/null +++ b/.docker/base/Dockerfile.base @@ -0,0 +1,106 @@ +FROM debian:stretch + +RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list +RUN echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + bzip2 \ + ca-certificates \ + libffi-dev \ + libgdbm3 \ + libssl1.0-dev \ + libyaml-dev \ + procps \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* + +# skip installing gem documentation +RUN mkdir -p /usr/local/etc \ + && { \ + echo 'install: --no-document'; \ + echo 'update: --no-document'; \ + } >> /usr/local/etc/gemrc + +ENV RUBY_MAJOR 2.1 +ENV RUBY_VERSION 2.1.10 +ENV RUBY_DOWNLOAD_SHA256 5be9f8d5d29d252cd7f969ab7550e31bbb001feb4a83532301c0dd3b5006e148 +ENV RUBYGEMS_VERSION 2.6.12 +ENV BUNDLER_VERSION 1.15.1 + +# some of ruby's build scripts are written in ruby +# we purge system ruby later to make sure our final image uses what we just built +RUN set -ex \ + \ + && buildDeps=' \ + autoconf \ + bison \ + dpkg-dev \ + gcc \ + libbz2-dev \ + libgdbm-dev \ + libglib2.0-dev \ + libncurses-dev \ + libreadline-dev \ + libxml2-dev \ + libxslt-dev \ + make \ + ruby \ + wget \ + xz-utils \ + ' \ + && apt-get update \ + && apt-get install -y --no-install-recommends $buildDeps \ + && rm -rf /var/lib/apt/lists/* \ + \ + && wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \ + && echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - \ + \ + && mkdir -p /usr/src/ruby \ + && tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \ + && rm ruby.tar.xz \ + \ + && cd /usr/src/ruby \ + \ +# hack in "ENABLE_PATH_CHECK" disabling to suppress: +# warning: Insecure world writable dir + && { \ + echo '#define ENABLE_PATH_CHECK 0'; \ + echo; \ + cat file.c; \ + } > file.c.new \ + && mv file.c.new file.c \ + \ + && autoconf \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && ./configure \ + --build="$gnuArch" \ + --disable-install-doc \ + --enable-shared \ + && make -j "$(nproc)" \ + && make install \ + \ + && dpkg-query --show --showformat '${package}\n' \ + | grep -P '^libreadline\d+$' \ + | xargs apt-mark manual \ + && apt-get purge -y --auto-remove $buildDeps \ + && cd / \ + && rm -r /usr/src/ruby \ + \ + && gem update --system "$RUBYGEMS_VERSION" \ + && gem install bundler --version "$BUNDLER_VERSION" --force \ + && rm -r /root/.gem/ + +# install things globally, for great justice +# and don't create ".bundle" in all our apps +ENV GEM_HOME /usr/local/bundle +ENV BUNDLE_PATH="$GEM_HOME" \ + BUNDLE_SILENCE_ROOT_WARNING=1 \ + BUNDLE_APP_CONFIG="$GEM_HOME" +# path recommendation: https://github.com/bundler/bundler/pull/6469#issuecomment-383235438 +ENV PATH $GEM_HOME/bin:$BUNDLE_PATH/gems/bin:$PATH +# adjust permissions of a few directories for running "gem install" as an arbitrary user +RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME" +# (BUNDLE_PATH = GEM_HOME, no need to mkdir/chown both) + +CMD [ "irb" ] \ No newline at end of file diff --git a/.docker/config/database.rb b/.docker/config/database.rb new file mode 100644 index 000000000..b3895a069 --- /dev/null +++ b/.docker/config/database.rb @@ -0,0 +1,9 @@ +require File.join(File.dirname(__FILE__), "..", "lib/ojdbc7-12.1.0.2.0.jar") +Sequel::Model.plugin(:schema) +Sequel::Model.raise_on_save_failure = false # Do not throw exceptions on failure +Sequel::Model.db = case Padrino.env + when :development then Sequel.connect("B2B_URI") + when :production then Sequel.connect("B2B_URI") + when :test then Sequel.connect("B2B_URI") + when :cte then Sequel.connect("B2B_URI") +end diff --git a/.docker/config/glue_update.sh b/.docker/config/glue_update.sh new file mode 100644 index 000000000..cad0c5cf2 --- /dev/null +++ b/.docker/config/glue_update.sh @@ -0,0 +1,235 @@ +#!/bin/bash -xe +#set -e +## Global Vars + +cd /edidb + +if [ -z "$1" ] +then + DAYS=2 +else + DAYS=$1 +fi + +export START_DATE=`date --date="$DAYS days ago" +%Y%m%d000000` +export ENV_NAME +export HBX_ID +export EDIDB_DB_HOST +export EDIDB_DB_NAME +export EDIDB_DB_PASSWORD +export B2B_HOST +export B2B_SERVICE_PASSWORD +export SLACK_TOKEN +export SLACK_CHANNEL +export TO_ADDRESSES +export EMAIL_FROM_ADDRESS +export EDIDB_CURL_URL +export RABBITMQ_CURL_URL +export RABBITMQ_USER +export RABBITMQ_PASSWORD +export AWS_ACCESS_KEY_ID +export AWS_SECRET_ACCESS_KEY +export REPORT_ZIP_PASSWORD + +## notification function +function send_sms_notification +{ +cat << EOH > sms_notification.rb +#!/usr/bin/env ruby + +require 'active_resource' +require 'json' +require 'aws-sdk' + +ses = Aws::SES::Client.new( + region: 'us-east-1', + access_key_id: ENV['AWS_ACCESS_KEY_ID'], + secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'] +) + +date = Time.now.inspect +email_subject = "GlueDB Update $1 \n\n" +email_body = "\n$1 at: \n#{date}\n\n$2" + + +resp = ses.send_email({ + source: ENV['EMAIL_FROM_ADDRESS'], + destination: { + to_addresses: ENV.fetch('TO_ADDRESSES').split(',') + }, + message: { + subject: { + data: email_subject + }, + body: { + text: { + data: email_body + } + }, + }, + reply_to_addresses: ENV.fetch('EMAIL_FROM_ADDRESS').split(','), +}) + +EOH + +ruby ./sms_notification.rb + +} + +## slack message to note the beginning of the glue update +curl -X POST -H "Content-type: application/json; charset=utf-8" -H "Authorization: Bearer ${SLACK_TOKEN}" --data '{"channel": "#SLACK_CHANNEL", "username": "EDI Database Bot", "text": "'\`' ### GlueDB Update Started ### '\`'", "icon_emoji": ":gear:"}' https://slack.com/api/chat.postMessage + +cat > script.sh <<'EOL' +#!/bin/bash -xe + +##App Server Vars +export PARSER_DIRECTORY='/edidb/ediparser' +export GLUEDB_DIRECTORY='/edidb' +export UPDATER_DIRECTORY='/edidb/hbx_oracle' +export START_DATE + +##cleanup files +rm -f ${GLUEDB_DIRECTORY}/todays_data.zip +rm -f ${GLUEDB_DIRECTORY}/db/data/all_json.csv +rm -f ${PARSER_DIRECTORY}/*.csv +rm -f ${UPDATER_DIRECTORY}/*.csv + +cat << EOH > /edidb/gateway_transmissions.sh +unset BUNDLE_APP_CONFIG +unset BUNDLE_BIN +unset BUNDLE_PATH +unset BUNDLER_VERSION +unset GEM_HOME +unset RUBYGEMS_VERSION +PATH=/edidb/jruby-1.7.27/bin:$PATH +GEM_PATH=/edidb/jruby-1.7.27/lib/ruby/gems/shared +cd ${UPDATER_DIRECTORY} +padrino r scripts/gateway_transmissions.rb --start $START_DATE +EOH + +chmod 744 /edidb/gateway_transmissions.sh + +set +e +batch_handler=$( kubectl get pods | grep edidb-glue-batch | grep Running ) +set -e +if [ -z "$batch_handler" ]; then + kubectl patch cronjobs edidb-glue-batch -p "{\"spec\" : {\"suspend\" : true }}" + curl -X POST -H "Content-type: application/json; charset=utf-8" -H "Authorization: Bearer ${SLACK_TOKEN}" --data '{"channel": "#'$SLACK_CHANNEL'", "username": "EDI Database Bot", "text": "'\`' ### GlueDB Update Started ### '\`'", "icon_emoji": ":gear:"}' https://slack.com/api/chat.postMessage +else + exit 5 +fi + + +## bring down the listeners +echo "bringing down listeners: "$(date) +kubectl scale --replicas=0 deployment/edidb-enrollment-validator deployment/edidb-broker-updated-listener \ + deployment/edidb-policy-id-list-listener deployment/edidb-enrollment-event-listener \ + deployment/edidb-enrollment-event-handler + #deployment/edidb-enrollment-event-batch-processor +sleep 60 +kubectl scale --replicas=0 deployment/edidb-enroll-query-result-handler +sleep 120 +kubectl scale --replicas=0 deployment/edidb-employer-workers +sleep 120 +kubectl scale --replicas=0 deployment/edidb-legacy-listeners +sleep 180 + +echo "copying prod databaase: "$(date) +mongo --host $EDIDB_DB_HOST --authenticationDatabase 'admin' -u 'admin' -p $EDIDB_DB_PASSWORD < ~/scripts/prepare_dev.js + +sleep 10 + +/edidb/gateway_transmissions.sh +cp ${UPDATER_DIRECTORY}/b2b_edi.csv ${PARSER_DIRECTORY} +cat ${PARSER_DIRECTORY}/b2b_edi.csv | ${PARSER_DIRECTORY}/dist/build/InterchangeTest/InterchangeTest > ${PARSER_DIRECTORY}/all_json.csv +mkdir -p ${GLUEDB_DIRECTORY}/db/data +cp ${PARSER_DIRECTORY}/all_json.csv ${GLUEDB_DIRECTORY}/db/data/ + +cd ${GLUEDB_DIRECTORY} +#echo -e '\ngem "rubycritic"' >> Gemfile +#bundle install +RAILS_ENV=development bundle exec rake edi:import:all +RAILS_ENV=development rails r script/queries/set_authority_members.rb +#head -n -1 Gemfile > Gemfile.tmp +#mv Gemfile.tmp Gemfile + +echo "updating prod database: "$(date) +update=`mongo --host $EDIDB_DB_HOST --authenticationDatabase 'admin' -u 'admin' -p $EDIDB_DB_PASSWORD < ~/scripts/prepare_prod.js` +echo $update +update=$(echo -n ${update#*"db ${EDIDB_DB_NAME}_dev"}) +update=$(echo -n ${update%bye*}) +update=$(echo -n ${update#*clone}) +update_status=`echo $update | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["'ok'"]'` + +sleep 60 + +if [ "$update_status" -eq 1 ]; then + + #curl -X POST -H "Content-type: application/json; charset=utf-8" -H "Authorization: Bearer ${SLACK_TOKEN}" --data '{"channel": "#'$SLACK_CHANNEL'", "username": "EDI Database Bot", "text": "'\`' ### GlueDB Update Completed :: Running Reports Before Starting Listeners ### '\`'", "icon_emoji": ":gear:"}' https://slack.com/api/chat.postMessage + + #cp /etc/reports/glue_enrollment_report.sh /edidb/glue_enrollment_report.sh && chmod 744 /edidb/glue_enrollment_report.sh + #cp /etc/reports/glue_enrollment_report.json.template /edidb/glue_enrollment_report.json.template + #/edidb/glue_enrollment_report.sh > glue_enrollment_report.log + #tail -30 glue_enrollment_report.log + + #cp /etc/reports/policies_missing_transmissions.sh /edidb/policies_missing_transmissions.sh && chmod 744 /edidb/policies_missing_transmissions.sh + #cp /etc/reports/policies_missing_transmissions.json.template /edidb/policies_missing_transmissions.json.template + #/edidb/policies_missing_transmissions.sh > policies_missing_transmissions.log + #tail -10 policies_missing_transmissions.log + + kubectl scale --replicas=1 deployment/edidb-legacy-listeners + messages=1 + while [ $messages -gt 0 ] + do + sleep 120 + messages=$( curl --user $RABBITMQ_USER:$RABBITMQ_PASSWORD $RABBITMQ_CURL_URL/api/queues/%2F/$HBX_ID.$ENV_NAME.q.glue.individual_updated_listener | jq .messages | tail -1 ) + done + kubectl scale --replicas=1 deployment/edidb-employer-workers + sleep 120 + kubectl scale --replicas=2 deployment/edidb-enroll-query-result-handler + sleep 120 + kubectl scale --replicas=2 deployment/edidb-enrollment-validator deployment/edidb-broker-updated-listener \ + deployment/edidb-policy-id-list-listener deployment/edidb-enrollment-event-listener \ + deployment/edidb-enrollment-event-handler \ + deployment/edidb-enrollment-event-batch-processor + sleep 120 + kubectl patch cronjobs edidb-glue-batch -p "{\"spec\" : {\"suspend\" : false }}" + kubectl rollout restart deployment edidb-$ENV_NAME +else + exit 1 +fi + +EOL + +chmod +x script.sh +set +e +./script.sh +update_status=$? +set -e +sleep 120 + +curlTestCmd="curl -sLk -w "%{http_code}" -o /dev/null ${EDIDB_CURL_URL}/accounts/sign_in" +curlTest=`eval $curlTestCmd` + +if [ "$update_status" -eq 0 ] +then + if [ "$curlTest" == "200" ] + then + curl -X POST -H "Content-type: application/json; charset=utf-8" -H "Authorization: Bearer ${SLACK_TOKEN}" --data '{"channel": "#'$SLACK_CHANNEL'", "username": "EDI Database Bot", "text": "'\`' ### GlueDB Update Completed :: Listeners Are Up ### '\`'", "icon_emoji": ":gear:"}' https://slack.com/api/chat.postMessage + send_sms_notification Success + exit 0 + else + curl -X POST -H "Content-type: application/json; charset=utf-8" -H "Authorization: Bearer ${SLACK_TOKEN}" --data '{"channel": "#'$SLACK_CHANNEL'", "username": "EDI Database Bot", "text": "'\`' ### GlueDB Update Completed :: But Restart Failed ### '\`'", "icon_emoji": ":gear:"}' https://slack.com/api/chat.postMessage + send_sms_notification "Restart Failed" + exit 1 + fi +elif [ "$update_status" -eq 5 ] +then + curl -X POST -H "Content-type: application/json; charset=utf-8" -H "Authorization: Bearer ${SLACK_TOKEN}" --data '{"channel": "#'$SLACK_CHANNEL'", "username": "EDI Database Bot", "text": " '\`' ### GlueDB Update Did Not Start -- Batch Handler Is Running ### '\`'", "icon_emoji": ":gear:"}' https://slack.com/api/chat.postMessage + send_sms_notification "Did Not Start" "The batch handler is running!" + exit 1 +else + curl -X POST -H "Content-type: application/json; charset=utf-8" -H "Authorization: Bearer ${SLACK_TOKEN}" --data '{"channel": "#'$SLACK_CHANNEL'", "username": "EDI Database Bot", "text": " '\`' ### GlueDB Update Failed ### '\`'", "icon_emoji": ":gear:"}' https://slack.com/api/chat.postMessage + send_sms_notification Failed "Please check GlueDB Update job in ${ENV_NAME}" + exit 1 +fi diff --git a/.docker/config/prepare_dev.js b/.docker/config/prepare_dev.js new file mode 100644 index 000000000..f8aac20fb --- /dev/null +++ b/.docker/config/prepare_dev.js @@ -0,0 +1,8 @@ +use DB_NAME_dev; +db.dropDatabase(); +sleep(10000); +use DB_NAME_dev; +db.dropDatabase(); +sleep(10000); +use DB_NAME; +db.copyDatabase('DB_NAME', 'DB_NAME_dev'); diff --git a/.docker/config/prepare_prod.js b/.docker/config/prepare_prod.js new file mode 100644 index 000000000..c3246a470 --- /dev/null +++ b/.docker/config/prepare_prod.js @@ -0,0 +1,12 @@ +use DB_NAME; +db.dropDatabase(); +sleep(10000); +use DB_NAME; +db.dropDatabase(); +sleep(20000); +use DB_NAME; +db.dropDatabase(); +sleep(20000); +use DB_NAME_dev; +sleep(10000); +db.copyDatabase('DB_NAME_dev', 'DB_NAME'); diff --git a/.docker/config/update_variables.sh b/.docker/config/update_variables.sh new file mode 100644 index 000000000..de6fb7f80 --- /dev/null +++ b/.docker/config/update_variables.sh @@ -0,0 +1,2 @@ +sed -i "s|B2B_URI|$B2B_URI|g" /edidb/hbx_oracle/config/database.rb +sed -i "s|DB_NAME|$EDIDB_DB_NAME|g" /edidb/scripts/prepare* diff --git a/.docker/production/Dockerfile.gha b/.docker/production/Dockerfile.gha new file mode 100644 index 000000000..3ea2804f5 --- /dev/null +++ b/.docker/production/Dockerfile.gha @@ -0,0 +1,304 @@ +ARG COMMIT_SHA +ARG BRANCH=main +ARG GEM_OAUTH_TOKEN +ARG BUNDLE_GITHUB__COM=$GEM_OAUTH_TOKEN + +############################################ +### Base image ### +############################################ + +FROM ghcr.io/health-connector/gluedb:base as base +LABEL author="ideacrew" + +ENV USERNAME=gluedb + +ARG DEBIAN_FRONTEND=noninteractive +ARG BUNDLER_VERSION=1.17.3 + +# Must be set as ENV variable to overrride the default +ENV BUNDLER_VERSION=$BUNDLER_VERSION + +# Only add packages that aren't already in the base image +# https://github.com/docker-library/ruby/blob/99def14400fcd612782367830836dfcbc10c8c50/2.1/slim/Dockerfile +RUN apt-get update -qq \ + # && apt-get -yq dist-upgrade \ + && apt-get install -y \ + fontconfig \ + libffi6 \ + libxext6 \ + libxml2 \ + libxrender1 \ + libyaml-cpp0.5v5 \ + nano \ + openssl \ + p7zip-full \ + sshpass \ + unzip \ + vim \ + zip \ + zlibc \ + libjemalloc1 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && truncate -s 0 /var/log/*log + +# Configure bundler and PATH, install bundler version +ENV GEM_HOME=/usr/local/bundle +ENV BUNDLE_PATH=$GEM_HOME +ENV BUNDLE_APP_CONFIG=$BUNDLE_PATH +ENV BUNDLE_BIN=/usr/local/bin +ENV BUNDLE_JOBS=4 +ENV BUNDLE_RETRY=3 + +ENV LANG=C.UTF-8 + +ENV PATH=$HOME/bin:$BUNDLE_BIN:$GEM_HOME/gems/bin:$PATH + +RUN rm -f /usr/local/bin/ruby/gems/*/specifications/default/bundler-*.gemspec +RUN gem install bundler -v $BUNDLER_VERSION + +RUN groupadd --gid 1001 $USERNAME \ + && useradd --uid 1001 --gid $USERNAME --shell /bin/bash --create-home $USERNAME + +ENV HOME=/edidb +RUN mkdir $HOME \ + && chown -R $USERNAME:$USERNAME $HOME + +# Configure app home directory +WORKDIR $HOME + +ENV EDIDB_DEVISE_SECRET_KEY=4949641a374994854c0529feb329a81885867f044eb6c23102892e38bb32da437a94ee27eb4086b196f7273868d4b06c682948f5ced62385c548ba2d96898e20 + +# unused in Rails 3 +# ENV EDIDB_SECRET_KEY_BASE=c8d2b9b204fbac78081a88a2c29b28cfeb82e6ccd3664b3948b813463b5917b315dbbd3040e8dffcb5b68df427099db0ce03e59e2432dfe5d272923b00755b82 + +ENV RECEIVER_ID=000000001 + +ENV RAILS_ENV=production +ENV NODE_ENV=production + +############################################################################### +## Builder. Adds node and Yarn. Not necessary in production. ### +############################################################################## +FROM base as builder + +ARG DEBIAN_FRONTEND=noninteractive + +ARG NODE_MAJOR=12 +ENV NODE_MAJOR=$NODE_MAJOR + +RUN apt-get update -qq \ + && apt-get install -yq --no-install-recommends \ + build-essential \ + git \ + libxml2-dev \ + nodejs \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && truncate -s 0 /var/log/*log + +######################################################## +# Node and Bundle for production +######################################################## +FROM builder as prod_gems_and_assets + +ARG GEM_OAUTH_TOKEN +ARG BUNDLE_GITHUB__COM=$GEM_OAUTH_TOKEN + +COPY --chown=$USERNAME:$USERNAME ./Gemfile $HOME/Gemfile +COPY --chown=$USERNAME:$USERNAME ./Gemfile.lock $HOME/Gemfile.lock + +RUN gem install libxml-ruby -v '2.9.0' --source 'https://rubygems.org/' + +ENV BUNDLE_WITHOUT=development:test +RUN bundle install + +COPY --chown=$USERNAME:$USERNAME . $HOME + +ARG HOSTNAME=localhost + +# Needed to run client swap script +ENV EDIDB_DB_HOST=${HOSTNAME} +ENV EDIDB_DB_PORT=27017 +ENV EDIDB_DB_NAME=edidb_prod +ENV RABBITMQ_URL=amqp://${HOSTNAME}:5672 + +COPY --chown=$USERNAME:$USERNAME ./config/exchange_prod.yml $HOME/config/exchange.yml + +RUN bundle exec rake assets:precompile + +# https://github.com/rubygems/rubygems/issues/3225 +RUN rm -rf $GEM_HOME/bundle/ruby/*/cache + +################################################################ +# Deployable image +################################################################ + +FROM base as deploy + +ARG HOSTNAME=localhost + +# Needed to run client swap script +ENV EDIDB_DB_AUTH=true +ENV EDIDB_DB_HOST=${HOSTNAME} +ENV EDIDB_DB_NAME=edidb_prod +ENV EDIDB_DB_PASSWORD=anything +ENV EDIDB_DB_PORT=27017 +ENV EDIDB_DB_REPLICA_SET_NAME=anything +ENV EDIDB_DB_USERNAME=anything +ENV RABBITMQ_URL=amqp://${HOSTNAME}:5672 + +# Copy prebuilt gems +COPY --chown=$USERNAME:$USERNAME --from=prod_gems_and_assets $BUNDLE_PATH $BUNDLE_PATH + +# Copy all app code again (sans gems, node_modules, assets) +COPY --chown=$USERNAME:$USERNAME . $HOME + +# Copy prebuilt assets +COPY --chown=$USERNAME:$USERNAME --from=prod_gems_and_assets $HOME/public $HOME/public + +# Copy environment-based config files +COPY --chown=$USERNAME:$USERNAME ./config/exchange_prod.yml $HOME/config/exchange.yml + +USER $USERNAME + +ENTRYPOINT ["bin/docker-entrypoint"] + +################################################################ +# Glue update image builder +################################################################ + +FROM builder as update_builder + +RUN apt-get update \ + && apt-get -yq dist-upgrade \ + && apt-get install -y \ + wget \ + default-jdk + +ARG GEM_OAUTH_TOKEN +ENV BUNDLE_GITHUB__COM=x-access-token:"$GEM_OAUTH_TOKEN" + +RUN git clone https://"$GEM_OAUTH_TOKEN"@github.com/ideacrew/ediparser.git +RUN git clone https://"$GEM_OAUTH_TOKEN"@github.com/health-connector/hbx_oracle.git + +RUN wget https://repo1.maven.org/maven2/org/jruby/jruby-dist/1.7.27/jruby-dist-1.7.27-bin.zip && unzip jruby-dist-1.7.27-bin.zip +ENV PATH=$HOME/jruby-1.7.27/bin:$PATH +WORKDIR $HOME/hbx_oracle +RUN unset BUNDLE_APP_CONFIG && \ + unset BUNDLE_BIN && \ + unset BUNDLE_PATH && \ + unset BUNDLER_VERSION && \ + unset GEM_HOME && \ + unset RUBYGEMS_VERSION && \ + jruby -S gem install bundler -v 1.17.1 && \ + jruby -S bundle install + + +################################################################ +# Glue update image builder +################################################################ + +FROM ghcr.io/health-connector/gluedb:${BRANCH}-${COMMIT_SHA} as update + +# Switch back to root to install system libraries +USER root + +RUN apt-get update && apt-get install wget gnupg software-properties-common dirmngr -y +# Install mongodb shell +RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - +RUN echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list + +# Install required packages/libraries +RUN apt-get update \ + # && apt-get upgrade \ + # && apt-get -yq dist-upgrade \ + && apt-get install -y \ + curl \ + jq \ + mongodb-org-shell \ + default-jdk \ + xz-utils \ + gcc \ + build-essential \ + git \ + libgmp-dev \ + python \ + lftp + +RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - +RUN apt-get install -y nodejs +RUN cd /root && curl -O https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-x86_64-deb8-linux.tar.xz && tar xf ghc-8.0.2-x86_64-deb8-linux.tar.xz && cd ghc-8.0.2 && ./configure && make install +RUN cd /root && git clone https://github.com/haskell/cabal.git && cd /root/cabal && git checkout Cabal-v1.24.2.0 && cd cabal-install && ./bootstrap.sh +ENV PATH=$PATH:$HOME/.cabal/bin +#ENV PATH=$HOME/jruby-1.7.27/bin:$PATH +RUN cabal update + +RUN echo '\ngem "rubycritic"' >> Gemfile +RUN bundle install --jobs 20 --retry 5 --without development test + +COPY --chown=$USERNAME:$USERNAME --from=update_builder $HOME/ediparser $HOME/ediparser +COPY --chown=$USERNAME:$USERNAME --from=update_builder $HOME/hbx_oracle $HOME/hbx_oracle +COPY --chown=$USERNAME:$USERNAME --from=update_builder $HOME/jruby-1.7.27 $HOME/jruby-1.7.27 + +RUN cd /edidb/ediparser && cabal update && cabal install --dependencies-only && cabal build && cabal configure +RUN mkdir -p /edidb/scripts + +COPY .docker/config/prepare_dev.js /edidb/scripts/prepare_dev.js +COPY .docker/config/prepare_prod.js /edidb/scripts/prepare_prod.js +COPY .docker/config/database.rb /edidb/hbx_oracle/config/database.rb +COPY .docker/config/update_variables.sh /edidb/scripts/update_variables.sh +RUN chmod 755 /edidb/scripts/update_variables.sh +COPY .docker/config/glue_update.sh /edidb/scripts/glue_update.sh +RUN chmod 755 /edidb/scripts/glue_update.sh + +RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.20.14/bin/linux/amd64/kubectl +RUN chmod 744 ./kubectl +RUN mv ./kubectl /usr/local/bin/kubectl +RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip +RUN npm install -g secure-spreadsheet +RUN chown -R $USERNAME:$USERNAME $HOME + +################################################################ +# Glue reports image builder +################################################################ + +FROM ghcr.io/health-connector/gluedb:${BRANCH}-${COMMIT_SHA} as reports + +# Switch back to root to install system libraries +USER root + +RUN apt-get update && apt-get install wget gnupg software-properties-common dirmngr -y +# Install mongodb shell +RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - +RUN echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list + +# Install required packages/libraries +RUN apt-get update \ + # && apt-get upgrade \ + # && apt-get -yq dist-upgrade \ + && apt-get install -y \ + curl \ + jq \ + mongodb-org-shell \ + default-jdk \ + xz-utils \ + gcc \ + build-essential \ + git \ + libgmp-dev \ + python \ + lftp + +RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - +RUN apt-get install -y nodejs + +RUN echo '\ngem "rubycritic"' >> Gemfile +RUN bundle install --jobs 20 --retry 5 --without development test + +RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.20.14/bin/linux/amd64/kubectl +RUN chmod 744 ./kubectl +RUN mv ./kubectl /usr/local/bin/kubectl +RUN curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install && rm awscliv2.zip +RUN npm install -g secure-spreadsheet +RUN chown -R $USERNAME:$USERNAME $HOME diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml new file mode 100644 index 000000000..952446e33 --- /dev/null +++ b/.github/workflows/build-and-deploy.yml @@ -0,0 +1,186 @@ +name: Build Image and Deploy + +on: + workflow_dispatch: + push: + branches: + - "master" + pull_request: + branches: + - "master" + +concurrency: + group: docker-${{ github.ref }} + cancel-in-progress: true + +env: + RABBITMQ_DEFAULT_USER: "guest" + RABBITMQ_DEFAULT_PASS: "guest" + +jobs: + prep: + runs-on: ubuntu-latest + outputs: + taggedImage: ${{ steps.prep.outputs.tagged_image }} + tag: ${{ steps.prep.outputs.tag }} + registry_ghcr: ${{ steps.prep.outputs.registry_ghcr }} + shortSha: ${{ steps.prep.outputs.short_sha}} + branchName: ${{ steps.prep.outputs.branch_name }} + latestTag: ${{ steps.prep.outputs.latest_tag }} + repositoryName: ${{ steps.prep.outputs.repository_name }} + steps: + - name: Git branch name + id: git-branch-name + uses: EthanSK/git-branch-name-action@v1 + - name: Prepare info + id: prep + run: | + SHORT_SHA=$(echo $GITHUB_SHA | head -c7) + REPO=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}') + TAG=${{ env.GIT_BRANCH_NAME }}-$(echo $GITHUB_SHA | head -c7) + IMAGE=health-connector/$REPO + echo "tagged_image=${IMAGE}:${TAG}" >> $GITHUB_OUTPUT + echo "tag=${TAG}" >> $GITHUB_OUTPUT + echo "registry_ghcr=ghcr.io" >> $GITHUB_OUTPUT + echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT + echo "branch_name=${{ env.GIT_BRANCH_NAME }}" >> $GITHUB_OUTPUT + echo "repository_name=$REPO" >> $GITHUB_OUTPUT + echo "latest_tag=${IMAGE}:latest" >> $GITHUB_OUTPUT + + # Uses buildx to build and push the image + build-and-upload-image: + needs: [prep] + runs-on: ubuntu-latest + services: + rabbitmq: + image: rabbitmq:latest + ports: + - 5672:5672 + - 15672:15672 + options: >- + --name "rabbitmq" + --health-cmd "rabbitmqctl node_health_check" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + mongo: + image: mongo:4.2 + ports: + - 27017:27017 + options: >- + --name "mongo" + --health-cmd mongo + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v3 + + - name: Add git HEAD info to docker image + run: git show --quiet HEAD > release.txt + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + install: true + version: v0.9.1 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + # Key is named differently to avoid collision + key: ${{ runner.os }}-multi-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-multi-buildx + + # Add vhosts to RabbitMQ + - run: | + docker exec rabbitmq rabbitmqctl add_vhost / + docker exec rabbitmq rabbitmqctl add_vhost event_source + docker exec rabbitmq rabbitmqctl set_permissions -p event_source guest ".*" ".*" ".*" + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ${{ needs.prep.outputs.registry_ghcr }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Image + uses: docker/build-push-action@v3 + with: + context: . + builder: ${{ steps.buildx.outputs.name }} + file: .docker/production/Dockerfile.gha + # Set the desired build target here + target: deploy + # needed to access mongo and rabbit on GHA machine + network: host + # send to public registry if not a pull request + push: ${{ github.event_name != 'pull_request' }} + # create local image (for scanning) if it is a pull request + load: ${{ github.event_name == 'pull_request' }} + tags: | + ${{ format('{0}/{1}', needs.prep.outputs.registry_ghcr, needs.prep.outputs.taggedImage) }} + ${{ format('{0}/{1}', needs.prep.outputs.registry_ghcr, needs.prep.outputs.latestTag) }} + cache-from: type=local,src=/tmp/.buildx-cache + # Note the mode=max here + # More: https://github.com/moby/buildkit#--export-cache-options + # And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + build-args: | + HOSTNAME=172.17.0.1 + GEM_OAUTH_TOKEN=${{ secrets.dchbx_deployments_token }} + + - name: Scan Docker image + if: github.event_name != 'pull_request' + id: scan + uses: anchore/scan-action@main + with: + image: ${{ format('{0}/{1}', needs.prep.outputs.registry_ghcr, needs.prep.outputs.taggedImage) }} + # acs-report-enable: true + fail-build: false + severity-cutoff: critical + + # - name: upload Anchore scan SARIF report + # if: github.event_name != 'pull_request' + # uses: github/codeql-action/upload-sarif@v1 + # with: + # sarif_file: ${{ steps.scan.outputs.sarif }} + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + # notify-slack: + # if: github.event_name != 'pull_request' + # needs: [prep, build-and-upload-image] + # runs-on: ubuntu-latest + # strategy: + # matrix: + # registry: ['ghcr.io'] + # steps: + # - name: Post to a Slack channel + # id: slack + # uses: slackapi/slack-github-action@v1.16.0 + # with: + # channel-id: "docker-images-${{ needs.prep.outputs.repositoryName }}" + # payload: | + # { + # "blocks": [ + # { + # "type": "section", + # "text": { + # "type": "mrkdwn", + # "text": "*${{ format('{0} image*:\n`{1}/{2}`', matrix.registry, matrix.registry, needs.prep.outputs.taggedImage) }}" + # } + # }, + # { + # "type": "divider" + # } + # ] + # } + # env: + # SLACK_BOT_TOKEN: ${{ secrets.CCA_DEPLOY_SLACK_BOT_TOKEN }} diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml new file mode 100644 index 000000000..fc30b890b --- /dev/null +++ b/.github/workflows/build-base-image.yml @@ -0,0 +1,60 @@ +name: Build Base Image + +on: + workflow_dispatch: + push: + branches: + - "main" + paths: + - ".docker/base/**" + +concurrency: + group: base-${{ github.ref }} + cancel-in-progress: true + +jobs: + # Uses buildx to build and push the image + build-and-upload-image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + install: true + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + # Key is named differently to avoid collision + key: ${{ runner.os }}-multi-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-multi-buildx + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Image + uses: docker/build-push-action@v3 + with: + context: . + builder: ${{ steps.buildx.outputs.name }} + file: .docker/base/Dockerfile.base + push: "true" + tags: ghcr.io/health-connector/gluedb:base + cache-from: type=local,src=/tmp/.buildx-cache + # Note the mode=max here + # More: https://github.com/moby/buildkit#--export-cache-options + # And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/.github/workflows/build-reports-image.yml b/.github/workflows/build-reports-image.yml new file mode 100644 index 000000000..d75a8bdf7 --- /dev/null +++ b/.github/workflows/build-reports-image.yml @@ -0,0 +1,82 @@ +name: Build reports image + +on: + workflow_dispatch: + inputs: + branch: + default: 'master' + description: 'Branch to build' + required: true + commit_sha: + description: 'Commit sha to build' + required: true + repository_dispatch: + types: + - build-reports-image + +concurrency: + group: reports-${{ github.ref }} + cancel-in-progress: true + +jobs: + prep: + runs-on: ubuntu-latest + outputs: + client: ${{ steps.prep.outputs.client }} + branch: ${{ steps.prep.outputs.branch}} + commit_sha: ${{ steps.prep.outputs.commit_sha }} + steps: + - name: Set variables from workflow dispatch + id: prep + run: | + if [[ "${{github.event_name}}" == "repository_dispatch" ]]; then + echo ::set-output name=client::${{ github.event.client_payload.client }} + echo ::set-output name=branch::${{ github.event.client_payload.branch }} + echo ::set-output name=commit_sha::${{ github.event.client_payload.commit_sha }} + else + echo ::set-output name=client::${{ github.event.inputs.client }} + echo ::set-output name=branch::${{ github.event.inputs.branch }} + echo ::set-output name=commit_sha::${{ github.event.inputs.commit_sha }} + fi + + build-and-upload-image: + runs-on: ubuntu-latest + needs: [prep] + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ needs.prep.outputs.branch }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + # Key is named differently to avoid collision + key: ${{ runner.os }}-multi-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-multi-buildx + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build reports Image + uses: docker/build-push-action@v2 + with: + context: . + push: true + builder: ${{ steps.buildx.outputs.name }} + file: .docker/production/Dockerfile.gha + target: reports + tags: ghcr.io/health-connector/gluedb:cca-reports + build-args: | + COMMIT_SHA=${{ needs.prep.outputs.commit_sha }} + BRANCH=${{ needs.prep.outputs.branch }} diff --git a/.github/workflows/build-update-image.yml b/.github/workflows/build-update-image.yml new file mode 100644 index 000000000..a13d642b4 --- /dev/null +++ b/.github/workflows/build-update-image.yml @@ -0,0 +1,160 @@ +name: Build Update Image + +run-name: Build Update Image + +on: + workflow_dispatch: + inputs: + branch: + default: "master" + description: "Branch to build" + required: true + commit_sha: + description: "Commit sha to build" + required: true + + repository_dispatch: + types: + - build-update-image + +concurrency: + group: update-${{ github.ref }} + cancel-in-progress: true + +env: + RABBITMQ_DEFAULT_USER: "guest" + RABBITMQ_DEFAULT_PASS: "guest" + +jobs: + prep: + runs-on: ubuntu-latest + outputs: + tagged_image: ${{ steps.prep.outputs.tagged_image }} + tagged_images: ${{ steps.prep.outputs.tagged_images }} + branch: ${{ steps.prep.outputs.branch }} + commit_sha: ${{ steps.prep.outputs.commit_sha }} + repository_name: gluedb + steps: + - name: Set variables from workflow dispatch + id: prep + run: | + repo="ghcr.io/health-connector/gluedb" + if [[ "${{github.event_name}}" == "repository_dispatch" ]]; then + echo ::set-output name=client::${{ github.event.client_payload.client }} + echo ::set-output name=branch::${{ github.event.client_payload.branch }} + echo ::set-output name=commit_sha::${{ github.event.client_payload.commit_sha }} + echo ::set-output name=tagged_image::${repo}:${{ github.event.client_payload.branch }}-${{ github.event.client_payload.commit_sha }}-glue-update + echo ::set-output name=tagged_images::${repo}:${{ github.event.client_payload.branch }}-${{ github.event.client_payload.commit_sha }}-glue-update,${repo}:latest-prod-glue-update-${{ github.event.client_payload.client }} + else + echo ::set-output name=client::${{ github.event.inputs.client }} + echo ::set-output name=branch::${{ github.event.inputs.branch }} + echo ::set-output name=commit_sha::${{ github.event.inputs.commit_sha }} + echo ::set-output name=tagged_image::${repo}:${{ github.event.inputs.branch }}-${{ github.event.inputs.commit_sha }}-glue-update + echo ::set-output name=tagged_images::${repo}:${{ github.event.inputs.branch }}-${{ github.event.inputs.commit_sha }}-glue-update + fi + + # Uses buildx to build and push the image + build-and-upload-image: + needs: [prep] + runs-on: ubuntu-latest + services: + rabbitmq: + image: rabbitmq:latest + ports: + - 5672:5672 + - 15672:15672 + options: >- + --name "rabbitmq" + --health-cmd "rabbitmqctl node_health_check" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + mongo: + image: mongo:4.2 + ports: + - 27017:27017 + options: >- + --name "mongo" + --health-cmd mongo + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ needs.prep.outputs.branch }} + + - name: Add git HEAD info to docker image + run: git show --quiet HEAD > release.txt + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + install: true + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + # Key is named differently to avoid collision + key: ${{ runner.os }}-multi-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-multi-buildx + + # Add vhosts to RabbitMQ + - run: | + docker exec rabbitmq rabbitmqctl add_vhost / + docker exec rabbitmq rabbitmqctl add_vhost event_source + docker exec rabbitmq rabbitmqctl set_permissions -p event_source guest ".*" ".*" ".*" + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Glue Update Image + uses: docker/build-push-action@v3 + with: + context: . + builder: ${{ steps.buildx.outputs.name }} + file: .docker/production/Dockerfile.gha + # Set the desired build target here + target: update + # needed to access mongo and rabbit on GHA machine + network: host + # send to public registry if not a pull request + push: ${{ github.event_name != 'pull_request' }} + # create local image (for scanning) if it is a pull request + load: ${{ github.event_name == 'pull_request' }} + tags: ${{ needs.prep.outputs.tagged_images }} + cache-from: type=local,src=/tmp/.buildx-cache + # Note the mode=max here + # More: https://github.com/moby/buildkit#--export-cache-options + # And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + build-args: | + HOSTNAME=172.17.0.1 + GEM_OAUTH_TOKEN=${{ secrets.dchbx_deployments_token }} + COMMIT_SHA=${{ needs.prep.outputs.commit_sha }} + BRANCH=${{ needs.prep.outputs.branch }} + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + +# notify-slack: +# if: github.event_name != 'pull_request' +# needs: [prep, build-and-upload-image] +# runs-on: ubuntu-latest +# steps: +# - name: Post to a Slack channel +# id: slack +# uses: slackapi/slack-github-action@v1.16.0 +# with: +# channel-id: "docker-images-${{ needs.prep.outputs.repository_name }}" +# slack-message: "New image pushed: ${{ needs.prep.outputs.tagged_image }} built from on `${{ needs.prep.outputs.branch }}`" +# env: +# SLACK_BOT_TOKEN: ${{ secrets.YELLR_BOT_TOKEN }} diff --git a/.github/workflows/push_checks.yml b/.github/workflows/push_checks.yml new file mode 100644 index 000000000..4dc7005f4 --- /dev/null +++ b/.github/workflows/push_checks.yml @@ -0,0 +1,51 @@ +name: RSpec +on: push + +jobs: + rspec: + runs-on: ubuntu-22.04 + steps: + - name: Get Packages for Ruby Prerequisites + run: | + sudo apt-get -y update + sudo apt-get -y install git libntirpc-dev libxml2 libxml2-dev curl libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev + - name: Install libssl1.0-dev from bionic sources + run: | + echo 'deb http://security.ubuntu.com/ubuntu bionic-security main' | sudo tee -a /etc/apt/sources.list.d/bionic-security.list + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 + sudo apt update && apt-cache policy libssl1.0-dev + sudo apt-get -y install libssl1.0-dev + - name: Install Ruby + run: | + curl -O https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.10.tar.bz2 + tar xjf ruby-2.1.10.tar.bz2 + cd ruby-2.1.10 && ./configure && make -j 2 + sudo make install + - name: Launch MongoDB + uses: wbari/start-mongoDB@v0.2 + with: + mongoDBVersion: 3.4 + - name: Setup Node.js for use with actions + uses: actions/setup-node@v2 + with: + # Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0, lts + node-version: 9.11.1 + - uses: actions/checkout@v3 + - name: Cache Gems + uses: actions/cache@v3 + with: + path: vendor/bundle + key: ${{ runner.os }}-gluedb-gems-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gluedb-gems-${{ hashFiles('**/Gemfile.lock') }} + - name: bundle install + run: | + sudo gem install bundler -v '1.17.3' + export BUNDLE_GITHUB__COM=${{ secrets.dchbx_deployments_token }}:x-oauth-basic + bundle config path vendor/bundle + export BUNDLE_GITHUB__COM=${{ secrets.dchbx_deployments_token }}:x-oauth-basic + bundle install + - name: run tests + run: | + cp config/exchange.yml.example config/exchange.yml + bundle exec rspec \ No newline at end of file diff --git a/.github/workflows/tag-latest-prod-image.yml b/.github/workflows/tag-latest-prod-image.yml new file mode 100644 index 000000000..93c8550c0 --- /dev/null +++ b/.github/workflows/tag-latest-prod-image.yml @@ -0,0 +1,82 @@ +name: Tag latest prod image + +on: + repository_dispatch: + types: + - tag-latest-prod-image + +concurrency: + group: tag-latest-prod-image-${{ github.ref }} + cancel-in-progress: true + +jobs: + prep: + runs-on: ubuntu-latest + outputs: + repo: ${{ steps.prep.outputs.repo }} + image_tag: ${{ steps.prep.outputs.image_tag }} + registry_ghcr: ${{ steps.prep.outputs.registry_ghcr }} + short_sha: ${{ steps.prep.outputs.short_sha}} + branch: ${{ steps.prep.outputs.branch }} + latest_prod_tag: ${{ steps.prep.outputs.latest_prod_tag }} + steps: + - name: Git branch name + id: git-branch-name + uses: EthanSK/git-branch-name-action@v1 + - name: Prepare info + id: prep + run: | + repo=health-connector/gluedb + image_tag=${{ github.event.client_payload.image }} + echo ::set-output name=repo::${repo} + echo ::set-output name=image_tag::${image_tag} + echo ::set-output name=registry_ghcr::ghcr.io + echo ::set-output name=short_sha::${{ github.event.client_payload.commit_sha }} + echo ::set-output name=branch::${{ github.event.client_payload.branch }} + echo ::set-output name=latest_prod_tag::latest-prod-${{ github.event.client_payload.client }} + + build-and-upload-image: + runs-on: ubuntu-latest + needs: [prep] + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ needs.prep.outputs.branch }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + install: true + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + # Key is named differently to avoid collision + key: ${{ runner.os }}-multi-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-multi-buildx + + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ${{ needs.prep.outputs.registry_ghcr }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Tag GHCR images + uses: shrink/actions-docker-registry-tag@v3 + with: + registry: ${{ needs.prep.outputs.registry_ghcr }} + repository: ${{ needs.prep.outputs.repo }} + target: ${{ needs.prep.outputs.image_tag }} + tags: ${{ needs.prep.outputs.latest_prod_tag }} + +# - name: Pull, Tag, and Push Image +# run: | +# docker pull ${{ needs.prep.outputs.registry_ecr }}/${{ needs.prep.outputs.image_tag }} +# docker tag ${{ needs.prep.outputs.registry_ecr }}/${{ needs.prep.outputs.image_tag }} ${{ needs.prep.outputs.registry_ecr }}/${{ needs.prep.outputs.latest_prod_tag }} +# docker push ${{ needs.prep.outputs.registry_ecr }}/${{ needs.prep.outputs.latest_prod_tag }} +# docker tag ${{ needs.prep.outputs.registry_ecr }}/${{ needs.prep.outputs.image_tag }} ${{ needs.prep.outputs.registry_ghcr }}/${{ needs.prep.outputs.latest_prod_tag }} +# docker push ${{ needs.prep.outputs.registry_ghcr }}/${{ needs.prep.outputs.latest_prod_tag }} + diff --git a/.gitignore b/.gitignore index 8125ccc84..ffddcdf57 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ # Ignore vim swapfiles *.swp +coverage/ dump/ db/data db/seedfiles/**/*.xml @@ -25,4 +26,14 @@ db/seedfiles/**/*.xls db/seedfiles/**/*.xlsx db/seedfiles/*.csv db/seedfiles/*.yml +node_modules +.idea/ config/exchange.yml +spec/vocabularies + +config/settings.local.yml +config/settings/*.local.yml +config/environments/*.local.yml +*.xml +*.xls +*.xlsx diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 000000000..cfbccd5e1 --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,36 @@ +CommitMsg: + CapitalizedSubject: + enabled: false + + EmptyMessage: + enabled: false + + TrailingPeriod: + enabled: true + + TextWidth: + enabled: false + +PreCommit: + ALL: + on_warn: warn + problem_on_unmodified_line: warn + + AuthorEmail: + enabled: true + + AuthorName: + enabled: true + + MergeConflicts: + enabled: true + + YamlSyntax: + enabled: true + + BundleCheck: + enabled: true + + RuboCop: + enabled: true + problem_on_unmodified_line: warn diff --git a/.rbenv-gemsets b/.rbenv-gemsets deleted file mode 100644 index 35c6bb7c7..000000000 --- a/.rbenv-gemsets +++ /dev/null @@ -1 +0,0 @@ -gluedb diff --git a/.reek b/.reek new file mode 100644 index 000000000..9c15b8638 --- /dev/null +++ b/.reek @@ -0,0 +1,2 @@ +DuplicateMethodCall: + max_calls: 2 diff --git a/.rspec b/.rspec index a80d5ab23..83e16f804 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,2 @@ --color ---require ./spec/glue_formatter.rb +--require spec_helper diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 000000000..db12eae75 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1,5 @@ +--color +--require spec_helper +--format progress +--format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log +--format RspecJunitFormatter --out tmp/rspec<%= ENV['TEST_ENV_NUMBER'] %>.xml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 000000000..14af7a460 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,187 @@ +# This yaml describes our current checks. +# Any checks marked "# TODO: RWC" are "re-enable when corrected.RWC" are "re-enable when corrected. + +# We will add the following back in later, but they cause +# a completely outsized amount of cop failures for the number of files: +# - db/seedfiles +# - lib/tasks +AllCops: + Exclude: + - './project_gems/effective_datatables-2.6.14/effective_datatables-2.6.14.gemspec' + - './node_modules/**/*' + - './db/seedfiles/**/*' + - './lib/tasks/**/*' + - './components/benefit_markets/db/seedfiles/**/*' + - './components/benefit_sponsors/db/seedfiles/**/*' + - './components/old_sponsored_benefits/**/*' + - './eyes/enroll.eye.rb' + +Rails: + Enabled: true + +Rails/ActiveRecordAliases: + Enabled: false + +Rails/FilePath: + Enabled: false + +Rails/FindBy: + Enabled: false + +Rails/DynamicFindBy: + Enabled: false + +# Re-enable for upgrade of rails +Rails/ActionFilter: + Enabled: false + +Rails/HasManyOrHasOneDependent: + Enabled: false + +Rails/Output: + Enabled: false + +# Re-enable for upgrade of rails +Rails/Validation: + Enabled: false + +# TODO: RWC +Rails: + Enabled: false + +Layout/CommentIndentation: + Enabled: false + +Layout/EmptyLines: + Enabled: false + +Layout/EmptyLinesAroundBlockBody: + Enabled: false + +Layout/LeadingCommentSpace: + Enabled: false + +Layout/ExtraSpacing: + Enabled: false + +Layout/EmptyLinesAroundClassBody: + Enabled: false + +Layout/IndentArray: + Enabled: false + +# Re-enable once other problems are solved +Layout/SpaceAfterComma: + Enabled: false + +Layout/SpaceBeforeBlockBraces: + Enabled: false + +Layout/SpaceInsideHashLiteralBraces: + Enabled: false + +Layout/SpaceInsideBlockBraces: + Enabled: false + +Layout/TrailingBlankLines: + Enabled: false + +Layout/IndentationWidth: + Enabled: true + +Layout/Tab: + Enabled: true + +Layout/TrailingWhitespace: + Enabled: true + +Metrics/AbcSize: + Max: 50 + +Metrics/ClassLength: + Max: 300 + +Metrics/CyclomaticComplexity: + Max: 15 + +Metrics/BlockLength: + Enabled: false + +Metrics/LineLength: + Max: 250 + +Metrics/MethodLength: + Max: 50 + +Metrics/PerceivedComplexity: + Max: 15 + +Naming/PredicateName: + Enabled: false + +Naming/VariableNumber: + Enabled: false + +Style/AndOr: + Enabled: true + +Style/BlockComments: + Enabled: false + +Style/BracesAroundHashParameters: + Enabled: false + +# We will want to turn this back on or customize it more fully +Style/Documentation: + Enabled: false + +Style/EachWithObject: + Enabled: false + +Style/ExpandPathArguments: + Enabled: false + +Style/EmptyLiteral: + Enabled: false + +Style/HashSyntax: + Enabled: false + +Style/IfUnlessModifier: + Enabled: false + +Style/NumericPredicate: + Enabled: false + +Style/ParenthesesAroundCondition: + Enabled: false + +Style/RedundantSelf: + Enabled: false + +Style/StringLiterals: + Enabled: false + +Style/SymbolArray: + Enabled: false + +Style/WordArray: + Enabled: false + +Style/YodaCondition: + Enabled: false + +Bundler/OrderedGems: + Enabled: false + +Gemspec/OrderedDependencies: + Enabled: false + +Performance/StringReplacement: + Enabled: false + +# Deprecated +# Style/TrailingBlankLines: +# Enabled: false +# AllCops: +# RunRailsCops: true diff --git a/.ruby-version b/.ruby-version index 7a895c214..399088bf4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -1.9.3-p484 +2.1.6 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..b4aeaf74c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM --platform=linux/amd64 debian:stretch +RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list +RUN echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list + +RUN apt-get update && \ + apt-get install -y git gcc openssl libyaml-dev libyaml-cpp-dev curl libffi-dev libreadline-dev \ + zlibc libgdbm-dev libncurses-dev autoconf fontconfig unzip zip sshpass bzip2 libxrender1 libxext6 \ + build-essential libxml2 libxml2-dev libxslt1-dev libz-dev libssl1.0-dev python + +WORKDIR /usr/src/ +RUN curl -O https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.10.tar.bz2 +RUN tar xjf ruby-2.1.10.tar.bz2 +RUN cd ruby-2.1.10 && ./configure && make -j 2 +RUN cd ruby-2.1.10 && make install + +WORKDIR /usr/src/app +# Adding gems +COPY Gemfile Gemfile +COPY Gemfile.lock Gemfile.lock + +RUN gem install bundler --version "1.17.3" + +# Setting env up +ARG GEM_OAUTH_TOKEN +ENV BUNDLE_GITHUB__COM=x-access-token:"$GEM_OAUTH_TOKEN" + +RUN bundle install --jobs 20 --retry 5 + diff --git a/Gemfile b/Gemfile index 08c0a5f3d..37797267d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,59 +1,102 @@ source 'https://rubygems.org' -gem 'rails', '3.2.16' +gem 'rake', '10.4.2' +gem 'rails', '3.2.22.5' gem "mongoid", "~> 3.1.6" gem "origin" gem "aasm", "~> 3.0.25" gem "nokogiri", "~> 1.6.1" -gem "bunny" - -gem 'jquery-rails' -gem 'jquery-ui-rails' +gem "bunny", '1.4.1' +gem 'amq-protocol', '2.0.1' +gem 'jquery-rails', '3.1.3' +gem 'jquery-ui-rails', '5.0.5' +gem 'virtus' +gem 'spreadsheet', '1.0.4' +gem 'ruby-ole', '1.2.11.7' +gem 'openhbx_cv2', git: "https://github.com/ideacrew/openhbx_cv2.git", branch: "trunk" +gem "interactor", "~> 3.0" +gem 'interactor-rails', '2.0.2' +gem "psych", "2.0.5" +gem "rubyXL", "3.4.6" group :development do gem 'capistrano', '2.15.4' - gem 'ruby-progressbar' + gem 'rubocop', '0.57.2' + gem 'rubocop-git', '0.1.3' + gem 'overcommit', '0.44.0' # gem 'jazz_hands' end -group :development, :assets do +group 'development', 'test' do + gem 'rspec', '3.3.0' + gem 'rspec-core', '3.3.2' +end + +group :development, :assets, :test do + gem 'libv8' + gem 'therubyracer', '0.12.2', :platforms => :ruby gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' + gem 'less-rails-bootstrap', '3.2.0' + gem 'designmodo-flatuipro-rails', git: "https://github.com/ideacrew/designmodo-flatuipro-rails.git", branch: "trunk" +end +group :development, :assets do gem 'uglifier', '>= 1.0.3' + gem 'font-awesome-rails', '4.2.0.0' + gem "rails_best_practices" +end - gem 'therubyracer', :platforms => :ruby - gem 'less-rails-bootstrap' - gem 'designmodo-flatuipro-rails', '~> 1.2.5.0.branch' - gem 'font-awesome-rails' - +group :development, :test do + gem "parallel_tests" end group :test do - gem 'mongoid-rspec' - gem 'rspec-rails' #, '~> 3.0.0.beta' - gem 'capybara' - gem "capybara-webkit" - gem 'factory_girl_rails' - gem 'database_cleaner' + gem 'test-unit' + gem 'mongoid-rspec' + gem 'rspec-rails', '3.3.3' + gem 'rspec-collection_matchers', '1.1.2' + gem 'capybara', '2.4.4' + gem 'factory_girl_rails', '4.5.0' + gem 'factory_girl', '4.5.0' + gem 'database_cleaner', '1.5.3' + gem 'ci_reporter', '2.0.0' + gem 'savon', '2.7' + gem 'simplecov', :require => false + gem 'rspec_junit_formatter' end -gem 'simple_form' -gem "haml" -gem 'kaminari' -gem 'bootstrap-kaminari-views' -gem "pd_x12" -gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid' -gem 'devise' -gem "rsec" -gem "mongoid_auto_increment" -gem 'american_date' - -gem 'roo' - group :production do - gem 'unicorn' + gem 'unicorn', '4.8.2' +# gem 'bluepill', '0.0.68' + gem 'eye', '0.10.0' + gem 'celluloid', '~> 0.17.3' + gem 'nio4r', '1.1.1' end +gem 'ruby-progressbar', '~> 1.7' +gem "haml" +gem 'kaminari', '0.16.3' +gem 'bootstrap-kaminari-views', '0.0.5' +gem "pd_x12" +gem 'carrierwave-mongoid', '0.7.1', :require => 'carrierwave/mongoid' +gem 'devise', '3.3.0' +gem "rsec" +gem "mongoid_auto_increment", '0.1.2' +gem 'american_date', '1.1.0' +gem 'cancancan', '~> 1.9' gem 'oj' +gem 'roo', '2.1.0' +gem 'bh' +gem 'nokogiri-happymapper', :require => 'happymapper' +gem 'prawn', '~> 0.11.1' +gem 'forkr', '1.0.2' +gem 'edi_codec', git: "https://github.com/health-connector/edi_codec.git" +gem 'ibsciss-middleware', git: "https://github.com/ideacrew/ruby-middleware.git", branch: "trunk", :require => "middleware" +gem 'rgl', '0.5.2' +gem 'aws-sdk' + +# configuration support +gem "config", '1.0.0' +gem "puma", "~>2.16" \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 8f959937e..fdc983787 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,48 @@ +GIT + remote: https://github.com/health-connector/edi_codec.git + revision: e976cf4f08d99021c99cd8b071299b895a88d731 + specs: + edi_codec (0.1.2) + activesupport (>= 3.2) + nokogiri (~> 1.6) + +GIT + remote: https://github.com/ideacrew/designmodo-flatuipro-rails.git + revision: cf4e651a49bb3ba712efd90531d864a294616914 + branch: trunk + specs: + designmodo-flatuipro-rails (1.3.0.0.branch) + jquery-rails (>= 3.1.1) + jquery-ui-rails (>= 5.0.0) + less-rails-bootstrap (>= 3.2.0) + +GIT + remote: https://github.com/ideacrew/openhbx_cv2.git + revision: 4b6ace9d5a8202c0a115355e3166cdd6c3bb9bb7 + branch: trunk + specs: + openhbx_cv2 (0.0.1) + activesupport (>= 3.2) + nokogiri-happymapper (~> 0.5) + +GIT + remote: https://github.com/ideacrew/ruby-middleware.git + revision: 1c324903951337faf2116f20ec0df9ec13ddd781 + branch: trunk + specs: + ibsciss-middleware (0.4.0) + GEM remote: https://rubygems.org/ specs: + Ascii85 (1.0.2) aasm (3.0.26) - actionmailer (3.2.16) - actionpack (= 3.2.16) + actionmailer (3.2.22.5) + actionpack (= 3.2.22.5) mail (~> 2.5.4) - actionpack (3.2.16) - activemodel (= 3.2.16) - activesupport (= 3.2.16) + actionpack (3.2.22.5) + activemodel (= 3.2.22.5) + activesupport (= 3.2.22.5) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -15,231 +50,395 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.16) - activesupport (= 3.2.16) + activemodel (3.2.22.5) + activesupport (= 3.2.22.5) builder (~> 3.0.0) - activerecord (3.2.16) - activemodel (= 3.2.16) - activesupport (= 3.2.16) + activerecord (3.2.22.5) + activemodel (= 3.2.22.5) + activesupport (= 3.2.22.5) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.16) - activemodel (= 3.2.16) - activesupport (= 3.2.16) - activesupport (3.2.16) + activeresource (3.2.22.5) + activemodel (= 3.2.22.5) + activesupport (= 3.2.22.5) + activesupport (3.2.22.5) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) + afm (0.2.2) + akami (1.2.2) + gyoku (>= 0.4.0) + nokogiri american_date (1.1.0) - amq-protocol (1.9.2) + amq-protocol (2.0.1) arel (3.0.3) - atomic (1.1.15) - bcrypt (3.1.7) - bcrypt-ruby (3.1.5) - bcrypt (>= 3.1.3) - bootstrap-kaminari-views (0.0.3) + ast (2.4.0) + aws-sdk (2.2.4) + aws-sdk-resources (= 2.2.4) + aws-sdk-core (2.2.4) + jmespath (~> 1.0) + aws-sdk-resources (2.2.4) + aws-sdk-core (= 2.2.4) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) + bcrypt (3.1.12) + bh (1.3.6) + actionpack + activesupport + bootstrap-kaminari-views (0.0.5) kaminari (>= 0.13) rails (>= 3.1) builder (3.0.4) - bunny (1.3.1) + bunny (1.4.1) amq-protocol (>= 1.9.2) + cancancan (1.15.0) capistrano (2.15.4) highline net-scp (>= 1.0.0) net-sftp (>= 2.0.0) net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) - capybara (2.2.1) + capybara (2.4.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - capybara-webkit (1.0.0) - capybara (~> 2.0, >= 2.0.2) - json carrierwave (0.10.0) activemodel (>= 3.2.0) activesupport (>= 3.2.0) json (>= 1.7) mime-types (>= 1.16) - carrierwave-mongoid (0.7.0) + carrierwave-mongoid (0.7.1) carrierwave (>= 0.8.0, < 0.11.0) mongoid (>= 3.0, < 5.0) - mongoid-grid_fs (~> 1.3) + mongoid-grid_fs (>= 1.3, < 3.0) + celluloid (0.17.4) + celluloid-essentials + celluloid-extras + celluloid-fsm + celluloid-pool + celluloid-supervision + timers (>= 4.1.1) + celluloid-essentials (0.20.5) + timers (>= 4.1.1) + celluloid-extras (0.20.5) + timers (>= 4.1.1) + celluloid-fsm (0.20.5) + timers (>= 4.1.1) + celluloid-io (0.17.3) + celluloid (>= 0.17.2) + nio4r (>= 1.1) + timers (>= 4.1.1) + celluloid-pool (0.20.5) + timers (>= 4.1.1) + celluloid-supervision (0.20.6) + timers (>= 4.1.1) + childprocess (0.9.0) + ffi (~> 1.0, >= 1.0.11) + ci_reporter (2.0.0) + builder (>= 2.1.2) + code_analyzer (0.4.7) + sexp_processor + coercible (1.0.0) + descendants_tracker (~> 0.0.1) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) - coffee-script (2.2.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.7.0) + coffee-script-source (1.12.2) commonjs (0.2.7) - database_cleaner (1.2.0) - designmodo-flatuipro-rails (1.2.5.0.branch) - jquery-rails (>= 2.2.1) - jquery-ui-rails (>= 4.0.3) - less-rails-bootstrap - devise (3.2.3) - bcrypt-ruby (~> 3.0) + concurrent-ruby (1.0.5) + config (1.0.0) + activesupport (>= 3.0) + deep_merge (~> 1.0.0) + database_cleaner (1.5.3) + deep_merge (1.0.1) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + devise (3.3.0) + bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.2.5) + docile (1.1.5) + equalizer (0.0.11) erubis (2.7.0) - execjs (2.0.2) - factory_girl (4.4.0) + execjs (2.7.0) + eye (0.10.0) + celluloid (~> 0.17.3) + celluloid-io (~> 0.17.0) + kostya-sigar (~> 2.0.0) + state_machines + thor + factory_girl (4.5.0) activesupport (>= 3.0.0) - factory_girl_rails (4.4.1) - factory_girl (~> 4.4.0) + factory_girl_rails (4.5.0) + factory_girl (~> 4.5.0) railties (>= 3.0.0) - font-awesome-rails (4.0.3.1) + ffi (1.10.0) + font-awesome-rails (4.2.0.0) railties (>= 3.2, < 5.0) - haml (4.0.5) + forkr (1.0.2) + gyoku (1.1.1) + builder (>= 2.1.2) + haml (4.0.7) tilt - highline (1.6.21) + hashery (2.1.2) + highline (1.7.8) hike (1.2.3) - i18n (0.6.9) + httpi (2.2.7) + rack + i18n (0.9.1) + concurrent-ruby (~> 1.0) + ice_nine (0.11.2) + iniparse (1.4.4) + interactor (3.1.0) + interactor-rails (2.0.2) + interactor (~> 3.0) + rails (>= 3, < 5.1) + jaro_winkler (1.5.2) + jmespath (1.3.1) journey (1.0.4) - jquery-rails (3.1.0) + jquery-rails (3.1.3) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (4.2.0) + jquery-ui-rails (5.0.5) railties (>= 3.2.16) - json (1.8.1) - kaminari (0.16.1) + json (1.8.6) + kaminari (0.16.3) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - kgio (2.9.2) - less (2.4.0) + kgio (2.11.0) + kostya-sigar (2.0.10) + lazy_priority_queue (0.1.1) + less (2.5.1) commonjs (~> 0.2.7) - less-rails (2.4.2) + less-rails (2.5.0) actionpack (>= 3.1) - less (~> 2.4.0) - less-rails-bootstrap (3.1.1.0) - less-rails (~> 2.4.2) - libv8 (3.16.14.3) - mail (2.5.4) + less (~> 2.5.0) + less-rails-bootstrap (3.2.0) + less-rails (~> 2.5.0) + libv8 (3.16.14.17) + libxml-ruby (2.9.0) + macaddr (1.7.1) + systemu (~> 2.6.2) + mail (2.5.5) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - mini_portile (0.5.2) - mongoid (3.1.6) + mini_portile2 (2.1.0) + mongoid (3.1.7) activemodel (~> 3.2) moped (~> 1.4) origin (~> 1.0) tzinfo (~> 0.3.29) - mongoid-grid_fs (1.9.2) - mime-types (>= 1.19, < 3.0) - mongoid (>= 3.0, < 5.0) - mongoid-rspec (1.11.0) - mongoid (~> 3.1.6) + mongoid-grid_fs (2.3.0) + mime-types (>= 1.0, < 4.0) + mongoid (>= 3.0, < 7.0) + mongoid-rspec (1.13.0) + mongoid (~> 3.1) rake - rspec (>= 2.14) + rspec (~> 3.1) mongoid_auto_increment (0.1.2) mongoid (>= 2.0) - moped (1.5.2) - multi_json (1.10.1) + moped (1.5.3) + multi_json (1.13.1) net-scp (1.2.1) net-ssh (>= 2.6.5) net-sftp (2.1.2) net-ssh (>= 2.6.5) - net-ssh (2.9.1) + net-ssh (4.0.1) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) - oj (2.6.1) + nio4r (1.1.1) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) + nokogiri-happymapper (0.5.9) + nokogiri (~> 1.5) + nori (2.4.0) + oj (2.18.0) origin (1.1.0) orm_adapter (0.5.0) - pd_x12 (1.4.7) + overcommit (0.44.0) + childprocess (~> 0.6, >= 0.6.3) + iniparse (~> 1.4) + parallel (1.10.0) + parallel_tests (2.13.0) + parallel + parser (2.6.0.0) + ast (~> 2.4.0) + pd_x12 (1.5.4) + libxml-ruby + pdf-reader (1.4.1) + Ascii85 (~> 1.0.0) + afm (~> 0.2.1) + hashery (~> 2.0) + ruby-rc4 + ttfunk polyglot (0.3.5) - rack (1.4.5) - rack-cache (1.2) + power_assert (0.4.1) + powerpack (0.1.2) + prawn (0.11.1) + pdf-reader (>= 0.9.0) + ttfunk (~> 1.0.0) + psych (2.0.5) + puma (2.16.0) + rack (1.4.7) + rack-cache (1.7.1) rack (>= 0.4) rack-ssl (1.3.4) rack - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) - rails (3.2.16) - actionmailer (= 3.2.16) - actionpack (= 3.2.16) - activerecord (= 3.2.16) - activeresource (= 3.2.16) - activesupport (= 3.2.16) + rails (3.2.22.5) + actionmailer (= 3.2.22.5) + actionpack (= 3.2.22.5) + activerecord (= 3.2.22.5) + activeresource (= 3.2.22.5) + activesupport (= 3.2.22.5) bundler (~> 1.0) - railties (= 3.2.16) - railties (3.2.16) - actionpack (= 3.2.16) - activesupport (= 3.2.16) + railties (= 3.2.22.5) + rails_best_practices (1.17.0) + activesupport + code_analyzer (>= 0.4.3) + erubis + i18n + json + require_all + ruby-progressbar + railties (3.2.22.5) + actionpack (= 3.2.22.5) + activesupport (= 3.2.22.5) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - raindrops (0.13.0) - rake (10.3.2) + rainbow (3.0.0) + raindrops (0.17.0) + rake (10.4.2) rdoc (3.12.2) json (~> 1.4) - ref (1.0.5) - roo (1.13.2) - nokogiri - rubyzip - spreadsheet (> 0.6.4) - rsec (0.4) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.8) - rspec-expectations (2.14.5) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.6) - rspec-rails (2.14.1) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) + ref (2.0.0) + require_all (1.4.0) + rgl (0.5.2) + lazy_priority_queue (~> 0.1.0) + stream (~> 0.5.0) + roo (2.1.0) + nokogiri (~> 1) + rubyzip (~> 1.1, < 2.0.0) + rsec (0.4.2) + rspec (3.3.0) + rspec-core (~> 3.3.0) + rspec-expectations (~> 3.3.0) + rspec-mocks (~> 3.3.0) + rspec-collection_matchers (1.1.2) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.3.2) + rspec-support (~> 3.3.0) + rspec-expectations (3.3.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.3.0) + rspec-mocks (3.3.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.3.0) + rspec-rails (3.3.3) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.3.0) + rspec-expectations (~> 3.3.0) + rspec-mocks (~> 3.3.0) + rspec-support (~> 3.3.0) + rspec-support (3.3.0) + rspec_junit_formatter (0.2.3) + builder (< 4) + rspec-core (>= 2, < 4, != 2.12.0) + rubocop (0.57.2) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.5) + powerpack (~> 0.1) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + rubocop-git (0.1.3) + rubocop (>= 0.24.1) ruby-ole (1.2.11.7) - ruby-progressbar (1.4.2) - rubyzip (1.1.3) - sass (3.3.2) + ruby-progressbar (1.10.0) + ruby-rc4 (0.1.5) + rubyXL (3.4.6) + nokogiri (>= 1.4.4) + rubyzip (>= 1.1.6) + rubyzip (1.2.1) + sass (3.4.23) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - simple_form (2.1.1) - actionpack (~> 3.0) - activemodel (~> 3.0) - spreadsheet (0.9.7) + savon (2.7.0) + akami (~> 1.2.0) + builder (>= 2.1.2) + gyoku (~> 1.1.0) + httpi (~> 2.2.3) + nokogiri (>= 1.4.0) + nori (~> 2.4.0) + uuid (~> 2.3.7) + wasabi (~> 3.3.0) + sexp_processor (4.7.0) + simplecov (0.12.0) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) + spreadsheet (1.0.4) ruby-ole (>= 1.0) - sprockets (2.2.2) + sprockets (2.2.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - therubyracer (0.12.1) + state_machines (0.5.0) + stream (0.5) + systemu (2.6.5) + test-unit (3.2.3) + power_assert + therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref - thor (0.19.1) - thread_safe (0.2.0) - atomic (>= 1.1.7, < 2) + thor (1.2.2) + thread_safe (0.3.5) tilt (1.4.1) + timers (4.3.2) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.39) - uglifier (2.4.0) - execjs (>= 0.3.0) - json (>= 1.8.0) + ttfunk (1.0.3) + tzinfo (0.3.53) + uglifier (3.0.4) + execjs (>= 0.3.0, < 3) + unicode-display_width (1.5.0) unicorn (4.8.2) kgio (~> 2.6) rack raindrops (~> 0.7) - warden (1.2.3) + uuid (2.3.8) + macaddr (~> 1.0) + virtus (1.0.5) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) + equalizer (~> 0.0, >= 0.0.9) + warden (1.2.6) rack (>= 1.0) + wasabi (3.3.1) + httpi (~> 2.0) + nokogiri (>= 1.4.0) xpath (2.0.0) nokogiri (~> 1.3) @@ -248,38 +447,78 @@ PLATFORMS DEPENDENCIES aasm (~> 3.0.25) - american_date - bootstrap-kaminari-views - bunny + american_date (= 1.1.0) + amq-protocol (= 2.0.1) + aws-sdk + bh + bootstrap-kaminari-views (= 0.0.5) + bunny (= 1.4.1) + cancancan (~> 1.9) capistrano (= 2.15.4) - capybara - capybara-webkit - carrierwave-mongoid + capybara (= 2.4.4) + carrierwave-mongoid (= 0.7.1) + celluloid (~> 0.17.3) + ci_reporter (= 2.0.0) coffee-rails (~> 3.2.1) - database_cleaner - designmodo-flatuipro-rails (~> 1.2.5.0.branch) - devise - factory_girl_rails - font-awesome-rails + config (= 1.0.0) + database_cleaner (= 1.5.3) + designmodo-flatuipro-rails! + devise (= 3.3.0) + edi_codec! + eye (= 0.10.0) + factory_girl (= 4.5.0) + factory_girl_rails (= 4.5.0) + font-awesome-rails (= 4.2.0.0) + forkr (= 1.0.2) haml - jquery-rails - jquery-ui-rails - kaminari - less-rails-bootstrap + ibsciss-middleware! + interactor (~> 3.0) + interactor-rails (= 2.0.2) + jquery-rails (= 3.1.3) + jquery-ui-rails (= 5.0.5) + kaminari (= 0.16.3) + less-rails-bootstrap (= 3.2.0) + libv8 mongoid (~> 3.1.6) mongoid-rspec - mongoid_auto_increment + mongoid_auto_increment (= 0.1.2) + nio4r (= 1.1.1) nokogiri (~> 1.6.1) + nokogiri-happymapper oj + openhbx_cv2! origin + overcommit (= 0.44.0) + parallel_tests pd_x12 - rails (= 3.2.16) - roo + prawn (~> 0.11.1) + psych (= 2.0.5) + puma (~> 2.16) + rails (= 3.2.22.5) + rails_best_practices + rake (= 10.4.2) + rgl (= 0.5.2) + roo (= 2.1.0) rsec - rspec-rails - ruby-progressbar + rspec (= 3.3.0) + rspec-collection_matchers (= 1.1.2) + rspec-core (= 3.3.2) + rspec-rails (= 3.3.3) + rspec_junit_formatter + rubocop (= 0.57.2) + rubocop-git (= 0.1.3) + ruby-ole (= 1.2.11.7) + ruby-progressbar (~> 1.7) + rubyXL (= 3.4.6) sass-rails (~> 3.2.3) - simple_form - therubyracer + savon (= 2.7) + simplecov + spreadsheet (= 1.0.4) + test-unit + therubyracer (= 0.12.2) uglifier (>= 1.0.3) - unicorn + unicorn (= 4.8.2) + virtus + +BUNDLED WITH + 1.17.3 diff --git a/README.md b/README.md new file mode 100644 index 000000000..9666d82d5 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +#Gluedb + +*This document is intended for the internal development team.* + +##Setup + +###Setup the Rails Project +``` +git clone https://github.com/dchbx/gluedb.git +cd gluedb +bundle install +``` + +###Setup Flat-UI + +This is now done by installing a custom version of the gem from a private repository. + +Consult devops for access. + +###Setup Mongodb + +You will need mongo <= 3.4. + +``` +brew install mongodb +``` + +Start Mongodb Daemon +``` +mongod +``` + +Get the mongodb dump (ask a team member). Go to the directory where the dump director resides (i.e. one level above dump directory). +``` +mongorestore +``` +### License + +The software is available as open source under the terms of the MIT License (MIT) + +Copyright (c) 2014-2019 IdeaCrew, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Rakefile b/Rakefile index c828e193a..c697e6fea 100644 --- a/Rakefile +++ b/Rakefile @@ -11,3 +11,13 @@ task :default do load 'rspec/rails/tasks/rspec.rake' Rake::Task["spec"].invoke end + + +desc "Run tests as default task" +task :ci do + Bundler.require(:test) + load 'rspec/rails/tasks/rspec.rake' + require 'ci/reporter/rake/rspec' + Rake::Task["ci:setup:rspec"].invoke + Rake::Task["spec"].invoke +end diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 000000000..c88a12069 --- /dev/null +++ b/TODO.txt @@ -0,0 +1,7 @@ +TODO +- work address is saved but not transmitted +- address changes... "nothing" happens +- remove transmit bool from request, specs, and usecase +- remove console and console spec +- rename address changer specs (missing _spec) +- implement Person.find_by_id diff --git a/app/assets/fonts/Open_Sans/LICENSE.txt b/app/assets/fonts/Open_Sans/LICENSE.txt new file mode 100755 index 000000000..75b52484e --- /dev/null +++ b/app/assets/fonts/Open_Sans/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/app/assets/fonts/Open_Sans/OpenSans-Bold.ttf b/app/assets/fonts/Open_Sans/OpenSans-Bold.ttf new file mode 100755 index 000000000..7b5294560 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-Bold.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-BoldItalic.ttf b/app/assets/fonts/Open_Sans/OpenSans-BoldItalic.ttf new file mode 100755 index 000000000..a670e1426 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-BoldItalic.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-ExtraBold.ttf b/app/assets/fonts/Open_Sans/OpenSans-ExtraBold.ttf new file mode 100755 index 000000000..3660681d3 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-ExtraBold.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-ExtraBoldItalic.ttf b/app/assets/fonts/Open_Sans/OpenSans-ExtraBoldItalic.ttf new file mode 100755 index 000000000..8c4c15d88 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-ExtraBoldItalic.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-Italic.ttf b/app/assets/fonts/Open_Sans/OpenSans-Italic.ttf new file mode 100755 index 000000000..e6c541417 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-Italic.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-Light.ttf b/app/assets/fonts/Open_Sans/OpenSans-Light.ttf new file mode 100755 index 000000000..563872c76 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-Light.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-LightItalic.ttf b/app/assets/fonts/Open_Sans/OpenSans-LightItalic.ttf new file mode 100755 index 000000000..5ebe2a299 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-LightItalic.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-Regular.ttf b/app/assets/fonts/Open_Sans/OpenSans-Regular.ttf new file mode 100755 index 000000000..2e31d0242 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-Regular.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-SemiBold.ttf b/app/assets/fonts/Open_Sans/OpenSans-SemiBold.ttf new file mode 100755 index 000000000..99db86aa0 Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-SemiBold.ttf differ diff --git a/app/assets/fonts/Open_Sans/OpenSans-SemiBoldItalic.ttf b/app/assets/fonts/Open_Sans/OpenSans-SemiBoldItalic.ttf new file mode 100755 index 000000000..8cad4e32f Binary files /dev/null and b/app/assets/fonts/Open_Sans/OpenSans-SemiBoldItalic.ttf differ diff --git a/app/assets/images/favicon.png b/app/assets/images/favicon.png new file mode 100644 index 000000000..98a2e85d2 Binary files /dev/null and b/app/assets/images/favicon.png differ diff --git a/app/assets/javascripts/api/v1/employers.js.coffee b/app/assets/javascripts/api/v1/employers.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/api/v1/employers.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/api/v1/family.js.coffee b/app/assets/javascripts/api/v1/family.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/api/v1/family.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/api/v1/households.js.coffee b/app/assets/javascripts/api/v1/households.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/api/v1/households.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/api/v1/people.js.coffee b/app/assets/javascripts/api/v1/people.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/api/v1/people.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/api/v1/policies.js.coffee b/app/assets/javascripts/api/v1/policies.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/api/v1/policies.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 655848dba..565002d56 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,13 +11,14 @@ // GO AFTER THE REQUIRES BELOW. // //= require jquery -//= require jquery.ui.button -//= require jquery.ui.datepicker -//= require jquery.ui.slider -//= require jquery.ui.spinner -//= require jquery.ui.tooltip -//= require jquery.ui.effect +//= require jquery-ui/button +//= require jquery-ui/datepicker +//= require jquery-ui/slider +//= require jquery-ui/spinner +//= require jquery-ui/tooltip +//= require jquery-ui/effect //= require flatuipro //= require jquery_ujs //= require twitter/bootstrap +//= require highlight/highlight.pack //= require_tree . diff --git a/app/assets/javascripts/carefirst_policy_updates.js.coffee b/app/assets/javascripts/carefirst_policy_updates.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/carefirst_policy_updates.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/change_vocabularies.js b/app/assets/javascripts/change_vocabularies.js new file mode 100644 index 000000000..31b6bea28 --- /dev/null +++ b/app/assets/javascripts/change_vocabularies.js @@ -0,0 +1,14 @@ +$(document).ready(function() { + $("input[id^='change'][id$='include_selected']").on('click', function() { + var select = $(this).val(); + var affect = $(this).closest('td').next('td').find(':checkbox'); + + if(select==1) { + affect.prop('disabled', !$(this).is(':checked')); + affect.prop('checked', false); + }else { + affect.prop('enabled', !$(this).is(':checked')); + affect.prop('checked', true); + } + }); +}); diff --git a/app/assets/javascripts/docs.js b/app/assets/javascripts/docs.js new file mode 100644 index 000000000..0cb891931 --- /dev/null +++ b/app/assets/javascripts/docs.js @@ -0,0 +1,253 @@ +/*! + * JavaScript for Flat UI's docs (http://designmodo.com/flat) + * Copyright 2013-2014 Designmodo, Inc. + */ + +// Some general UI pack related JS +// Extend JS String with repeat method +String.prototype.repeat = function (num) { + 'use strict'; + return new Array(num + 1).join(this); +}; + +(function ($) { + 'use strict'; + + // Add segments to a slider + $.fn.addSliderSegments = function (amount, orientation) { + return this.each(function () { + if (orientation === 'vertical') { + var output = ''; + var i; + for (i = 1; i <= amount - 2; i++) { + output += '
'; + } + $(this).prepend(output); + } else { + var segmentGap = 100 / (amount - 1) + '%'; + var segment = '
'; + $(this).prepend(segment.repeat(amount - 2)); + } + }); + }; + + $(function () { + + // Custom Selects + if ($('[data-toggle="select"]').length) { + $('[data-toggle="select"]').select2(); + } + + // Checkboxes and Radiobuttons + + $('[data-toggle="checkbox"]').radiocheck(); + $('[data-toggle="radio"]').radiocheck(); + + // Tabs + $('.nav-tabs a').on('click', function (e) { + e.preventDefault(); + $(this).tab('show'); + }); + + // Tooltips + $('[data-toggle="tooltip"]').tooltip('show'); + + // Popovers + $('[data-toggle="popover"]').popover(); + + // jQuery UI Sliders + var $slider = $('#slider'); + if ($slider.length) { + $slider.slider({ + min: 1, + max: 5, + values: [3, 4], + orientation: 'horizontal', + range: true + }).addSliderSegments($slider.slider('option').max); + + } + + var $slider2 = $('#slider2'); + if ($slider2.length) { + $slider2.slider({ + min: 1, + max: 5, + values: [3, 4], + orientation: 'horizontal', + range: true + }).addSliderSegments($slider2.slider('option').max); + } + + var $slider3 = $('#slider3'); + var slider3ValueMultiplier = 100; + var slider3Options; + + if ($slider3.length) { + $slider3.slider({ + min: 1, + max: 5, + values: [3, 4], + orientation: 'horizontal', + range: true, + slide: function (event, ui) { + $slider3.find('.ui-slider-value:first') + .text('$' + ui.values[0] * slider3ValueMultiplier) + .end() + .find('.ui-slider-value:last') + .text('$' + ui.values[1] * slider3ValueMultiplier); + } + }); + + slider3Options = $slider3.slider('option'); + $slider3.addSliderSegments(slider3Options.max) + .find('.ui-slider-value:first') + .text('$' + slider3Options.values[0] * slider3ValueMultiplier) + .end() + .find('.ui-slider-value:last') + .text('$' + slider3Options.values[1] * slider3ValueMultiplier); + } + + var $verticalSlider = $('#vertical-slider'); + if ($verticalSlider.length) { + $verticalSlider.slider({ + min: 1, + max: 5, + value: 3, + orientation: 'vertical', + range: 'min' + }).addSliderSegments($verticalSlider.slider('option').max, 'vertical'); + } + + // Placeholders for input/textarea + $(':text, textarea').placeholder(); + + // Make pagination demo work + $('.pagination').on('click', 'a', function () { + $(this).parent().siblings('li').removeClass('active').end().addClass('active'); + }); + + $('.btn-group').on('click', 'a', function () { + $(this).siblings().removeClass('active').end().addClass('active'); + }); + + // Disable link clicks to prevent page scrolling + $(document).on('click', 'a[href="#fakelink"]', function (e) { + e.preventDefault(); + }); + + // jQuery UI Spinner + if (typeof $.ui != 'undefined') { + $.widget('ui.customspinner', $.ui.spinner, { + widgetEventPrefix: $.ui.spinner.prototype.widgetEventPrefix, + _buttonHtml: function () { // Remove arrows on the buttons + return '' + + '' + + '' + + '' + + '' + + '' + + ''; + } + }); + + $('#spinner-01, #spinner-02, #spinner-03, #spinner-04, #spinner-05').customspinner({ + min: -99, + max: 99 + }).on('focus', function () { + $(this).closest('.ui-spinner').addClass('focus'); + }).on('blur', function () { + $(this).closest('.ui-spinner').removeClass('focus'); + }); + } + + + // Focus state for append/prepend inputs + $('.input-group').on('focus', '.form-control', function () { + $(this).closest('.input-group, .form-group').addClass('focus'); + }).on('blur', '.form-control', function () { + $(this).closest('.input-group, .form-group').removeClass('focus'); + }); + + // Table: Toggle all checkboxes + $('.table .toggle-all :checkbox').on('click', function () { + var $this = $(this); + var ch = $this.prop('checked'); + $this.closest('.table').find('tbody :checkbox').radiocheck(!ch ? 'uncheck' : 'check'); + }); + + // Table: Add class row selected + $('.table tbody :checkbox').on('change.radiocheck', function () { + var $this = $(this); + var check = $this.prop('checked'); + var checkboxes = $('.table tbody :checkbox'); + var checkAll = checkboxes.length === checkboxes.filter(':checked').length; + + $this.closest('tr')[check ? 'addClass' : 'removeClass']('selected-row'); + $this.closest('.table').find('.toggle-all :checkbox').radiocheck(checkAll ? 'check' : 'uncheck'); + }); + + // jQuery UI Datepicker + if (typeof $.ui != 'undefined') { + var datepickerSelector = $('#datepicker-01'); + datepickerSelector.datepicker({ + showOtherMonths: true, + selectOtherMonths: true, + dateFormat: 'd MM, yy', + yearRange: '-1:+1' + }).prev('.input-group-btn').on('click', function (e) { + e && e.preventDefault(); + datepickerSelector.focus(); + }); + $.extend($.datepicker, { _checkOffset: function (inst,offset,isFixed) { return offset; } }); + + // Now let's align datepicker with the prepend button + datepickerSelector.datepicker('widget').css({ 'margin-left': -datepickerSelector.prev('.input-group-btn').find('.btn').outerWidth() + 3 }); + } + + // Timepicker + if ($('#timepicker1').length) { + $('#timepicker1').timepicker().on('click', function () { + $(this).timepicker('showWidget'); + }); + } + + // Switches + if ($('[data-toggle="switch"]').length) { + $('[data-toggle="switch"]').bootstrapSwitch(); + } + + // Typeahead + if ($('#typeahead-demo-01').length) { + var states = new Bloodhound({ + datumTokenizer: function (d) { return Bloodhound.tokenizers.whitespace(d.word); }, + queryTokenizer: Bloodhound.tokenizers.whitespace, + limit: 4, + local: [ + { word: 'Alabama' }, + { word: 'Alaska' }, + { word: 'Arizona' }, + { word: 'Arkansas' }, + { word: 'California' }, + { word: 'Colorado' } + ] + }); + + states.initialize(); + + $('#typeahead-demo-01').typeahead(null, { + name: 'states', + displayKey: 'word', + source: states.ttAdapter() + }); + } + + // Todo list + $('.todo').on('click', 'li', function () { + $(this).toggleClass('todo-done'); + }); + + // make code pretty + window.prettyPrint && prettyPrint(); + }); +}(jQuery)); diff --git a/app/assets/javascripts/dynamic_nested_fields.js.coffee b/app/assets/javascripts/dynamic_nested_fields.js.coffee index 636f7a39f..314954a88 100644 --- a/app/assets/javascripts/dynamic_nested_fields.js.coffee +++ b/app/assets/javascripts/dynamic_nested_fields.js.coffee @@ -11,16 +11,12 @@ jQuery -> $('form').on 'click', '.remove_fields', (event) -> event.preventDefault() - fieldset = $(this).closest('fieldset') - fieldset.find('input[type=hidden]').val('1') - fieldset.hide() + $(this).closest('fieldset').remove() update_delete_buttons() style_select_picker = -> - $(document).find('select').selectpicker - style: 'btn-info', - menuStyle: 'dropdown-inverse' - + $(document).find('select').select2() + @update_delete_buttons = -> nested_fields = $('.form-inputs') nested_fields.each -> @@ -29,4 +25,4 @@ style_select_picker = -> if visible_fieldsets.length == 1 delete_button.hide() else - delete_button.show() \ No newline at end of file + delete_button.show() \ No newline at end of file diff --git a/app/assets/javascripts/flatuipro-demo.js b/app/assets/javascripts/flatuipro-demo.js index e1761ac02..3c5a45b42 100644 --- a/app/assets/javascripts/flatuipro-demo.js +++ b/app/assets/javascripts/flatuipro-demo.js @@ -7,7 +7,7 @@ String.prototype.repeat = function(num) { (function($) { // Add segments to a slider - $.fn.addSliderSegments = function (amount, orientation) { + $.fn.addSliderSegments = function (amount, orientation) { return this.each(function () { if (orientation == "vertical") { var output = '' @@ -27,10 +27,10 @@ String.prototype.repeat = function(num) { $(function() { // Custom Selects - $("select[name='huge']").selectpicker({style: 'btn-hg btn-primary', menuStyle: 'dropdown-inverse'}); - $("select[name='large']").selectpicker({style: 'btn-lg btn-danger'}); - $("select[name='info']").selectpicker({style: 'btn-info'}); - $("select[name='small']").selectpicker({style: 'btn-sm btn-warning'}); + // $("select[name='huge']").selectpicker({style: 'btn-hg btn-primary', menuStyle: 'dropdown-inverse'}); + // $("select[name='large']").selectpicker({style: 'btn-lg btn-danger'}); + // $("select[name='info']").selectpicker({style: 'btn-info'}); + // $("select[name='small']").selectpicker({style: 'btn-sm btn-warning'}); // Tabs $(".nav-tabs a").on('click', function (e) { @@ -42,7 +42,7 @@ String.prototype.repeat = function(num) { $("[data-toggle=tooltip]").tooltip("show"); // Tags Input - $(".tagsinput").tagsInput(); + // $(".tagsinput").tagsInput(); // jQuery UI Sliders var $slider = $("#slider"); @@ -211,7 +211,7 @@ String.prototype.repeat = function(num) { "North Carolina","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina", "South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"] }); - } + } // make code pretty window.prettyPrint && prettyPrint(); diff --git a/app/assets/javascripts/flatuipro.js b/app/assets/javascripts/flatuipro.js index 9eae6c9f5..e42a2d012 100644 --- a/app/assets/javascripts/flatuipro.js +++ b/app/assets/javascripts/flatuipro.js @@ -1,8 +1,11 @@ -//= require jquery.ui.touch-punch.min -//= require bootstrap-select +//= require fileinput +//= require radiocheck //= require bootstrap-switch -//= require flatui-checkbox -//= require flatui-radio -//= require jquery.tagsinput +//= require bootstrap-tagsinput +//= require holder //= require jquery.placeholder -//= require typeahead +//= require jquery.ui.touch-punch +//= require respond +//= require select2 +//= require typeahead.bundle +//= require video diff --git a/app/assets/javascripts/highlight.js b/app/assets/javascripts/highlight.js new file mode 100644 index 000000000..6e5b60b30 --- /dev/null +++ b/app/assets/javascripts/highlight.js @@ -0,0 +1,5 @@ +$(document).ready(function() { + $('pre code').each(function(i, block) { + hljs.highlightBlock(block); + }); +}); diff --git a/app/assets/javascripts/highlight/highlight.pack.js b/app/assets/javascripts/highlight/highlight.pack.js new file mode 100644 index 000000000..225118222 --- /dev/null +++ b/app/assets/javascripts/highlight/highlight.pack.js @@ -0,0 +1,2 @@ +/*! highlight.js v9.9.0 | BSD3 License | git.io/hljslicense */ +!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/[&<>]/gm,function(e){return I[e]})}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function i(e){return k.test(e)}function a(e){var n,t,r,a,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return R(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(a=o[n],i(a)||R(a))return a}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,i){for(var a=e.firstChild;a;a=a.nextSibling)3===a.nodeType?i+=a.nodeValue.length:1===a.nodeType&&(n.push({event:"start",offset:i,node:a}),i=r(a,i),t(a).match(/br|hr|img|input/)||n.push({event:"stop",offset:i,node:a}));return i}(e,0),n}function c(e,r,i){function a(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function u(e){l+=""}function c(e){("start"===e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=a();if(l+=n(i.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=a();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(i.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(i,a){if(!i.compiled){if(i.compiled=!0,i.k=i.k||i.bK,i.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof i.k?c("keyword",i.k):E(i.k).forEach(function(e){c(e,i.k[e])}),i.k=u}i.lR=t(i.l||/\w+/,!0),a&&(i.bK&&(i.b="\\b("+i.bK.split(" ").join("|")+")\\b"),i.b||(i.b=/\B|\b/),i.bR=t(i.b),i.e||i.eW||(i.e=/\B|\b/),i.e&&(i.eR=t(i.e)),i.tE=n(i.e)||"",i.eW&&a.tE&&(i.tE+=(i.e?"|":"")+a.tE)),i.i&&(i.iR=t(i.i)),null==i.r&&(i.r=1),i.c||(i.c=[]);var s=[];i.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"===e?i:e)}),i.c=s,i.c.forEach(function(e){r(e,i)}),i.starts&&r(i.starts,a);var l=i.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([i.tE,i.i]).map(n).filter(Boolean);i.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,i,a){function o(e,n){var t,i;for(t=0,i=n.c.length;i>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!i&&r(n.iR,e)}function g(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function h(e,n,t,r){var i=r?"":y.classPrefix,a='',a+n+o}function p(){var e,t,r,i;if(!E.k)return n(B);for(i="",t=0,E.lR.lastIndex=0,r=E.lR.exec(B);r;)i+=n(B.substring(t,r.index)),e=g(E,r),e?(M+=e[1],i+=h(e[0],n(r[0]))):i+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(B);return i+n(B.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!x[E.sL])return n(B);var t=e?l(E.sL,B,!0,L[E.sL]):f(B,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(L[E.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){k+=null!=E.sL?d():p(),B=""}function v(e){k+=e.cN?h(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(B+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?B+=n:(t.eB&&(B+=n),b(),t.rB||t.eB||(B=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var i=E;i.skip?B+=n:(i.rE||i.eE||(B+=n),b(),i.eE&&(B=n));do E.cN&&(k+=C),E.skip||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),i.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return B+=n,n.length||1}var N=R(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,E=a||N,L={},k="";for(w=E;w!==N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var B="",M=0;try{for(var I,j,O=0;;){if(E.t.lastIndex=O,I=E.t.exec(t),!I)break;j=m(t.substring(O,I.index),I[0]),O=I.index+j}for(m(t.substr(O)),w=E;w.parent;w=w.parent)w.cN&&(k+=C);return{r:M,value:k,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function f(e,t){t=t||y.languages||E(x);var r={r:0,value:n(e)},i=r;return t.filter(R).forEach(function(n){var t=l(n,e,!1);t.language=n,t.r>i.r&&(i=t),t.r>r.r&&(i=r,r=t)}),i.language&&(r.second_best=i),r}function g(e){return y.tabReplace||y.useBR?e.replace(M,function(e,n){return y.useBR&&"\n"===e?"
":y.tabReplace?n.replace(/\t/g,y.tabReplace):void 0}):e}function h(e,n,t){var r=n?L[n]:t,i=[e.trim()];return e.match(/\bhljs\b/)||i.push("hljs"),-1===e.indexOf(r)&&i.push(r),i.join(" ").trim()}function p(e){var n,t,r,o,s,p=a(e);i(p)||(y.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,s=n.textContent,r=p?l(p,s,!0):f(s),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),s)),r.value=g(r.value),e.innerHTML=r.value,e.className=h(e.className,p,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function d(e){y=o(y,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");w.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=x[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function N(){return E(x)}function R(e){return e=(e||"").toLowerCase(),x[e]||x[L[e]]}var w=[],E=Object.keys,x={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="
",y={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},I={"&":"&","<":"<",">":">"};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=R,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var i=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return i.c.push(e.PWM),i.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),i},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0}]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"meta",v:[{b:/<\?xml/,e:/\?>/,r:10},{b:/<\?\w+/,e:/\?>/}]},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}}); \ No newline at end of file diff --git a/app/assets/javascripts/mass_silent_cancels.js.coffee b/app/assets/javascripts/mass_silent_cancels.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/mass_silent_cancels.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/people.js.coffee b/app/assets/javascripts/people.js.coffee index 92f8d0277..4a1b40d44 100644 --- a/app/assets/javascripts/people.js.coffee +++ b/app/assets/javascripts/people.js.coffee @@ -10,15 +10,21 @@ jQuery -> changeMonth: true, dateFormat: "mm/dd/yy", yearRange: '-80:+1' + onChangeMonthYear: (year, month, inst) -> + selectedDate = $(this).datepicker("getDate") + if(selectedDate == null) + return + selectedDate.setMonth month - 1 # 0-11 + selectedDate.setFullYear year + $(this).datepicker "setDate", selectedDate $('.input-group-btn button').click -> $('.date_picker').datepicker("show") - $("select").selectpicker - style: 'btn-info', - menuStyle: 'dropdown-inverse' - # size: 5 - + $("select").select2() + + $('.nav.nav-list .disabled a').removeAttr('href') + update_delete_buttons() $('#setAuthorityLink').click -> $('#authorityIDModal').modal({}) diff --git a/app/assets/javascripts/plans.js b/app/assets/javascripts/plans.js index 24aff1b51..5031dbaa1 100644 --- a/app/assets/javascripts/plans.js +++ b/app/assets/javascripts/plans.js @@ -1,22 +1,45 @@ $(document).ready(function() { - $('.btn#Plans').prop('disabled', true); - $('#Carriers').change(function(e) { - $('.btn#Plans').prop('disabled', false); - $( "option[value|='']" ).remove() + $('#plan-years').prop('disabled', true); + $('#plans').prop('disabled', true); + + $('#carriers').change(function(e) { + $('#plans').prop('disabled', true); + $('#plan-years').prop('disabled', false); + $('#plans').empty(); + $('#plan-years').empty(); + var id = $('#carriers').val(); + $.getJSON('/carriers/'+ id +'/plan_years', function(data) { + $.each(data, function(key, value) { + $('#plan-years').append($('