Skip to content

Restructure workspace management - #888

Merged
tompng merged 4 commits into
masterfrom
restructure-workspace-management
Mar 1, 2024
Merged

tompng merged 4 commits into
masterfrom
restructure-workspace-management

Conversation

@st0012

@st0012 st0012 commented Feb 25, 2024 •

Copy link
Copy Markdown
Member

Currently, workspace is an attribute of IRB::Context in most use cases. But when some workspace commands are used, like pushws or popws, a workspace will be created and used along side with the original workspace attribute.

This complexity is not necessary and will prevent us from expanding multi-workspace support in the future.

So this PR introduces a @workspace_stack ivar to IRB::Context so IRB can have a more natural way to manage workspaces.

Also, workspaces, pushws, and popws commands now print the full workspaces stack, which should make the commands' usage easier to understand.

@st0012 st0012 self-assigned this Feb 25, 2024
Currently, workspace is an attribute of IRB::Context in most use cases.
But when some workspace commands are used, like `pushws` or `popws`, a
workspace will be created and used along side with the original workspace
attribute.

This complexity is not necessary and will prevent us from expanding
multi-workspace support in the future.

So this commit introduces a @workspace_stack ivar to IRB::Context so IRB
can have a more natural way to manage workspaces.
@st0012
st0012 force-pushed the restructure-workspace-management branch from 22eb776 to fe33141 Compare February 25, 2024 16:13
Comment thread lib/irb/ext/workspaces.rb Resolved
Comment thread lib/irb/command/pushws.rb Resolved
@st0012
st0012 force-pushed the restructure-workspace-management branch 2 times, most recently from c5531ae to 5ff1d38 Compare February 29, 2024 02:52
Comment thread lib/irb/command/pushws.rb Resolved
@st0012
st0012 requested a review from tompng February 29, 2024 03:01
Comment thread lib/irb/workspace.rb Resolved
@st0012
st0012 force-pushed the restructure-workspace-management branch from 5ff1d38 to 8ea782d Compare March 1, 2024 14:06
@st0012
st0012 requested a review from tompng March 1, 2024 14:08
@st0012 st0012 added the enhancement New feature or request label Mar 1, 2024

@tompng tompng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tompng
tompng merged commit 61560b9 into master Mar 1, 2024
@tompng
tompng deleted the restructure-workspace-management branch March 1, 2024 15:51
matzbot pushed a commit to ruby/ruby that referenced this pull request Mar 1, 2024
(ruby/irb#888)

* Remove dead irb_level method

* Restructure workspace management

Currently, workspace is an attribute of IRB::Context in most use cases.
But when some workspace commands are used, like `pushws` or `popws`, a
workspace will be created and used along side with the original workspace
attribute.

This complexity is not necessary and will prevent us from expanding
multi-workspace support in the future.

So this commit introduces a @workspace_stack ivar to IRB::Context so IRB
can have a more natural way to manage workspaces.

* Fix pushws without args

* Always display workspace stack after related commands are used

ruby/irb@61560b99b3
lacostej added a commit to lacostej/fastlane that referenced this pull request Feb 26, 2026
IRB introduced a breaking change in v1.12.0 and removed the IRB::Context.workspace setter. See ruby/irb#888

We adjust the code to work with the new API.

Also add a unit test.
lacostej added a commit to fastlane/fastlane that referenced this pull request Feb 26, 2026
IRB introduced a breaking change in v1.12.0 and removed the IRB::Context.workspace setter. See ruby/irb#888

We adjust the code to work with the API that still works.

Also add a unit test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants