Module: Verto

Extended by:
Dry::Configurable
Defined in:
lib/verto/commands/tag_command.rb,
lib/verto.rb,
lib/verto/dsl.rb,
lib/verto/version.rb,
lib/verto/dsl/file.rb,
lib/verto/dsl/hook.rb,
lib/verto/dsl/syntax.rb,
lib/verto/utils/template.rb,
lib/verto/dsl/interpreter.rb,
lib/verto/utils/cli_helpers.rb,
lib/verto/dsl/built_in_hooks.rb,
lib/verto/dsl/update_changelog.rb,
lib/verto/commands/base_command.rb,
lib/verto/commands/main_command.rb,
lib/verto/utils/command_options.rb,
lib/verto/utils/semantic_version.rb,
lib/verto/repositories/tag_repository.rb,
lib/verto/utils/system_command_executor.rb,
lib/verto/dsl/update_changelog/filtered_by.rb,
lib/verto/dsl/update_changelog/with_commit_messages.rb,
lib/verto/dsl/update_changelog/with_merged_pull_requests.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

Modules: CliHelpers, DSL Classes: BaseCommand, CommandOptions, MainCommand, SemanticVersion, SystemCommandExecutor, TagCommand, TagRepository, Template

Constant Summary collapse

ExitError =
Class.new(Thor::Error)
CommandError =
Class.new(ExitError)
VERSION =
'0.12.0'

Class Method Summary collapse

Class Method Details

.containerObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/verto.rb', line 70

def self.container
  @container ||= Dry::Container.new.tap do |container|
    container.register('system_command_executor') { SystemCommandExecutor.new }
    container.register('system_command_executor_without_output') do
      SystemCommandExecutor.new(stdout: nil, stderr: nil)
    end
    container.register('cli_helpers') { CliHelpers }

    container.register('tag_repository') { TagRepository.new }

    container.register('stdout', memoize: true) do
      stdout = Verto.config.output.stdout_to
      stdout && Verto.project_path.join(stdout).open('a+') || $stdout
    end

    container.register('stderr', memoize: true) do
      stderr = Verto.config.output.stderr_to
      stderr && Verto.project_path.join(stderr).open('a+') || $stderr
    end

    # TODO: Remove project.path from container
    container.namespace('project') do
      register('path') { Verto.config.project.path }
    end

    container.namespace('changelog') do
      register('format') { Verto.config.changelog.format }
    end
  end
end

.current_momentObject



113
114
115
# File 'lib/verto.rb', line 113

def self.current_moment
  @current_moment
end

.current_moment=(moment) ⇒ Object



117
118
119
# File 'lib/verto.rb', line 117

def self.current_moment=(moment)
  @current_moment = moment
end

.importObject



101
102
103
# File 'lib/verto.rb', line 101

def self.import
  @import ||= Dry::AutoInject(container)
end

.project_pathObject



66
67
68
# File 'lib/verto.rb', line 66

def self.project_path
  Pathname.new Verto.config.project.path
end

.root_pathObject



62
63
64
# File 'lib/verto.rb', line 62

def self.root_path
  Pathname.new File.expand_path("#{File.dirname(__FILE__)}/..")
end

.stderrObject



109
110
111
# File 'lib/verto.rb', line 109

def self.stderr
  Verto.container.resolve('stderr')
end

.stdoutObject



105
106
107
# File 'lib/verto.rb', line 105

def self.stdout
  Verto.container.resolve('stdout')
end