A ruby playground to experiment with the ruby wrapper for the FIrebase API.
Running under Docker
Once you have the repository pulled down, you can run under Docker without having to have ruby or any of the tooling required installed and set up. There are a couple of things to know about but besides that, it's a pretty standard Docker image build and container run. The commands are listed below and you're going to need a firestore created for this as well.
docker build -t ruby-firebase-playground --build-arg project_id=<firebase_project_id> .
project_id build arg sets the Firebase project ID for the container. The second thing to know is that you have to mount the creds file to get access to your Firebase project. That happens in the
docker run command and it looked a little like this.
docker run -it --rm --name <container_name> -v <path/to/creds/file.json>:/usr/creds/firebase.json ruby-firebase-playground
Once you run successfully, this will put you in
pry with all of the relevant code
Pull the repository down and run
bundle install to get all the dependencies. If you don't have
gem install bundler. This project uses Ruby 2.6.x.
First, you're going to need a firebase account and a firestore created for this repository. You're then going to want to create a file called
.env in the project root that will store the firesbase project ID. The format of the .env file is below.
The path for the second key there,
GOOGLE_APPLICATION_CREDENTIALS, can be obtained by following the the "Firestore Ruby Getting Started" article that's linked in the references.
To start the playground, just run
bundle exec rake play or if you have rake installed, run
There are other
rake commands that you can run in this project, they are documented in the table below. You can run any of the commands listed below using
||the main command that runs the playground code|
||includes all the code but launches into
||runs rubocop on the entire project and autocorrects whatever it can|
||runs the RSpec tests that are in the project with coverage|
||an alias for
||open's the coverage file generated by
bundle exec rake will run the