rueda 0.1.0 → 0.1.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/SPEC.md +1 -2
- data/lib/rueda/cli.rb +18 -0
- data/lib/rueda/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4e7223aa26dff5a79dfe9d5703526390aacafa423074624b7ed418fd0b5a133
|
|
4
|
+
data.tar.gz: 2b5dcb037735ba51e76a6f1f75b6309882c98335c0d471bcf3dee2a6fe385d99
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc6903864086af86b1d2368a4900792d53024411a66ee7a6b49c9bdb2b9a506f9b814a303111942fedc50e442b69caa20ab5da2f4ccd84894303ca2e02624190
|
|
7
|
+
data.tar.gz: 1bb9ffb7ddbd1dea0b9f3f0f79791021035670d1787fc4f2a4acb97b2f98015c26d1bc64f63ecc7d8b2622a6b1133d62c8c2b20cf52fb1cec9e0a91d267f5a24
|
data/SPEC.md
CHANGED
|
@@ -217,8 +217,7 @@ Out of scope for v1, in order:
|
|
|
217
217
|
## Open decisions
|
|
218
218
|
|
|
219
219
|
- **Aggregates (`rueda stats`).** Out for now: the client fetches data and consumers do the math. Reconsider if agents keep repeating the same calculations.
|
|
220
|
-
- **
|
|
221
|
-
- **Confirm `rueda` is available** on RubyGems and GitHub.
|
|
220
|
+
- **Standalone binary.** rueda ships as a gem (0.1.0 on RubyGems). Whether to also ship a standalone binary is still open.
|
|
222
221
|
|
|
223
222
|
## References
|
|
224
223
|
|
data/lib/rueda/cli.rb
CHANGED
|
@@ -9,6 +9,15 @@ module Rueda
|
|
|
9
9
|
DEFAULT_DAYS = 30
|
|
10
10
|
DATE = /\A\d{4}-\d{2}-\d{2}\z/
|
|
11
11
|
ID = /\A[1-9]\d*\z/
|
|
12
|
+
COMMAND_OPTIONS = {
|
|
13
|
+
since: ["--since", %w[activities]],
|
|
14
|
+
until: ["--until", %w[activities]],
|
|
15
|
+
limit: ["--limit", %w[activities]],
|
|
16
|
+
raw: ["--raw", %w[activities activity]],
|
|
17
|
+
fit: ["--fit", %w[activity]],
|
|
18
|
+
output: ["-o", %w[activity]],
|
|
19
|
+
force: ["--force", %w[activity]]
|
|
20
|
+
}.freeze
|
|
12
21
|
BANNER = <<~TEXT.freeze
|
|
13
22
|
Usage: rueda COMMAND [options]
|
|
14
23
|
|
|
@@ -64,6 +73,7 @@ module Rueda
|
|
|
64
73
|
end
|
|
65
74
|
|
|
66
75
|
def dispatch(args)
|
|
76
|
+
check_options(args.first)
|
|
67
77
|
case args
|
|
68
78
|
in ["auth", "check"] then auth_check
|
|
69
79
|
in ["activities"] then list_activities
|
|
@@ -97,6 +107,8 @@ module Rueda
|
|
|
97
107
|
end
|
|
98
108
|
|
|
99
109
|
def show_activity(id)
|
|
110
|
+
raise UsageError, "-o and --force work only with --fit." if @options[:output] || @options[:force]
|
|
111
|
+
|
|
100
112
|
check_raw_format
|
|
101
113
|
activity = Activities.new(client:, authenticator:).find(id, raw: raw?)
|
|
102
114
|
emit(Output.activity(activity, format:, raw: raw?))
|
|
@@ -115,6 +127,12 @@ module Rueda
|
|
|
115
127
|
end
|
|
116
128
|
end
|
|
117
129
|
|
|
130
|
+
def check_options(command)
|
|
131
|
+
misplaced = COMMAND_OPTIONS.filter_map { |key, (flag, commands)| flag if @options[key] && !commands.include?(command) }
|
|
132
|
+
misplaced << "--type" if @options[:types].any? && command != "activities"
|
|
133
|
+
raise UsageError, "#{misplaced.join(", ")} can't be used with `rueda #{command}`." if misplaced.any?
|
|
134
|
+
end
|
|
135
|
+
|
|
118
136
|
def check_raw_format
|
|
119
137
|
raise UsageError, "--raw works only with --format json or ndjson." if raw? && !Output::RAW_FORMATS.include?(format)
|
|
120
138
|
end
|
data/lib/rueda/version.rb
CHANGED