edify-cli 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 317616031e24d8053b85bd553df6792682fec679b3093ec860c695b2485d0166
4
- data.tar.gz: 1c1844d0d4c9c60e440290e595eeb25528dabbf349468d78ee09bd1e9feda8d7
3
+ metadata.gz: 52b26c0e847bced6de074790b98a079cef541659ef205ff084234f4d472e4cc6
4
+ data.tar.gz: 18a48efbd67f5e6f3a288e3d9b567f76bf356e1c644fc1bbe22b14414b12f75e
5
5
  SHA512:
6
- metadata.gz: e9b63b488cdc2987bf1db7657f9052af99000cb92163e4bfc0e3b9ae662e48ee8906bced9cc77abdc60b6c8d1b930127aea6afee2d0fab808577128d481031ba
7
- data.tar.gz: 858451e4d0425995af124f6af27f917503398b123b83c8c602cbb4c157cb7d897e9785222b2d399f33a9144a563eb21fbfbcc7d2761fa5050e2b8443de08ef9d
6
+ metadata.gz: b71b13e91b670e0fd6e05e0e8614b948eeb8e11d0cab3060f20469d95209611dfab39d6814fa5a37648709c66e48917ca9e744b344b867a3e9a676a194a911e5
7
+ data.tar.gz: 447d675606095d0a43ad2ca85e7184b223297870c15b42c21b6b217df3fb6fab52210971b974249c285ab92a26608c040e502fb5dfdd5d12a97df69569fcb5c1
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to edify-cli are recorded here. The format follows [Keep a C
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.3.0] - 2026-11-23
8
+
9
+ ### Added
10
+
11
+ - `edify status`: the server and where it comes from, where the token comes from (never the token itself), and whether the server accepts it. Exits 1 when it doesn't (#14).
12
+ - `edify logout`: removes the saved login and reminds you to revoke the token in Edify (#14).
13
+
7
14
  ## [0.2.0] - 2026-11-23
8
15
 
9
16
  ### Added
@@ -26,6 +33,7 @@ All notable changes to edify-cli are recorded here. The format follows [Keep a C
26
33
  - `--json` on data commands, `EDIFY_TOKEN` and `EDIFY_URL` overrides, and API errors on stderr with exit status 1 (#2, #3).
27
34
  - The login is saved with owner-only permissions, and the token is sent only over HTTPS, except to localhost (#2).
28
35
 
29
- [Unreleased]: https://github.com/edifyapporg/edify-cli/compare/v0.2.0...HEAD
36
+ [Unreleased]: https://github.com/edifyapporg/edify-cli/compare/v0.3.0...HEAD
37
+ [0.3.0]: https://github.com/edifyapporg/edify-cli/compare/v0.2.0...v0.3.0
30
38
  [0.2.0]: https://github.com/edifyapporg/edify-cli/compare/v0.1.0...v0.2.0
31
39
  [0.1.0]: https://github.com/edifyapporg/edify-cli/releases/tag/v0.1.0
data/README.md CHANGED
@@ -6,13 +6,13 @@ It only reads from the API and formats the answer. Who can see what, and which m
6
6
 
7
7
  ## Install
8
8
 
9
- Requires Ruby 4.0 or newer. The gem is not on RubyGems yet. Download `edify-cli-<version>.gem` from the [latest release](https://github.com/edifyapporg/edify-cli/releases/latest), then:
9
+ Requires Ruby 4.0 or newer.
10
10
 
11
11
  ```sh
12
- gem install ./edify-cli-0.2.0.gem
12
+ gem install edify-cli
13
13
  ```
14
14
 
15
- Each release lists the gem's SHA-256 checksum, and [CHANGELOG.md](CHANGELOG.md) says what changed. To build from source instead, check out a release tag and run `gem build edify-cli.gemspec`.
15
+ Update with `gem update edify-cli`. [CHANGELOG.md](CHANGELOG.md) says what changed in each version. Each [GitHub release](https://github.com/edifyapporg/edify-cli/releases) also has the gem attached, with its SHA-256 checksum.
16
16
 
17
17
  ## Log in
18
18
 
@@ -27,7 +27,18 @@ Each release lists the gem's SHA-256 checksum, and [CHANGELOG.md](CHANGELOG.md)
27
27
 
28
28
  To skip the prompts: `edify login --token edify_...` (add `--url http://localhost:3000` for a development server).
29
29
 
30
- To stop using a token, revoke it in Edify under **Settings > API Tokens**.
30
+ To check which server and token the CLI is using, and whether the server accepts the token (the token itself is never shown):
31
+
32
+ ```sh
33
+ $ edify status
34
+ Server: https://www.edifyapp.org (from the saved login)
35
+ Token: from /Users/you/.config/edify/config.yml, saved 2026-11-23
36
+ Check: accepted
37
+ ```
38
+
39
+ `edify status` exits 0 when the token is accepted and 1 otherwise.
40
+
41
+ To stop using a token, run `edify logout` to remove the saved login, then revoke the token in Edify under **Settings > API Tokens**. Logging out alone doesn't revoke it.
31
42
 
32
43
  ## Commands
33
44
 
@@ -85,6 +96,7 @@ Songs and meetings are available to every role in your unit.
85
96
 
86
97
  ### Other commands
87
98
 
99
+ - `edify status`, `edify logout` (see [Log in](#log-in))
88
100
  - `edify version`
89
101
  - `edify help [COMMAND]`
90
102
 
@@ -113,25 +125,27 @@ Record each user-visible change under **Unreleased** in [CHANGELOG.md](CHANGELOG
113
125
 
114
126
  ## Releasing
115
127
 
116
- Versions follow [Semantic Versioning](https://semver.org/): a new command or option is a minor release (0.2.0 to 0.3.0), and a fix is a patch release (0.2.0 to 0.2.1).
128
+ Versions follow [Semantic Versioning](https://semver.org/): a new command or option is a minor release (0.2.0 to 0.3.0), and a fix is a patch release (0.2.0 to 0.2.1). Publishing uses RubyGems [trusted publishing](https://guides.rubygems.org/trusted-publishing/), so no API key is stored anywhere.
117
129
 
118
130
  1. **Release PR.** On a branch, bump `Edify::VERSION` in `lib/edify/version.rb`. In `CHANGELOG.md`, rename **Unreleased** to the new version with the release date, add an empty **Unreleased** above it, and update the comparison links at the bottom. Open a PR and merge it.
119
- 2. **Tag the merge.** On an up-to-date `main`, confirm `edify version` prints the new version, then:
131
+ 2. **Run the Release workflow** on `main`, from **Actions > Release > Run workflow** or with:
120
132
 
121
133
  ```sh
122
- git tag -a v0.3.0 -m "edify-cli 0.3.0" && git push origin v0.3.0
134
+ gh workflow run release.yml --ref main
123
135
  ```
124
- 3. **Build from the tag** and note the checksum:
136
+
137
+ It runs the specs, then `rake release`: it creates and pushes the `v0.3.0` tag and pushes the gem to RubyGems.org, with an attestation. If the `rubygems` environment requires a reviewer, approve the run when asked.
138
+ 3. **Publish the GitHub release** with the version's changelog section and the checksum as notes, attaching the gem fetched from RubyGems, so both places carry the same file:
125
139
 
126
140
  ```sh
127
- gem build edify-cli.gemspec && shasum -a 256 edify-cli-0.3.0.gem
141
+ gem fetch edify-cli -v 0.3.0 && shasum -a 256 edify-cli-0.3.0.gem
142
+ gh release create v0.3.0 --verify-tag --title "edify-cli 0.3.0" --notes-file NOTES.md edify-cli-0.3.0.gem
128
143
  ```
129
- 4. **Publish the GitHub release** with the version's changelog section and the checksum as notes, and the gem attached:
144
+ 4. **Check it.** Install the new version into a throwaway gem home and confirm `edify version`:
130
145
 
131
146
  ```sh
132
- gh release create v0.3.0 --verify-tag --title "edify-cli 0.3.0" --notes-file NOTES.md edify-cli-0.3.0.gem
147
+ (export GEM_HOME="$(mktemp -d)" GEM_PATH=""; gem install edify-cli -v 0.3.0 && "$GEM_HOME/bin/edify" version)
133
148
  ```
134
- 5. **Check it.** Download the attached gem with `gh release download v0.3.0`, compare its checksum, and install it into a throwaway `GEM_HOME` to confirm `edify version`.
135
149
 
136
150
  A published version is never changed or reused. A mistake is fixed in a new patch release.
137
151
 
data/lib/edify/cli.rb CHANGED
@@ -37,6 +37,38 @@ module Edify
37
37
  say "Logged in to #{url.to_s.strip.chomp('/')}. Saved to #{config.path}."
38
38
  end
39
39
 
40
+ desc "logout", "Remove the saved login"
41
+ long_desc <<~DESC
42
+ Deletes the login saved by `edify login`. The token itself keeps working until you revoke it in Edify under
43
+ Settings > API Tokens. An EDIFY_TOKEN set in your environment is not affected.
44
+ DESC
45
+ def logout
46
+ if config.delete
47
+ say "Logged out. Removed #{config.path}."
48
+ say "The token still works until you revoke it in Edify under Settings > API Tokens."
49
+ else
50
+ say "No saved login to remove (#{config.path})."
51
+ end
52
+ say "EDIFY_TOKEN is still set in this environment, so commands keep using it." if config.token_source == :env
53
+ end
54
+
55
+ desc "status", "Show which server and token the CLI uses, and whether the server accepts the token"
56
+ long_desc <<~DESC
57
+ Shows the Edify server the CLI talks to and where that comes from, where its token comes from (never the token
58
+ itself), and whether the server accepts the token. Exits 0 when it does and 1 otherwise.
59
+ DESC
60
+ def status
61
+ say "Server: #{config.url} (#{URL_SOURCES.fetch(config.url_source)})"
62
+ return not_logged_in_status unless config.configured?
63
+
64
+ say "Token: #{token_description}"
65
+ result = verify_token(config.url, config.token)
66
+ say(result == :accepted ? "Check: accepted" : "Check: accepted, though your role cannot list speakers")
67
+ rescue Client::Error => e
68
+ say "Check: not accepted. #{e.message}"
69
+ exit 1
70
+ end
71
+
40
72
  desc "version", "Show the edify-cli version"
41
73
  def version
42
74
  say VERSION
@@ -51,16 +83,40 @@ module Edify
51
83
  desc "meetings SUBCOMMAND", "Questions about meetings"
52
84
  subcommand "meetings", Commands::Meetings
53
85
 
86
+ URL_SOURCES = { env: "from EDIFY_URL", saved: "from the saved login", default: "the default" }.freeze
87
+
54
88
  private
55
89
 
56
- # The API has no "who am I" endpoint yet, so a one-row request stands in. An invalid token is refused. A valid
57
- # token whose role cannot see speakers is still saved, since it may be meant for other commands.
58
90
  def check_login(url, token)
59
91
  raise Thor::Error, "Both a URL and a token are needed." if url.empty? || token.empty?
60
92
 
93
+ verify_token(url, token)
94
+ rescue Client::Error => e
95
+ raise Thor::Error, e.message
96
+ end
97
+
98
+ # The API has no "who am I" endpoint yet, so a one-row request stands in. A valid token whose role cannot see
99
+ # speakers still counts, since it may be meant for other commands.
100
+ # @return [Symbol] :accepted, or :accepted_without_speakers
101
+ # @raise [Client::Error] when the server refuses the token or cannot be reached
102
+ def verify_token(url, token)
61
103
  Client.new(url: url, token: token).get("speakers/stale", limit: 1)
104
+ :accepted
62
105
  rescue Client::Error => e
63
- raise Thor::Error, e.message unless e.code == "forbidden"
106
+ raise unless e.code == "forbidden"
107
+
108
+ :accepted_without_speakers
109
+ end
110
+
111
+ def token_description
112
+ return "from EDIFY_TOKEN" if config.token_source == :env
113
+
114
+ "from #{config.path}, saved #{config.saved_at.strftime('%Y-%m-%d')}"
115
+ end
116
+
117
+ def not_logged_in_status
118
+ say "Token: none. Run `edify login`, or set EDIFY_TOKEN."
119
+ exit 1
64
120
  end
65
121
  end
66
122
  end
data/lib/edify/config.rb CHANGED
@@ -40,6 +40,39 @@ module Edify
40
40
  !token.nil?
41
41
  end
42
42
 
43
+ # @return [Symbol] :env (EDIFY_URL), :saved (the saved login) or :default
44
+ def url_source
45
+ return :env if present(env["EDIFY_URL"])
46
+
47
+ stored["url"] ? :saved : :default
48
+ end
49
+
50
+ # @return [Symbol, nil] :env (EDIFY_TOKEN), :saved (the saved login), or nil when there is no token
51
+ def token_source
52
+ return :env if present(env["EDIFY_TOKEN"])
53
+
54
+ :saved if stored["token"]
55
+ end
56
+
57
+ def saved?
58
+ File.exist?(path)
59
+ end
60
+
61
+ # @return [Time, nil] when the login was last saved
62
+ def saved_at
63
+ File.mtime(path) if saved?
64
+ end
65
+
66
+ # Removes the saved login. EDIFY_URL and EDIFY_TOKEN are untouched.
67
+ # @return [Boolean] whether there was a saved login to remove
68
+ def delete
69
+ return false unless saved?
70
+
71
+ File.delete(path)
72
+ @stored = nil
73
+ true
74
+ end
75
+
43
76
  # Writes the URL and token, creating the file with owner-only permissions and tightening them if it already
44
77
  # existed with looser ones.
45
78
  def save(url:, token:)
data/lib/edify/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Edify
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,73 +1,70 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edify-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Mark Oveson
7
+ - Mark Oveson
8
8
  bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: thor
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- -
17
- - ~>
18
- - !ruby/object:Gem::Version
19
- version: "1.3"
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- -
25
- - ~>
26
- - !ruby/object:Gem::Version
27
- version: "1.3"
28
- description: "Ask an Edify server about speakers and music from the command line, using a personal access token. Readable tables by default, JSON with --json."
12
+ - !ruby/object:Gem::Dependency
13
+ name: thor
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.3'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.3'
26
+ description: Ask an Edify server about speakers and music from the command line, using
27
+ a personal access token. Readable tables by default, JSON with --json.
29
28
  executables:
30
- - edify
29
+ - edify
31
30
  extensions: []
32
31
  extra_rdoc_files: []
33
32
  files:
34
- - CHANGELOG.md
35
- - LICENSE.md
36
- - README.md
37
- - exe/edify
38
- - lib/edify/cli.rb
39
- - lib/edify/client.rb
40
- - lib/edify/commands/helpers.rb
41
- - lib/edify/commands/meetings.rb
42
- - lib/edify/commands/songs.rb
43
- - lib/edify/commands/speakers.rb
44
- - lib/edify/config.rb
45
- - lib/edify/table.rb
46
- - lib/edify/version.rb
47
- homepage: "https://github.com/edifyapporg/edify-cli"
33
+ - CHANGELOG.md
34
+ - LICENSE.md
35
+ - README.md
36
+ - exe/edify
37
+ - lib/edify/cli.rb
38
+ - lib/edify/client.rb
39
+ - lib/edify/commands/helpers.rb
40
+ - lib/edify/commands/meetings.rb
41
+ - lib/edify/commands/songs.rb
42
+ - lib/edify/commands/speakers.rb
43
+ - lib/edify/config.rb
44
+ - lib/edify/table.rb
45
+ - lib/edify/version.rb
46
+ homepage: https://github.com/edifyapporg/edify-cli
48
47
  licenses:
49
- - MIT
48
+ - MIT
50
49
  metadata:
51
- source_code_uri: "https://github.com/edifyapporg/edify-cli"
52
- changelog_uri: "https://github.com/edifyapporg/edify-cli/blob/main/CHANGELOG.md"
53
- rubygems_mfa_required: "true"
50
+ source_code_uri: https://github.com/edifyapporg/edify-cli
51
+ changelog_uri: https://github.com/edifyapporg/edify-cli/blob/main/CHANGELOG.md
52
+ rubygems_mfa_required: 'true'
54
53
  rdoc_options: []
55
54
  require_paths:
56
- - lib
55
+ - lib
57
56
  required_ruby_version: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- -
60
- - ">="
61
- - !ruby/object:Gem::Version
62
- version: "4.0"
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '4.0'
63
61
  required_rubygems_version: !ruby/object:Gem::Requirement
64
62
  requirements:
65
- -
66
- - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
69
66
  requirements: []
70
- rubygems_version: 4.1.0
67
+ rubygems_version: 4.0.20
71
68
  specification_version: 4
72
69
  summary: Command-line client for the Edify API
73
70
  test_files: []