module Verto

Constants

CommandError
ExitError
VERSION

Public Class Methods

container() click to toggle source
# File lib/verto.rb, line 67
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_moment() click to toggle source
# File lib/verto.rb, line 110
def self.current_moment
  @current_moment
end
current_moment=(moment) click to toggle source
# File lib/verto.rb, line 114
def self.current_moment=(moment)
  @current_moment = moment
end
import() click to toggle source
# File lib/verto.rb, line 98
def self.import
  @import ||= Dry::AutoInject(container)
end
project_path() click to toggle source
# File lib/verto.rb, line 63
def self.project_path
  Pathname.new Verto.config.project.path
end
root_path() click to toggle source
# File lib/verto.rb, line 59
def self.root_path
  Pathname.new File.expand_path(File.dirname(__FILE__) + '/..')
end
stderr() click to toggle source
# File lib/verto.rb, line 106
def self.stderr
  Verto.container.resolve('stderr')
end
stdout() click to toggle source
# File lib/verto.rb, line 102
def self.stdout
  Verto.container.resolve('stdout')
end