Module: DocOpsLab::Dev::Checkers

Defined in:
lib/docopslab/dev/checkers.rb

Class Method Summary collapse

Class Method Details

.check_config_structure(context) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/docopslab/dev/checkers.rb', line 45

def check_config_structure context
  puts "\nšŸ“‹ Configuration Status:"

  manifest = context.load_manifest

  if manifest
    puts 'āœ… Manifest found: .config/docopslab-dev.yml'
  else
    puts "āŒ No manifest found; run 'labdev:init:all' to create one"
    return
  end

  # Check configs for each tool in manifest
  manifest['tools']&.each do |tool_entry|
    tool_slug = tool_entry['tool']
    tool_meta = context.(tool_slug)
    tool_name = tool_meta ? tool_meta['name'] : tool_slug
    tool_enabled = tool_entry.fetch('enabled', true)

    unless tool_enabled
      puts "ā­ļø  #{tool_name}: disabled in manifest"
      next
    end

    files = context.get_tool_files(tool_slug)

    unless files[:project]
      puts "āš ļø  #{tool_name}: no project config defined in manifest"
      next
    end

    project_path = files[:project][:local]
    unless project_path && File.exist?(project_path)
      puts "āŒ No #{tool_name} project config found; run 'labdev:init:all' to create one"
      next
    end

    # Check for base config if tool uses vendor base
    if files[:base] && tool_meta && tool_meta['config']['uses_vendor_base']
      base_status = File.exist?(files[:base][:local]) ? 'āœ…' : 'āŒ'
      puts "āœ… #{tool_name} project config: #{project_path} (base: #{base_status})"
    else
      puts "āœ… #{tool_name} project config: #{project_path}"
    end
  end
end

.check_ruby_versionObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/docopslab/dev/checkers.rb', line 19

def check_ruby_version
  expected_version = RUBY_TARGET
  current_version = RUBY_VERSION

  puts "Ruby version: #{current_version}"

  if current_version == expected_version
    puts "āœ… Ruby version matches DocOps Lab standard (#{expected_version})"
  else
    puts "āš ļø  Ruby version differs from DocOps Lab standard (#{expected_version})"
  end

  if File.exist?('.ruby-version')
    file_version = File.read('.ruby-version').strip
    puts "šŸ“„ .ruby-version file specifies: #{file_version}"

    if file_version == expected_version
      puts 'āœ… .ruby-version matches DocOps Lab standard'
    else
      puts 'āš ļø  .ruby-version differs from DocOps Lab standard'
    end
  else
    puts 'ā„¹ļø  No .ruby-version file found'
  end
end

.check_standard_rake_tasksObject



92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/docopslab/dev/checkers.rb', line 92

def check_standard_rake_tasks
  # Checks local Rakefile for presence of standard (non-labdev) tasks
  standard_tasks = %w[rspec cli_test yaml_test pr_test install_local]
  missing_tasks = []
  standard_tasks.each do |task_name|
    missing_tasks << task_name unless Rake::Task.task_defined?(task_name)
  end
  if missing_tasks.empty?
    puts 'āœ… All standard Rake tasks are present'
  else
    puts "āŒ Missing standard Rake tasks: #{missing_tasks.join(', ')}"
  end
end

.gem_sourced_locally?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/docopslab/dev/checkers.rb', line 12

def gem_sourced_locally?
  # Check if the gem is being used via a path dependency (development mode)
  # This is true when running from issuer, releasehx, etc. with path: '../lab/gems/docopslab-dev'
  # The GEM_ROOT will point to a local filesystem path rather than a gem installation
  !GEM_ROOT.include?('/gems/') || GEM_ROOT.include?('/lab/gems/docopslab-dev')
end

.lab_dev_mode?Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/docopslab/dev/checkers.rb', line 7

def lab_dev_mode?
  # Detect if we are running inside the DocOps/lab monorepo
  Dir.exist?('gems/docopslab-dev')
end