Class: GFSM::Tools::VersionBumperSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/tools/version_bumper.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cli_args) ⇒ VersionBumperSettings

Returns a new instance of VersionBumperSettings.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tools/version_bumper.rb', line 12

def initialize(cli_args)
  @repository = GFSM::Tools::GitUtilities.load_repo(get_repository_path(cli_args))
  @configuration = GFSM::Data::Configuration.new(get_configuration_file_path(cli_args))
  @force = get_force(cli_args)
  @force_version = get_force_version(cli_args)
  @prerelease = get_prerelease(cli_args)
  @prerelease_name = get_prerelease_name(cli_args)
  @from = get_from(cli_args)
  @to = get_to(cli_args)
  @initial_version = get_initial_version(cli_args)
  @from = GFSM::Tools::GitUtilities.extract_last_tag_name(@repository) if @from.nil?
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def configuration
  @configuration
end

#forceObject (readonly)

Returns the value of attribute force.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def force
  @force
end

#force_versionObject (readonly)

Returns the value of attribute force_version.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def force_version
  @force_version
end

#fromObject (readonly)

Returns the value of attribute from.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def from
  @from
end

#initial_versionObject (readonly)

Returns the value of attribute initial_version.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def initial_version
  @initial_version
end

#prereleaseObject (readonly)

Returns the value of attribute prerelease.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def prerelease
  @prerelease
end

#prerelease_nameObject (readonly)

Returns the value of attribute prerelease_name.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def prerelease_name
  @prerelease_name
end

#repositoryObject (readonly)

Returns the value of attribute repository.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def repository
  @repository
end

#toObject (readonly)

Returns the value of attribute to.



10
11
12
# File 'lib/tools/version_bumper.rb', line 10

def to
  @to
end

Class Method Details

.cli_infoObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/tools/version_bumper.rb', line 25

def self.cli_info
  options = "    --force                               # When there are no commits with a changelog trailer the version won't get bumped. Use this flag to force the version bump. Unless specified, it will increase the patch\n    --force-version <major|minor|match>   # What section of the version to bump if the changelog trailer is not found.\n    --prerelease                          # Use this switch to also include a prerelease in the version. By default will add 'pre' and increment it like 'pre.1', 'pre.2' and so on\n    --prerelease-name <name>              # Name of the prerelease that will get added when the switch is enabled\n    --configuration <path>                # Path to the configuration YAML file\n    --from <hash or tag>                  # The commit hash or tag to start from when extracting the commits. By default will use the latest tag\n    --to <hash, tag or HEAD>              # The commit hash or tag to stop at when extracting the commits. By default will use HEAD to get to the latest commit on the current branch\n    --configuration <path>                # Path to the configuration YAML file\n    --path <path>                         # Path to the repository. By default will use the current directory\n    --initial-version <x.y.z>             # Version to use when no existing version is found, useful when initializing the first one\n  OPTIONS\n\n  environment_variables = <<~ENVVARS\n    FORCE_BUMP                            # Equivalent to --force\n    FORCE_BUMP_VERSION                    # Equivalent to --force-version\n    PRERELEASE                            # Equivalent to --prerelease\n    PRERELEASE_NAME                       # Equivalent to --prerelease-name\n    CONFIGURATION_FILE                    # Equivalent to --configuration\n    REPOSITORY_PATH                       # Equivalent to --path\n    FROM_COMMIT                           # Equivalent to --from\n    TO_COMMIT                             # Equivalent to --to\n    INITIAL_VERSION                       # Equivalent to --initial-version\n  ENVVARS\n\n  return {\n    usage: \"[--force] [--force-version <major|minor|patch>] [--configuration <configuration_file_path>] [--prerelease] [--prerelease-name <prerelease_name>] [--from <hash or tag>] [--to <hash, tag or HEAD>] [--path <repository_path] [--initial-version <x.y.z>]\",\n    options: options,\n    environment_variables: environment_variables\n  }\nend\n"