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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb546a4621da61ec3d034e31f02bf92707e0f255876d55b19998fede94d857da
4
- data.tar.gz: 82371c1594ba2a17140c370f0804b80f3cec82c05935db3274fd21c2edb0cd07
3
+ metadata.gz: e4e7223aa26dff5a79dfe9d5703526390aacafa423074624b7ed418fd0b5a133
4
+ data.tar.gz: 2b5dcb037735ba51e76a6f1f75b6309882c98335c0d471bcf3dee2a6fe385d99
5
5
  SHA512:
6
- metadata.gz: e3c2d941a4c3fce7ebee89868cb0ebb1701a88f0a3af7c3f5723dc21afe11f09e39829965aec7aeb3a8d69dab6da9b188ae91571759a39743b7d73a5582f8922
7
- data.tar.gz: 896de09eb7cd26ad7a426b6f4935bb676c156f0ebf57d62d0671c8d929738e055961707646ddd5771a9fa9e7b18315f6aa61ecb632cf0365aae3accd574cd4d8
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
- - **Distribution:** an installable gem, or also a standalone binary.
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
@@ -1,3 +1,3 @@
1
1
  module Rueda
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rueda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Rzezak