Class: Spoom::Context

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Bundle, Exec, FileSystem, Git, Sorbet
Defined in:
lib/spoom/context.rb,
lib/spoom/context/git.rb,
lib/spoom/context/exec.rb,
lib/spoom/context/bundle.rb,
lib/spoom/context/sorbet.rb,
lib/spoom/context/file_system.rb

Overview

An abstraction to a Ruby project context

A context maps to a directory in the file system. It is used to manipulate files and run commands in the context of this directory.

Defined Under Namespace

Modules: Bundle, Exec, FileSystem, Git, Sorbet

Constant Summary

Constants included from Sorbet

Sorbet::BIN_PATH, Sorbet::CONFIG_PATH, Sorbet::GEM_PATH, Sorbet::KILLED_CODE, Sorbet::SEGFAULT_CODE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Git

#git, #git_checkout!, #git_checkout_new_branch!, #git_commit!, #git_current_branch, #git_diff, #git_init!, #git_last_commit, #git_log, #git_push!, #git_show, #git_workdir_clean?

Methods included from FileSystem

#absolute_path_to, #collect_files, #destroy!, #exist?, #file?, #glob, #list, #mkdir!, #move!, #read, #remove!, #write!

Methods included from Exec

#exec

Methods included from Bundle

#bundle, #bundle_exec, #bundle_install!, #gem_version_from_gemfile_lock, #gemfile_lock_specs, #read_gemfile, #read_gemfile_lock, #write_gemfile!

Constructor Details

#initialize(absolute_path) ⇒ Context

Returns a new instance of Context.



51
52
53
# File 'lib/spoom/context.rb', line 51

def initialize(absolute_path)
  @absolute_path = T.let(::File.expand_path(absolute_path), String)
end

Instance Attribute Details

#absolute_pathObject (readonly)

Returns the value of attribute absolute_path.



44
45
46
# File 'lib/spoom/context.rb', line 44

def absolute_path
  @absolute_path
end

Class Method Details

.mktmp!(name = nil) ⇒ Object



37
38
39
# File 'lib/spoom/context.rb', line 37

def mktmp!(name = nil)
  new(::Dir.mktmpdir(name))
end