├── .better-html.yml ├── .browserslistrc ├── .circleci └── config.yml ├── .editorconfig ├── .erb-lint.yml ├── .eslintrc.js ├── .gitattributes ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ └── test.yml ├── .gitignore ├── .pronto.yml ├── .pronto_eslint_npm.yml ├── .reek.yml ├── .rubocop.yml ├── .ruby-version ├── .simplecov ├── .yamllint.yml ├── Brewfile ├── Gemfile ├── Gemfile.lock ├── Gemfile.tools ├── Gemfile.tools.lock ├── LICENSE ├── Procfile ├── README.md ├── Rakefile ├── app.json ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ └── .keep │ └── stylesheets │ │ └── application.css ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ └── landing_controller.rb ├── helpers │ └── application_helper.rb ├── javascript │ ├── app.vue │ ├── assets │ │ └── adminlte.scss │ ├── initializers │ │ ├── adminlte.js │ │ ├── plugins.js │ │ ├── polyfills.js │ │ └── turbolinks.js │ ├── packs │ │ ├── application.js │ │ ├── hello_vue.js │ │ └── serviceworker.js │ └── serviceworker-companion.js ├── jobs │ └── application_job.rb ├── models │ ├── application_record.rb │ └── concerns │ │ └── .keep └── views │ ├── landing │ └── index.html.erb │ └── layouts │ └── application.html.erb ├── babel.config.js ├── bin ├── bundle ├── circleci-auto_upgrade_tools ├── git-hooks │ ├── post-merge │ └── pre-push ├── heroku-postdeploy ├── heroku-release ├── lint-pr ├── pronto ├── rails ├── rake ├── rubocop ├── setup ├── spring ├── standardrb ├── tools-setup ├── tools-upgrade ├── webpack ├── webpack-dev-server └── yarn ├── codecov.yml ├── config.ru ├── config ├── application.rb ├── boot.rb ├── credentials.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ ├── staging.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── permissions_policy.rb │ ├── serviceworker.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── puma.rb ├── rails_best_practices.yml ├── routes.rb ├── spring.rb ├── storage.yml ├── webpack │ ├── development.js │ ├── environment.js │ ├── loaders │ │ └── vue.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── package.json ├── postcss.config.js ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico ├── offline.html └── robots.txt ├── storage └── .keep ├── test ├── application_system_test_case.rb ├── controllers │ ├── .keep │ └── landing_controller_test.rb ├── fixtures │ └── files │ │ └── .keep ├── helpers │ └── .keep ├── integration │ └── .keep ├── javascript │ ├── __snapshots__ │ │ └── app.test.js.snap │ ├── app.test.js │ └── test.test.js ├── models │ └── .keep ├── system │ ├── .keep │ └── app_component_integrations_test.rb └── test_helper.rb ├── tmp ├── .keep └── pids │ └── .keep ├── vendor └── .keep └── yarn.lock /.better-html.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/.better-html.yml -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Ruby CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-ruby/ for more details 4 | # 5 | --- 6 | 7 | version: 2.1 8 | 9 | orbs: 10 | browser-tools: circleci/browser-tools@1 11 | node: circleci/node@4 12 | ruby: circleci/ruby@1 13 | 14 | workflows: 15 | version: 2 16 | commit: 17 | jobs: 18 | - test: 19 | requires: 20 | - lint 21 | - lint: 22 | filters: 23 | branches: 24 | ignore: 25 | - master 26 | - production 27 | - staging 28 | merge: 29 | jobs: 30 | - test: 31 | filters: 32 | branches: 33 | only: 34 | - master 35 | - production 36 | - staging 37 | 38 | auto_upgrade_tools: 39 | triggers: 40 | - schedule: 41 | cron: "0 10 1 * *" 42 | filters: 43 | branches: 44 | only: 45 | - master 46 | jobs: 47 | - upgrade_tools 48 | 49 | jobs: 50 | test: 51 | docker: 52 | # specify the version you desire here 53 | - image: cimg/ruby:3.0.0-browsers 54 | environment: 55 | BUNDLE_GEMFILE: Gemfile 56 | BUNDLE_PATH: vendor/bundle 57 | BUNDLE_JOBS: 4 58 | BUNDLE_RETRY: 3 59 | BUNDLE_WITHOUT: "production:staging:development" 60 | COVERAGE: true 61 | DATABASE_URL: postgresql://ubuntu@localhost/db 62 | NODE_ENV: test 63 | RACK_ENV: test 64 | RAILS_ENV: test 65 | 66 | # Specify service dependencies here if necessary 67 | # CircleCI maintains a library of pre-built images 68 | # documented at https://circleci.com/docs/2.0/circleci-images/ 69 | - image: circleci/postgres:alpine-ram 70 | environment: 71 | POSTGRES_USER: ubuntu 72 | POSTGRES_DB: db 73 | 74 | steps: 75 | - checkout 76 | - browser-tools/install-chrome 77 | - browser-tools/install-chromedriver 78 | 79 | - restore_cache: 80 | name: Restore Bundler Cache between Branches 81 | keys: 82 | - v1-dependencies-{{ checksum "Gemfile.lock" }} 83 | - v1-dependencies- 84 | 85 | - ruby/install-deps: 86 | bundler-version: '`cat Gemfile.lock | tail -1 | tr -d " "`' 87 | key: v1-dependencies 88 | with-cache: false 89 | path: './vendor/bundle' 90 | 91 | - run: bundle exec bootsnap precompile --gemfile app/ lib/ 92 | - run: gem install spring 93 | 94 | - save_cache: 95 | name: Save Bundler Cache between Branches 96 | paths: 97 | - vendor/bundle 98 | - tmp/cache/bootsnap-compile-cache 99 | key: v1-dependencies-{{ checksum "Gemfile.lock" }} 100 | 101 | - node/install-packages: 102 | app-dir: . 103 | pkg-manager: yarn 104 | cache-version: v1 105 | 106 | - restore_cache: 107 | keys: 108 | - asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ .Environment.CIRCLE_SHA1 }} 109 | - asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}- 110 | - asset-cache-v1-{{ arch }}-{{ .Branch }}- 111 | - asset-cache-v1-{{ arch }}-master- 112 | 113 | - run: 114 | name: Precompile Assets 115 | command: | 116 | bin/rails assets:precompile 117 | 118 | - save_cache: 119 | key: asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ .Environment.CIRCLE_SHA1 }} 120 | paths: 121 | - public/packs-test 122 | - tmp/cache/assets 123 | - tmp/cache/webpacker 124 | 125 | # Run JS Tests 126 | # - restore_cache: 127 | # name: Restore Jest Cache 128 | # keys: 129 | # - jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }} 130 | # - jest-cache-v1-{{ arch }}-{{ .Branch }}- 131 | # - jest-cache-v1- 132 | # 133 | # - run: 134 | # name: JavaScript Unit Tests 135 | # command: | 136 | # bin/yarn test --ci --no-watchman \ 137 | # --coverage --coverageDirectory coverage/jest \ 138 | # --coverageReporters text-summary --coverageReporters html \ 139 | # --reporters=jest-junit 140 | # environment: 141 | # JEST_JUNIT_OUTPUT_DIR: tmp/reports/jest-results 142 | # 143 | # - save_cache: 144 | # name: Save Jest Cache 145 | # key: jest-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }} 146 | # paths: 147 | # - tmp/cache/jest 148 | 149 | - run: bin/rails db:test:prepare 150 | - run: bin/rails test "test/**/*_test.rb" 151 | 152 | # Collect reports 153 | - store_test_results: 154 | path: ./tmp/reports/ 155 | - store_artifacts: 156 | path: ./coverage 157 | - store_artifacts: 158 | path: ./tmp/screenshots 159 | lint: 160 | docker: 161 | - image: cimg/ruby:3.0.0-node 162 | environment: 163 | DISABLE_SPRING: 1 164 | BUNDLE_GEMFILE: Gemfile.tools 165 | BUNDLE_PATH: vendor/bundle-tools 166 | BUNDLE_JOBS: 4 167 | BUNDLE_RETRY: 3 168 | 169 | steps: 170 | - checkout 171 | 172 | - restore_cache: 173 | keys: 174 | - v1-tools-dependencies-{{ checksum "Gemfile.tools.lock" }}-{{ checksum "yarn.lock" }} 175 | - v1-tools-dependencies- 176 | 177 | - run: 178 | name: Install cmake for building pronto dependencies 179 | command: sudo apt-get update -qq 180 | && sudo apt-get install -yq --no-install-recommends 181 | cmake yamllint python3-setuptools python3-pkg-resources pkg-config 182 | 183 | - run: 184 | name: Install Bundle Dependencies 185 | command: bin/bundle check || bin/bundle install 186 | 187 | - run: 188 | name: Install Node Packages 189 | command: bin/yarn check || bin/yarn install 190 | 191 | - save_cache: 192 | key: v1-tools-dependencies-{{ checksum "Gemfile.tools.lock" }}-{{ checksum "yarn.lock" }} 193 | paths: 194 | - ./vendor/bundle-tools 195 | - ./node_modules 196 | 197 | - run: bin/lint-pr 198 | 199 | upgrade_tools: 200 | docker: 201 | - image: cimg/ruby:3.0.0-node 202 | environment: 203 | DISABLE_SPRING: 1 204 | BUNDLE_GEMFILE: Gemfile.tools 205 | BUNDLE_JOBS: 4 206 | BUNDLE_RETRY: 3 207 | 208 | steps: 209 | - checkout 210 | 211 | - run: 212 | name: Install Bundler 213 | command: | 214 | echo 'export BUNDLER_VERSION=$(cat Gemfile.tools.lock | tail -1 | tr -d " ")' >> $BASH_ENV 215 | source $BASH_ENV 216 | gem install bundler:$BUNDLER_VERSION 217 | 218 | - run: 219 | name: Install System Dependencies 220 | command: sudo apt-get update 221 | && sudo apt-get install cmake yamllint python3-setuptools python3-pkg-resources pkg-config 222 | 223 | - run: 224 | name: Run Gemfile tools update in separate branch 225 | command: ./bin/circleci-auto_upgrade_tools 226 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 2 7 | indent_style = space 8 | insert_final_newline = true 9 | max_line_length = 113 10 | tab_width = 2 11 | trim_trailing_whitespace = true 12 | 13 | [*.css] 14 | ij_continuation_indent_size = 2 15 | ij_css_align_closing_brace_with_properties = false 16 | ij_css_blank_lines_around_nested_selector = 1 17 | ij_css_blank_lines_between_blocks = 1 18 | ij_css_keep_blank_lines_in_code = 2 19 | ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow 20 | 21 | [*.haml] 22 | tab_width = 2 23 | ij_haml_keep_indents_on_empty_lines = false 24 | 25 | [*.properties] 26 | 27 | [*.scss] 28 | ij_continuation_indent_size = 2 29 | ij_scss_align_closing_brace_with_properties = false 30 | ij_scss_blank_lines_around_nested_selector = 1 31 | ij_scss_blank_lines_between_blocks = 1 32 | 33 | [.editorconfig] 34 | 35 | [{*.js,*.cjs}] 36 | ij_continuation_indent_size = 2 37 | 38 | [{*.sht,*.html,*.shtm,*.shtml,*.htm}] 39 | ij_continuation_indent_size = 2 40 | 41 | [{*.xslt,*.rng,*.ant,*.xsl,*.xsd,*.xul,*.jhm,*.xml,*.tld,*.fxml,*.wsdl,*.jrxml,*.jnlp}] 42 | tab_width = 2 43 | 44 | [{*.yml,*.yaml}] 45 | tab_width = 2 46 | 47 | [{.babelrc,.stylelintrc,.eslintrc,jest.config,.resultset.json.lock,bowerrc,*.json,*.jsb3,*.jsb2}] 48 | tab_width = 2 49 | 50 | [{Podfile,Brewfile,cucumber,yarn,spork,Gemfile.tools,rake,.simplecov,rcov,rails,spec,capfile,gemfile,rakefile,guardfile,isolate,vagrantfile,*.gemspec,*.jbuilder,*.thor,*.rbw,*.ru,*.rb,*.rake}] 51 | ij_ruby_align_group_field_declarations = false 52 | ij_ruby_align_multiline_parameters = false 53 | ij_ruby_blank_lines_around_method = 1 54 | ij_ruby_chain_calls_alignment = 0 55 | ij_ruby_convert_brace_block_by_enter = true 56 | ij_ruby_force_newlines_around_visibility_mods = true 57 | ij_ruby_indent_private_methods = false 58 | ij_ruby_indent_protected_methods = false 59 | ij_ruby_indent_public_methods = false 60 | ij_ruby_indent_when_cases = false 61 | ij_ruby_keep_blank_lines_in_declarations = 2 62 | ij_ruby_keep_line_breaks = true 63 | ij_ruby_parentheses_around_method_arguments = true 64 | ij_ruby_spaces_around_assignment_operators = true 65 | ij_ruby_spaces_around_hashrocket = true 66 | ij_ruby_spaces_around_other_operators = true 67 | ij_ruby_spaces_around_range_operators = false 68 | ij_ruby_spaces_around_relational_operators = true 69 | ij_ruby_spaces_within_array_initializer_braces = true 70 | ij_ruby_spaces_within_braces = true 71 | -------------------------------------------------------------------------------- /.erb-lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | linters: 3 | ErbSafety: 4 | enabled: true 5 | better_html_config: .better-html.yml 6 | Rubocop: 7 | enabled: true 8 | rubocop_config: 9 | inherit_from: 10 | - .rubocop.yml 11 | Layout/InitialIndentation: 12 | Enabled: false 13 | Layout/LineLength: 14 | Enabled: false 15 | Layout/TrailingEmptyLines: 16 | Enabled: false 17 | Layout/TrailingWhitespace: 18 | Enabled: false 19 | Lint/UselessAssignment: 20 | Enabled: false 21 | Naming/FileName: 22 | Enabled: false 23 | Rails/OutputSafety: 24 | Enabled: false 25 | Style/FrozenStringLiteralComment: 26 | Enabled: false 27 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // Documentation on http://eslint.org/docs/rules/ 2 | 3 | module.exports = { 4 | 'env': { 5 | 'browser': true, 6 | 'node': true, 7 | 'jquery': true 8 | }, 9 | 'rules': { 10 | 'no-unused-expressions': ['error', { 'allowShortCircuit': true }], 11 | 'max-len': ['error', { 'code': 113 }] 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files. 2 | 3 | # Mark the database schema as having been generated. 4 | db/schema.rb linguist-generated 5 | 6 | # Mark the yarn lockfile as having been generated. 7 | yarn.lock linguist-generated 8 | 9 | # Mark any vendored files as having been vendored. 10 | vendor/* linguist-vendored 11 | *.gemspec diff=ruby 12 | *.rake diff=ruby 13 | *.rb diff=ruby 14 | *.js diff=javascript 15 | 16 | db/schema.rb merge=ours diff=ruby 17 | yarn.lock merge=ours 18 | Gemfile.lock merge=ours linguist-generated 19 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [pftg] 4 | patreon: pftg 5 | custom: ['https://www.jetthoughts.com', 'https://jtway.co'] 6 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: bundler 5 | directory: "/" 6 | schedule: 7 | interval: weekly 8 | time: "10:00" 9 | open-pull-requests-limit: 3 10 | versioning-strategy: lockfile-only 11 | allow: 12 | - dependency-type: all 13 | - package-ecosystem: npm 14 | directory: "/" 15 | schedule: 16 | interval: weekly 17 | time: "10:00" 18 | open-pull-requests-limit: 3 19 | versioning-strategy: lockfile-only 20 | allow: 21 | - dependency-type: all 22 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '29 15 * * 2' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v1 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v1 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v1 72 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Test 3 | 4 | # yamllint disable-line rule:truthy 5 | on: 6 | push: 7 | branches: [$default-branch] 8 | pull_request: 9 | 10 | env: 11 | CI: true 12 | RAILS_ENV: test 13 | 14 | jobs: 15 | lint: 16 | runs-on: ubuntu-latest 17 | env: 18 | BUNDLE_GEMFILE: Gemfile.tools 19 | COVERAGE: true 20 | DISABLE_SPRING: 1 21 | steps: 22 | - run: |- 23 | sudo apt-get update -qq && \ 24 | sudo apt-get install -yq --no-install-recommends \ 25 | cmake yamllint python3-setuptools python3-pkg-resources pkg-config 26 | 27 | - uses: actions/checkout@v2 28 | with: 29 | fetch-depth: 10 30 | 31 | - name: Set up Ruby 32 | uses: ruby/setup-ruby@v1 33 | with: 34 | bundler-cache: true 35 | 36 | - name: Use Node.js 37 | uses: actions/setup-node@v1 38 | with: 39 | node-version: 14 40 | 41 | - name: Get yarn cache directory path 42 | id: yarn-cache-dir-path 43 | run: echo "::set-output name=dir::$(yarn cache dir)" 44 | 45 | - uses: actions/cache@v2 46 | with: 47 | path: | 48 | **/node_modules 49 | ${{ steps.yarn-cache-dir-path.outputs.dir }} 50 | key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} 51 | restore-keys: | 52 | ${{ runner.os }}-modules- 53 | 54 | - run: bin/yarn check || bin/yarn install 55 | 56 | - run: git fetch origin master --depth 1 57 | - run: bin/lint-pr 58 | test: 59 | needs: [lint] 60 | runs-on: ubuntu-latest 61 | env: 62 | COVERAGE: true 63 | DATABASE_URL: postgresql://postgres_user:postgres@localhost:5432/postgres_db 64 | 65 | services: 66 | postgres: 67 | image: circleci/postgres:alpine-ram 68 | env: 69 | POSTGRES_DB: postgres_db 70 | POSTGRES_USER: postgres_user 71 | POSTGRES_PASSWORD: postgres 72 | ports: 73 | - 5432:5432 74 | options: >- 75 | --health-cmd pg_isready 76 | --health-interval 10s 77 | --health-timeout 5s 78 | --health-retries 5 79 | 80 | steps: 81 | - name: Install PostgreSQL 11 client 82 | run: | 83 | sudo apt-get -yqq install libpq-dev 84 | 85 | - uses: actions/checkout@v2 86 | - name: Set up Ruby 87 | uses: ruby/setup-ruby@v1 88 | with: 89 | ruby-version: 3.0 90 | bundler-cache: true 91 | 92 | - name: Setup DB 93 | run: bundle exec rake db:test:prepare 94 | 95 | - name: Use Node.js 96 | uses: actions/setup-node@v1 97 | with: 98 | node-version: 14 99 | 100 | - name: Get yarn cache directory path 101 | id: yarn-cache-dir-path 102 | run: echo "::set-output name=dir::$(yarn cache dir)" 103 | 104 | - uses: actions/cache@v2 105 | with: 106 | path: | 107 | **/node_modules 108 | ${{ steps.yarn-cache-dir-path.outputs.dir }} 109 | key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} 110 | restore-keys: | 111 | ${{ runner.os }}-modules- 112 | 113 | - run: bin/yarn check || bin/yarn install 114 | 115 | - uses: actions/cache@v2 116 | with: 117 | path: | 118 | public/assets 119 | public/packs-test 120 | tmp/cache/assets 121 | tmp/cache/webpacker 122 | key: "${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}\ 123 | -${{ hashFiles('**/app/assets') }}-${{ hashFiles('**/app/javascript') }}" 124 | 125 | restore-keys: | 126 | ${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/app/assets') }} 127 | ${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }} 128 | ${{ runner.os }}-assets- 129 | 130 | - name: Precompile assets 131 | run: bundle exec rake assets:precompile 132 | 133 | - name: Run tests 134 | run: bin/rails test "test/**/*_test.rb" 135 | 136 | - name: Upload Coverage 137 | uses: actions/upload-artifact@v2 138 | with: 139 | name: coverage 140 | path: coverage 141 | 142 | - name: Upload Capybara Screenshots 143 | uses: actions/upload-artifact@v2 144 | with: 145 | name: capybara-screenshots 146 | path: tmp/screenshots 147 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore pidfiles, but keep the directory. 17 | /tmp/pids/* 18 | !/tmp/pids/ 19 | !/tmp/pids/.keep 20 | 21 | # Ignore uploaded files in development. 22 | /storage/* 23 | !/storage/.keep 24 | 25 | /public/assets 26 | .byebug_history 27 | 28 | # Ignore master key for decrypting credentials and more. 29 | /config/master.key 30 | 31 | /public/packs 32 | /public/packs-test 33 | /node_modules 34 | /yarn-error.log 35 | yarn-debug.log* 36 | .yarn-integrity 37 | 38 | /coverage 39 | -------------------------------------------------------------------------------- /.pronto.yml: -------------------------------------------------------------------------------- 1 | --- 2 | all: 3 | exclude: 4 | - .* 5 | - .**/* 6 | - bin/**/* 7 | - config/**/* 8 | - db/migrate/**/* 9 | - db/schema.rb 10 | - docs/**/* 11 | - node_modules/**/* 12 | - public/**/* 13 | - vendor/**/* 14 | 15 | eslint: 16 | exclude: 17 | - vendor/assets/**/* 18 | - vendor/packs/**/* 19 | 20 | flay: 21 | exclude: 22 | - test/**/* 23 | 24 | max_warnings: 10 25 | verbose: true 26 | warnings_per_review: 5 27 | -------------------------------------------------------------------------------- /.pronto_eslint_npm.yml: -------------------------------------------------------------------------------- 1 | --- 2 | eslint_executable: "node_modules/.bin/eslint" 3 | -------------------------------------------------------------------------------- /.reek.yml: -------------------------------------------------------------------------------- 1 | --- 2 | detectors: 3 | IrresponsibleModule: 4 | enabled: false 5 | DuplicateMethodCall: 6 | max_calls: 4 7 | FeatureEnvy: 8 | enabled: false 9 | UncommunicativeVariableName: 10 | accept: 11 | - e 12 | - i 13 | - v 14 | UnusedPrivateMethod: 15 | enabled: false 16 | UtilityFunction: 17 | enabled: false 18 | 19 | directories: 20 | "**/app/controllers/**": 21 | InstanceVariableAssumption: 22 | enabled: false 23 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | require: 3 | - rubocop-minitest 4 | - rubocop-rails 5 | - rubocop-performance 6 | - standard 7 | 8 | inherit_gem: 9 | standard: config/base.yml 10 | 11 | AllCops: 12 | NewCops: enable 13 | TargetRubyVersion: 3.0 14 | 15 | Exclude: 16 | - 'bin/**/*' 17 | - 'db/migrate/**/*' 18 | - 'db/schema.rb' 19 | - 'vendor/**/*' 20 | 21 | Bundler/InsecureProtocolSource: 22 | Enabled: true 23 | Include: 24 | - '**/*.gemfile' 25 | - '**/Gemfile' 26 | - '**/Gemfile.tools' 27 | - '**/gems.rb' 28 | 29 | Layout/EmptyLinesAroundAttributeAccessor: 30 | Enabled: true 31 | 32 | Layout/LineLength: 33 | Max: 113 34 | 35 | Layout/MultilineMethodArgumentLineBreaks: 36 | Enabled: true 37 | 38 | Layout/SpaceInLambdaLiteral: 39 | EnforcedStyle: require_space 40 | 41 | Lint/StructNewOverride: 42 | Enabled: true 43 | 44 | Metrics/AbcSize: 45 | Exclude: 46 | - 'test/**/*.rb' 47 | 48 | Metrics/ClassLength: 49 | CountComments: false 50 | Exclude: 51 | - 'test/**/*.rb' 52 | 53 | Metrics/MethodLength: 54 | CountComments: false 55 | Exclude: 56 | - 'test/**/*.rb' 57 | 58 | Metrics/ModuleLength: 59 | CountComments: false 60 | Exclude: 61 | - 'test/**/*.rb' 62 | 63 | Naming/MemoizedInstanceVariableName: 64 | EnforcedStyleForLeadingUnderscores: required 65 | 66 | Naming/PredicateName: 67 | Exclude: 68 | - 'app/helpers/application_helper.rb' 69 | 70 | Standard/BlockDelimiters: 71 | Enabled: true 72 | EnforcedStyle: braces_for_chaining 73 | 74 | Style/ClassAndModuleChildren: 75 | Exclude: 76 | - 'test/**/*.rb' 77 | 78 | Style/Documentation: 79 | Enabled: false 80 | 81 | Style/FrozenStringLiteralComment: 82 | Enabled: true 83 | 84 | Style/HashEachMethods: 85 | Enabled: true 86 | 87 | Style/StringLiterals: 88 | Enabled: true 89 | EnforcedStyle: single_quotes 90 | 91 | # Rails 92 | 93 | Rails: 94 | Enabled: true 95 | 96 | Rails/SkipsModelValidations: 97 | Enabled: false 98 | 99 | Rails/UnknownEnv: 100 | Environments: 101 | - development 102 | - production 103 | - staging 104 | - test 105 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.0.0 2 | -------------------------------------------------------------------------------- /.simplecov: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | if defined?(Spring) && ENV['DISABLE_SPRING'].nil? 4 | puts '**** NO COVERAGE FOR YOU! ****' 5 | puts 'Please disable Spring to get COVERAGE by `DISABLE_SPRING=1 COVERAGE=1 bin/rspec`' 6 | else 7 | SimpleCov.start 'rails' do 8 | add_filter %w[app/views bin spec test] 9 | 10 | maximum_coverage_drop 0.5 11 | end 12 | 13 | if ENV['CODECOV_TOKEN'] 14 | require 'codecov' 15 | SimpleCov.formatter = SimpleCov::Formatter::Codecov 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /.yamllint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | extends: default 4 | 5 | rules: 6 | braces: 7 | max-spaces-inside: 1 8 | line-length: 9 | max: 113 10 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | tap 'heroku/brew' 4 | 5 | brew 'circleci' 6 | brew 'graphicsmagick' # For ActiveStorage 7 | brew 'heroku' 8 | brew 'hub' # For creating Pull Request from CLI 9 | brew 'postgresql' 10 | brew 'rbenv' 11 | brew 'ruby-build' 12 | brew 'vips' # For ActiveStorage 13 | brew 'yamllint' # For Linters 14 | brew 'yarn' 15 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby RUBY_VERSION 5 | 6 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' 7 | gem 'rails', '~> 6.1.3', '>= 6.1.3.1' 8 | # Use postgresql as the database for Active Record 9 | gem 'pg', '~> 1.1' 10 | # Use Puma as the app server 11 | gem 'puma', '~> 5.0' 12 | # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker 13 | gem 'webpacker', '~> 5.0' 14 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 15 | gem 'jbuilder', '~> 2.7' 16 | # Use Active Model has_secure_password 17 | # gem 'bcrypt', '~> 3.1.7' 18 | 19 | # Use Active Storage variant 20 | # gem 'image_processing', '~> 1.2' 21 | 22 | # Reduces boot times through caching; required in config/boot.rb 23 | gem 'bootsnap', '>= 1.4.4', require: false 24 | 25 | group :development, :test do 26 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 27 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 28 | end 29 | 30 | group :development do 31 | # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 32 | gem 'web-console', '>= 4.1.0' 33 | # Display performance information such as SQL time and flame graphs for each request in your browser. 34 | # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md 35 | gem 'rack-mini-profiler', '~> 2.0' 36 | gem 'listen', '~> 3.3' 37 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 38 | gem 'spring' 39 | end 40 | 41 | group :test do 42 | # Adds support for Capybara system testing and selenium driver 43 | gem 'capybara', '>= 3.26' 44 | gem 'selenium-webdriver' 45 | # Easy installation and use of web drivers to run system tests with browsers 46 | gem 'webdrivers' 47 | end 48 | 49 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 50 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 51 | gem 'serviceworker-rails', github: 'rossta/serviceworker-rails' 52 | gem 'jt_tools', github: 'jetthoughts/jt_tools', group: :development 53 | 54 | group :test do 55 | gem 'simplecov', require: false, group: :test 56 | gem 'codecov', require: false, group: :test 57 | gem 'rexml', require: false, group: :test 58 | end 59 | gem 'oj' 60 | 61 | group :production, :staging do 62 | gem 'dalli' 63 | gem 'r7insight' 64 | gem 'rollbar' 65 | end 66 | gem 'minitest-ci', require: false, group: :test 67 | gem 'connection_pool' 68 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://github.com/jetthoughts/jt_tools.git 3 | revision: 66a830f21b5786d081d7e6a4f48110f0a0c44742 4 | specs: 5 | jt_tools (0.0.19) 6 | railties (>= 4.2) 7 | 8 | GIT 9 | remote: https://github.com/rossta/serviceworker-rails.git 10 | revision: a81aa1f138716e4eda8c1241c8b8152c1b1bda9c 11 | specs: 12 | serviceworker-rails (0.6.0) 13 | railties (>= 3.1) 14 | 15 | GEM 16 | remote: https://rubygems.org/ 17 | specs: 18 | actioncable (6.1.3.1) 19 | actionpack (= 6.1.3.1) 20 | activesupport (= 6.1.3.1) 21 | nio4r (~> 2.0) 22 | websocket-driver (>= 0.6.1) 23 | actionmailbox (6.1.3.1) 24 | actionpack (= 6.1.3.1) 25 | activejob (= 6.1.3.1) 26 | activerecord (= 6.1.3.1) 27 | activestorage (= 6.1.3.1) 28 | activesupport (= 6.1.3.1) 29 | mail (>= 2.7.1) 30 | actionmailer (6.1.3.1) 31 | actionpack (= 6.1.3.1) 32 | actionview (= 6.1.3.1) 33 | activejob (= 6.1.3.1) 34 | activesupport (= 6.1.3.1) 35 | mail (~> 2.5, >= 2.5.4) 36 | rails-dom-testing (~> 2.0) 37 | actionpack (6.1.3.1) 38 | actionview (= 6.1.3.1) 39 | activesupport (= 6.1.3.1) 40 | rack (~> 2.0, >= 2.0.9) 41 | rack-test (>= 0.6.3) 42 | rails-dom-testing (~> 2.0) 43 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 44 | actiontext (6.1.3.1) 45 | actionpack (= 6.1.3.1) 46 | activerecord (= 6.1.3.1) 47 | activestorage (= 6.1.3.1) 48 | activesupport (= 6.1.3.1) 49 | nokogiri (>= 1.8.5) 50 | actionview (6.1.3.1) 51 | activesupport (= 6.1.3.1) 52 | builder (~> 3.1) 53 | erubi (~> 1.4) 54 | rails-dom-testing (~> 2.0) 55 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 56 | activejob (6.1.3.1) 57 | activesupport (= 6.1.3.1) 58 | globalid (>= 0.3.6) 59 | activemodel (6.1.3.1) 60 | activesupport (= 6.1.3.1) 61 | activerecord (6.1.3.1) 62 | activemodel (= 6.1.3.1) 63 | activesupport (= 6.1.3.1) 64 | activestorage (6.1.3.1) 65 | actionpack (= 6.1.3.1) 66 | activejob (= 6.1.3.1) 67 | activerecord (= 6.1.3.1) 68 | activesupport (= 6.1.3.1) 69 | marcel (~> 1.0.0) 70 | mini_mime (~> 1.0.2) 71 | activesupport (6.1.3.1) 72 | concurrent-ruby (~> 1.0, >= 1.0.2) 73 | i18n (>= 1.6, < 2) 74 | minitest (>= 5.1) 75 | tzinfo (~> 2.0) 76 | zeitwerk (~> 2.3) 77 | addressable (2.7.0) 78 | public_suffix (>= 2.0.2, < 5.0) 79 | bindex (0.8.1) 80 | bootsnap (1.7.3) 81 | msgpack (~> 1.0) 82 | builder (3.2.4) 83 | byebug (11.1.3) 84 | capybara (3.35.3) 85 | addressable 86 | mini_mime (>= 0.1.3) 87 | nokogiri (~> 1.8) 88 | rack (>= 1.6.0) 89 | rack-test (>= 0.6.3) 90 | regexp_parser (>= 1.5, < 3.0) 91 | xpath (~> 3.2) 92 | childprocess (3.0.0) 93 | codecov (0.5.1) 94 | simplecov (>= 0.15, < 0.22) 95 | concurrent-ruby (1.1.8) 96 | connection_pool (2.2.3) 97 | crass (1.0.6) 98 | dalli (2.7.11) 99 | docile (1.3.5) 100 | erubi (1.10.0) 101 | ffi (1.15.0) 102 | globalid (0.4.2) 103 | activesupport (>= 4.2.0) 104 | i18n (1.8.10) 105 | concurrent-ruby (~> 1.0) 106 | jbuilder (2.11.2) 107 | activesupport (>= 5.0.0) 108 | listen (3.5.1) 109 | rb-fsevent (~> 0.10, >= 0.10.3) 110 | rb-inotify (~> 0.9, >= 0.9.10) 111 | loofah (2.9.1) 112 | crass (~> 1.0.2) 113 | nokogiri (>= 1.5.9) 114 | mail (2.7.1) 115 | mini_mime (>= 0.1.1) 116 | marcel (1.0.1) 117 | method_source (1.0.0) 118 | mini_mime (1.0.3) 119 | minitest (5.14.4) 120 | minitest-ci (3.4.0) 121 | minitest (>= 5.0.6) 122 | msgpack (1.4.2) 123 | nio4r (2.5.7) 124 | nokogiri (1.11.5-x86_64-darwin) 125 | racc (~> 1.4) 126 | nokogiri (1.11.5-x86_64-linux) 127 | racc (~> 1.4) 128 | oj (3.11.3) 129 | pg (1.2.3) 130 | public_suffix (4.0.6) 131 | puma (5.3.2) 132 | nio4r (~> 2.0) 133 | r7insight (3.0.4) 134 | racc (1.5.2) 135 | rack (2.2.3) 136 | rack-mini-profiler (2.3.1) 137 | rack (>= 1.2.0) 138 | rack-proxy (0.6.5) 139 | rack 140 | rack-test (1.1.0) 141 | rack (>= 1.0, < 3) 142 | rails (6.1.3.1) 143 | actioncable (= 6.1.3.1) 144 | actionmailbox (= 6.1.3.1) 145 | actionmailer (= 6.1.3.1) 146 | actionpack (= 6.1.3.1) 147 | actiontext (= 6.1.3.1) 148 | actionview (= 6.1.3.1) 149 | activejob (= 6.1.3.1) 150 | activemodel (= 6.1.3.1) 151 | activerecord (= 6.1.3.1) 152 | activestorage (= 6.1.3.1) 153 | activesupport (= 6.1.3.1) 154 | bundler (>= 1.15.0) 155 | railties (= 6.1.3.1) 156 | sprockets-rails (>= 2.0.0) 157 | rails-dom-testing (2.0.3) 158 | activesupport (>= 4.2.0) 159 | nokogiri (>= 1.6) 160 | rails-html-sanitizer (1.3.0) 161 | loofah (~> 2.3) 162 | railties (6.1.3.1) 163 | actionpack (= 6.1.3.1) 164 | activesupport (= 6.1.3.1) 165 | method_source 166 | rake (>= 0.8.7) 167 | thor (~> 1.0) 168 | rake (13.0.3) 169 | rb-fsevent (0.10.4) 170 | rb-inotify (0.10.1) 171 | ffi (~> 1.0) 172 | regexp_parser (2.1.1) 173 | rexml (3.2.5) 174 | rollbar (3.1.2) 175 | rubyzip (2.3.0) 176 | selenium-webdriver (3.142.7) 177 | childprocess (>= 0.5, < 4.0) 178 | rubyzip (>= 1.2.2) 179 | semantic_range (3.0.0) 180 | simplecov (0.21.2) 181 | docile (~> 1.1) 182 | simplecov-html (~> 0.11) 183 | simplecov_json_formatter (~> 0.1) 184 | simplecov-html (0.12.3) 185 | simplecov_json_formatter (0.1.2) 186 | spring (2.1.1) 187 | sprockets (4.0.2) 188 | concurrent-ruby (~> 1.0) 189 | rack (> 1, < 3) 190 | sprockets-rails (3.2.2) 191 | actionpack (>= 4.0) 192 | activesupport (>= 4.0) 193 | sprockets (>= 3.0.0) 194 | thor (1.1.0) 195 | tzinfo (2.0.4) 196 | concurrent-ruby (~> 1.0) 197 | web-console (4.1.0) 198 | actionview (>= 6.0.0) 199 | activemodel (>= 6.0.0) 200 | bindex (>= 0.4.0) 201 | railties (>= 6.0.0) 202 | webdrivers (4.6.0) 203 | nokogiri (~> 1.6) 204 | rubyzip (>= 1.3.0) 205 | selenium-webdriver (>= 3.0, < 4.0) 206 | webpacker (5.2.1) 207 | activesupport (>= 5.2) 208 | rack-proxy (>= 0.6.1) 209 | railties (>= 5.2) 210 | semantic_range (>= 2.3.0) 211 | websocket-driver (0.7.3) 212 | websocket-extensions (>= 0.1.0) 213 | websocket-extensions (0.1.5) 214 | xpath (3.2.0) 215 | nokogiri (~> 1.8) 216 | zeitwerk (2.4.2) 217 | 218 | PLATFORMS 219 | x86_64-darwin-20 220 | x86_64-linux 221 | 222 | DEPENDENCIES 223 | bootsnap (>= 1.4.4) 224 | byebug 225 | capybara (>= 3.26) 226 | codecov 227 | connection_pool 228 | dalli 229 | jbuilder (~> 2.7) 230 | jt_tools! 231 | listen (~> 3.3) 232 | minitest-ci 233 | oj 234 | pg (~> 1.1) 235 | puma (~> 5.0) 236 | r7insight 237 | rack-mini-profiler (~> 2.0) 238 | rails (~> 6.1.3, >= 6.1.3.1) 239 | rexml 240 | rollbar 241 | selenium-webdriver 242 | serviceworker-rails! 243 | simplecov 244 | spring 245 | tzinfo-data 246 | web-console (>= 4.1.0) 247 | webdrivers 248 | webpacker (~> 5.0) 249 | 250 | RUBY VERSION 251 | ruby 3.0.0p0 252 | 253 | BUNDLED WITH 254 | 2.2.16 255 | -------------------------------------------------------------------------------- /Gemfile.tools: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | git_source(:github) do |repo_name| 4 | repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/') 5 | "https://github.com/#{repo_name}.git" 6 | end 7 | 8 | gem 'oj' 9 | 10 | group :tools do 11 | gem 'pronto', require: false 12 | gem 'pronto-blacklist', require: false 13 | gem 'pronto-erb_lint', require: false 14 | gem 'pronto-eslint', require: false 15 | gem 'pronto-fasterer', require: false 16 | gem 'pronto-rails_best_practices', require: false 17 | gem 'pronto-reek', require: false 18 | gem 'pronto-rubocop', require: false 19 | gem 'pronto-yamllint', require: false 20 | 21 | gem 'rubocop-performance', require: false 22 | gem 'rubocop-rails', require: false 23 | gem 'rubocop-minitest', require: false 24 | 25 | gem 'standard', '>= 0.4.7', require: false 26 | # gem 'pronto-standardrb', require: false 27 | # gem 'rubocop-rspec', require: false 28 | end 29 | -------------------------------------------------------------------------------- /Gemfile.tools.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionview (6.1.3.1) 5 | activesupport (= 6.1.3.1) 6 | builder (~> 3.1) 7 | erubi (~> 1.4) 8 | rails-dom-testing (~> 2.0) 9 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 10 | activesupport (6.1.3.1) 11 | concurrent-ruby (~> 1.0, >= 1.0.2) 12 | i18n (>= 1.6, < 2) 13 | minitest (>= 5.1) 14 | tzinfo (~> 2.0) 15 | zeitwerk (~> 2.3) 16 | addressable (2.7.0) 17 | public_suffix (>= 2.0.2, < 5.0) 18 | ast (2.4.2) 19 | better_html (1.0.16) 20 | actionview (>= 4.0) 21 | activesupport (>= 4.0) 22 | ast (~> 2.0) 23 | erubi (~> 1.4) 24 | html_tokenizer (~> 0.0.6) 25 | parser (>= 2.4) 26 | smart_properties 27 | builder (3.2.4) 28 | code_analyzer (0.5.2) 29 | sexp_processor 30 | colorize (0.8.1) 31 | concurrent-ruby (1.1.8) 32 | crass (1.0.6) 33 | erb_lint (0.0.37) 34 | activesupport 35 | better_html (~> 1.0.7) 36 | html_tokenizer 37 | parser (>= 2.7.1.4) 38 | rainbow 39 | rubocop 40 | smart_properties 41 | erubi (1.10.0) 42 | erubis (2.7.0) 43 | eslintrb (2.1.0) 44 | execjs 45 | multi_json (>= 1.3) 46 | rake 47 | execjs (2.7.0) 48 | faraday (1.3.0) 49 | faraday-net_http (~> 1.0) 50 | multipart-post (>= 1.2, < 3) 51 | ruby2_keywords 52 | faraday-net_http (1.0.1) 53 | fasterer (0.7.1) 54 | colorize (~> 0.7) 55 | ruby_parser (>= 3.13.0) 56 | gitlab (4.17.0) 57 | httparty (~> 0.18) 58 | terminal-table (~> 1.5, >= 1.5.1) 59 | html_tokenizer (0.0.7) 60 | httparty (0.18.1) 61 | mime-types (~> 3.0) 62 | multi_xml (>= 0.5.2) 63 | i18n (1.8.10) 64 | concurrent-ruby (~> 1.0) 65 | json (2.5.1) 66 | kwalify (0.7.2) 67 | loofah (2.9.1) 68 | crass (~> 1.0.2) 69 | nokogiri (>= 1.5.9) 70 | mime-types (3.3.1) 71 | mime-types-data (~> 3.2015) 72 | mime-types-data (3.2021.0225) 73 | minitest (5.14.4) 74 | multi_json (1.15.0) 75 | multi_xml (0.6.0) 76 | multipart-post (2.1.1) 77 | nokogiri (1.11.3-x86_64-darwin) 78 | racc (~> 1.4) 79 | nokogiri (1.11.3-x86_64-linux) 80 | racc (~> 1.4) 81 | octokit (4.20.0) 82 | faraday (>= 0.9) 83 | sawyer (~> 0.8.0, >= 0.5.3) 84 | oj (3.11.3) 85 | parallel (1.20.1) 86 | parser (3.0.1.0) 87 | ast (~> 2.4.1) 88 | pathspec (0.2.1) 89 | pronto (0.11.0) 90 | gitlab (~> 4.4, >= 4.4.0) 91 | httparty (>= 0.13.7) 92 | octokit (~> 4.7, >= 4.7.0) 93 | rainbow (>= 2.2, < 4.0) 94 | rexml (~> 3.2) 95 | rugged (>= 0.23.0, < 1.1.0) 96 | thor (>= 0.20.3, < 2.0) 97 | pronto-blacklist (0.2.0) 98 | pathspec (~> 0.2) 99 | pronto (~> 0.9) 100 | pronto-erb_lint (0.1.5) 101 | erb_lint (~> 0.0.24) 102 | pronto (> 0.9.0) 103 | pronto-eslint (0.11.0) 104 | eslintrb (~> 2.0, >= 2.0.0) 105 | pronto (~> 0.11.0) 106 | pronto-fasterer (0.11.0) 107 | fasterer (~> 0.7.1) 108 | pronto (~> 0.11.0) 109 | pronto-rails_best_practices (0.11.0) 110 | pronto (~> 0.11.0) 111 | rails_best_practices (~> 1.16, >= 1.15.0) 112 | pronto-reek (0.11.0) 113 | pronto (~> 0.11.0) 114 | reek (>= 4.2, < 7.0) 115 | pronto-rubocop (0.11.1) 116 | pronto (~> 0.11.0) 117 | rubocop (>= 0.63.1, < 2.0) 118 | pronto-yamllint (0.2.0) 119 | pronto (~> 0.11.0) 120 | psych (3.3.1) 121 | public_suffix (4.0.6) 122 | racc (1.5.2) 123 | rack (2.2.3) 124 | rails-dom-testing (2.0.3) 125 | activesupport (>= 4.2.0) 126 | nokogiri (>= 1.6) 127 | rails-html-sanitizer (1.3.0) 128 | loofah (~> 2.3) 129 | rails_best_practices (1.20.0) 130 | activesupport 131 | code_analyzer (>= 0.5.1) 132 | erubis 133 | i18n 134 | json 135 | require_all (~> 3.0) 136 | ruby-progressbar 137 | rainbow (3.0.0) 138 | rake (13.0.3) 139 | reek (6.0.3) 140 | kwalify (~> 0.7.0) 141 | parser (~> 3.0.0) 142 | psych (~> 3.1) 143 | rainbow (>= 2.0, < 4.0) 144 | regexp_parser (2.1.1) 145 | require_all (3.0.0) 146 | rexml (3.2.5) 147 | rubocop (1.11.0) 148 | parallel (~> 1.10) 149 | parser (>= 3.0.0.0) 150 | rainbow (>= 2.2.2, < 4.0) 151 | regexp_parser (>= 1.8, < 3.0) 152 | rexml 153 | rubocop-ast (>= 1.2.0, < 2.0) 154 | ruby-progressbar (~> 1.7) 155 | unicode-display_width (>= 1.4.0, < 3.0) 156 | rubocop-ast (1.4.1) 157 | parser (>= 2.7.1.5) 158 | rubocop-minitest (0.11.1) 159 | rubocop (>= 0.90, < 2.0) 160 | rubocop-performance (1.10.1) 161 | rubocop (>= 0.90.0, < 2.0) 162 | rubocop-ast (>= 0.4.0) 163 | rubocop-rails (2.9.1) 164 | activesupport (>= 4.2.0) 165 | rack (>= 1.1) 166 | rubocop (>= 0.90.0, < 2.0) 167 | ruby-progressbar (1.11.0) 168 | ruby2_keywords (0.0.4) 169 | ruby_parser (3.15.1) 170 | sexp_processor (~> 4.9) 171 | rugged (1.0.1) 172 | sawyer (0.8.2) 173 | addressable (>= 2.3.5) 174 | faraday (> 0.8, < 2.0) 175 | sexp_processor (4.15.2) 176 | smart_properties (1.15.0) 177 | standard (1.0.4) 178 | rubocop (= 1.11.0) 179 | rubocop-performance (= 1.10.1) 180 | terminal-table (1.8.0) 181 | unicode-display_width (~> 1.1, >= 1.1.1) 182 | thor (1.1.0) 183 | tzinfo (2.0.4) 184 | concurrent-ruby (~> 1.0) 185 | unicode-display_width (1.7.0) 186 | zeitwerk (2.4.2) 187 | 188 | PLATFORMS 189 | x86_64-darwin-20 190 | x86_64-linux 191 | 192 | DEPENDENCIES 193 | oj 194 | pronto 195 | pronto-blacklist 196 | pronto-erb_lint 197 | pronto-eslint 198 | pronto-fasterer 199 | pronto-rails_best_practices 200 | pronto-reek 201 | pronto-rubocop 202 | pronto-yamllint 203 | rubocop-minitest 204 | rubocop-performance 205 | rubocop-rails 206 | standard (>= 0.4.7) 207 | 208 | BUNDLED WITH 209 | 2.2.16 210 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 JetThoughts 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | release: bin/heroku-release 2 | web: bin/bundle exec puma -C config/puma.rb 3 | worker: RAILS_MAX_THREADS=$SIDEKIQ_CONCURRENCY bin/bundle exec sidekiq -e $RAILS_ENV 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rails 6 + Vue.js 2 Starter Kit GitHub Template. 2 | 3 | **NOTE:** For Rails 5.2, please check 4 | https://github.com/jetthoughts/vuejs-rails-starterkit/tree/rails-5-latest 5 | 6 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) 7 | ![GitHub Actions Test](https://github.com/jetthoughts/vuejs-rails-starterkit/workflows/Test/badge.svg) 8 | [![CircleCI Test](https://circleci.com/gh/jetthoughts/vuejs-rails-starterkit.svg?style=svg)](https://circleci.com/gh/jetthoughts/vuejs-rails-starterkit) 9 | [![codecov](https://codecov.io/gh/jetthoughts/vuejs-rails-starterkit/branch/master/graph/badge.svg)](https://codecov.io/gh/jetthoughts/vuejs-rails-starterkit) 10 | 11 | A quick and easy way to setup Rails + PWA + Turbolinks + Webpacker + Bootstrap with AdminLTE theme + Vue + Jest. 12 | If your team is considering or has already decided to use Vue, this is the right for you. 13 | As an additional review of how to setup PWA, Turbolinks, CSS frameworks, Storybook. 14 | 15 | ### Preview of all steps 16 | [![asciicast](https://asciinema.org/a/ArqvGrc6JK6pKzlRTMV3Jotwr.svg)](https://asciinema.org/a/ArqvGrc6JK6pKzlRTMV3Jotwr) 17 | 18 | ### Expected Final Screen 19 | ![image](https://user-images.githubusercontent.com/53345298/80085750-586bc080-8561-11ea-8c3b-dc1eab5b9200.png) 20 | 21 | ## Table of Contents 22 | - [Step 1. Generate Ruby on Rails Project with Vue.js](#generate-ruby-on-rails-project-with-vuejs-no-turbolinks-included-on-this-stage) 23 | - [Step 2. Setup development environment](#setup-development-environment) 24 | - [Step 3. Add sample page to host Vue.js component](#add-sample-page-to-host-vuejs-component) 25 | - [Step 4. Use Webpacker assets in the application](#use-webpacker-assets-in-the-application) 26 | - [Step 5. Install Jest for Component Unit Tests](#install-jest-for-component-unit-tests) 27 | - [Step 6. Setup Heroku and Deploy](#setup-heroku-and-deploy) 28 | - [Step 7. Setup basic PWA](#setup-basic-pwa) 29 | - [Step 8. Setup Turbolinks](#setup-turbolinks) 30 | - [Step 9. Installs UI Kit - AdminLTE](#setup-adminlte) 31 | - [Step 10. Configure continuous integration and other services for static code 32 | analysis](#configure-continuous-integration-and-other-services-for-static-code-analysis) 33 | 34 | 35 | #### Things you may want to cover: 36 | 37 | #### Features: 38 | 39 | * Optimized for peformance Webpacker with Vue.js: Lazy Load, Split Chunks 40 | * Turbolinks 41 | * PWA 42 | * Backend Unit and System Tests with coverage 43 | * Vue.js Unit Tests with coverage 44 | * Deployable to Heroku 45 | * Pre-setup for services: 46 | - GitHub 47 | - Heroku (Heroku Reviews Apps) 48 | - CircleCI 49 | - Codecov and Simplecov 50 | - Dependabot 51 | * Static Code Analyzers: 52 | - Pronto 53 | - Rubocop 54 | - ESLint 55 | - EditorConfig 56 | 57 | 58 | #### Dependencies: 59 | 60 | * [Ruby on Rails](https://rubyonrails.org/) version 6 61 | * [Vue.js](https://vuejs.org) version 2 with [Vue Test Utils](https://vue-test-utils.vuejs.org/) 62 | * [Webpacker](https://github.com/rails/webpacker) 5 with [Webpack](https://webpack.js.org/) 4 63 | * [Bootstrap](https://getbootstrap.com/) 4 with [AdminLTE Template](https://adminlte.io/) 64 | * [Babel](https://babeljs.io/) 7 65 | 66 | #### System Dependencies: 67 | 68 | * [Ruby](https://www.ruby-lang.org/en/) 3.0 69 | * [Node.js](https://nodejs.org/en/) 14 70 | * [Yarn](https://yarnpkg.com/en/) 71 | * [PostgreSQL](https://www.postgresql.org/) 12 72 | * [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) 73 | 74 | ## Generate Ruby on Rails Project with Vue.js (No Turbolinks included on this stage) 75 | 76 | ```bash 77 | gem install rails 78 | 79 | rails new vuejs-rails-starterkit --force --database=postgresql \ 80 | --skip-action-mailer --skip-action-cable --skip-sprockets --skip-turbolinks \ 81 | --webpack=vue 82 | 83 | cd ./vuejs-rails-starterkit 84 | 85 | bin/rails db:create db:migrate 86 | ``` 87 | 88 | This generates Rails project with: 89 | 90 | - Vue component in `app/javascript/app.vue` 91 | - Example entry file `app/javascript/packs/hello_vue.js` 92 | 93 | ### Setup development environment: 94 | 95 | 1. Uncomment `system('bin/yarn')` in `bin/setup` and `bin/update` to 96 | install new node modules. 97 | 98 | 2. Install dependencies: 99 | 100 | ```bash 101 | bin/setup 102 | ``` 103 | 3. Enable *content_security_policy* in the `config/initializers/content_security_policy.rb` 104 | with the following configuration: 105 | 106 | ```ruby 107 | Rails.application.config.content_security_policy do |policy| 108 | policy.script_src :self, :https 109 | 110 | if Rails.env.development? || Rails.env.test? 111 | policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' 112 | end 113 | end 114 | ``` 115 | 4. Verify that we have not broken anything 116 | 117 | ```bash 118 | bin/webpack 119 | bin/rails runner "exit" 120 | ``` 121 | 122 | ### Add sample page to host Vue.js component 123 | 124 | 1. Generate controller and view: 125 | 126 | ```bash 127 | bin/rails generate controller Landing index --no-javascripts --no-stylesheets --no-helper --no-assets --no-fixture 128 | ``` 129 | 130 | 2. Update `app/views/landing/index.html.erb` to: 131 | 132 | ```erb 133 |

Landing#index

134 |

Find me in app/views/landing/index.html.erb

135 | 136 |
137 | ``` 138 | 139 | 3. Change `app/javascript/packs/hello_vue.js` to: 140 | 141 | ```javascript 142 | import Vue from 'vue' 143 | import App from '../app.vue' 144 | 145 | document.addEventListener('DOMContentLoaded', () => { 146 | const app = new Vue({ 147 | render: h => h(App), 148 | el: '#hello_vue_app' 149 | }).$mount() 150 | }) 151 | ``` 152 | 153 | 4. Setup a sample page as a home page by updating `config/routes.rb`: 154 | 155 | ```ruby 156 | root 'landing#index' 157 | ``` 158 | 159 | ### Use Webpacker assets in the application 160 | 161 | 1. Enable Webpacker with `SplitChunks`: 162 | 163 | * Enable `SplitChunks` with default config by adding to `config/webpack/environment.js`: 164 | 165 | ```js 166 | environment.splitChunks() 167 | ``` 168 | 169 | * Enable Webpacker by updating `app/views/layouts/application.html.erb`: 170 | 171 | Change: 172 | 173 | ```erb 174 | <%= stylesheet_link_tag 'application', media: 'all' %> 175 | <%= javascript_pack_tag 'application' %> 176 | ``` 177 | 178 | to: 179 | 180 | ```erb 181 | <%= stylesheet_packs_with_chunks_tag 'application', 'hello_vue', media: 'all' %> 182 | <%= javascript_packs_with_chunks_tag 'application', 'hello_vue' %> 183 | ``` 184 | 185 | 2. Verify locally that vue.js is working and `SplitChunks` is enabled 186 | 187 | ```bash 188 | bin/rails s 189 | open "http://localhost:3000/" 190 | ``` 191 | 192 | Expect to see 193 | ![](https://user-images.githubusercontent.com/8617866/79469404-ca478580-8008-11ea-8b1a-e74cdc906183.png) 194 | 195 | The `javascript_packs_with_chunks_tag` and `stylesheet_packs_with_chunks_tag` helpers split assets 196 | into small size chunks and create html tags for them: 197 | 198 | ```html 199 | 200 | 201 | 202 | ``` 203 | 204 | ## Install Jest for Component Unit Tests 205 | 206 | 1. Add Jest with required dependencies 207 | 208 | ```bash 209 | yarn add --dev jest @vue/test-utils vue-jest babel-core@^7.0.0-bridge.0 babel-jest jest-serializer-vue 210 | ``` 211 | 212 | 2. Configure Jest in `package.json` (including the Coverage enabling): 213 | 214 | ```json 215 | "scripts": { 216 | "test": "jest" 217 | }, 218 | "jest": { 219 | "verbose": true, 220 | "testURL": "http://localhost/", 221 | "roots": [ 222 | "test/javascript" 223 | ], 224 | "moduleDirectories": [ 225 | "node_modules", 226 | "app/javascript" 227 | ], 228 | "moduleNameMapper": { 229 | "^@/(.*)$": "/app/javascript/$1" 230 | }, 231 | "moduleFileExtensions": [ 232 | "js", 233 | "json", 234 | "vue" 235 | ], 236 | "transform": { 237 | ".+\\.js$": "babel-jest", 238 | ".+\\.vue$": "vue-jest" 239 | }, 240 | "testPathIgnorePatterns": [ 241 | "/config/webpack/" 242 | ], 243 | "snapshotSerializers": [ 244 | "jest-serializer-vue" 245 | ], 246 | "collectCoverage": true, 247 | "collectCoverageFrom": [ 248 | "**/*.{js,vue}", 249 | "!**/node_modules/**" 250 | ] 251 | }, 252 | ``` 253 | 254 | 3. Add `test/javascript/test.test.js`: 255 | 256 | ```js 257 | test('there is no I in team', () => { 258 | expect('team').not.toMatch(/I/); 259 | }); 260 | ``` 261 | 262 | 4. Verify installation 263 | 264 | ```bash 265 | yarn test 266 | ``` 267 | 268 | Expect to see ![](https://cl.ly/3y0d2E110c3H/Image%202018-03-31%20at%2019.18.54.public.png) 269 | 270 | 6. Add component test for App in `test/javascript/app.test.js`: 271 | 272 | ```js 273 | import { mount, shallowMount } from '@vue/test-utils' 274 | import App from 'app'; 275 | 276 | describe('App', () => { 277 | test('is a Vue instance', () => { 278 | const wrapper = mount(App) 279 | expect(wrapper.vm).toBeTruthy() 280 | }) 281 | 282 | test('matches snapshot', () => { 283 | const wrapper = shallowMount(App) 284 | expect(wrapper.html()).toMatchSnapshot() 285 | }) 286 | }); 287 | ``` 288 | 289 | 7. Verify by 290 | 291 | ```bash 292 | yarn test 293 | ``` 294 | 295 | You should see all tests passed 296 | 297 | ## Setup Heroku and Deploy 298 | 299 | 1. Confirm compilation is working: 300 | 301 | ```bash 302 | RAILS_ENV=production \ 303 | NODE_ENV=production \ 304 | RAILS_SERVE_STATIC_FILES=true \ 305 | SECRET_KEY_BASE="7aa51097e982f34be02abe83528c3308768dff3837b405e0907028c750d22d067367fb79e2b223e3f223fea50ddf2d5dc9b3c933cf5bc8c7f2a3d3d75f73c4a7" \ 306 | bin/rails assets:precompile 307 | ``` 308 | 309 | 2. Create a Heroku App and provision it 310 | 311 | Requirements: [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli#download-and-install). 312 | 313 | **NOTE:** Do not forget to commit all your changes: `git add . && git 314 | commit -m "Generates Ruby on Rails application with Vue.js onboard"` 315 | 316 | 317 | ```bash 318 | heroku create 319 | 320 | heroku addons:create heroku-postgresql:hobby-dev 321 | 322 | heroku buildpacks:add heroku/ruby 323 | 324 | heroku config:set RAILS_ENV=production NODE_ENV=production YARN_PRODUCTION=true MALLOC_ARENA_MAX=2 325 | ``` 326 | 327 | 3. Setup Node.js for Heroku 328 | 329 | ```bash 330 | heroku buildpacks:add --index 1 heroku/nodejs 331 | ``` 332 | 333 | Use the `engines` section of the `package.json` to specify the version of Node.js to use on Heroku. 334 | Drop the ‘v’ to save only the version number: 335 | 336 | ```json 337 | { 338 | "engines": { 339 | "node": ">= 12.x" 340 | } 341 | } 342 | ``` 343 | 344 | 4. Deploy and verify that vue.js is working on Heroku 345 | 346 | ```bash 347 | git push heroku master 348 | 349 | heroku apps:open 350 | ``` 351 | 352 | ## Setup basic PWA 353 | 354 | 1. Install `serviceworker-rails` by adding into `Gemfile`: 355 | 356 | ```ruby 357 | gem 'serviceworker-rails', github: 'rossta/serviceworker-rails' 358 | ``` 359 | 360 | 2. Following the guide: https://github.com/rossta/serviceworker-rails 361 | you should get something like: https://gist.github.com/pftg/786b147eff85a6fc98bd8dc1c3c9778e 362 | 363 | 3. There'll be an issue with service worker registration on the page saying: 364 | `Uncaught ReferenceError: window is not defined` and 365 | `Failed to register a ServiceWorker...`. 366 | To fix that add following line to `config/webpack/environment.js` 367 | as suggested [here](https://github.com/webpack/webpack/issues/6642#issuecomment-371087342): 368 | 369 | ```javascript 370 | environment.config.set('output.globalObject', 'this') 371 | ``` 372 | 373 | ## Setup Turbolinks 374 | 375 | 1. Add node dependencies 376 | 377 | ```bash 378 | yarn add vue-turbolinks turbolinks 379 | ``` 380 | 381 | 2. Load Turbolinks by adding to 382 | `app/javascript/initializers/turbolinks.js`: 383 | 384 | ```javascript 385 | import Turbolinks from 'turbolinks' 386 | Turbolinks.start() 387 | ``` 388 | 389 | 3. Add to `app/javascript/packs/application.js`: 390 | 391 | ```javascript 392 | import 'initializers/turbolinks.js' 393 | ``` 394 | 395 | 4. Change `app/javascript/packs/hello_vue.js` to: 396 | 397 | ```javascript 398 | import TurbolinksAdapter from 'vue-turbolinks' 399 | import Vue from 'vue' 400 | import App from '../app.vue' 401 | 402 | Vue.use(TurbolinksAdapter) 403 | 404 | document.addEventListener('turbolinks:load', () => { 405 | const app = new Vue({ 406 | render: h => h(App), 407 | el: '#hello_vue_app' 408 | }).$mount() 409 | }) 410 | 411 | ``` 412 | 413 | 5. Update layout `app/views/layouts/application.html.erb`: 414 | 415 | ```erb 416 | <%= javascript_packs_with_chunks_tag 'hello_vue', 'application', 'data-turbolinks-track': 'reload' %> 417 | ``` 418 | 419 | 6. Run tests and server to verify: 420 | 421 | ```bash 422 | bin/rails t 423 | bin/rails s 424 | ``` 425 | 426 | ## Setup AdminLTE 427 | 428 | 1. Add node dependencies 429 | 430 | ```bash 431 | yarn add admin-lte bootstrap jquery popover @fortawesome/fontawesome-free 432 | ``` 433 | 434 | 2. Add `app/javascript/initializers/adminlte.js` initializer: 435 | 436 | ```javascript 437 | import '../assets/adminlte.scss' 438 | import('./plugins') // () needed for async loading 439 | ``` 440 | 441 | 3. Add `app/javascript/initializers/plugins.js` file with plugin importing: 442 | 443 | ```javascript 444 | import '@fortawesome/fontawesome-free' 445 | import 'jquery/src/jquery.js' 446 | import 'popper.js' 447 | import 'bootstrap' 448 | import 'admin-lte/build/js/AdminLTE' 449 | ``` 450 | 451 | 4. Import admin lte initializer in `app/javascript/packs/application.js` pack: 452 | 453 | ```javascript 454 | import 'initializers/adminlte' 455 | ``` 456 | 457 | 5. Next step is updating main layout `app/views/layouts/application.html.erb`. Code for layout you can find [here](https://adminlte.io/themes/v3/starter.html). 458 | Also don't forget to add `yield` in div with `content` class: 459 | 460 | ```html 461 |
462 | <%= yield %> 463 |
464 | ``` 465 | 466 | 6. Add styles to `app/javascript/assets/adminlte.scss`: 467 | 468 | ```css 469 | $fa-font-path: '~@fortawesome/fontawesome-free/webfonts'; 470 | 471 | @import '~@fortawesome/fontawesome-free/scss/fontawesome'; 472 | @import '~@fortawesome/fontawesome-free/scss/solid'; 473 | @import '~@fortawesome/fontawesome-free/scss/regular'; 474 | @import '~@fortawesome/fontawesome-free/scss/brands'; 475 | 476 | @import "~admin-lte/build/scss/adminlte"; 477 | ``` 478 | 479 | 7. Run tests and server to verify: 480 | 481 | ```bash 482 | yarn test 483 | bin/rails test 484 | bin/rails test:system 485 | bin/rails s 486 | ``` 487 | 488 | Expect to see: 489 | ![image](https://user-images.githubusercontent.com/53345298/80085750-586bc080-8561-11ea-8c3b-dc1eab5b9200.png) 490 | 491 | ## Configure continuous integration and other services for static code analysis. 492 | 493 | To be able to automatically analyze the quality of the code, let's install the [jt_tools](https://github.com/jetthoughts/jt_tools) gem. 494 | 495 | 1. Add this line to your application's Gemfile: 496 | 497 | ```ruby 498 | gem 'jt_tools', groups: [:development] 499 | ``` 500 | 501 | 2. Next step is running bundle install and generator: 502 | 503 | ```bash 504 | bin/bundle 505 | bin/rails jt_tools:install 506 | ``` 507 | 508 | 3. Run linters to verify 509 | 510 | ```bash 511 | bin/lint-pr 512 | ``` 513 | You should see a list of the linters that were running. 514 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative "config/application" 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "postdeploy": "bin/heroku-postdeploy" 4 | }, 5 | "env": { 6 | "BUNDLE_WITHOUT": "development:test:production", 7 | "DISABLE_DATABASE_ENVIRONMENT_CHECK": "1", 8 | "JEMALLOC_ENABLED": "true", 9 | "LANG": "en_US.UTF-8", 10 | "MALLOC_ARENA_MAX": "2", 11 | "NODE_ENV": "production", 12 | "RACK_ENV": "staging", 13 | "RAILS_ENV": "staging", 14 | "RAILS_LOG_TO_STDOUT": "enabled", 15 | "RAILS_MASTER_KEY": { 16 | "required": true 17 | }, 18 | "RAILS_MAX_THREADS": "5", 19 | "RAILS_SERVE_STATIC_FILES": "enabled", 20 | "REDIS_PROVIDER": "REDISTOGO_URL", 21 | "ROLLBAR_ACCESS_TOKEN": { 22 | "required": true 23 | }, 24 | "ROLLBAR_ENDPOINT": { 25 | "required": true 26 | }, 27 | "ROLLBAR_ENV": "staging", 28 | "SECRET_KEY_BASE": { 29 | "generator": "secret" 30 | }, 31 | "SIDEKIQ_CONCURRENCY": "5", 32 | "WEB_CONCURRENCY": "2" 33 | }, 34 | "addons": [ 35 | "memcachier:dev", 36 | "logentries:le_tryit", 37 | "heroku-postgresql:hobby-dev", 38 | "redistogo:nano" 39 | ], 40 | "buildpacks": [ 41 | { 42 | "url": "https://github.com/gaffneyc/heroku-buildpack-jemalloc.git" 43 | }, 44 | { 45 | "url": "heroku/nodejs" 46 | }, 47 | { 48 | "url": "heroku/ruby" 49 | } 50 | ], 51 | "stack": "heroku-20" 52 | } 53 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 6 | * vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/landing_controller.rb: -------------------------------------------------------------------------------- 1 | class LandingController < ApplicationController 2 | def index 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/javascript/app.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | 17 | 23 | -------------------------------------------------------------------------------- /app/javascript/assets/adminlte.scss: -------------------------------------------------------------------------------- 1 | $fa-font-path: '~@fortawesome/fontawesome-free/webfonts'; 2 | 3 | @import '~@fortawesome/fontawesome-free/scss/fontawesome'; 4 | @import '~@fortawesome/fontawesome-free/scss/solid'; 5 | @import '~@fortawesome/fontawesome-free/scss/regular'; 6 | @import '~@fortawesome/fontawesome-free/scss/brands'; 7 | 8 | @import "~admin-lte/build/scss/adminlte"; 9 | -------------------------------------------------------------------------------- /app/javascript/initializers/adminlte.js: -------------------------------------------------------------------------------- 1 | import '../assets/adminlte.scss' 2 | 3 | import('./plugins') // () needed for async loading 4 | -------------------------------------------------------------------------------- /app/javascript/initializers/plugins.js: -------------------------------------------------------------------------------- 1 | import '@fortawesome/fontawesome-free' 2 | import 'jquery/src/jquery.js' 3 | import 'popper.js' 4 | import 'bootstrap' 5 | import 'admin-lte/build/js/AdminLTE' 6 | -------------------------------------------------------------------------------- /app/javascript/initializers/polyfills.js: -------------------------------------------------------------------------------- 1 | import "core-js"; 2 | import "regenerator-runtime/runtime"; 3 | -------------------------------------------------------------------------------- /app/javascript/initializers/turbolinks.js: -------------------------------------------------------------------------------- 1 | import Turbolinks from 'turbolinks' 2 | Turbolinks.start() 3 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | // This file is automatically compiled by Webpack, along with any other files 2 | // present in this directory. You're encouraged to place your actual application logic in 3 | // a relevant structure within app/javascript and only use these pack files to reference 4 | // that code so it'll be compiled. 5 | 6 | import Rails from "@rails/ujs" 7 | import * as ActiveStorage from "@rails/activestorage" 8 | 9 | Rails.start() 10 | ActiveStorage.start() 11 | 12 | 13 | import 'serviceworker-companion' 14 | import 'initializers/polyfills' 15 | import 'initializers/turbolinks' 16 | import 'initializers/adminlte' -------------------------------------------------------------------------------- /app/javascript/packs/hello_vue.js: -------------------------------------------------------------------------------- 1 | /* eslint no-console: 0 */ 2 | // Run this example by adding <%= javascript_pack_tag 'hello_vue' %> (and 3 | // <%= stylesheet_pack_tag 'hello_vue' %> if you have styles in your component) 4 | // to the head of your layout file, 5 | // like app/views/layouts/application.html.erb. 6 | // All it does is render
Hello Vue
at the bottom of the page. 7 | 8 | import Vue from 'vue' 9 | import App from '../app.vue' 10 | 11 | import TurbolinksAdapter from 'vue-turbolinks' 12 | Vue.use(TurbolinksAdapter) 13 | 14 | document.addEventListener('turbolinks:load', () => { const app = new Vue({ 15 | render: h => h(App), 16 | el: '#hello_vue_app' 17 | }).$mount() 18 | console.log(app) 19 | }) 20 | 21 | 22 | // The above code uses Vue without the compiler, which means you cannot 23 | // use Vue to target elements in your existing html templates. You would 24 | // need to always use single file components. 25 | // To be able to target elements in your existing html/erb templates, 26 | // comment out the above code and uncomment the below 27 | // Add <%= javascript_pack_tag 'hello_vue' %> to your layout 28 | // Then add this markup to your html template: 29 | // 30 | //
31 | // {{message}} 32 | // 33 | //
34 | 35 | 36 | // import Vue from 'vue/dist/vue.esm' 37 | // import App from '../app.vue' 38 | // 39 | // document.addEventListener('DOMContentLoaded', () => { 40 | // const app = new Vue({ 41 | // el: '#hello', 42 | // data: { 43 | // message: "Can you say hello?" 44 | // }, 45 | // components: { App } 46 | // }) 47 | // }) 48 | // 49 | // 50 | // 51 | // If the project is using turbolinks, install 'vue-turbolinks': 52 | // 53 | // yarn add vue-turbolinks 54 | // 55 | // Then uncomment the code block below: 56 | // 57 | // import TurbolinksAdapter from 'vue-turbolinks' 58 | // import Vue from 'vue/dist/vue.esm' 59 | // import App from '../app.vue' 60 | // 61 | // Vue.use(TurbolinksAdapter) 62 | // 63 | // document.addEventListener('turbolinks:load', () => { 64 | // const app = new Vue({ 65 | // el: '#hello', 66 | // data: () => { 67 | // return { 68 | // message: "Can you say hello?" 69 | // } 70 | // }, 71 | // components: { App } 72 | // }) 73 | // }) 74 | -------------------------------------------------------------------------------- /app/javascript/packs/serviceworker.js: -------------------------------------------------------------------------------- 1 | const CACHE_NAME = "v1-cached-assets" 2 | 3 | function onInstall(event) { 4 | event.waitUntil( 5 | caches.open(CACHE_NAME).then(function prefill(cache) { 6 | return cache.addAll([ 7 | '/offline.html' 8 | ]); 9 | }) 10 | ); 11 | } 12 | 13 | function onActivate(event) { 14 | event.waitUntil( 15 | caches.keys().then(function (cacheNames) { 16 | return Promise.all( 17 | cacheNames.filter(function (cacheName) { 18 | // Return true if you want to remove this cache, 19 | // but remember that caches are shared across 20 | // the whole origin 21 | return cacheName.indexOf('v1') !== 0; 22 | }).map(function (cacheName) { 23 | return caches.delete(cacheName); 24 | }) 25 | ); 26 | }) 27 | ); 28 | } 29 | 30 | self.addEventListener('install', onInstall) 31 | self.addEventListener('activate', onActivate) 32 | 33 | function onFetch(event) { 34 | // Fetch from network, fallback to cached content, then offline.html for same-origin GET requests 35 | const request = event.request; 36 | 37 | if (!request.url.match(/localhost|herokuapp/)) { 38 | return; 39 | } 40 | if (request.method !== 'GET') { 41 | return; 42 | } 43 | 44 | event.respondWith( 45 | fetch(request).catch(function fallback() { 46 | return caches.match('/offline.html') 47 | }) 48 | ); 49 | 50 | // See https://jakearchibald.com/2014/offline-cookbook/#on-network-response for more examples 51 | } 52 | 53 | self.addEventListener('fetch', onFetch); 54 | -------------------------------------------------------------------------------- /app/javascript/serviceworker-companion.js: -------------------------------------------------------------------------------- 1 | if ('serviceWorker' in navigator) { 2 | // Use the window load event to keep the page load performant 3 | window.addEventListener('load', () => { 4 | navigator.serviceWorker.register('/serviceworker.js'); 5 | }); 6 | } 7 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/views/landing/index.html.erb: -------------------------------------------------------------------------------- 1 |

Landing#index

2 |

Find me in app/views/landing/index.html.erb

3 | 4 |
5 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | VuejsRailsStarterkit 5 | 6 | <%= csrf_meta_tags %> 7 | <%= csp_meta_tag %> 8 | 9 | 10 | 11 | 12 | 13 | <%= stylesheet_packs_with_chunks_tag 'application', 'hello_vue', media: 'all' %> 14 | <%= javascript_packs_with_chunks_tag 'application', 'hello_vue', 'data-turbolinks-track': 'reload' %> 15 | 16 | 17 | 18 |
19 | 20 | 21 | 137 | 138 | 139 | 140 | 188 | 189 | 190 |
191 | 192 |
193 |
194 |
195 |
196 |

<%= yield(:title) || 'Starter Page' %>

197 |
198 |
199 | 203 |
204 |
205 |
206 |
207 | 208 | 209 | 210 |
211 | <%= yield %> 212 |
213 | 214 |
215 | 216 | 217 | 218 | 225 | 226 | 227 | 228 |
229 | 230 | Copyright © 2020 JetThoughts LLC. All rights 231 | reserved. 232 |
233 |
234 | 235 | 236 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | var validEnv = ['development', 'test', 'production'] 3 | var currentEnv = api.env() 4 | var isDevelopmentEnv = api.env('development') 5 | var isProductionEnv = api.env('production') 6 | var isTestEnv = api.env('test') 7 | 8 | if (!validEnv.includes(currentEnv)) { 9 | throw new Error( 10 | 'Please specify a valid `NODE_ENV` or ' + 11 | '`BABEL_ENV` environment variables. Valid values are "development", ' + 12 | '"test", and "production". Instead, received: ' + 13 | JSON.stringify(currentEnv) + 14 | '.' 15 | ) 16 | } 17 | 18 | return { 19 | presets: [ 20 | isTestEnv && [ 21 | '@babel/preset-env', 22 | { 23 | targets: { 24 | node: 'current' 25 | } 26 | } 27 | ], 28 | (isProductionEnv || isDevelopmentEnv) && [ 29 | '@babel/preset-env', 30 | { 31 | forceAllTransforms: true, 32 | useBuiltIns: 'entry', 33 | corejs: 3, 34 | modules: false, 35 | exclude: ['transform-typeof-symbol'] 36 | } 37 | ] 38 | ].filter(Boolean), 39 | plugins: [ 40 | 'babel-plugin-macros', 41 | '@babel/plugin-syntax-dynamic-import', 42 | isTestEnv && 'babel-plugin-dynamic-import-node', 43 | '@babel/plugin-transform-destructuring', 44 | [ 45 | '@babel/plugin-proposal-class-properties', 46 | { 47 | loose: true 48 | } 49 | ], 50 | [ 51 | '@babel/plugin-proposal-object-rest-spread', 52 | { 53 | useBuiltIns: true 54 | } 55 | ], 56 | [ 57 | '@babel/plugin-transform-runtime', 58 | { 59 | helpers: false 60 | } 61 | ], 62 | [ 63 | '@babel/plugin-transform-regenerator', 64 | { 65 | async: false 66 | } 67 | ] 68 | ].filter(Boolean) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'bundle' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "rubygems" 12 | 13 | m = Module.new do 14 | module_function 15 | 16 | def invoked_as_script? 17 | File.expand_path($0) == File.expand_path(__FILE__) 18 | end 19 | 20 | def env_var_version 21 | ENV["BUNDLER_VERSION"] 22 | end 23 | 24 | def cli_arg_version 25 | return unless invoked_as_script? # don't want to hijack other binstubs 26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 27 | bundler_version = nil 28 | update_index = nil 29 | ARGV.each_with_index do |a, i| 30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 31 | bundler_version = a 32 | end 33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 34 | bundler_version = $1 35 | update_index = i 36 | end 37 | bundler_version 38 | end 39 | 40 | def gemfile 41 | gemfile = ENV["BUNDLE_GEMFILE"] 42 | return gemfile if gemfile && !gemfile.empty? 43 | 44 | File.expand_path("../../Gemfile", __FILE__) 45 | end 46 | 47 | def lockfile 48 | lockfile = 49 | case File.basename(gemfile) 50 | when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) 51 | else "#{gemfile}.lock" 52 | end 53 | File.expand_path(lockfile) 54 | end 55 | 56 | def lockfile_version 57 | return unless File.file?(lockfile) 58 | lockfile_contents = File.read(lockfile) 59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 60 | Regexp.last_match(1) 61 | end 62 | 63 | def bundler_version 64 | @bundler_version ||= 65 | env_var_version || cli_arg_version || 66 | lockfile_version 67 | end 68 | 69 | def bundler_requirement 70 | return "#{Gem::Requirement.default}.a" unless bundler_version 71 | 72 | bundler_gem_version = Gem::Version.new(bundler_version) 73 | 74 | requirement = bundler_gem_version.approximate_recommendation 75 | 76 | return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") 77 | 78 | requirement += ".a" if bundler_gem_version.prerelease? 79 | 80 | requirement 81 | end 82 | 83 | def load_bundler! 84 | ENV["BUNDLE_GEMFILE"] ||= gemfile 85 | 86 | activate_bundler 87 | end 88 | 89 | def activate_bundler 90 | gem_error = activation_error_handling do 91 | gem "bundler", bundler_requirement 92 | end 93 | return if gem_error.nil? 94 | require_error = activation_error_handling do 95 | require "bundler/version" 96 | end 97 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 98 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" 99 | exit 42 100 | end 101 | 102 | def activation_error_handling 103 | yield 104 | nil 105 | rescue StandardError, LoadError => e 106 | e 107 | end 108 | end 109 | 110 | m.load_bundler! 111 | 112 | if m.invoked_as_script? 113 | load Gem.bin_path("bundler", "bundle") 114 | end 115 | -------------------------------------------------------------------------------- /bin/circleci-auto_upgrade_tools: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | echo "-----Create and switch to new branch-----" 6 | 7 | current_date=$(date +"%Y%m%d%H%M") 8 | new_branch_name="auto-upgrade-tools-dependencies-${current_date}" 9 | git checkout -b $new_branch_name 10 | 11 | echo "-----Run Gemfile.tools update-----" 12 | 13 | if bin/tools-upgrade; then 14 | echo 'Updated successfully' 15 | 16 | git config user.name "jt-tools-deployments" 17 | git config user.email "circleci.bot@example.com" 18 | 19 | git commit -am "Upgrades Gemfile.tools dependencies" 20 | git push "https://$GITHUB_TOKEN@github.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git" -f 21 | 22 | curl -X POST \ 23 | -H "Authorization: token ${GITHUB_TOKEN}" \ 24 | -d '{"title":"Upgrades tools dependencies","base":"master","head":"'$CIRCLE_PROJECT_USERNAME':'$new_branch_name'"}' \ 25 | https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls 26 | exit 0 27 | else 28 | echo 'Failed to update\n' 29 | exit 1 30 | fi 31 | -------------------------------------------------------------------------------- /bin/git-hooks/post-merge: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run updates on new changes 4 | branch_name=$(git branch | grep "*" | sed "s/\* //") 5 | reflog_message=$(git reflog -1) 6 | merged_branch_name=$(echo $reflog_message | cut -d" " -f 4 | sed "s/://") 7 | 8 | # if the merge was caused by a "git pull", we can safely ignore it 9 | if [[ $reflog_message =~ "merge" ]]; then 10 | echo "We support only pull" 11 | exit 0 12 | fi 13 | 14 | if [[ $branch_name == "master" ]]; then 15 | bin/spring stop; pkill "spring"; 16 | rm -rf tmp/cache 17 | 18 | bin/setup 19 | 20 | bin/rake db:reset 21 | 22 | echo "Removing merged branches..." 23 | git branch --merged master | grep -v "\*" | grep -v master | xargs -n 1 git branch -d 24 | fi 25 | -------------------------------------------------------------------------------- /bin/git-hooks/pre-push: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | bin/lint-pr --no-staged 6 | 7 | # bin/rspec --tag critical 8 | # bin/rails test 9 | -------------------------------------------------------------------------------- /bin/heroku-postdeploy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "== Preparing database ==" 4 | bin/rails db:prepare 5 | -------------------------------------------------------------------------------- /bin/heroku-release: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "== Update Database ==" 4 | bin/rake db:prepare 5 | -------------------------------------------------------------------------------- /bin/lint-pr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | reporters_opt="" 6 | 7 | if [[ -n "$PRONTO_GITHUB_ACCESS_TOKEN" && "$CIRCLECI" == "true" ]] 8 | then 9 | git fetch origin master --depth 1 10 | reporters_opt="-f github_status github_pr_review" 11 | fi 12 | 13 | bin/pronto run -c origin/master $reporters_opt --exit-code $@ 14 | -------------------------------------------------------------------------------- /bin/pronto: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'pronto' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile.tools", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("pronto", "pronto") 30 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | load File.expand_path("spring", __dir__) 3 | APP_PATH = File.expand_path('../config/application', __dir__) 4 | require_relative "../config/boot" 5 | require "rails/commands" 6 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | load File.expand_path("spring", __dir__) 3 | require_relative "../config/boot" 4 | require "rake" 5 | Rake.application.run 6 | -------------------------------------------------------------------------------- /bin/rubocop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rubocop' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile.tools", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rubocop", "rubocop") 30 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require "fileutils" 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path('..', __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to set up or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system! 'bin/tools-setup' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # Install JavaScript dependencies 22 | system! 'bin/yarn' 23 | 24 | # puts "\n== Copying sample files ==" 25 | # unless File.exist?('config/database.yml') 26 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 27 | # end 28 | 29 | puts "\n== Preparing database ==" 30 | system! 'bin/rails db:prepare' 31 | 32 | puts "\n== Removing old logs and tempfiles ==" 33 | system! 'bin/rails log:clear tmp:clear' 34 | 35 | puts "\n== Restarting application server ==" 36 | system! 'bin/rails restart' 37 | end 38 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) 3 | gem "bundler" 4 | require "bundler" 5 | 6 | # Load Spring without loading other gems in the Gemfile, for speed. 7 | Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring| 8 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 9 | gem "spring", spring.version 10 | require "spring/binstub" 11 | rescue Gem::LoadError 12 | # Ignore when Spring is not installed. 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /bin/standardrb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'standardrb' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile.tools", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("standard", "standardrb") 30 | -------------------------------------------------------------------------------- /bin/tools-setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | ([[ (-x "$(command -v brew)") ]] && brew bundle check || brew bundle --no-lock) \ 6 | || (echo "*** Please install manually system dependencies: ***" && cat Brewfile) 7 | 8 | export BUNDLE_GEMFILE=Gemfile.tools 9 | 10 | [[ (-z "$(command -v bundle)") ]] && gem install --conservative bundler 11 | 12 | bundle check || bundle install --jobs=4 --retry=3 13 | 14 | bin/yarn check || bin/yarn install 15 | -------------------------------------------------------------------------------- /bin/tools-upgrade: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | ([[ (-x "$(command -v brew)") ]] && brew bundle check || brew bundle --no-lock) \ 6 | || (echo "*** Please upgrade manually system dependencies: ***" && cat Brewfile) 7 | 8 | export BUNDLE_GEMFILE=Gemfile.tools 9 | 10 | bundle update --jobs=4 --retry=3 --all 11 | 12 | yarn check || yarn upgrade 13 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/webpack_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::WebpackRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/dev_server_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::DevServerRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | yarn = ENV["PATH"].split(File::PATH_SEPARATOR). 5 | select { |dir| File.expand_path(dir) != __dir__ }. 6 | product(["yarn", "yarn.cmd", "yarn.ps1"]). 7 | map { |dir, file| File.expand_path(file, dir) }. 8 | find { |file| File.executable?(file) } 9 | 10 | if yarn 11 | exec yarn, *ARGV 12 | else 13 | $stderr.puts "Yarn executable was not detected in the system." 14 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 15 | exit 1 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | --- 2 | codecov: 3 | notify: 4 | require_ci_to_pass: true 5 | 6 | comment: 7 | layout: 'diff, flags, files' 8 | behavior: 'once' 9 | require_changes: false 10 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative "config/environment" 4 | 5 | run Rails.application 6 | Rails.application.load_server 7 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative "boot" 2 | 3 | require "rails" 4 | # Pick the frameworks you want: 5 | require "active_model/railtie" 6 | require "active_job/railtie" 7 | require "active_record/railtie" 8 | require "active_storage/engine" 9 | require "action_controller/railtie" 10 | # require "action_mailer/railtie" 11 | require "action_mailbox/engine" 12 | require "action_text/engine" 13 | require "action_view/railtie" 14 | # require "action_cable/engine" 15 | # require "sprockets/railtie" 16 | require "rails/test_unit/railtie" 17 | 18 | # Require the gems listed in Gemfile, including any gems 19 | # you've limited to :test, :development, or :production. 20 | Bundler.require(*Rails.groups) 21 | 22 | module VuejsRailsStarterkit 23 | class Application < Rails::Application 24 | # Initialize configuration defaults for originally generated Rails version. 25 | config.load_defaults 6.1 26 | 27 | # Configuration for the application, engines, and railties goes here. 28 | # 29 | # These settings can be overridden in specific environments using the files 30 | # in config/environments, which are processed later. 31 | # 32 | # config.time_zone = "Central Time (US & Canada)" 33 | # config.eager_load_paths << Rails.root.join("extras") 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | require "bootsnap/setup" # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | B2cVb2JAxcTHaQGIrZTSS6mR1DZZQIZav77i8b52aLhip5mkIwNgo1KyOl0WB3pWGsxtONBX+DoD2GoozTNAos6ZB4RxE7m2sf25HZAGKdwWmVIVkd88xsCp16NvvevbKuZrYFea6BRXBZ7zwnjNH4vXsouRiUXyC5Cz1/odAvAkLXJqRmRmI+cb6dFvyzt2SnnkkCj5uV3dJWqjRIvqAL1UCJQs/H+UtqXepI6o83e8ibIzMgOdniWzEFmgUQxQQL/3Xrh3o69yLYnkiIx2RjjbqdkaJDu376vMg0/Koq59YDGy/fQSfE8JU0DL0fTyk6lusFWzkn7B9RMmtEBK54cOEa0QJ4zolZhJvuAIxgcZ7CecTKBCtw27dtWKdO35TDL/IpFsC/oZVRTwQ7VZTpdgLvADVEEt+Zp+--QqUJhrX4x4EC4rja--qgjVQkbeuwTjmYxJ2hIDZg== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.3 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On macOS with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On macOS with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see Rails configuration guide 21 | # https://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: vuejs_rails_starterkit_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user running Rails. 32 | #username: vuejs_rails_starterkit 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: vuejs_rails_starterkit_test 61 | 62 | # As with config/credentials.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password or a full connection URL as an environment 67 | # variable when you boot the app. For example: 68 | # 69 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 70 | # 71 | # If the connection URL is provided in the special DATABASE_URL environment 72 | # variable, Rails will automatically merge its configuration values on top of 73 | # the values provided in this file. Alternatively, you can specify a connection 74 | # URL environment variable explicitly: 75 | # 76 | # production: 77 | # url: <%= ENV['MY_APP_DATABASE_URL'] %> 78 | # 79 | # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 80 | # for a full overview on how database connection configuration can be specified. 81 | # 82 | production: 83 | <<: *default 84 | database: vuejs_rails_starterkit_production 85 | username: vuejs_rails_starterkit 86 | password: <%= ENV['VUEJS_RAILS_STARTERKIT_DATABASE_PASSWORD'] %> 87 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative "application" 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded any time 7 | # it changes. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable/disable caching. By default caching is disabled. 18 | # Run rails dev:cache to toggle caching. 19 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 20 | config.action_controller.perform_caching = true 21 | config.action_controller.enable_fragment_cache_logging = true 22 | 23 | config.cache_store = :memory_store 24 | config.public_file_server.headers = { 25 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 26 | } 27 | else 28 | config.action_controller.perform_caching = false 29 | 30 | config.cache_store = :null_store 31 | end 32 | 33 | # Store uploaded files on the local file system (see config/storage.yml for options). 34 | config.active_storage.service = :local 35 | 36 | # Print deprecation notices to the Rails logger. 37 | config.active_support.deprecation = :log 38 | 39 | # Raise exceptions for disallowed deprecations. 40 | config.active_support.disallowed_deprecation = :raise 41 | 42 | # Tell Active Support which deprecation messages to disallow. 43 | config.active_support.disallowed_deprecation_warnings = [] 44 | 45 | # Raise an error on page load if there are pending migrations. 46 | config.active_record.migration_error = :page_load 47 | 48 | # Highlight code that triggered database queries in logs. 49 | config.active_record.verbose_query_logs = true 50 | 51 | 52 | # Raises error for missing translations. 53 | # config.i18n.raise_on_missing_translations = true 54 | 55 | # Annotate rendered view with file names. 56 | # config.action_view.annotate_rendered_view_with_filenames = true 57 | 58 | # Use an evented file watcher to asynchronously detect changes in source code, 59 | # routes, locales, etc. This feature depends on the listen gem. 60 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 61 | 62 | # Uncomment if you wish to allow Action Cable access from any origin. 63 | # config.action_cable.disable_request_forgery_protection = true 64 | end 65 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | require 'r7_insight.rb' 4 | 5 | Rails.application.configure do 6 | if ENV["MEMCACHIER_SERVERS"] 7 | config.cache_store = :mem_cache_store, 8 | ENV["MEMCACHIER_SERVERS"].split(","), { 9 | username: ENV["MEMCACHIER_USERNAME"], password: ENV["MEMCACHIER_PASSWORD"], 10 | failover: true, socket_timeout: 1.5, socket_failure_delay: 0.2, down_retry_delay: 60, 11 | pool_size: ENV.fetch("RAILS_MAX_THREADS") { 5 }, 12 | } 13 | end 14 | 15 | if ENV['R7INSIGHT_TOKEN'].present? 16 | Rails.logger = R7Insight.new(ENV['R7INSIGHT_TOKEN'], ENV['R7INSIGHT_REGION']) 17 | end 18 | # Settings specified here will take precedence over those in config/application.rb. 19 | 20 | # Code is not reloaded between requests. 21 | config.cache_classes = true 22 | 23 | # Eager load code on boot. This eager loads most of Rails and 24 | # your application in memory, allowing both threaded web servers 25 | # and those relying on copy on write to perform better. 26 | # Rake tasks automatically ignore this option for performance. 27 | config.eager_load = true 28 | 29 | # Full error reports are disabled and caching is turned on. 30 | config.consider_all_requests_local = false 31 | config.action_controller.perform_caching = true 32 | 33 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 34 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 35 | # config.require_master_key = true 36 | 37 | # Disable serving static files from the `/public` folder by default since 38 | # Apache or NGINX already handles this. 39 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 40 | 41 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 42 | # config.asset_host = 'http://assets.example.com' 43 | 44 | # Specifies the header that your server uses for sending files. 45 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 46 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 47 | 48 | # Store uploaded files on the local file system (see config/storage.yml for options). 49 | config.active_storage.service = :local 50 | 51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 52 | # config.force_ssl = true 53 | 54 | # Include generic and useful information about system operation, but avoid logging too much 55 | # information to avoid inadvertent exposure of personally identifiable information (PII). 56 | config.log_level = :info 57 | 58 | # Prepend all log lines with the following tags. 59 | config.log_tags = [ :request_id ] 60 | 61 | # Use a different cache store in production. 62 | # config.cache_store = :mem_cache_store 63 | 64 | # Use a real queuing backend for Active Job (and separate queues per environment). 65 | # config.active_job.queue_adapter = :resque 66 | # config.active_job.queue_name_prefix = "vuejs_rails_starterkit_production" 67 | 68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 69 | # the I18n.default_locale when a translation cannot be found). 70 | config.i18n.fallbacks = true 71 | 72 | # Send deprecation notices to registered listeners. 73 | config.active_support.deprecation = :notify 74 | 75 | # Log disallowed deprecations. 76 | config.active_support.disallowed_deprecation = :log 77 | 78 | # Tell Active Support which deprecation messages to disallow. 79 | config.active_support.disallowed_deprecation_warnings = [] 80 | 81 | # Use default logging formatter so that PID and timestamp are not suppressed. 82 | config.log_formatter = ::Logger::Formatter.new 83 | 84 | # Use a different logger for distributed setups. 85 | # require "syslog/logger" 86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 87 | 88 | if ENV["RAILS_LOG_TO_STDOUT"].present? 89 | logger = ActiveSupport::Logger.new(STDOUT) 90 | logger.formatter = config.log_formatter 91 | config.logger = ActiveSupport::TaggedLogging.new(logger) 92 | end 93 | 94 | # Do not dump schema after migrations. 95 | config.active_record.dump_schema_after_migration = false 96 | 97 | # Inserts middleware to perform automatic connection switching. 98 | # The `database_selector` hash is used to pass options to the DatabaseSelector 99 | # middleware. The `delay` is used to determine how long to wait after a write 100 | # to send a subsequent read to the primary. 101 | # 102 | # The `database_resolver` class is used by the middleware to determine which 103 | # database is appropriate to use based on the time delay. 104 | # 105 | # The `database_resolver_context` class is used by the middleware to set 106 | # timestamps for the last write to the primary. The resolver uses the context 107 | # class timestamps to determine how long to wait before reading from the 108 | # replica. 109 | # 110 | # By default Rails will store a last write timestamp in the session. The 111 | # DatabaseSelector middleware is designed as such you can define your own 112 | # strategy for connection switching and pass that into the middleware through 113 | # these configuration options. 114 | # config.active_record.database_selector = { delay: 2.seconds } 115 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver 116 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session 117 | end 118 | -------------------------------------------------------------------------------- /config/environments/staging.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | require 'r7_insight.rb' 4 | 5 | Rails.application.configure do 6 | if ENV["MEMCACHIER_SERVERS"] 7 | config.cache_store = :mem_cache_store, 8 | ENV["MEMCACHIER_SERVERS"].split(","), { 9 | username: ENV["MEMCACHIER_USERNAME"], password: ENV["MEMCACHIER_PASSWORD"], 10 | failover: true, socket_timeout: 1.5, socket_failure_delay: 0.2, down_retry_delay: 60, 11 | pool_size: ENV.fetch("RAILS_MAX_THREADS") { 5 }, 12 | } 13 | end 14 | 15 | if ENV['R7INSIGHT_TOKEN'].present? 16 | Rails.logger = R7Insight.new(ENV['R7INSIGHT_TOKEN'], ENV['R7INSIGHT_REGION']) 17 | end 18 | # Settings specified here will take precedence over those in config/application.rb. 19 | 20 | # Code is not reloaded between requests. 21 | config.cache_classes = true 22 | 23 | # Eager load code on boot. This eager loads most of Rails and 24 | # your application in memory, allowing both threaded web servers 25 | # and those relying on copy on write to perform better. 26 | # Rake tasks automatically ignore this option for performance. 27 | config.eager_load = true 28 | 29 | # Full error reports are disabled and caching is turned on. 30 | config.consider_all_requests_local = false 31 | config.action_controller.perform_caching = true 32 | 33 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 34 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 35 | # config.require_master_key = true 36 | 37 | # Disable serving static files from the `/public` folder by default since 38 | # Apache or NGINX already handles this. 39 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 40 | 41 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 42 | # config.asset_host = 'http://assets.example.com' 43 | 44 | # Specifies the header that your server uses for sending files. 45 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 46 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 47 | 48 | # Store uploaded files on the local file system (see config/storage.yml for options). 49 | config.active_storage.service = :local 50 | 51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 52 | # config.force_ssl = true 53 | 54 | # Include generic and useful information about system operation, but avoid logging too much 55 | # information to avoid inadvertent exposure of personally identifiable information (PII). 56 | config.log_level = :info 57 | 58 | # Prepend all log lines with the following tags. 59 | config.log_tags = [ :request_id ] 60 | 61 | # Use a different cache store in production. 62 | # config.cache_store = :mem_cache_store 63 | 64 | # Use a real queuing backend for Active Job (and separate queues per environment). 65 | # config.active_job.queue_adapter = :resque 66 | # config.active_job.queue_name_prefix = "vuejs_rails_starterkit_production" 67 | 68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 69 | # the I18n.default_locale when a translation cannot be found). 70 | config.i18n.fallbacks = true 71 | 72 | # Send deprecation notices to registered listeners. 73 | config.active_support.deprecation = :notify 74 | 75 | # Log disallowed deprecations. 76 | config.active_support.disallowed_deprecation = :log 77 | 78 | # Tell Active Support which deprecation messages to disallow. 79 | config.active_support.disallowed_deprecation_warnings = [] 80 | 81 | # Use default logging formatter so that PID and timestamp are not suppressed. 82 | config.log_formatter = ::Logger::Formatter.new 83 | 84 | # Use a different logger for distributed setups. 85 | # require "syslog/logger" 86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 87 | 88 | if ENV["RAILS_LOG_TO_STDOUT"].present? 89 | logger = ActiveSupport::Logger.new(STDOUT) 90 | logger.formatter = config.log_formatter 91 | config.logger = ActiveSupport::TaggedLogging.new(logger) 92 | end 93 | 94 | # Do not dump schema after migrations. 95 | config.active_record.dump_schema_after_migration = false 96 | 97 | # Inserts middleware to perform automatic connection switching. 98 | # The `database_selector` hash is used to pass options to the DatabaseSelector 99 | # middleware. The `delay` is used to determine how long to wait after a write 100 | # to send a subsequent read to the primary. 101 | # 102 | # The `database_resolver` class is used by the middleware to determine which 103 | # database is appropriate to use based on the time delay. 104 | # 105 | # The `database_resolver_context` class is used by the middleware to set 106 | # timestamps for the last write to the primary. The resolver uses the context 107 | # class timestamps to determine how long to wait before reading from the 108 | # replica. 109 | # 110 | # By default Rails will store a last write timestamp in the session. The 111 | # DatabaseSelector middleware is designed as such you can define your own 112 | # strategy for connection switching and pass that into the middleware through 113 | # these configuration options. 114 | # config.active_record.database_selector = { delay: 2.seconds } 115 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver 116 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session 117 | end 118 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | config.cache_classes = false 12 | config.action_view.cache_template_loading = true 13 | 14 | # Do not eager load code on boot. This avoids loading your whole application 15 | # just for the purpose of running a single test. If you are using a tool that 16 | # preloads Rails for running tests, you may have to set it to true. 17 | config.eager_load = false 18 | 19 | # Configure public file server for tests with Cache-Control for performance. 20 | config.public_file_server.enabled = true 21 | config.public_file_server.headers = { 22 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 23 | } 24 | 25 | # Show full error reports and disable caching. 26 | config.consider_all_requests_local = true 27 | config.action_controller.perform_caching = false 28 | config.cache_store = :null_store 29 | 30 | # Raise exceptions instead of rendering exception templates. 31 | config.action_dispatch.show_exceptions = false 32 | 33 | # Disable request forgery protection in test environment. 34 | config.action_controller.allow_forgery_protection = false 35 | 36 | # Store uploaded files on the local file system in a temporary directory. 37 | config.active_storage.service = :test 38 | 39 | # Print deprecation notices to the stderr. 40 | config.active_support.deprecation = :stderr 41 | 42 | # Raise exceptions for disallowed deprecations. 43 | config.active_support.disallowed_deprecation = :raise 44 | 45 | # Tell Active Support which deprecation messages to disallow. 46 | config.active_support.disallowed_deprecation_warnings = [] 47 | 48 | # Raises error for missing translations. 49 | # config.i18n.raise_on_missing_translations = true 50 | 51 | # Annotate rendered view with file names. 52 | # config.action_view.annotate_rendered_view_with_filenames = true 53 | end 54 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code 7 | # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'". 8 | Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"] 9 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | # # If you are using webpack-dev-server then specify webpack-dev-server host 15 | # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? 16 | 17 | # # Specify URI for violation reports 18 | # # policy.report_uri "/csp-violation-report-endpoint" 19 | # end 20 | 21 | # If you are using UJS then enable automatic nonce generation 22 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 23 | 24 | # Set the nonce only to specific directives 25 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) 26 | 27 | # Report CSP violations to a specified URI 28 | # For further information see the following documentation: 29 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 30 | # Rails.application.config.content_security_policy_report_only = true 31 | 32 | Rails.application.config.content_security_policy do |policy| 33 | policy.script_src :self, :https 34 | 35 | if Rails.env.development? || Rails.env.test? 36 | policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [ 5 | :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn 6 | ] 7 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Define an application-wide HTTP permissions policy. For further 2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy 3 | # 4 | # Rails.application.config.permissions_policy do |f| 5 | # f.camera :none 6 | # f.gyroscope :none 7 | # f.microphone :none 8 | # f.usb :none 9 | # f.fullscreen :self 10 | # f.payment :self, "https://secure.example.com" 11 | # end 12 | -------------------------------------------------------------------------------- /config/initializers/serviceworker.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | config.serviceworker.routes.draw do 3 | # map to assets implicitly 4 | match '/serviceworker.js', pack: 'serviceworker.js' 5 | 6 | # Examples 7 | # 8 | # map to a named asset explicitly 9 | # match "/proxied-serviceworker.js" => "nested/asset/serviceworker.js" 10 | # match "/nested/serviceworker.js" => "another/serviceworker.js" 11 | # 12 | # capture named path segments and interpolate to asset name 13 | # match "/captures/*segments/serviceworker.js" => "%{segments}/serviceworker.js" 14 | # 15 | # capture named parameter and interpolate to asset name 16 | # match "/parameter/:id/serviceworker.js" => "project/%{id}/serviceworker.js" 17 | # 18 | # insert custom headers 19 | # match "/header-serviceworker.js" => "another/serviceworker.js", 20 | # headers: { "X-Resource-Header" => "A resource" } 21 | # 22 | # anonymous glob exposes `paths` variable for interpolation 23 | # match "/*/serviceworker.js" => "%{paths}/serviceworker.js" 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before 12 | # terminating a worker in development environments. 13 | # 14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" 15 | 16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 17 | # 18 | port ENV.fetch("PORT") { 3000 } 19 | 20 | # Specifies the `environment` that Puma will run in. 21 | # 22 | environment ENV.fetch("RAILS_ENV") { "development" } 23 | 24 | # Specifies the `pidfile` that Puma will use. 25 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 26 | 27 | # Specifies the number of `workers` to boot in clustered mode. 28 | # Workers are forked web server processes. If using threads and workers together 29 | # the concurrency of the application would be max `threads` * `workers`. 30 | # Workers do not work on JRuby or Windows (both of which do not support 31 | # processes). 32 | # 33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 34 | 35 | # Use the `preload_app!` method when specifying a `workers` number. 36 | # This directive tells Puma to first boot the application and load code 37 | # before forking the application. This takes advantage of Copy On Write 38 | # process behavior so workers use less memory. 39 | # 40 | # preload_app! 41 | 42 | # Allow puma to be restarted by `rails restart` command. 43 | plugin :tmp_restart 44 | -------------------------------------------------------------------------------- /config/rails_best_practices.yml: -------------------------------------------------------------------------------- 1 | --- 2 | AddModelVirtualAttributeCheck: 3 | AlwaysAddDbIndexCheck: {} 4 | # CheckSaveReturnValueCheck: {} 5 | # CheckDestroyReturnValueCheck: {} 6 | DefaultScopeIsEvilCheck: {} 7 | DryBundlerInCapistranoCheck: {} 8 | # HashSyntaxCheck: {} 9 | IsolateSeedDataCheck: {} 10 | KeepFindersOnTheirOwnModelCheck: {} 11 | LawOfDemeterCheck: {} 12 | # LongLineCheck: { max_line_length: 80 } 13 | MoveCodeIntoControllerCheck: {} 14 | MoveCodeIntoHelperCheck: { array_count: 10 } 15 | MoveCodeIntoModelCheck: { use_count: 10 } 16 | MoveFinderToNamedScopeCheck: {} 17 | MoveModelLogicIntoModelCheck: { use_count: 10 } 18 | NeedlessDeepNestingCheck: { nested_count: 5 } 19 | NotRescueExceptionCheck: {} 20 | NotUseDefaultRouteCheck: {} 21 | NotUseTimeAgoInWordsCheck: {} 22 | OveruseRouteCustomizationsCheck: { customize_count: 3 } 23 | ProtectMassAssignmentCheck: {} 24 | RemoveEmptyHelpersCheck: {} 25 | # RemoveTabCheck: {} 26 | RemoveTrailingWhitespaceCheck: {} 27 | # RemoveUnusedMethodsInControllersCheck: { except_methods: [] } 28 | # RemoveUnusedMethodsInHelpersCheck: { except_methods: [] } 29 | # RemoveUnusedMethodsInModelsCheck: { except_methods: [] } 30 | ReplaceComplexCreationWithFactoryMethodCheck: { attribute_assignment_count: 5 } 31 | ReplaceInstanceVariableWithLocalVariableCheck: {} 32 | RestrictAutoGeneratedRoutesCheck: {} 33 | SimplifyRenderInControllersCheck: {} 34 | SimplifyRenderInViewsCheck: {} 35 | # UseBeforeFilterCheck: { customize_count: 2 } 36 | UseModelAssociationCheck: {} 37 | UseMultipartAlternativeAsContentTypeOfEmailCheck: {} 38 | # UseParenthesesInMethodDefCheck: {} 39 | UseObserverCheck: {} 40 | UseQueryAttributeCheck: {} 41 | UseSayWithTimeInMigrationsCheck: {} 42 | UseScopeAccessCheck: {} 43 | UseTurboSprocketsRails3Check: {} 44 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | root 'landing#index' 3 | get 'landing/index' 4 | # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html 5 | end 6 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | Spring.watch( 2 | ".ruby-version", 3 | ".rbenv-vars", 4 | "tmp/restart.txt", 5 | "tmp/caching-dev.txt" 6 | ) 7 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | const { VueLoaderPlugin } = require('vue-loader') 3 | const vue = require('./loaders/vue') 4 | 5 | environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin()) 6 | environment.loaders.prepend('vue', vue) 7 | 8 | environment.config.set('output.globalObject', 'this') 9 | 10 | environment.splitChunks() 11 | module.exports = environment 12 | -------------------------------------------------------------------------------- /config/webpack/loaders/vue.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | test: /\.vue(\.erb)?$/, 3 | use: [{ 4 | loader: 'vue-loader' 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_root_path: public 7 | public_output_path: packs 8 | cache_path: tmp/cache/webpacker 9 | webpack_compile_output: true 10 | 11 | # Additional paths webpack should lookup modules 12 | # ['app/assets', 'engine/foo/app/assets'] 13 | additional_paths: [] 14 | 15 | # Reload manifest.json on all requests so we reload latest compiled packs 16 | cache_manifest: false 17 | 18 | # Extract and emit a css file 19 | extract_css: false 20 | 21 | static_assets_extensions: 22 | - .jpg 23 | - .jpeg 24 | - .png 25 | - .gif 26 | - .tiff 27 | - .ico 28 | - .svg 29 | - .eot 30 | - .otf 31 | - .ttf 32 | - .woff 33 | - .woff2 34 | 35 | extensions: 36 | - .vue 37 | - .mjs 38 | - .js 39 | - .sass 40 | - .scss 41 | - .css 42 | - .module.sass 43 | - .module.scss 44 | - .module.css 45 | - .png 46 | - .svg 47 | - .gif 48 | - .jpeg 49 | - .jpg 50 | 51 | development: 52 | <<: *default 53 | compile: true 54 | 55 | # Reference: https://webpack.js.org/configuration/dev-server/ 56 | dev_server: 57 | https: false 58 | host: localhost 59 | port: 3035 60 | public: localhost:3035 61 | hmr: false 62 | # Inline should be set to true if using HMR 63 | inline: true 64 | overlay: true 65 | compress: true 66 | disable_host_check: true 67 | use_local_ip: false 68 | quiet: false 69 | pretty: false 70 | headers: 71 | 'Access-Control-Allow-Origin': '*' 72 | watch_options: 73 | ignored: '**/node_modules/**' 74 | 75 | 76 | test: 77 | <<: *default 78 | compile: true 79 | 80 | # Compile test packs to a separate directory 81 | public_output_path: packs-test 82 | 83 | production: 84 | <<: *default 85 | 86 | # Production depends on precompilation of packs prior to booting for performance. 87 | compile: false 88 | 89 | # Extract and emit a css file 90 | extract_css: true 91 | 92 | # Cache manifest.json for performance 93 | cache_manifest: true 94 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # This file is the source Rails uses to define your schema when running `bin/rails 6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 0) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | 18 | end 19 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vuejs-rails-starterkit", 3 | "private": true, 4 | "engines": { 5 | "node": ">= 12.x" 6 | }, 7 | "scripts": { 8 | "test": "jest" 9 | }, 10 | "jest": { 11 | "verbose": true, 12 | "testURL": "http://localhost/", 13 | "roots": [ 14 | "test/javascript" 15 | ], 16 | "moduleDirectories": [ 17 | "node_modules", 18 | "app/javascript" 19 | ], 20 | "moduleNameMapper": { 21 | "^@/(.*)$": "/app/javascript/$1" 22 | }, 23 | "moduleFileExtensions": [ 24 | "js", 25 | "json", 26 | "vue" 27 | ], 28 | "transform": { 29 | ".+\\.js$": "babel-jest", 30 | ".+\\.vue$": "vue-jest" 31 | }, 32 | "testPathIgnorePatterns": [ 33 | "/config/webpack/" 34 | ], 35 | "snapshotSerializers": [ 36 | "jest-serializer-vue" 37 | ], 38 | "collectCoverage": true, 39 | "collectCoverageFrom": [ 40 | "**/*.{js,vue}", 41 | "!**/node_modules/**", 42 | "!**/config/**", 43 | "!**/vendor/**" 44 | ] 45 | }, 46 | "dependencies": { 47 | "@fortawesome/fontawesome-free": "^5.15.3", 48 | "@rails/activestorage": "^6.0.0", 49 | "@rails/ujs": "^6.0.0", 50 | "@rails/webpacker": "5.2.1", 51 | "admin-lte": "^3.1.0", 52 | "bootstrap": "^4.6.0", 53 | "jquery": "^3.6.0", 54 | "popover": "^2.4.1", 55 | "turbolinks": "^5.2.0", 56 | "vue": "^2.6.12", 57 | "vue-loader": "^15.9.6", 58 | "vue-template-compiler": "^2.6.12", 59 | "vue-turbolinks": "^2.2.1" 60 | }, 61 | "version": "0.1.0", 62 | "devDependencies": { 63 | "@vue/test-utils": "^1.1.4", 64 | "babel-core": "^7.0.0-bridge.0", 65 | "babel-jest": "^26.6.3", 66 | "eslint": "^7.24.0", 67 | "jest": "^26.6.3", 68 | "jest-junit": "^12.0.0", 69 | "jest-serializer-vue": "^2.0.2", 70 | "vue-jest": "^3.0.7", 71 | "webpack-dev-server": "^3.11.2" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/public/favicon.ico -------------------------------------------------------------------------------- /public/offline.html: -------------------------------------------------------------------------------- 1 |

Offline!

2 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/storage/.keep -------------------------------------------------------------------------------- /test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] 5 | end 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/landing_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class LandingControllerTest < ActionDispatch::IntegrationTest 4 | test "should get index" do 5 | get landing_index_url 6 | assert_response :success 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/test/integration/.keep -------------------------------------------------------------------------------- /test/javascript/__snapshots__/app.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`App matches snapshot 1`] = ` 4 |
5 |

Hello Vue!

6 |
7 | `; 8 | -------------------------------------------------------------------------------- /test/javascript/app.test.js: -------------------------------------------------------------------------------- 1 | import { mount, shallowMount } from '@vue/test-utils' 2 | import App from 'app'; 3 | 4 | describe('App', () => { 5 | test('is a Vue instance', () => { 6 | const wrapper = mount(App) 7 | expect(wrapper.vm).toBeTruthy() 8 | }) 9 | 10 | test('matches snapshot', () => { 11 | const wrapper = shallowMount(App) 12 | expect(wrapper.html()).toMatchSnapshot() 13 | }) 14 | }); 15 | -------------------------------------------------------------------------------- /test/javascript/test.test.js: -------------------------------------------------------------------------------- 1 | test('there is no I in team', () => { 2 | expect('team').not.toMatch(/I/); 3 | }); 4 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/test/models/.keep -------------------------------------------------------------------------------- /test/system/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/test/system/.keep -------------------------------------------------------------------------------- /test/system/app_component_integrations_test.rb: -------------------------------------------------------------------------------- 1 | require 'application_system_test_case' 2 | 3 | class AppComponentIntegrationsTest < ApplicationSystemTestCase 4 | driven_by :selenium, using: :headless_chrome 5 | 6 | test 'vue component on landing page' do 7 | visit root_path 8 | 9 | assert_selector 'p', text: 'Hello Vue!' 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | require 'simplecov' if ENV['COVERAGE'] 2 | ENV['RAILS_ENV'] ||= 'test' 3 | require_relative "../config/environment" 4 | require "rails/test_help" 5 | 6 | class ActiveSupport::TestCase 7 | # Run tests in parallel with specified workers 8 | parallelize(workers: :number_of_processors) unless ENV['COVERAGE'] 9 | 10 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 11 | fixtures :all 12 | 13 | # Add more helper methods to be used by all tests here... 14 | end 15 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/tmp/.keep -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/tmp/pids/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jetthoughts/vuejs-rails-starterkit/f34ca73c06269dba49d7ac08fdb77c27b0202f62/vendor/.keep --------------------------------------------------------------------------------