Class: Rails::Worktrees::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/worktrees/configuration.rb,
sig/rails/worktrees.rbs

Overview

Stores application-level settings for the wt command.

Constant Summary collapse

CONFIGURABLE_ATTRIBUTES =
%i[
  bootstrap_env
  workspace_root
  dev_port_range
  branch_prefix
  name_sources_path
  used_names_file
  worktree_database_suffix_max_length
  post_create_command
  run_bundle_install
  run_yarn_install
  run_db_prepare
  run_test_db_prepare
  run_test_assets_precompile
  link_credential_keys
  link_test_credential_key
  link_production_credential_key
].freeze
DEFAULT_BOOTSTRAP_ENV =
true
DEFAULT_BRANCH_PREFIX =
'🚂'.freeze
DEFAULT_DEV_PORT_RANGE =
(3000..3999)
DEFAULT_USED_NAMES_DIRECTORY =
File.join(
  ENV.fetch('XDG_STATE_HOME', File.join(Dir.home, '.local/state')),
  'rails-worktrees'
)
DEFAULT_USED_NAMES_FILE =
File.join(DEFAULT_USED_NAMES_DIRECTORY, 'used-names.tsv')
DEFAULT_NAME_SOURCES_PATH =
File.expand_path('names', __dir__)
DEFAULT_WORKTREE_DATABASE_SUFFIX_MAX_LENGTH =
18

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



43
44
45
46
# File 'lib/rails/worktrees/configuration.rb', line 43

def initialize
  assign_core_defaults
  assign_post_create_defaults
end

Instance Attribute Details

#bootstrap_envBoolean

Returns the value of attribute bootstrap_env.

Returns:

  • (Boolean)


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def bootstrap_env
  @bootstrap_env
end

#branch_prefixString

Returns the value of attribute branch_prefix.

Returns:

  • (String)


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def branch_prefix
  @branch_prefix
end

#dev_port_range::Range[Integer]

Returns the value of attribute dev_port_range.

Returns:

  • (::Range[Integer])


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def dev_port_range
  @dev_port_range
end

#legacy_used_names_filesArray[String]

Returns the value of attribute legacy_used_names_files.

Returns:

  • (Array[String])


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def legacy_used_names_files
  @legacy_used_names_files
end

Returns the value of attribute link_credential_keys.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def link_credential_keys
  @link_credential_keys
end

Returns the value of attribute link_production_credential_key.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def link_production_credential_key
  @link_production_credential_key
end

Returns the value of attribute link_test_credential_key.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def link_test_credential_key
  @link_test_credential_key
end

#name_sources_pathString

Returns the value of attribute name_sources_path.

Returns:

  • (String)


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def name_sources_path
  @name_sources_path
end

#post_create_commandObject

Returns the value of attribute post_create_command.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def post_create_command
  @post_create_command
end

#run_bundle_installObject

Returns the value of attribute run_bundle_install.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def run_bundle_install
  @run_bundle_install
end

#run_db_prepareObject

Returns the value of attribute run_db_prepare.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def run_db_prepare
  @run_db_prepare
end

#run_test_assets_precompileObject

Returns the value of attribute run_test_assets_precompile.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def run_test_assets_precompile
  @run_test_assets_precompile
end

#run_test_db_prepareObject

Returns the value of attribute run_test_db_prepare.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def run_test_db_prepare
  @run_test_db_prepare
end

#run_yarn_installObject

Returns the value of attribute run_yarn_install.



35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def run_yarn_install
  @run_yarn_install
end

#used_names_fileString

Returns the value of attribute used_names_file.

Returns:

  • (String)


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def used_names_file
  @used_names_file
end

#workspace_rootString?

Returns the value of attribute workspace_root.

Returns:

  • (String, nil)


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def workspace_root
  @workspace_root
end

#worktree_database_suffix_max_lengthInteger

Returns the value of attribute worktree_database_suffix_max_length.

Returns:

  • (Integer)


35
36
37
# File 'lib/rails/worktrees/configuration.rb', line 35

def worktree_database_suffix_max_length
  @worktree_database_suffix_max_length
end