Skip to content

YashdalfTheGray/firebase-ruby-playground

Repository files navigation

Build Status Coverage Status Yard Docs

firebase-ruby-playground

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> .

The 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 required in.

Installation

Pull the repository down and run bundle install to get all the dependencies. If you don't have bundle, run gem install bundler. This project uses Ruby 2.6.x.

Running

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.

PROJECT_ID=<project_id>
GOOGLE_APPLICATION_CREDENTIALS=<path_to_google_creds_json_file>

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 rake play.

Other commands

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 rake <command>.

Command Description
play the main command that runs the playground code
pry includes all the code but launches into pry instead of running the code
rubocop runs rubocop on the entire project and autocorrects whatever it can
spec runs the RSpec tests that are in the project with coverage
test an alias for spec
open_coverage opens the coverage file generated by simplecov
open_docs opens the docs for the package, generated by yard

Just running rake or bundle exec rake will run the spec and rubocop tasks.

References

About

A ruby playground to experiment with the ruby wrapper for the FIrebase API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published