Module: Toolshed

Defined in:
lib/toolshed.rb,
lib/toolshed/cli.rb,
lib/toolshed/git.rb,
lib/toolshed/base.rb,
lib/toolshed/error.rb,
lib/toolshed/client.rb,
lib/toolshed/timeout.rb,
lib/toolshed/version.rb,
lib/toolshed/password.rb,
lib/toolshed/git/branch.rb,
lib/toolshed/git/github.rb,
lib/toolshed/commands/ssh.rb,
lib/toolshed/commands/base.rb,
lib/toolshed/git/validator.rb,
lib/toolshed/commands/scp_base.rb,
lib/toolshed/commands/scp/upload.rb,
lib/toolshed/ticket_tracking/jira.rb,
lib/toolshed/commands/mysql/backup.rb,
lib/toolshed/commands/scp/download.rb,
lib/toolshed/time_tracking/harvest.rb,
lib/toolshed/commands/create_branch.rb,
lib/toolshed/commands/delete_branch.rb,
lib/toolshed/commands/list_branches.rb,
lib/toolshed/databases/mysql/backup.rb,
lib/toolshed/commands/checkout_branch.rb,
lib/toolshed/server_administration/scp.rb,
lib/toolshed/server_administration/ssh.rb,
lib/toolshed/commands/ticket_information.rb,
lib/toolshed/time_tracking/time_tracking.rb,
lib/toolshed/commands/create_pull_request.rb,
lib/toolshed/commands/update_ticket_status.rb,
lib/toolshed/commands/create_ticket_comment.rb,
lib/toolshed/commands/get_daily_time_update.rb,
lib/toolshed/ticket_tracking/pivotal_tracker.rb,
lib/toolshed/ticket_tracking/ticket_tracking.rb,
lib/toolshed/commands/create_pivotal_tracker_note.rb,
lib/toolshed/commands/update_pivotal_tracker_story_status.rb

Overview

Module for toolshed

Defined Under Namespace

Modules: Commands, Databases, Password, ServerAdministration, TicketTracking, TimeTracking Classes: AuthenticationFailed, Base, CLI, Client, CommandNotFound, CorruptFileException, Error, Git, Logger, RecordExists, RecordNotFoundError, SSHResponseException, Timeout, Version

Constant Summary collapse

BLANK_REGEX =
/\S+/
VERSION =
'1.0.12'

Class Method Summary collapse

Class Method Details

.add_file_log_source(command_name = '') ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/toolshed.rb', line 17

def add_file_log_source(command_name = '')
  log_path = Toolshed.configuration.log_path
  return if log_path.nil? || log_path.empty?

  FileUtils.mkdir_p(log_path)
  command_name_string = '_'
  command_name_string = "_#{command_name}_" unless command_name.nil? || command_name.empty? # rubocop:disable Metrics/LineLength
  file_name = "toolshed#{command_name_string}#{Time.now.utc.strftime('%Y%m%d%H%M%S%L')}" # rubocop:disable Metrics/LineLength
  file = "#{log_path}/#{file_name}"
  FileUtils.touch(file)
  logger.add_log_source(file)
end

.configurationObject



30
31
32
# File 'lib/toolshed.rb', line 30

def configuration
  Toolshed::Client.instance
end

.deprecate(message = nil) ⇒ Object



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

def deprecate(message = nil)
  message ||= 'You are using deprecated behavior which will be removed from the next major or minor release.' # rubocop:disable Metrics/LineLength
  warn("DEPRECATION WARNING: #{message}")
end

.die(message = '', exit_code = -1)) ⇒ Object



39
40
41
42
# File 'lib/toolshed.rb', line 39

def die(message = '', exit_code = -1)
  logger.fatal message unless message.nil? || message.empty?
  Kernel.exit(exit_code)
end

.loggerObject



44
45
46
47
48
49
# File 'lib/toolshed.rb', line 44

def logger
  @logger ||= begin
    Toolshed::Logger.create(log_sources: [STDOUT])
    Toolshed::Logger.instance
  end
end