mtncloud-cli 1.0.0 → 1.0.1
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/.dockerignore +20 -20
- data/.github/pull_request_template.md +14 -14
- data/.github/workflows/ci.yml +56 -56
- data/.gitignore +24 -24
- data/CLAUDE.md +24 -24
- data/CONTRIBUTING.md +91 -91
- data/Dockerfile +19 -19
- data/Gemfile +4 -4
- data/README.md +187 -187
- data/Rakefile +26 -26
- data/bin/mcs +3 -3
- data/bin/mtncloud +0 -0
- data/lib/mtncloud/cli/cli_command.rb +2281 -2281
- data/lib/mtncloud/cli/version.rb +1 -1
- data/lib/mtncloud/ext/hash.rb +109 -109
- data/lib/mtncloud/ext/nil_class.rb +5 -5
- data/lib/mtncloud/ext/rest_client.rb +37 -37
- data/lib/mtncloud/ext/string.rb +66 -66
- data/mtncloud-cli.gemspec +38 -38
- metadata +9 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c74ca2c70a2b0a12b972e2c0d9837321807c6c50e083850f7750cb8d236af074
|
|
4
|
+
data.tar.gz: 4ea3f71ff8652b53c20c067f08e4fe7ce3cf4729a4716b8246a279312d6b721c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c9c7c54b4ab29be0a10e94371819b762e8620d0f54c04225ac501c31c72dd182f70b3796e3da7e11d0a0f8a38f18920464c64f997c21638a6176aea8fc1d081
|
|
7
|
+
data.tar.gz: 992d76ed72f096181b68682f01926dc88c3742754426efb5ffa8f08a785181e8e59ac46c6f1ab7bb886d1ba312fc0de96620ad0c1372cbe26ff6be39df50473a
|
data/.dockerignore
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# Keep local and generated files out of the Docker build context.
|
|
2
|
-
# Do NOT add .git here: the gem build uses `git ls-files` to list its files.
|
|
3
|
-
# Only exclude files that are not tracked by git, or the gem build will fail.
|
|
4
|
-
|
|
5
|
-
# test credentials for the live appliance tests
|
|
6
|
-
test_config.yaml
|
|
7
|
-
|
|
8
|
-
# built gems and bundler state
|
|
9
|
-
*.gem
|
|
10
|
-
pkg
|
|
11
|
-
.bundle
|
|
12
|
-
Gemfile.lock
|
|
13
|
-
|
|
14
|
-
# temporary and editor files
|
|
15
|
-
tmp
|
|
16
|
-
coverage
|
|
17
|
-
*.log
|
|
18
|
-
.idea
|
|
19
|
-
.vscode
|
|
20
|
-
.DS_Store
|
|
1
|
+
# Keep local and generated files out of the Docker build context.
|
|
2
|
+
# Do NOT add .git here: the gem build uses `git ls-files` to list its files.
|
|
3
|
+
# Only exclude files that are not tracked by git, or the gem build will fail.
|
|
4
|
+
|
|
5
|
+
# test credentials for the live appliance tests
|
|
6
|
+
test_config.yaml
|
|
7
|
+
|
|
8
|
+
# built gems and bundler state
|
|
9
|
+
*.gem
|
|
10
|
+
pkg
|
|
11
|
+
.bundle
|
|
12
|
+
Gemfile.lock
|
|
13
|
+
|
|
14
|
+
# temporary and editor files
|
|
15
|
+
tmp
|
|
16
|
+
coverage
|
|
17
|
+
*.log
|
|
18
|
+
.idea
|
|
19
|
+
.vscode
|
|
20
|
+
.DS_Store
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
## What this changes
|
|
2
|
-
|
|
3
|
-
<!-- What does this pull request change, and why? -->
|
|
4
|
-
|
|
5
|
-
## How it was tested
|
|
6
|
-
|
|
7
|
-
<!-- For example: bundle exec rake test:offline, or commands you ran against an appliance -->
|
|
8
|
-
|
|
9
|
-
## Checklist
|
|
10
|
-
|
|
11
|
-
- [ ] `bundle exec rake test:offline` passes
|
|
12
|
-
- [ ] Tests added or updated for the changed behaviour
|
|
13
|
-
- [ ] README updated if installation, configuration or usage changed
|
|
14
|
-
- [ ] Customer-facing text says MTN Cloud, not Morpheus
|
|
1
|
+
## What this changes
|
|
2
|
+
|
|
3
|
+
<!-- What does this pull request change, and why? -->
|
|
4
|
+
|
|
5
|
+
## How it was tested
|
|
6
|
+
|
|
7
|
+
<!-- For example: bundle exec rake test:offline, or commands you ran against an appliance -->
|
|
8
|
+
|
|
9
|
+
## Checklist
|
|
10
|
+
|
|
11
|
+
- [ ] `bundle exec rake test:offline` passes
|
|
12
|
+
- [ ] Tests added or updated for the changed behaviour
|
|
13
|
+
- [ ] README updated if installation, configuration or usage changed
|
|
14
|
+
- [ ] Customer-facing text says MTN Cloud, not Morpheus
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
# Runs on every pull request and every push to main.
|
|
2
|
-
# main is protected: a pull request can only be merged when every job here passes.
|
|
3
|
-
name: CI
|
|
4
|
-
|
|
5
|
-
on:
|
|
6
|
-
pull_request:
|
|
7
|
-
push:
|
|
8
|
-
branches: [main]
|
|
9
|
-
|
|
10
|
-
permissions:
|
|
11
|
-
contents: read
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
test:
|
|
15
|
-
name: Offline tests (Ruby ${{ matrix.ruby }})
|
|
16
|
-
runs-on: ubuntu-latest
|
|
17
|
-
strategy:
|
|
18
|
-
fail-fast: false
|
|
19
|
-
matrix:
|
|
20
|
-
ruby: ["3.3", "3.4", "4.0"]
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v5
|
|
23
|
-
|
|
24
|
-
- uses: ruby/setup-ruby@v1
|
|
25
|
-
with:
|
|
26
|
-
ruby-version: ${{ matrix.ruby }}
|
|
27
|
-
bundler-cache: true
|
|
28
|
-
|
|
29
|
-
- name: Run offline tests
|
|
30
|
-
run: bundle exec rake test:offline
|
|
31
|
-
|
|
32
|
-
build:
|
|
33
|
-
name: Build gem
|
|
34
|
-
runs-on: ubuntu-latest
|
|
35
|
-
steps:
|
|
36
|
-
- uses: actions/checkout@v5
|
|
37
|
-
|
|
38
|
-
- uses: ruby/setup-ruby@v1
|
|
39
|
-
with:
|
|
40
|
-
ruby-version: "3.3"
|
|
41
|
-
|
|
42
|
-
- name: Build the gem
|
|
43
|
-
run: gem build mtncloud-cli.gemspec
|
|
44
|
-
|
|
45
|
-
# One check for branch protection to require, so the protection rule does not
|
|
46
|
-
# need to change when the Ruby versions above change.
|
|
47
|
-
ci-passed:
|
|
48
|
-
name: CI passed
|
|
49
|
-
if: always()
|
|
50
|
-
needs: [test, build]
|
|
51
|
-
runs-on: ubuntu-latest
|
|
52
|
-
steps:
|
|
53
|
-
- name: Fail unless every job passed
|
|
54
|
-
run: |
|
|
55
|
-
echo "test: ${{ needs.test.result }}, build: ${{ needs.build.result }}"
|
|
56
|
-
[ "${{ needs.test.result }}" = "success" ] && [ "${{ needs.build.result }}" = "success" ]
|
|
1
|
+
# Runs on every pull request and every push to main.
|
|
2
|
+
# main is protected: a pull request can only be merged when every job here passes.
|
|
3
|
+
name: CI
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
pull_request:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
name: Offline tests (Ruby ${{ matrix.ruby }})
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
fail-fast: false
|
|
19
|
+
matrix:
|
|
20
|
+
ruby: ["3.3", "3.4", "4.0"]
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v5
|
|
23
|
+
|
|
24
|
+
- uses: ruby/setup-ruby@v1
|
|
25
|
+
with:
|
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
|
27
|
+
bundler-cache: true
|
|
28
|
+
|
|
29
|
+
- name: Run offline tests
|
|
30
|
+
run: bundle exec rake test:offline
|
|
31
|
+
|
|
32
|
+
build:
|
|
33
|
+
name: Build gem
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v5
|
|
37
|
+
|
|
38
|
+
- uses: ruby/setup-ruby@v1
|
|
39
|
+
with:
|
|
40
|
+
ruby-version: "3.3"
|
|
41
|
+
|
|
42
|
+
- name: Build the gem
|
|
43
|
+
run: gem build mtncloud-cli.gemspec
|
|
44
|
+
|
|
45
|
+
# One check for branch protection to require, so the protection rule does not
|
|
46
|
+
# need to change when the Ruby versions above change.
|
|
47
|
+
ci-passed:
|
|
48
|
+
name: CI passed
|
|
49
|
+
if: always()
|
|
50
|
+
needs: [test, build]
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
steps:
|
|
53
|
+
- name: Fail unless every job passed
|
|
54
|
+
run: |
|
|
55
|
+
echo "test: ${{ needs.test.result }}, build: ${{ needs.build.result }}"
|
|
56
|
+
[ "${{ needs.test.result }}" = "success" ] && [ "${{ needs.build.result }}" = "success" ]
|
data/.gitignore
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
.bundle
|
|
4
|
-
.config
|
|
5
|
-
.yardoc
|
|
6
|
-
Gemfile.lock
|
|
7
|
-
InstalledFiles
|
|
8
|
-
_yardoc
|
|
9
|
-
coverage
|
|
10
|
-
doc/
|
|
11
|
-
lib/bundler/man
|
|
12
|
-
pkg
|
|
13
|
-
rdoc
|
|
14
|
-
spec/reports
|
|
15
|
-
test/tmp
|
|
16
|
-
test/version_tmp
|
|
17
|
-
tmp
|
|
18
|
-
*.bundle
|
|
19
|
-
*.so
|
|
20
|
-
*.o
|
|
21
|
-
*.a
|
|
22
|
-
mkmf.log
|
|
23
|
-
.DS_Store
|
|
24
|
-
.idea
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
|
18
|
+
*.bundle
|
|
19
|
+
*.so
|
|
20
|
+
*.o
|
|
21
|
+
*.a
|
|
22
|
+
mkmf.log
|
|
23
|
+
.DS_Store
|
|
24
|
+
.idea
|
|
25
25
|
test_config.yaml
|
data/CLAUDE.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# MTN Cloud CLI
|
|
2
|
-
|
|
3
|
-
Ruby gem `mtncloud-cli`. It installs the `mtncloud` command and its alias `mcs`. Code is under `lib/mtncloud/` in the `MtnCloud::` namespace. See CONTRIBUTING.md and the README.
|
|
4
|
-
|
|
5
|
-
## Git workflow (required)
|
|
6
|
-
|
|
7
|
-
- Never commit or push to `main`. It is protected, and direct pushes are rejected.
|
|
8
|
-
- For every code or docs change: create a branch from an up-to-date `main` (`feature/`, `fix/`, `docs/` or `chore/` prefix), commit there, push the branch, and open a pull request against `main` with `gh pr create --base main`.
|
|
9
|
-
- Merge only after the **CI passed** check succeeds (`gh pr checks <number> --watch`). Never bypass a failing or pending check.
|
|
10
|
-
- Never force-push to `main` and never delete it.
|
|
11
|
-
|
|
12
|
-
## Testing
|
|
13
|
-
|
|
14
|
-
- Run `bundle exec rake test:offline` before opening a pull request. CI runs the same task on Ruby 3.3, 3.4 and 4.0.
|
|
15
|
-
- Tests that `require 'mtncloud_test'` need a live appliance and are not run by CI.
|
|
16
|
-
|
|
17
|
-
## Naming
|
|
18
|
-
|
|
19
|
-
- Customer-facing text says MTN Cloud, and commands are shown as `mtncloud`.
|
|
20
|
-
- Keep values the appliance or its API defines unchanged, even though they contain "Morpheus": the `X-Morpheus-Lease` and `X-Morpheus-Token` headers, `MORPHEUS_LEASE_TOKEN`, the `morpheus.yml` fallback, job type codes such as `morpheus.task`, the `morpheus` blueprint and backup provider codes, and Morpheus Hub. `test/branding_test.rb` lists the approved ones.
|
|
21
|
-
|
|
22
|
-
## Releases
|
|
23
|
-
|
|
24
|
-
Pushing a `v<version>` tag runs `.github/workflows/release.yml`, which publishes to RubyGems. The tag must match `VERSION` in `lib/mtncloud/cli/version.rb`. Push a release tag only when the user asks for one.
|
|
1
|
+
# MTN Cloud CLI
|
|
2
|
+
|
|
3
|
+
Ruby gem `mtncloud-cli`. It installs the `mtncloud` command and its alias `mcs`. Code is under `lib/mtncloud/` in the `MtnCloud::` namespace. See CONTRIBUTING.md and the README.
|
|
4
|
+
|
|
5
|
+
## Git workflow (required)
|
|
6
|
+
|
|
7
|
+
- Never commit or push to `main`. It is protected, and direct pushes are rejected.
|
|
8
|
+
- For every code or docs change: create a branch from an up-to-date `main` (`feature/`, `fix/`, `docs/` or `chore/` prefix), commit there, push the branch, and open a pull request against `main` with `gh pr create --base main`.
|
|
9
|
+
- Merge only after the **CI passed** check succeeds (`gh pr checks <number> --watch`). Never bypass a failing or pending check.
|
|
10
|
+
- Never force-push to `main` and never delete it.
|
|
11
|
+
|
|
12
|
+
## Testing
|
|
13
|
+
|
|
14
|
+
- Run `bundle exec rake test:offline` before opening a pull request. CI runs the same task on Ruby 3.3, 3.4 and 4.0.
|
|
15
|
+
- Tests that `require 'mtncloud_test'` need a live appliance and are not run by CI.
|
|
16
|
+
|
|
17
|
+
## Naming
|
|
18
|
+
|
|
19
|
+
- Customer-facing text says MTN Cloud, and commands are shown as `mtncloud`.
|
|
20
|
+
- Keep values the appliance or its API defines unchanged, even though they contain "Morpheus": the `X-Morpheus-Lease` and `X-Morpheus-Token` headers, `MORPHEUS_LEASE_TOKEN`, the `morpheus.yml` fallback, job type codes such as `morpheus.task`, the `morpheus` blueprint and backup provider codes, and Morpheus Hub. `test/branding_test.rb` lists the approved ones.
|
|
21
|
+
|
|
22
|
+
## Releases
|
|
23
|
+
|
|
24
|
+
Pushing a `v<version>` tag runs `.github/workflows/release.yml`, which publishes to RubyGems. The tag must match `VERSION` in `lib/mtncloud/cli/version.rb`. Push a release tag only when the user asks for one.
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
# Contributing to the MTN Cloud CLI
|
|
2
|
-
|
|
3
|
-
Thank you for helping improve the MTN Cloud CLI. This guide explains how changes get into the project.
|
|
4
|
-
|
|
5
|
-
## How changes reach main
|
|
6
|
-
|
|
7
|
-
`main` is protected. Nobody pushes to it directly, including maintainers. Every change goes through a pull request:
|
|
8
|
-
|
|
9
|
-
1. Update your local `main`:
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
git checkout main
|
|
13
|
-
git pull
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
2. Create a branch for your change:
|
|
17
|
-
|
|
18
|
-
```shell
|
|
19
|
-
git checkout -b fix/clusters-get-help
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Name the branch after the change, with a prefix: `feature/`, `fix/`, `docs/` or `chore/`.
|
|
23
|
-
|
|
24
|
-
3. Make your change, run the offline tests (see [Testing](#testing)), and commit.
|
|
25
|
-
4. Push the branch and open a pull request against `main`:
|
|
26
|
-
|
|
27
|
-
```shell
|
|
28
|
-
git push -u origin fix/clusters-get-help
|
|
29
|
-
gh pr create --base main
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
5. Wait for the **CI passed** check. It runs the offline tests on Ruby 3.3, 3.4 and 4.0 and builds the gem.
|
|
33
|
-
6. When CI passes, merge the pull request. A pull request cannot be merged while CI is failing or still running.
|
|
34
|
-
|
|
35
|
-
If CI fails, push more commits to the same branch. CI runs again on every push.
|
|
36
|
-
|
|
37
|
-
## Setting up
|
|
38
|
-
|
|
39
|
-
Requirements:
|
|
40
|
-
|
|
41
|
-
- Ruby 3.3 or newer
|
|
42
|
-
- Bundler 2
|
|
43
|
-
- Git
|
|
44
|
-
|
|
45
|
-
```shell
|
|
46
|
-
git clone https://github.com/Jose-henry/mtncloud-cli
|
|
47
|
-
cd mtncloud-cli
|
|
48
|
-
bundle install
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Run the CLI from your working copy:
|
|
52
|
-
|
|
53
|
-
```shell
|
|
54
|
-
bundle exec ruby bin/mtncloud --help
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
See [Development](README.md#development) in the README for the code layout.
|
|
58
|
-
|
|
59
|
-
## Testing
|
|
60
|
-
|
|
61
|
-
Run the offline tests before you open a pull request. They don't need an MTN Cloud appliance, and they are the same tests CI runs:
|
|
62
|
-
|
|
63
|
-
```shell
|
|
64
|
-
bundle exec rake test:offline
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Add or update tests for the behaviour you change. A test that doesn't need an appliance must not `require 'mtncloud_test'`, so that `test:offline` and CI run it.
|
|
68
|
-
|
|
69
|
-
`test/branding_test.rb` fails if any command's help mentions Morpheus, except for values that belong to the appliance, such as the `X-Morpheus-Lease` header. Keep it passing.
|
|
70
|
-
|
|
71
|
-
The tests that need a live appliance are described in [Testing](README.md#testing) in the README. Run them when you change how the CLI talks to the API.
|
|
72
|
-
|
|
73
|
-
## Writing changes
|
|
74
|
-
|
|
75
|
-
- Keep each pull request to one change. Separate refactoring from behaviour changes.
|
|
76
|
-
- Follow the style of the code around your change.
|
|
77
|
-
- Customer-facing text says **MTN Cloud**, and commands are shown as `mtncloud`. Values that the appliance or its API defines keep their names, for example `X-Morpheus-Lease` and `MORPHEUS_LEASE_TOKEN`.
|
|
78
|
-
- Update the README when you change how the CLI is installed, configured or used.
|
|
79
|
-
|
|
80
|
-
## Commit messages
|
|
81
|
-
|
|
82
|
-
- Write a short summary line in the imperative mood, for example "Fix clusters get usage on Ruby 3.4".
|
|
83
|
-
- If the reason for the change isn't obvious, explain it in the body.
|
|
84
|
-
|
|
85
|
-
## Releases
|
|
86
|
-
|
|
87
|
-
Maintainers publish releases. See [Releasing](README.md#releasing) in the README. The version bump goes through a pull request like any other change, and the version tag is pushed after that pull request is merged.
|
|
88
|
-
|
|
89
|
-
## License
|
|
90
|
-
|
|
91
|
-
By contributing, you agree that your contributions are licensed under the project's [MIT license](LICENSE.txt).
|
|
1
|
+
# Contributing to the MTN Cloud CLI
|
|
2
|
+
|
|
3
|
+
Thank you for helping improve the MTN Cloud CLI. This guide explains how changes get into the project.
|
|
4
|
+
|
|
5
|
+
## How changes reach main
|
|
6
|
+
|
|
7
|
+
`main` is protected. Nobody pushes to it directly, including maintainers. Every change goes through a pull request:
|
|
8
|
+
|
|
9
|
+
1. Update your local `main`:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
git checkout main
|
|
13
|
+
git pull
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. Create a branch for your change:
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
git checkout -b fix/clusters-get-help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Name the branch after the change, with a prefix: `feature/`, `fix/`, `docs/` or `chore/`.
|
|
23
|
+
|
|
24
|
+
3. Make your change, run the offline tests (see [Testing](#testing)), and commit.
|
|
25
|
+
4. Push the branch and open a pull request against `main`:
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
git push -u origin fix/clusters-get-help
|
|
29
|
+
gh pr create --base main
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
5. Wait for the **CI passed** check. It runs the offline tests on Ruby 3.3, 3.4 and 4.0 and builds the gem.
|
|
33
|
+
6. When CI passes, merge the pull request. A pull request cannot be merged while CI is failing or still running.
|
|
34
|
+
|
|
35
|
+
If CI fails, push more commits to the same branch. CI runs again on every push.
|
|
36
|
+
|
|
37
|
+
## Setting up
|
|
38
|
+
|
|
39
|
+
Requirements:
|
|
40
|
+
|
|
41
|
+
- Ruby 3.3 or newer
|
|
42
|
+
- Bundler 2
|
|
43
|
+
- Git
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
git clone https://github.com/Jose-henry/mtncloud-cli
|
|
47
|
+
cd mtncloud-cli
|
|
48
|
+
bundle install
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Run the CLI from your working copy:
|
|
52
|
+
|
|
53
|
+
```shell
|
|
54
|
+
bundle exec ruby bin/mtncloud --help
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
See [Development](README.md#development) in the README for the code layout.
|
|
58
|
+
|
|
59
|
+
## Testing
|
|
60
|
+
|
|
61
|
+
Run the offline tests before you open a pull request. They don't need an MTN Cloud appliance, and they are the same tests CI runs:
|
|
62
|
+
|
|
63
|
+
```shell
|
|
64
|
+
bundle exec rake test:offline
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Add or update tests for the behaviour you change. A test that doesn't need an appliance must not `require 'mtncloud_test'`, so that `test:offline` and CI run it.
|
|
68
|
+
|
|
69
|
+
`test/branding_test.rb` fails if any command's help mentions Morpheus, except for values that belong to the appliance, such as the `X-Morpheus-Lease` header. Keep it passing.
|
|
70
|
+
|
|
71
|
+
The tests that need a live appliance are described in [Testing](README.md#testing) in the README. Run them when you change how the CLI talks to the API.
|
|
72
|
+
|
|
73
|
+
## Writing changes
|
|
74
|
+
|
|
75
|
+
- Keep each pull request to one change. Separate refactoring from behaviour changes.
|
|
76
|
+
- Follow the style of the code around your change.
|
|
77
|
+
- Customer-facing text says **MTN Cloud**, and commands are shown as `mtncloud`. Values that the appliance or its API defines keep their names, for example `X-Morpheus-Lease` and `MORPHEUS_LEASE_TOKEN`.
|
|
78
|
+
- Update the README when you change how the CLI is installed, configured or used.
|
|
79
|
+
|
|
80
|
+
## Commit messages
|
|
81
|
+
|
|
82
|
+
- Write a short summary line in the imperative mood, for example "Fix clusters get usage on Ruby 3.4".
|
|
83
|
+
- If the reason for the change isn't obvious, explain it in the body.
|
|
84
|
+
|
|
85
|
+
## Releases
|
|
86
|
+
|
|
87
|
+
Maintainers publish releases. See [Releasing](README.md#releasing) in the README. The version bump goes through a pull request like any other change, and the version tag is pushed after that pull request is merged.
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
By contributing, you agree that your contributions are licensed under the project's [MIT license](LICENSE.txt).
|
data/Dockerfile
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
# Stage 1: build the mtncloud-cli gem from this repository.
|
|
2
|
-
# The gemspec lists its files with `git ls-files`, so this stage needs the .git
|
|
3
|
-
# directory in the build context. Only files tracked by git go into the gem.
|
|
4
|
-
FROM ruby:3.3 AS build
|
|
5
|
-
WORKDIR /src
|
|
6
|
-
COPY . .
|
|
7
|
-
RUN gem build mtncloud-cli.gemspec -o /mtncloud-cli.gem
|
|
8
|
-
|
|
9
|
-
# Stage 2: install the gem into a clean image.
|
|
10
|
-
# Only the built .gem is copied from stage 1, so nothing else from the build
|
|
11
|
-
# context (local files such as test_config.yaml, or the .git directory)
|
|
12
|
-
# ends up in the final image.
|
|
13
|
-
FROM ruby:3.3
|
|
14
|
-
COPY --from=build /mtncloud-cli.gem /tmp/mtncloud-cli.gem
|
|
15
|
-
RUN gem install /tmp/mtncloud-cli.gem --no-document \
|
|
16
|
-
&& rm /tmp/mtncloud-cli.gem
|
|
17
|
-
|
|
18
|
-
WORKDIR /root
|
|
19
|
-
ENTRYPOINT ["mtncloud"]
|
|
1
|
+
# Stage 1: build the mtncloud-cli gem from this repository.
|
|
2
|
+
# The gemspec lists its files with `git ls-files`, so this stage needs the .git
|
|
3
|
+
# directory in the build context. Only files tracked by git go into the gem.
|
|
4
|
+
FROM ruby:3.3 AS build
|
|
5
|
+
WORKDIR /src
|
|
6
|
+
COPY . .
|
|
7
|
+
RUN gem build mtncloud-cli.gemspec -o /mtncloud-cli.gem
|
|
8
|
+
|
|
9
|
+
# Stage 2: install the gem into a clean image.
|
|
10
|
+
# Only the built .gem is copied from stage 1, so nothing else from the build
|
|
11
|
+
# context (local files such as test_config.yaml, or the .git directory)
|
|
12
|
+
# ends up in the final image.
|
|
13
|
+
FROM ruby:3.3
|
|
14
|
+
COPY --from=build /mtncloud-cli.gem /tmp/mtncloud-cli.gem
|
|
15
|
+
RUN gem install /tmp/mtncloud-cli.gem --no-document \
|
|
16
|
+
&& rm /tmp/mtncloud-cli.gem
|
|
17
|
+
|
|
18
|
+
WORKDIR /root
|
|
19
|
+
ENTRYPOINT ["mtncloud"]
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in mtncloud-cli.gemspec
|
|
4
|
-
gemspec
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in mtncloud-cli.gemspec
|
|
4
|
+
gemspec
|