Skip to content

Instantly share code, notes, and snippets.

@tdonohue
Last active June 21, 2021 15:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tdonohue/0571c97ac4ff45a6af7756c0b231f370 to your computer and use it in GitHub Desktop.
Save tdonohue/0571c97ac4ff45a6af7756c0b231f370 to your computer and use it in GitHub Desktop.
Windows + Atom + Vagrant tricks

Editing files in Vagrant using your local copy of Atom

In case you want to have an IDE locally, but have your Development environment be on a VM

  1. Install Atom on your local (host) machine: https://atom.io/
  2. Install the "remote-sync" package: https://atom.io/packages/remote-sync
  3. Ensure Vagrant is running (e.g. vagrant up)
  4. Create an empty directory on your local (host) machine that you want to "sync" with a directory on the Vagrant VM
  5. Open that empty directory in Atom
  6. Right click on it, select "Remote Sync -> Configure"
  7. Fill in the SSH configuration details
    • Hint, run vagrant ssh-config to get these details for a Vagrant VM
    • You can test them by trying: ssh -p [port] -i [identityfile] [user]@[hostname]
    • For the remote folder, you can use a relative path (based on user's home directory)
  8. Right click on the empty folder again, select "Remote Sync -> Download Folder". Wait while it syncs your remote folder down to the host.
  9. Edit the files. If you have it upload on save (see configuration of "remote-sync"), then saving will upload the changes to Vagrant.
    • Otherwise, you can "Remote Sync -> Upload File" by right clicking on the individual file
    • You can also "Monitor File" for remote changes (to sync down to your local machine when changed remotely)

Atom + Rubocop on Windows

This is useful for Ruby coding in Atom on Windows. You do however have to install Ruby and Rubocop on Windows.

  1. Install Ruby on Windows per https://rubyinstaller.org/
  2. Install Ruby DevTools per https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
  3. Install Rubocop
    • gem install rubocop --platform=ruby
    • gem install rubocop-rspec --platform=ruby
  4. Test it to ensure it's working:
    • rubocop [path-to-an-rb-file]
  5. In Atom, install Linter and Linter-Rubocop
    • You may need to configure linter-rubocop to use the full path of your rubocop install (find it using which rubocop)
  6. That's it! Now anytime you open or edit a Ruby file, you'll get warnings if you disobey rubocop's suggestions!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment