cloudflare-r2-cli 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +86 -2
- data/README.md +109 -36
- data/docs/ARCHITECTURE.md +177 -82
- data/docs/FEATURES.md +121 -5
- data/docs/SECURITY.md +4 -0
- data/lib/r2/cli.rb +234 -13
- data/lib/r2/content_type.rb +70 -0
- data/lib/r2/errors.rb +13 -0
- data/lib/r2/logging.rb +34 -0
- data/lib/r2/retry.rb +105 -0
- data/lib/r2/storage.rb +183 -24
- data/lib/r2/version.rb +1 -1
- data/lib/r2.rb +3 -0
- metadata +6 -11
- data/docs/DECISIONS.md +0 -30
- data/docs/DEVELOPMENT.md +0 -65
- data/docs/ROADMAP.md +0 -69
- data/docs/architecture/cli.md +0 -24
- data/docs/architecture/configuration.md +0 -24
- data/docs/architecture/errors.md +0 -25
- data/docs/architecture/storage.md +0 -46
- data/docs/architecture/testing.md +0 -48
- /data/{LICENCE → LICENSE} +0 -0
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Storage
|
|
2
|
-
|
|
3
|
-
The storage abstracts the communication with Cloudflare R2, using the
|
|
4
|
-
`aws-sdk-s3` gem.
|
|
5
|
-
|
|
6
|
-
## Dependencies
|
|
7
|
-
|
|
8
|
-
The `aws-sdk-s3` gem requires an XML parser. The project uses `rexml` to meet
|
|
9
|
-
this requirement at runtime.
|
|
10
|
-
|
|
11
|
-
## Responsibility
|
|
12
|
-
|
|
13
|
-
The layer is responsible for communicating with Cloudflare R2, receiving the
|
|
14
|
-
data prepared by the upper layers and executing the storage operations.
|
|
15
|
-
|
|
16
|
-
## Region
|
|
17
|
-
|
|
18
|
-
The region is provided by the `Configuration` through `R2_REGION`, using `auto`
|
|
19
|
-
as the default.
|
|
20
|
-
|
|
21
|
-
## Boundaries
|
|
22
|
-
|
|
23
|
-
The layer must not:
|
|
24
|
-
|
|
25
|
-
* Read or locate files.
|
|
26
|
-
* Process or transform content.
|
|
27
|
-
* Determine the origin of the content.
|
|
28
|
-
|
|
29
|
-
These responsibilities belong to the layers that use the storage.
|
|
30
|
-
|
|
31
|
-
## Configuration
|
|
32
|
-
|
|
33
|
-
The bucket is defined by the `Storage` configuration and is not informed
|
|
34
|
-
individually in each operation.
|
|
35
|
-
|
|
36
|
-
Details of the features and their behavior for the user are documented in
|
|
37
|
-
[FEATURES.md](../FEATURES.md).
|
|
38
|
-
|
|
39
|
-
## Errors
|
|
40
|
-
|
|
41
|
-
The client failures are converted to the `R2::Errors` hierarchy:
|
|
42
|
-
|
|
43
|
-
* `Errors::ConfigurationError` — missing or invalid access credentials.
|
|
44
|
-
* `Errors::BucketNotFoundError` — the configured bucket does not exist.
|
|
45
|
-
* `Errors::NetworkError` — network failure in the communication.
|
|
46
|
-
* `Errors::StorageError` — other failures of the storage layer.
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Testing
|
|
2
|
-
|
|
3
|
-
Each test type has its own folder, keeping objectives and responsibilities
|
|
4
|
-
separated.
|
|
5
|
-
|
|
6
|
-
## Unit Tests
|
|
7
|
-
|
|
8
|
-
Located in `spec/unit/`.
|
|
9
|
-
|
|
10
|
-
Test components in isolation.
|
|
11
|
-
|
|
12
|
-
## Integration Tests
|
|
13
|
-
|
|
14
|
-
Located in `spec/integration/`.
|
|
15
|
-
|
|
16
|
-
Test the interaction between components.
|
|
17
|
-
|
|
18
|
-
## E2E Tests
|
|
19
|
-
|
|
20
|
-
Located in `spec/e2e/`.
|
|
21
|
-
|
|
22
|
-
Focus on the main flows and expected results, keeping the scenarios simple and
|
|
23
|
-
avoiding tests of internal implementation details.
|
|
24
|
-
|
|
25
|
-
## Environment
|
|
26
|
-
|
|
27
|
-
Tests use a dedicated bucket configured through `R2_TEST_BUCKET`.
|
|
28
|
-
|
|
29
|
-
Temporary files must remain in `tmp/`, which must be included in `.gitignore`.
|
|
30
|
-
|
|
31
|
-
Resources created by tests must be cleaned up at the end of execution whenever
|
|
32
|
-
possible. E2E tests remove uploaded objects at the end of each scenario.
|
|
33
|
-
|
|
34
|
-
Credentials can be provided through the `.env` file or the environment.
|
|
35
|
-
|
|
36
|
-
## Coverage
|
|
37
|
-
|
|
38
|
-
Tests must cover the main behaviors, including success and error scenarios.
|
|
39
|
-
|
|
40
|
-
E2E tests are an exception: they must remain extremely simple and focused only
|
|
41
|
-
on the main user flows.
|
|
42
|
-
|
|
43
|
-
## Execution
|
|
44
|
-
|
|
45
|
-
Run the full test suite:
|
|
46
|
-
|
|
47
|
-
```console
|
|
48
|
-
$ bundle exec rake
|
/data/{LICENCE → LICENSE}
RENAMED
|
File without changes
|