{"id":15651193,"url":"https://github.com/renchap/shrine-google_cloud_storage","last_synced_at":"2025-04-09T15:08:12.164Z","repository":{"id":10728632,"uuid":"66763953","full_name":"renchap/shrine-google_cloud_storage","owner":"renchap","description":"Google Cloud Storage for Shrine","archived":false,"fork":false,"pushed_at":"2024-05-16T19:00:29.000Z","size":120,"stargazers_count":33,"open_issues_count":7,"forks_count":26,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T15:08:07.412Z","etag":null,"topics":["google-cloud-storage","ruby","shrine"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/renchap.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-28T11:11:12.000Z","updated_at":"2024-09-12T17:10:18.000Z","dependencies_parsed_at":"2024-06-21T02:12:05.669Z","dependency_job_id":"13caebf2-6127-4a18-90c3-2cc8c353e2de","html_url":"https://github.com/renchap/shrine-google_cloud_storage","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renchap%2Fshrine-google_cloud_storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renchap%2Fshrine-google_cloud_storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renchap%2Fshrine-google_cloud_storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renchap%2Fshrine-google_cloud_storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renchap","download_url":"https://codeload.github.com/renchap/shrine-google_cloud_storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055284,"owners_count":21040157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-cloud-storage","ruby","shrine"],"created_at":"2024-10-03T12:37:23.597Z","updated_at":"2025-04-09T15:08:12.147Z","avatar_url":"https://github.com/renchap.png","language":"Ruby","readme":"[![Gem Version](https://badge.fury.io/rb/shrine-google_cloud_storage.svg)](https://badge.fury.io/rb/shrine-google_cloud_storage)\n\n# Shrine::Storage::GoogleCloudStorage\n\nProvides [Google Cloud Storage] (GCS) storage for [Shrine].\n\n## Installation\n\n```ruby\ngem \"shrine-google_cloud_storage\"\n```\n\n## Authentication\n\nThe GCS plugin uses the `google-cloud-storage` gem. Please refer to [its documentation for setting up authentication](https://googleapis.dev/ruby/google-cloud-storage/latest/file.AUTHENTICATION.html).\n\n## Usage\n\n```rb\nrequire \"shrine/storage/google_cloud_storage\"\n\nShrine.storages = {\n  cache: Shrine::Storage::GoogleCloudStorage.new(bucket: \"cache\"),\n  store: Shrine::Storage::GoogleCloudStorage.new(bucket: \"store\"),\n}\n```\n\nYou can set a predefined ACL on created objects, as well as custom headers using the `object_options` parameter:\n\n```rb\nShrine::Storage::GoogleCloudStorage.new(\n  bucket: \"store\",\n  default_acl: 'publicRead',\n  object_options: {\n    cache_control: 'public, max-age: 7200'\n  },\n)\n```\n\n\n## Contributing\n\n### Test setup\n\n#### Option 1 - use the script\n\nReview the script `test/create_test_environment.sh`. It will:\n- create a Google Cloud project\n- associate it with your billing account\n- create a service account\n- add the `roles/storage.admin` iam policy\n- download the json credentials\n- create a test bucket\n- add the needed variables to your `.env` file\n\nTo run, it assumes you have already run `gcloud auth login`.\nIt also needs a `.env` file in the project root containing the project name\nand the billing account to use:\n\n```sh\ncp .env.sample .env\n# Edit .env to fill in your project and billing accounts\n./test/create_test_environment.sh\n```\n\n#### Option 2 - manual setup\n\nCreate your own bucket and provide variables that allow for [project and credential lookup](https://googleapis.dev/ruby/google-cloud-storage/latest/file.AUTHENTICATION.html#project-and-credential-lookup).\nFor example:\n\n```sh\nGCS_BUCKET=shrine-gcs-test-my-project\nGOOGLE_CLOUD_PROJECT=my-project\nGOOGLE_CLOUD_KEYFILE=/Users/user/.gcp/my-project/shrine-gcs-test.json\n```\n\n**Warning**: all content of the bucket is cleared between tests, create a new one only for this usage!\n\n### Running tests\n\nAfter setting up your bucket, run the tests:\n\n```sh\n$ bundle exec rake test\n```\n\nFor additional debug, add the following to your `.env` file:\n\n```sh\nGCS_DEBUG=true\n```\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n\n[Google Cloud Storage]: https://cloud.google.com/storage/\n[Shrine]: https://github.com/shrinerb/shrine\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenchap%2Fshrine-google_cloud_storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenchap%2Fshrine-google_cloud_storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenchap%2Fshrine-google_cloud_storage/lists"}