README excerpt
# Pharo Command Recorder
A simple command recording implementation in Pharo that demonstrates core concepts for the Phizura GSoC project. This repository showcases how to implement a command pattern with recording and playback functionalities in Pharo.
## Overview
This repository demonstrates:
- Command pattern implementation in Pharo
- Recording functionality for commands with timestamps
- Command history management and playback
- Unit tests for core functionality
## Installation
To install this project in your Pharo image:
```smalltalk
Metacello new
baseline: 'CommandRecorder';
repository: 'github://imshrishk/pharo-samples:main';
load.
```
## Usage Example
Here's a simple example of how to use the command recorder:
```smalltalk
"Create a command recorder"
recorder := CRCommandRecorder new.
"Start recording"
recorder startRecording.
"Create and execute some commands"
command1 := [ Transcript show: 'Command 1 executed'; cr ] asCommand.
command2 := [ Transcript show: 'Command 2 executed'; cr ] asCommand.
recorder execute: command1.
(Delay forMilliseconds: 500) wait.
recorder execute: command2.
"Stop recording"
recorder stopRecording.
"Replay the recorded commands"
recorder replay.
```
## Components
- **CRCommand**: Base command class that encapsulates an action
- **CRTimedCommand**: Command with execution timestamp
- **CRCommandHistory**: Manages a history of executed commands
- **CRCommandRecorder**: Core class that records and replays commands
- **CRCommandInvoker**: Executes commands and manages the command history
## Testing
Run the tests using the Pharo Test Runner on the `CommandRecorder-Tests` package.
## Relation to Phizura Project
This implementation demonstrates the core recording mechanism that will be extended for music live coding in the Phizura project. While this sample doesn't incorporate the music-specific aspects, it shows how commands can be captured, stored with timing information, and replayed - which is the foundation of the Phizura system