Skip to content

Commit d01538f

Browse files
committed
Modernize code.
1 parent 96cde27 commit d01538f

File tree

8 files changed

+43
-15
lines changed

8 files changed

+43
-15
lines changed

.github/copilot-instructions.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# GitHub Copilot Instructions
2+
3+
## Use Agent Context
4+
5+
When working on this project, consult the `agent.md` file for project-specific guidelines, architecture decisions, and development patterns. This file contains curated information that will help you make better decisions aligned with the project's goals and standards.
6+
7+
If the file does not exist, you will need to install it, by running the following command:
8+
9+
```bash
10+
$ bundle install
11+
$ bundle exec bake agent:context:install
12+
```
13+
14+
This command will set up the necessary context files that help you understand the project structure, dependencies, and conventions.
15+
16+
## Ignoring Files
17+
18+
The `.gitignore` file is split into two sections, separated by a blank line. The first section is automatically generated, while the second section is user controlled.
19+
20+
While working on pull requests, you should not add unrelated changes to the `.gitignore` file as part of the pull request.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/agent.md
2-
/.bundle
32
/.context
3+
/.bundle
44
/pkg
55
/gems.locked
66
/.covered.db

bake.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@
88
# @parameter version [String] The new version number.
99
def after_gem_release_version_increment(version)
1010
context["releases:update"].call(version)
11-
context["utopia:project:readme:update"].call
12-
context["utopia:project:agent:context:update"].call
11+
context["utopia:project:update"].call
1312
end

examples/ipc/client.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!/usr/bin/env async-service
22
# frozen_string_literal: true
33

4+
# Released under the MIT License.
5+
# Copyright, 2025, by Samuel Williams.
6+
47
# This file demonstrates running just the client component
58
# Run with: async-service examples/ipc/client.rb
69
# (Make sure server.rb is running first)
710

8-
require 'socket'
11+
require "socket"
912

1013
# Shared environment for IPC configuration
1114
environment(:ipc) do
@@ -20,30 +23,30 @@ def setup(container)
2023
container.run(count: 1, restart: true) do |instance|
2124
socket_path = evaluator.ipc_socket_path
2225

23-
Console.info(self) { "IPC Client starting - will connect to #{socket_path}" }
26+
Console.info(self) {"IPC Client starting - will connect to #{socket_path}"}
2427
instance.ready!
2528

2629
while true
2730
begin
2831
# Connect to server
2932
client = UNIXSocket.new(socket_path)
30-
Console.info(self) { "Connected to server" }
33+
Console.info(self) {"Connected to server"}
3134

3235
# Read response
3336
response = client.readline.chomp
3437
puts "📨 Received: #{response}"
3538

3639
client.close
37-
Console.info(self) { "Connection closed" }
40+
Console.info(self) {"Connection closed"}
3841

3942
# Wait before next connection
4043
sleep(2)
4144

4245
rescue Errno::ENOENT
43-
Console.warn(self) { "Server socket not found at #{socket_path}, retrying..." }
46+
Console.warn(self) {"Server socket not found at #{socket_path}, retrying..."}
4447
sleep(3)
4548
rescue Errno::ECONNREFUSED
46-
Console.warn(self) { "Connection refused, server may not be ready" }
49+
Console.warn(self) {"Connection refused, server may not be ready"}
4750
sleep(3)
4851
rescue => error
4952
Console.error(self, error)

examples/ipc/server.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/usr/bin/env async-service
22
# frozen_string_literal: true
33

4+
# Released under the MIT License.
5+
# Copyright, 2025, by Samuel Williams.
6+
47
# This file demonstrates running just the server component
58
# Run with: async-service examples/ipc/server.rb
69

7-
require 'socket'
10+
require "socket"
811

912
# Shared environment for IPC configuration
1013
environment(:ipc) do
@@ -25,21 +28,21 @@ def setup(container)
2528
# Create Unix domain socket server
2629
server = UNIXServer.new(socket_path)
2730

28-
Console.info(self) { "IPC Server listening on #{socket_path}" }
31+
Console.info(self) {"IPC Server listening on #{socket_path}"}
2932
instance.ready!
3033

3134
begin
3235
while true
3336
# Accept incoming connections
3437
client = server.accept
35-
Console.info(self) { "Client connected from PID #{client.peereid[0]}" }
38+
Console.info(self) {"Client connected from PID #{client.peereid[0]}"}
3639

3740
# Send greeting with timestamp
3841
timestamp = Time.now.strftime("%H:%M:%S")
3942
client.write("Hello World at #{timestamp}\n")
4043
client.close
4144

42-
Console.info(self) { "Sent greeting and closed connection" }
45+
Console.info(self) {"Sent greeting and closed connection"}
4346
end
4447
rescue => error
4548
Console.error(self, error)

lib/async/service/container_environment.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# frozen_string_literal: true
22

3+
# Released under the MIT License.
4+
# Copyright, 2025, by Samuel Williams.
5+
36
module Async
47
module Service
58
# Default configuration for container-based services.

lib/async/service/environment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2024, by Samuel Williams.
4+
# Copyright, 2024-2025, by Samuel Williams.
55

66
module Async
77
module Service

test/async/service/formatting.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
expect(subject.format_count(1)).to be == "1"
1515
expect(subject.format_count(1.0)).to be == "1.0"
16-
16+
1717
expect(subject.format_count(999)).to be == "999"
1818
end
1919

0 commit comments

Comments
 (0)