Skip to content

Commit 9fa5f5b

Browse files
committed
Initial structure.
0 parents  commit 9fa5f5b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5758
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
indent_size = 2
6+
7+
[*.{yml,yaml}]
8+
indent_style = space
9+
indent_size = 2
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Documentation Coverage
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
COVERAGE: PartialSummary
10+
11+
jobs:
12+
validate:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: ruby
20+
bundler-cache: true
21+
22+
- name: Validate coverage
23+
timeout-minutes: 5
24+
run: bundle exec bake decode:index:coverage lib
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages:
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow one concurrent deployment:
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
env:
20+
BUNDLE_WITH: maintenance
21+
22+
jobs:
23+
generate:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: ruby
32+
bundler-cache: true
33+
34+
- name: Installing packages
35+
run: sudo apt-get install wget
36+
37+
- name: Generate documentation
38+
timeout-minutes: 5
39+
run: bundle exec bake utopia:project:static --force no
40+
41+
- name: Upload documentation artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: docs
45+
46+
deploy:
47+
runs-on: ubuntu-latest
48+
49+
environment:
50+
name: github-pages
51+
url: ${{steps.deployment.outputs.page_url}}
52+
53+
needs: generate
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

.github/workflows/rubocop.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: RuboCop
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: ruby
17+
bundler-cache: true
18+
19+
- name: Run RuboCop
20+
timeout-minutes: 10
21+
run: bundle exec rubocop

.github/workflows/test.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
test:
10+
name: ${{matrix.ruby}} on ${{matrix.os}}
11+
runs-on: ${{matrix.os}}-latest
12+
continue-on-error: ${{matrix.experimental}}
13+
14+
strategy:
15+
matrix:
16+
os:
17+
- ubuntu
18+
19+
ruby:
20+
- "3.2"
21+
- "3.3"
22+
- "3.4"
23+
24+
experimental: [false]
25+
26+
include:
27+
- os: ubuntu
28+
ruby: head
29+
experimental: true
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: ruby/setup-ruby-pkgs@v1
34+
with:
35+
ruby-version: ${{matrix.ruby}}
36+
bundler-cache: true
37+
apt-get: gdb
38+
39+
- name: Run tests
40+
timeout-minutes: 10
41+
run: bundle exec bake test

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/agents.md
2+
/.context
3+
/.bundle
4+
/pkg
5+
/gems.locked
6+
/.covered.db
7+
/external
8+
9+
**/__pycache__

.rubocop.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
plugins:
2+
- rubocop-md
3+
- rubocop-socketry
4+
5+
AllCops:
6+
DisabledByDefault: true
7+
8+
# Socketry specific rules:
9+
10+
Layout/ConsistentBlankLineIndentation:
11+
Enabled: true
12+
13+
Layout/BlockDelimiterSpacing:
14+
Enabled: true
15+
16+
# General Layout rules:
17+
18+
Layout/IndentationStyle:
19+
Enabled: true
20+
EnforcedStyle: tabs
21+
22+
Layout/InitialIndentation:
23+
Enabled: true
24+
25+
Layout/IndentationWidth:
26+
Enabled: true
27+
Width: 1
28+
29+
Layout/IndentationConsistency:
30+
Enabled: true
31+
EnforcedStyle: normal
32+
33+
Layout/BlockAlignment:
34+
Enabled: true
35+
36+
Layout/EndAlignment:
37+
Enabled: true
38+
EnforcedStyleAlignWith: start_of_line
39+
40+
Layout/BeginEndAlignment:
41+
Enabled: true
42+
EnforcedStyleAlignWith: start_of_line
43+
44+
Layout/RescueEnsureAlignment:
45+
Enabled: true
46+
47+
Layout/ElseAlignment:
48+
Enabled: true
49+
50+
Layout/DefEndAlignment:
51+
Enabled: true
52+
53+
Layout/CaseIndentation:
54+
Enabled: true
55+
EnforcedStyle: end
56+
57+
Layout/CommentIndentation:
58+
Enabled: true
59+
60+
Layout/FirstHashElementIndentation:
61+
Enabled: true
62+
EnforcedStyle: consistent
63+
64+
Layout/EmptyLinesAroundClassBody:
65+
Enabled: true
66+
67+
Layout/EmptyLinesAroundModuleBody:
68+
Enabled: true
69+
70+
Layout/EmptyLineAfterMagicComment:
71+
Enabled: true
72+
73+
Layout/SpaceInsideBlockBraces:
74+
Enabled: true
75+
EnforcedStyle: no_space
76+
SpaceBeforeBlockParameters: false
77+
78+
Layout/SpaceAroundBlockParameters:
79+
Enabled: true
80+
EnforcedStyleInsidePipes: no_space
81+
82+
Style/FrozenStringLiteralComment:
83+
Enabled: true
84+
85+
Style/StringLiterals:
86+
Enabled: true
87+
EnforcedStyle: double_quotes

bake/ruby/gdb.rb

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# frozen_string_literal: true
2+
3+
require "ruby/gdb"
4+
require "fileutils"
5+
6+
# Install GDB Python extensions to XDG data directory or custom prefix
7+
# @parameter prefix [String] Optional installation prefix (defaults to XDG_DATA_HOME)
8+
def install(prefix: nil)
9+
install_path = Ruby::GDB.install_path(prefix: prefix)
10+
11+
puts "Installing Ruby GDB extensions to: #{install_path}"
12+
13+
# Create installation directory
14+
FileUtils.mkdir_p(install_path)
15+
16+
# Copy Python scripts
17+
scripts = [
18+
Ruby::GDB.object_script_path,
19+
Ruby::GDB.fiber_script_path
20+
]
21+
22+
scripts.each do |script|
23+
if File.exist?(script)
24+
dest = File.join(install_path, File.basename(script))
25+
puts " Installing #{File.basename(script)}..."
26+
FileUtils.cp(script, dest)
27+
else
28+
warn " Warning: #{script} not found"
29+
end
30+
end
31+
32+
# Create a loader script that sources both extensions
33+
loader_path = File.join(install_path, "init.gdb")
34+
puts " Creating loader script: #{File.basename(loader_path)}"
35+
36+
File.write(loader_path, <<~GDB)
37+
# Ruby GDB Extensions Loader
38+
# This file loads Ruby debugging extensions for GDB
39+
40+
python
41+
import sys
42+
import os
43+
44+
# Add the Ruby GDB extensions directory to Python path
45+
ruby_gdb_dir = os.path.dirname(__file__)
46+
if ruby_gdb_dir not in sys.path:
47+
sys.path.insert(0, ruby_gdb_dir)
48+
49+
# Load Ruby object printing extensions
50+
exec(open(os.path.join(ruby_gdb_dir, 'object.py')).read())
51+
52+
# Load Ruby fiber debugging extensions
53+
exec(open(os.path.join(ruby_gdb_dir, 'fiber.py')).read())
54+
55+
print("Ruby GDB extensions loaded successfully!")
56+
print("Use 'help rb-' to see available commands.")
57+
end
58+
GDB
59+
60+
puts "\nInstallation complete!"
61+
puts "\nTo use these extensions, add the following to your ~/.gdbinit:"
62+
puts " source #{loader_path}"
63+
puts "\nOr load them manually in GDB with:"
64+
puts " (gdb) source #{loader_path}"
65+
end
66+
67+
# Uninstall GDB Python extensions
68+
# @parameter prefix [String] Optional installation prefix (defaults to XDG_DATA_HOME)
69+
def uninstall(prefix: nil)
70+
install_path = Ruby::GDB.install_path(prefix: prefix)
71+
72+
if Dir.exist?(install_path)
73+
puts "Removing Ruby GDB extensions from: #{install_path}"
74+
FileUtils.rm_rf(install_path)
75+
puts "Uninstallation complete!"
76+
else
77+
puts "No installation found at: #{install_path}"
78+
end
79+
end
80+
81+
# Show installation information
82+
def info
83+
puts "Ruby GDB Extensions v#{Ruby::GDB::VERSION}"
84+
puts "\nData directory: #{Ruby::GDB.data_path}"
85+
puts "Default install path: #{Ruby::GDB.install_path}"
86+
puts "\nAvailable scripts:"
87+
puts " - object.py (rb-object-print command)"
88+
puts " - fiber.py (rb-scan-fibers, rb-fiber-bt, and more)"
89+
end
90+

0 commit comments

Comments
 (0)