> For the complete documentation index, see [llms.txt](https://teachersmanual.firstdraft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teachersmanual.firstdraft.com/projects-checklist/appdev-2-hw-checklist.md).

# AD2 HW Checklist

## AD2 hw checklist

## Update files

* update `.gitpod.yml` with the AD1 [extensions](/projects-checklist/appdev-1-gitpod-extensions-and-settings.md#extensions).
* ensure Ruby version is up to date. (3.0.3)
* ensure better errors is whitelisted in `config/environments/development.rb` and contains

  ```rb
    config.web_console.whitelisted_ips = '0.0.0.0/0.0.0.0'
    BetterErrors::Middleware.allow_ip! '0.0.0.0/0.0.0.0'
  ```

  **remove the old whitelist**

  ```rb
    BetterErrors::Middleware.allow_ip! '10.138.0.0/16'
  ```
* create `.vscode/manage_extensions` if it doesn't exist and contains the following:

  ```bash
  #!/usr/bin/env ruby

  unwanted_extensions = [
  	"k--kato.intellij-idea-keybindings",
  	"kaiwood.endwise",
  	"castwide.solargraph",
  	"jnbt.vscode-rufo",
  	"mbessey.vscode-rufo",
  ]

  wanted_extensions = [
  	"vscode-rufo-0.0.6.vsix"
  ]

  unwanted_extensions.each do |extension|
  	results = `code --uninstall-extension #{extension}`
  	if results.include?("successfully uninstalled")
  		status = "."
  	elsif results.include?("is not installed")
  		status = "."
  	else
  		status = "X (#{extension.split(".")[0]})"
  	end
  	print "#{status}"
  end

  wanted_extensions.each do |extension|
  	results = `code --install-extension .vscode/#{extension}`
  	if results.include?("success")
  		status = "."
  	else
  		status = "X (#{extension.split(".")[0]})"
  	end
  	print "#{status}"
  end
  puts ""
  ```
* Ensure `.vscode/manage_extensions` is executable (run `chmod 777 .vscode/manage_extensions`).
* Ensure `.vscode/vscode-rufo-0.0.6.vsix` exists. If it doesn't download it from [here](https://github.com/appdev-projects/pg-ajax-1/raw/main/.vscode/vscode-rufo-0.0.6.vsix).
* Ensure `Dockerfile` is present in the project and [up to date](https://github.com/firstdraft/dockerfiles/tree/main/appdev2) w/ correct Ruby version.
* Ensure `webpacker` is up to date by running `rails webpacker:install`
* Ensure `.gitignore` file includes:

  ```
  vendor/bundle/*
  !vendor/bundle/.keep
  ```
* Check that `bin/server` compiles webpacker correctly in Gitpod— if it does not work, make the following changes:

  ```ruby
  export NODE_OPTIONS=--openssl-legacy-provider && rails server -b 0.0.0.0
  ```

  or rebuild the Docker image with Node version 14.
* ensure `bin/setup` file includes:

  ```ruby
  if !Dir.exist?("vendor/bundle/ruby") && Dir.exist?("/base-rails/gems/ruby")
    FileUtils.cp_r("/base-rails/gems/ruby", "vendor/bundle")
    system! "bundle config set --local path 'vendor/bundle'"
    system! 'bundle exec skylight disable_dev_warning'
  end
  if !Dir.exist?("node_modules") && Dir.exist?("/base-rails/node_modules")
    FileUtils.cp_r("/base-rails/node_modules", "node_modules")
  end
  ```
* ensure `.vscode` folder and `.vscode/settings.json` exist and are [up to date](/projects-checklist/appdev-1-gitpod-extensions-and-settings.md).

#### Gems

* ensure `web_git` gem is using the `master` branch and **not** `spring2020`.
* ensure `htmlbeautifier`, `rufo`, `solargraph` gems have been added to the `:development` group.

#### Testing

* `bundle update`
* `yarn install`
* `rails db:migrate`
* CRUD a resource to ensure JS works as expected -> `rails g scaffold tasks name`
* ensure you can do the following successfully:
  * `rails s`
  * `rails grade`
  * visit `/git`

## Update Docker image

* Build image
* Push to Dockerhub
* Update `.gitpod.yml` with Docker image name
* Push to GitHub branch
* Open workspace from branch, ensure Ruby version is correct and gems install instantly

See [Adding Dependencies to a Project](/projects-checklist/adding-dependencies-to-a-project.md#adding-dependencies-to-a-project) for more details on building and testing a Docker image.
