Class: Ace::Tmux::Organisms::SessionManager
- Inherits:
-
Object
- Object
- Ace::Tmux::Organisms::SessionManager
- Defined in:
- lib/ace/tmux/organisms/session_manager.rb
Overview
Orchestrates session creation from a preset
Flow:
1. Check if session already exists
2. Run on_project_start hooks
3. Create session (first window implicitly created)
4. Set up additional windows and panes
5. Set layouts and focus
6. Select startup window
7. Attach (unless --detach)
Constant Summary collapse
- POLLUTING_ENV_VARS =
%w[BUNDLE_GEMFILE BUNDLE_BIN_PATH RUBYOPT RUBYLIB].freeze
Instance Method Summary collapse
-
#initialize(executor:, session_builder:, tmux: "tmux") ⇒ SessionManager
constructor
A new instance of SessionManager.
-
#start(preset_name, detach: false, force: false, name: nil, root: nil) ⇒ void
Start a session from a preset.
Constructor Details
#initialize(executor:, session_builder:, tmux: "tmux") ⇒ SessionManager
Returns a new instance of SessionManager.
22 23 24 25 26 |
# File 'lib/ace/tmux/organisms/session_manager.rb', line 22 def initialize(executor:, session_builder:, tmux: "tmux") @executor = executor @session_builder = session_builder @tmux = tmux end |
Instance Method Details
#start(preset_name, detach: false, force: false, name: nil, root: nil) ⇒ void
This method returns an undefined value.
Start a session from a preset
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ace/tmux/organisms/session_manager.rb', line 36 def start(preset_name, detach: false, force: false, name: nil, root: nil) session = @session_builder.build(preset_name) session.name = name if name session.root = root if root if session_exists?(session.name) if force kill_session(session.name) else attach_session(session) unless detach return end end run_hooks(session.on_project_start) first_window_target = create_session(session, root_override: root) clean_environment(session) setup_windows(session) select_startup_window(session, first_window_target: first_window_target) attach_session(session) unless detach end |