-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set -e | ||
|
||
./fake-gcs-server -backend memory -scheme http -port 8080 -external-url "http://localhost:8080" & | ||
|
||
( | ||
cd examples/ruby | ||
bundle | ||
bundle exec ruby main.rb | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'google-cloud-storage' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
addressable (2.8.6) | ||
public_suffix (>= 2.0.2, < 6.0) | ||
base64 (0.2.0) | ||
declarative (0.0.20) | ||
digest-crc (0.6.5) | ||
rake (>= 12.0.0, < 14.0.0) | ||
faraday (2.8.1) | ||
base64 | ||
faraday-net_http (>= 2.0, < 3.1) | ||
ruby2_keywords (>= 0.0.4) | ||
faraday-net_http (3.0.2) | ||
google-apis-core (0.11.2) | ||
addressable (~> 2.5, >= 2.5.1) | ||
googleauth (>= 0.16.2, < 2.a) | ||
httpclient (>= 2.8.1, < 3.a) | ||
mini_mime (~> 1.0) | ||
representable (~> 3.0) | ||
retriable (>= 2.0, < 4.a) | ||
rexml | ||
webrick | ||
google-apis-iamcredentials_v1 (0.17.0) | ||
google-apis-core (>= 0.11.0, < 2.a) | ||
google-apis-storage_v1 (0.29.0) | ||
google-apis-core (>= 0.11.0, < 2.a) | ||
google-cloud-core (1.6.1) | ||
google-cloud-env (>= 1.0, < 3.a) | ||
google-cloud-errors (~> 1.0) | ||
google-cloud-env (2.1.0) | ||
faraday (>= 1.0, < 3.a) | ||
google-cloud-errors (1.3.1) | ||
google-cloud-storage (1.45.0) | ||
addressable (~> 2.8) | ||
digest-crc (~> 0.4) | ||
google-apis-iamcredentials_v1 (~> 0.1) | ||
google-apis-storage_v1 (~> 0.29.0) | ||
google-cloud-core (~> 1.6) | ||
googleauth (>= 0.16.2, < 2.a) | ||
mini_mime (~> 1.0) | ||
googleauth (1.9.1) | ||
faraday (>= 1.0, < 3.a) | ||
google-cloud-env (~> 2.1) | ||
jwt (>= 1.4, < 3.0) | ||
multi_json (~> 1.11) | ||
os (>= 0.9, < 2.0) | ||
signet (>= 0.16, < 2.a) | ||
httpclient (2.8.3) | ||
jwt (2.7.1) | ||
mini_mime (1.1.5) | ||
multi_json (1.15.0) | ||
os (1.1.4) | ||
public_suffix (5.0.4) | ||
rake (13.1.0) | ||
representable (3.2.0) | ||
declarative (< 0.1.0) | ||
trailblazer-option (>= 0.1.1, < 0.2.0) | ||
uber (< 0.2.0) | ||
retriable (3.1.2) | ||
rexml (3.2.6) | ||
ruby2_keywords (0.0.5) | ||
signet (0.18.0) | ||
addressable (~> 2.8) | ||
faraday (>= 0.17.5, < 3.a) | ||
jwt (>= 1.5, < 3.0) | ||
multi_json (~> 1.10) | ||
trailblazer-option (0.1.2) | ||
uber (0.1.0) | ||
webrick (1.8.1) | ||
|
||
PLATFORMS | ||
arm64-darwin-22 | ||
|
||
DEPENDENCIES | ||
google-cloud-storage | ||
|
||
BUNDLED WITH | ||
2.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# How to run this example | ||
# 1 - Build the docker image by running the command "docker build -t fsouza/fake-gcs-server ." | ||
# 2 - Start the docker container: "docker run -d --name fake-gcs-server -p 8080:4443 -v ${PWD}/examples/data:/data fsouza/fake-gcs-server -scheme http" | ||
# 3 - Check if it's working by running: "curl http://0.0.0.0:8080/storage/v1/b" | ||
# 4 - Install requirements: "bundle install" | ||
# 5 - Run this script: "bundle exec ruby main.rb" | ||
|
||
require 'google/cloud/storage' | ||
|
||
client = Google::Cloud::Storage.new(project_id: 'test', endpoint: 'http://localhost:8080/') | ||
client.buckets.each do |bucket| | ||
puts "Bucket: #{bucket.name}" | ||
bucket.files.each do |file| | ||
puts "File: #{file.name}" | ||
end | ||
end |