Project

blobby-gcs

0.0
No release in over 3 years
Low commit activity in last 3 years
Store BLOBs in Google Cloud Storage
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 10.0
~> 3.0
~> 0.78.0

Runtime

 Project Readme

Blobby::GCSStore Build status

This gem provides a Google Cloud Storage (GCS) implementation of the "store" interface defined by the blobby gem. It's been packaged separately to avoid adding dependencies to the core gem.

The simplest use-case is writing to a single bucket:

gcs_store = Blobby.store("gs://<bucket_name>/<directory_path_inside_bucket>")
gcs_store["key"].write("IO or string file content")

Configuration is provided using the same environment variables as the google-cloud-storage gem (which this one is wrapping).

require 'blobby-gcs'

ENV["GOOGLE_CLOUD_PROJECT"] = "my-project-id"
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/keyfile.json"

gcs_store = Blobby.store("gs://<bucket_name>/<directory_path_inside_bucket>")

Installation

Add this line to your application's Gemfile:

gem 'blobby-gcs'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blobby-gcs

Development

You can run the tests within Docker via auto/test or directly within your shell using scripts/test.

There are integration tests within this gem which point to a real Google Cloud Storage bucket, so credentials are required. If you do not already have ~/.config/gcloud/application_default_credentials.json from authenticating with gcloud, run:

$ gcloud auth application-default login

You will also need to provide the name of a GCS bucket you have storage.objectAdmin access to (and unfortunately, also storage.legacyBucketReader):

export GOOGLE_CLOUD_PROJECT=unused
export BLOBBY_GCS_TEST_BUCKET=...name of bucket...

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and publish the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/greensync/blobby-gcs.

License

The gem is available as open source under the terms of the MIT License.