Module: Braid

Extended by:
T::Sig
Defined in:
lib/braid/config.rb,
lib/braid.rb,
lib/braid/mirror.rb,
lib/braid/command.rb,
lib/braid/version.rb,
lib/braid/operations.rb,
lib/braid/commands/add.rb,
lib/braid/commands/diff.rb,
lib/braid/commands/push.rb,
lib/braid/commands/setup.rb,
lib/braid/commands/remove.rb,
lib/braid/commands/status.rb,
lib/braid/commands/update.rb,
lib/braid/operations_lite.rb,
lib/braid/sorbet/fake_runtime.rb,
lib/braid/commands/upgrade_config.rb

Overview

Create our fake module at Braid::T so that if someone loads Braid into the same Ruby interpreter as other code that needs the real sorbet-runtime, we don’t break the other code. (We don’t officially support loading Braid as a library, but we may as well go ahead and put this infrastructure in place.) Code in the Braid module still uses normal references to T, so the Sorbet static analyzer (which doesn’t read this file) doesn’t see anything out of the ordinary, but those references resolve to Braid::T at runtime according to Ruby’s constant lookup rules.

Defined Under Namespace

Modules: Commands, Operations, T Classes: BraidError, Command, Config, InternalError, Mirror, NoPushToTag

Constant Summary collapse

OLD_CONFIG_FILE =
'.braids'
CONFIG_FILE =
'.braids.json'
REQUIRED_GIT_VERSION =

See the background in the “Supported environments” section of README.md.

The newest Git feature that Braid is currently known to rely on is ‘receive.denyCurrentBranch = updateInstead` (in spec/integration/push_spec.rb), which was added in Git 2.3.0 (in 2015). It doesn’t seem worth even a small amount of work to remove that dependency and support even older versions of Git. So set that as the declared requirement for now. In general, a reasonable approach might be to try to support the oldest version of Git in current “long-term support” versions of popular OS distributions.

'2.3.0'
VERSION =
'1.1.7'.freeze

Class Method Summary collapse

Methods included from T::Sig

sig

Class Method Details

.forceObject



42
43
44
# File 'lib/braid.rb', line 42

def self.force
  !!@force
end

.force=(new_value) ⇒ Object



47
48
49
# File 'lib/braid.rb', line 47

def self.force=(new_value)
  @force = !!new_value
end

.local_cache_dirObject



57
58
59
# File 'lib/braid.rb', line 57

def self.local_cache_dir
  File.expand_path(ENV['BRAID_LOCAL_CACHE_DIR'] || "#{ENV['HOME']}/.braid/cache")
end

.use_local_cacheObject



52
53
54
# File 'lib/braid.rb', line 52

def self.use_local_cache
  [nil, 'true', '1'].include?(ENV['BRAID_USE_LOCAL_CACHE'])
end

.verboseObject



27
28
29
# File 'lib/braid.rb', line 27

def self.verbose
  !!@verbose
end

.verbose=(new_value) ⇒ Object



35
36
37
# File 'lib/braid.rb', line 35

def self.verbose=(new_value)
  @verbose = !!new_value
end