rails-active-mcp 3.1.1 → 3.1.2

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: f51ec40bfd555c21e4f779d71229f61d216a8a94267c86165af1ed85a4723564
4
- data.tar.gz: 39884b0d087fe8f4b669633b28f02930e61d86a3a7f7fe5c37a06b8ee7e0d506
3
+ metadata.gz: 79c6d243bc8d13785061d3c83a983f6d06c57cdcf25ac0658aae3d0af3112581
4
+ data.tar.gz: 97bfc9c22e4438f8c7487e87f560138d0adeb9dc61017c0b4c9508f7c7602a62
5
5
  SHA512:
6
- metadata.gz: 6ed9d1296cfe23b3970140a37bf83caf5d5a0a7104a04cabe911f13f443b2ad4a63fbbfec6aa458652669d9b649c6290218b3cb0e0bbadeb42c70f4d02e0500d
7
- data.tar.gz: d48173ef05b8bceb5e2520fd587b8a0f6331b1c124c77083862a3571f1d7e2c8e2ab990c8effe9885a0c4d94ef3b5babbe19b1051978f655426121c81d155260
6
+ metadata.gz: 1a5aa321931c6b8ede9b565e996604ee91d98871b64d58a93f0284222ec2d457279dc387e9573d1b148f1bd2a23b9312f2f7b1c707503222964a7d11ae7a112c
7
+ data.tar.gz: b6237811ae6bb46e214a34bce91218d178dbe476764c325cb4cc7f2070cc7e67db256cb192f8b7399e450e1ffcc6534db861182364b1c1b480847c9399c20efa
@@ -2,52 +2,8 @@
2
2
 
3
3
  # Rails Active MCP Wrapper Script
4
4
  # This script ensures Rails Active MCP works reliably across different Ruby version managers
5
-
6
- # Function to detect Ruby version manager
7
- detect_ruby_manager() {
8
- if command -v asdf >/dev/null 2>&1 && [ -f .tool-versions ]; then
9
- echo "asdf"
10
- elif command -v rbenv >/dev/null 2>&1 && [ -f .ruby-version ]; then
11
- echo "rbenv"
12
- elif command -v rvm >/dev/null 2>&1 && [ -f .rvmrc ]; then
13
- echo "rvm"
14
- else
15
- echo "system"
16
- fi
17
- }
18
-
19
- # Function to setup environment for different Ruby managers
20
- setup_ruby_environment() {
21
- local manager=$1
22
-
23
- case $manager in
24
- "asdf")
25
- if [ -n "$ASDF_DIR" ] && [ -f "$ASDF_DIR/asdf.sh" ]; then
26
- source "$ASDF_DIR/asdf.sh"
27
- elif [ -f "$HOME/.asdf/asdf.sh" ]; then
28
- export ASDF_DIR="$HOME/.asdf"
29
- source "$HOME/.asdf/asdf.sh"
30
- fi
31
- ;;
32
- "rbenv")
33
- if [ -n "$RBENV_ROOT" ] && [ -f "$RBENV_ROOT/bin/rbenv" ]; then
34
- export PATH="$RBENV_ROOT/bin:$PATH"
35
- eval "$(rbenv init - bash)"
36
- elif [ -f "$HOME/.rbenv/bin/rbenv" ]; then
37
- export PATH="$HOME/.rbenv/bin:$PATH"
38
- eval "$(rbenv init - bash)"
39
- elif command -v rbenv >/dev/null 2>&1; then
40
- # Homebrew or other installations where rbenv is already in PATH
41
- eval "$(rbenv init - bash)"
42
- fi
43
- ;;
44
- "rvm")
45
- if [ -f "$HOME/.rvm/scripts/rvm" ]; then
46
- source "$HOME/.rvm/scripts/rvm"
47
- fi
48
- ;;
49
- esac
50
- }
5
+ # when launched from MCP hosts (Claude Desktop, Claude Code, etc.) which may not have
6
+ # the user's shell profile loaded.
51
7
 
52
8
  # Get the directory where this script is located
53
9
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -59,9 +15,54 @@ cd "$PROJECT_ROOT" || {
59
15
  exit 1
60
16
  }
61
17
 
62
- # Detect and setup Ruby environment
63
- RUBY_MANAGER=$(detect_ruby_manager)
64
- setup_ruby_environment "$RUBY_MANAGER"
18
+ # Setup Ruby environment by adding version manager shims to PATH.
19
+ # Shims are self-contained scripts that route to the correct Ruby version
20
+ # without requiring full shell initialization (eval, source, etc.).
21
+ # This works reliably even in non-interactive contexts like MCP hosts.
22
+ setup_ruby_path() {
23
+ # rbenv: shims directory handles version switching
24
+ local rbenv_root="${RBENV_ROOT:-$HOME/.rbenv}"
25
+ if [ -d "$rbenv_root/shims" ]; then
26
+ export PATH="$rbenv_root/shims:$PATH"
27
+ return
28
+ fi
29
+
30
+ # asdf: shims directory handles version switching
31
+ local asdf_data="${ASDF_DATA_DIR:-$HOME/.asdf}"
32
+ if [ -d "$asdf_data/shims" ]; then
33
+ export PATH="$asdf_data/shims:$PATH"
34
+ return
35
+ fi
36
+
37
+ # mise (formerly rtx): shims directory
38
+ local mise_data="${MISE_DATA_DIR:-$HOME/.local/share/mise}"
39
+ if [ -d "$mise_data/shims" ]; then
40
+ export PATH="$mise_data/shims:$PATH"
41
+ return
42
+ fi
43
+
44
+ # rvm: requires sourcing but check for it
45
+ if [ -d "$HOME/.rvm/rubies" ]; then
46
+ if [ -f "$HOME/.rvm/scripts/rvm" ]; then
47
+ source "$HOME/.rvm/scripts/rvm"
48
+ fi
49
+ return
50
+ fi
51
+
52
+ # chruby: check common install locations
53
+ if [ -f /usr/local/share/chruby/chruby.sh ]; then
54
+ source /usr/local/share/chruby/chruby.sh
55
+ [ -f /usr/local/share/chruby/auto.sh ] && source /usr/local/share/chruby/auto.sh
56
+ return
57
+ fi
58
+ if [ -f /opt/homebrew/share/chruby/chruby.sh ]; then
59
+ source /opt/homebrew/share/chruby/chruby.sh
60
+ [ -f /opt/homebrew/share/chruby/auto.sh ] && source /opt/homebrew/share/chruby/auto.sh
61
+ return
62
+ fi
63
+ }
64
+
65
+ setup_ruby_path
65
66
 
66
67
  # Verify we have the necessary files
67
68
  if [ ! -f "Gemfile" ]; then
@@ -78,20 +79,11 @@ fi
78
79
  export RAILS_ENV="${RAILS_ENV:-development}"
79
80
 
80
81
  # Ensure we have the rails-active-mcp gem available
81
- if ! bundle list | grep -q "rails-active-mcp"; then
82
+ if ! bundle list 2>/dev/null | grep -q "rails-active-mcp"; then
82
83
  echo "Error: rails-active-mcp gem not found in bundle" >&2
83
84
  echo "Please run: bundle install" >&2
84
85
  exit 1
85
86
  fi
86
87
 
87
88
  # Execute the Rails Active MCP server
88
- # Try bundle exec first, then fall back to direct execution
89
- if bundle exec rails-active-mcp-server "$@" 2>/dev/null; then
90
- exit 0
91
- elif command -v rails-active-mcp-server >/dev/null 2>&1; then
92
- exec rails-active-mcp-server "$@"
93
- else
94
- echo "Error: Cannot find rails-active-mcp-server executable" >&2
95
- echo "Please ensure the rails-active-mcp gem is properly installed" >&2
96
- exit 1
97
- fi
89
+ exec bundle exec rails-active-mcp-server "$@"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsActiveMcp
4
- VERSION = '3.1.1'
4
+ VERSION = '3.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-active-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandyn Britton