Class: RailsMcpInsight::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_mcp_insight/configuration.rb

Overview

Holds all configuration for the MCP server and analyzers. Immutable after initialization — thread-safe by design.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_path: Dir.pwd) ⇒ Configuration

Returns a new instance of Configuration.



10
11
12
13
14
15
16
17
18
# File 'lib/rails_mcp_insight/configuration.rb', line 10

def initialize(project_path: Dir.pwd)
  @project_path = File.expand_path(project_path)
  @app_path     = File.join(@project_path, "app")
  @config_path  = File.join(@project_path, "config")
  @db_path      = File.join(@project_path, "db")
  @spec_path    = File.join(@project_path, "spec")
  @test_path    = File.join(@project_path, "test")
  @lib_path     = File.join(@project_path, "lib")
end

Instance Attribute Details

#app_pathObject (readonly)

Returns the value of attribute app_path.



7
8
9
# File 'lib/rails_mcp_insight/configuration.rb', line 7

def app_path
  @app_path
end

#config_pathObject (readonly)

Returns the value of attribute config_path.



7
8
9
# File 'lib/rails_mcp_insight/configuration.rb', line 7

def config_path
  @config_path
end

#db_pathObject (readonly)

Returns the value of attribute db_path.



7
8
9
# File 'lib/rails_mcp_insight/configuration.rb', line 7

def db_path
  @db_path
end

#lib_pathObject (readonly)

Returns the value of attribute lib_path.



7
8
9
# File 'lib/rails_mcp_insight/configuration.rb', line 7

def lib_path
  @lib_path
end

#project_pathObject (readonly)

Returns the value of attribute project_path.



7
8
9
# File 'lib/rails_mcp_insight/configuration.rb', line 7

def project_path
  @project_path
end

#spec_pathObject (readonly)

Returns the value of attribute spec_path.



7
8
9
# File 'lib/rails_mcp_insight/configuration.rb', line 7

def spec_path
  @spec_path
end

#test_pathObject (readonly)

Returns the value of attribute test_path.



7
8
9
# File 'lib/rails_mcp_insight/configuration.rb', line 7

def test_path
  @test_path
end

Instance Method Details

#controllers_pathObject



24
25
26
# File 'lib/rails_mcp_insight/configuration.rb', line 24

def controllers_path
  File.join(@app_path, "controllers")
end

#gemfile_lock_pathObject



60
61
62
# File 'lib/rails_mcp_insight/configuration.rb', line 60

def gemfile_lock_path
  File.join(@project_path, "Gemfile.lock")
end

#gemfile_pathObject



56
57
58
# File 'lib/rails_mcp_insight/configuration.rb', line 56

def gemfile_path
  File.join(@project_path, "Gemfile")
end

#jobs_pathObject



28
29
30
# File 'lib/rails_mcp_insight/configuration.rb', line 28

def jobs_path
  File.join(@app_path, "jobs")
end

#mailers_pathObject



32
33
34
# File 'lib/rails_mcp_insight/configuration.rb', line 32

def mailers_path
  File.join(@app_path, "mailers")
end

#migrations_pathObject



64
65
66
# File 'lib/rails_mcp_insight/configuration.rb', line 64

def migrations_path
  File.join(@db_path, "migrate")
end

#models_pathObject



20
21
22
# File 'lib/rails_mcp_insight/configuration.rb', line 20

def models_path
  File.join(@app_path, "models")
end

#rails_app?Boolean

Returns:

  • (Boolean)


68
69
70
71
72
# File 'lib/rails_mcp_insight/configuration.rb', line 68

def rails_app?
  File.exist?(routes_file) &&
    File.exist?(gemfile_path) &&
    Dir.exist?(@app_path)
end

#routes_fileObject



44
45
46
# File 'lib/rails_mcp_insight/configuration.rb', line 44

def routes_file
  File.join(@config_path, "routes.rb")
end

#schema_fileObject



48
49
50
# File 'lib/rails_mcp_insight/configuration.rb', line 48

def schema_file
  File.join(@db_path, "schema.rb")
end

#services_pathObject



40
41
42
# File 'lib/rails_mcp_insight/configuration.rb', line 40

def services_path
  File.join(@app_path, "services")
end

#structure_fileObject



52
53
54
# File 'lib/rails_mcp_insight/configuration.rb', line 52

def structure_file
  File.join(@db_path, "structure.sql")
end

#views_pathObject



36
37
38
# File 'lib/rails_mcp_insight/configuration.rb', line 36

def views_path
  File.join(@app_path, "views")
end