foobara 0.2.4 → 0.2.5

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: 7febf2c9b13ecbbbeb552dbfa7cf278805b60e808b01c64abcbd531264ff3486
4
- data.tar.gz: 72386588ea5c433a61585c48cd904143baf9b04165a2c62328a87f089851c4d0
3
+ metadata.gz: e05617e8bea9b7a9ce861246a1a5c664ad3b525630dd1cd7362b80b4d6d809ea
4
+ data.tar.gz: 10bd954f202f83aef9a20f0dec859212766a81e9682f6526ece70e3cd457b6a7
5
5
  SHA512:
6
- metadata.gz: 746004fcedb4287688d6f333b02c50d1b083591837be43f762eb4916670c7c65640d0c9cbbc6a202aaff84a461a20dce5d59c7ba6bc46ce0c5ffa28754baa374
7
- data.tar.gz: 1cae511fedd5916ec97c872eb07ffdae224f9cf76e6f2643de3138a4d146d1049bac68af3ed5ba60ec3b9778a779db051f067562ed64982e6bfeb16e4702e759
6
+ metadata.gz: 26fa0c9be295542f963963ac892405a315d5b6f004fadcdf23336bab09ad973cdae843186134c20c1e173be816506c37f2ad34e825c6d84f2c2ef42845262011
7
+ data.tar.gz: efefbce7b11751d240a09ca34bc5e20a182c60daa00cc79399aceee55c74e33b8b1135aca706abd2a8d3e80c39414477a19d3fee05cc28bdd0e13b063d6fda77
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [0.2.5] - 2025-10-27
2
+
3
+ - Do not allow commands to be connected multiple times via symbol/string
4
+ - Add CommandConnector#all_exposed_command_names
5
+ - pry is again required by default in development/test mode but can be skipped with SKIP_PRY env var
6
+
1
7
  # [0.2.4] -2025-10-26
2
8
 
3
9
  - Remove all uses of .require_project_file and deprecate it
data/README.md CHANGED
@@ -2124,10 +2124,103 @@ the build will fail if test coverage is below 100%.
2124
2124
 
2125
2125
  You should be able to do the typical stuff:
2126
2126
 
2127
+ ### 1. Cloning repository:
2128
+ Fork the repository and run this(Only for SSH):
2129
+
2130
+ ```
2131
+ git clone git@github.com:${your_github_username}/foobara.git
2132
+ ```
2133
+
2134
+ Create a new branch for you to push into
2135
+
2136
+ ```
2137
+ git checkout -b <branch-name>
2138
+ ```
2139
+
2140
+ Now navigate to project directory
2141
+
2127
2142
  ```
2128
- git clone git@github.com:foobara/foobara
2129
2143
  cd foobara
2144
+ ```
2145
+
2146
+ ### 2. Installing mise (LINUX/WSL)
2147
+ Mise is a package manager and helps with managing different versions of ruby. It allows you to switch different versions of ruby.
2148
+
2149
+ The installation docs might be updated by mise so here's the reference to that: [Installation Docs](https://mise.jdx.dev/installing-mise.html)
2150
+
2151
+ ***If you already installed by following mise's docs then, you can skip this section***
2152
+
2153
+ Else to setup mise follow the script given below:
2154
+
2155
+ ```
2156
+ sudo apt update -y && sudo apt install -y gpg wget \
2157
+ build-essential \
2158
+ libssl-dev zlib1g-dev libreadline-dev libyaml-dev libxml2-dev \
2159
+ libxslt1-dev libffi-dev libgdbm-dev autoconf bison
2160
+ wget -qO - https://mise.jdx.dev/gpg-key.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/mise-archive-keyring.gpg 1> /dev/null
2161
+ echo "deb [signed-by=/etc/apt/keyrings/mise-archive-keyring.gpg arch=amd64] https://mise.jdx.dev/deb stable main" | sudo tee /etc/apt/sources.list.d/mise.list
2162
+ sudo apt update
2163
+ sudo apt install -y mise
2164
+ ```
2165
+
2166
+ Verify if it's installed or not by running:
2167
+
2168
+ ```
2169
+ mise -v
2170
+ ```
2171
+
2172
+ It should print out an ascii-art saying "mise-en-place"
2173
+
2174
+ ### 3. Install required ruby version
2175
+ In this project, currently we require ruby version >=3.4 so we can install it manually using the command below
2176
+
2177
+ ```
2178
+ mise use -g ruby@3.4
2179
+ ```
2180
+
2181
+ In case, you want to automatically activate the ruby version whenever you navigate to the directory containing .ruby-version file
2182
+
2183
+ This helps a lot when you have lot of ruby projects with different versions and don't want to switch ruby versions each time manually
2184
+
2185
+ ```
2186
+ mise settings add idiomatic_version_file_enable_tools ruby
2187
+ ```
2188
+
2189
+ ### 4. Activating mise
2190
+ We can activate mise so that it will update the environment variables such that we will use the correct version of ruby.
2191
+
2192
+ ```
2193
+ echo 'eval "$(mise activate bash)"' >> ~/.bashrc
2194
+ ```
2195
+
2196
+ Restart the terminal
2197
+
2198
+ Now environment variables are updated and you can verify it by running:
2199
+
2200
+ ```
2201
+ ruby -v
2202
+ ```
2203
+
2204
+ It will print out the ruby version, which is mentioned in .ruby-version file
2205
+
2206
+ You can list out your mise tools and its versions by running:
2207
+
2208
+ ```
2209
+ mise list
2210
+ ```
2211
+
2212
+ ### 5. Running tests
2213
+ Before running test-suite, we need to install all the dependencies
2214
+
2215
+ Run this to install all the dependencies:
2216
+
2217
+ ```
2130
2218
  bundle
2219
+ ```
2220
+
2221
+ Run the tests now:
2222
+
2223
+ ```
2131
2224
  rake
2132
2225
  ```
2133
2226
 
@@ -1,6 +1,7 @@
1
1
  module Foobara
2
2
  class CommandConnector
3
3
  class UnexpectedSensitiveTypeInManifestError < StandardError; end
4
+ class AlreadyConnectedError < StandardError; end
4
5
 
5
6
  include Concerns::Desugarizers
6
7
 
@@ -305,7 +306,15 @@ module Foobara
305
306
  end
306
307
 
307
308
  def connect_delayed(registerable_name, *args, **opts)
308
- delayed_connections[registerable_name.to_s] = { args:, opts: }
309
+ key = registerable_name.to_s
310
+
311
+ if delayed_connections.key?(key)
312
+ # :nocov:
313
+ raise AlreadyConnectedError, "Already connected #{key}"
314
+ # :nocov:
315
+ else
316
+ delayed_connections[key] = { args:, opts: }
317
+ end
309
318
  end
310
319
 
311
320
  def delayed_connections
@@ -313,6 +322,8 @@ module Foobara
313
322
  end
314
323
 
315
324
  def process_delayed_connections
325
+ return if delayed_connections.empty?
326
+
316
327
  delayed_connections.each_pair do |registerable_name, arg_hash|
317
328
  args = arg_hash[:args]
318
329
  opts = arg_hash[:opts]
@@ -665,6 +676,10 @@ module Foobara
665
676
  command_registry.foobara_all_command(mode: Namespace::LookupMode::ABSOLUTE_SINGLE_NAMESPACE)
666
677
  end
667
678
 
679
+ def all_exposed_command_names
680
+ all_exposed_commands.map(&:full_command_name)
681
+ end
682
+
668
683
  def all_exposed_type_names
669
684
  # TODO: cache this or better yet cache #foobara_manifest
670
685
  foobara_manifest[:type].keys.sort.map(&:to_s)
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Foobara
2
2
  module Version
3
- VERSION = "0.2.4".freeze
3
+ VERSION = "0.2.5".freeze
4
4
  MINIMUM_RUBY_VERSION = ">= 3.4.0".freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi