Top Level Namespace

Defined Under Namespace

Modules: Raykit Classes: Dir, String

Constant Summary collapse

BUFFER_SIZE =

Constants

1024
RAKE_DIRECTORY =
Rake.application.original_dir
DEFAULT_SUBDIRECTORIES =
%w[src test examples]
DEFAULT_FILES =
%w[README.md LICENSE.md .gitignore]
RAYKIT_GLOBALS =
true
RAYKIT_AUTO_SETUP =
false
LOG_FILENAME =
ARGV.empty? ? "log/rake.txt" : "log/rake.#{ARGV.join(".")}.txt"
DEV_ROOT =

Constants

Raykit::Environment::root_dir
VERSION =
Raykit::Version.detect(File.basename(RAKE_DIRECTORY))
RUNTIME_IDENTIFIER =
Raykit::DotNet::get_runtime_identifier()
PROJECT =
Raykit::Project.new
SECRETS =
Raykit::Secrets.new
REPOSITORIES =
Raykit::Git::Repositories.new("#{Raykit::Environment.get_dev_dir("log")}/Raykit.Git.Repositories.json")
GIT_DIRECTORY =
Raykit::Git::Directory.new(Rake.application.original_dir)
NUGET_DIR =
Raykit::Environment::get_dev_dir("nuget")
PUBLISH_DIR =
Raykit::Environment::get_dev_dir("publish")
ARTIFACTS_DIR =
Raykit::Environment::get_dev_dir("artifacts")
LAST_MODIFIED_SOURCE_FILE =
GIT_DIRECTORY.last_modified_src_file
LAST_MODIFIED_SOURCE_TIME =
GIT_DIRECTORY.last_modified_src_time
LAST_MODIFIED_FILE =
GIT_DIRECTORY.last_modified_filename
LAST_MODIFIED_TIME =
GIT_DIRECTORY.last_modified_time
LAST_MODIFIED_ARTIFACT_TIME =
GIT_DIRECTORY.last_modified_artifact_time
LOG =
Raykit::Logging.new
MARKDOWN =
Raykit::Markdown.new
DEFAULT_LOGGER =

module Raykit

Raykit::Logger::default

Instance Method Summary collapse

Instance Method Details

#backup_git_directoryObject



54
55
56
57
58
59
60
61
# File 'lib/raykit.rb', line 54

def backup_git_directory
  if ENV["GIT_BACKUP_DIR"] && !ENV["GIT_BACKUP_DIR"].empty?
    puts "Backing up #{GIT_DIRECTORY.repository.url}"
    Raykit::Git::Repository::backup GIT_DIRECTORY.repository.url, "#{ENV["GIT_BACKUP_DIR"]}/#{GIT_DIRECTORY.repository.relative_path}"
  else
    puts "Environment variable GIT_BACKUP_DIR is not set"
  end
end

#copy_file_to_dir(file, dir) ⇒ Object



143
144
145
# File 'lib/raykit.rb', line 143

def copy_file_to_dir(file, dir)
  Raykit::FileSystem::copy_file_to_dir(file, dir)
end

#copy_files(src_dir, target_dir, glob) ⇒ Object



139
140
141
# File 'lib/raykit.rb', line 139

def copy_files(src_dir, target_dir, glob)
  Raykit::FileSystem::copy_files(src_dir, target_dir, glob)
end

#dir(name) ⇒ Object



86
87
88
# File 'lib/raykit.rb', line 86

def dir(name)
  FileUtils.mkdir("artifacts") if (!Dir.exist?(name))
end

#log_debug(message) ⇒ Object



82
83
84
# File 'lib/raykit/logger.rb', line 82

def log_debug(message)
  DEFAULT_LOGGER.debug(message)
end

#log_error(message) ⇒ Object



94
95
96
# File 'lib/raykit/logger.rb', line 94

def log_error(message)
  DEFAULT_LOGGER.error(message)
end

#log_fatal(message) ⇒ Object



98
99
100
# File 'lib/raykit/logger.rb', line 98

def log_fatal(message)
  DEFAULT_LOGGER.fatal(message)
end

#log_info(message) ⇒ Object



86
87
88
# File 'lib/raykit/logger.rb', line 86

def log_info(message)
  DEFAULT_LOGGER.info(message)
end

#log_warn(message) ⇒ Object



90
91
92
# File 'lib/raykit/logger.rb', line 90

def log_warn(message)
  DEFAULT_LOGGER.warn(message)
end

#make(artifact, command) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/raykit.rb', line 90

def make(artifact, command)
  if (File.exist?(artifact))
    puts "  #{artifact} exists"
  else
    cmd = run(command)
    if (cmd.exitstatus != 0)
      File.delete(artifact) if (File.exist?(artifact))
    end
    cmd
  end
end

#make_log(artifact, command) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
# File 'lib/raykit.rb', line 102

def make_log(artifact, command)
  if (File.exist?(artifact))
    puts "  #{artifact} exists"
  else
    cmd = run(command).log_to_file(artifact)
    if (cmd.exitstatus != 0)
      File.delete(artifact) if (File.exist?(artifact))
    end
    cmd
  end
end

#run(command, quit_on_failure = true) ⇒ Object



73
74
75
# File 'lib/raykit.rb', line 73

def run(command, quit_on_failure = true)
  Raykit::TopLevel.run(command, quit_on_failure)
end

#run_details(command) ⇒ Object



77
78
79
80
# File 'lib/raykit.rb', line 77

def run_details(command)
  cmd = Raykit::Command.new(command).run
  cmd.details
end

#set_log_level(level) ⇒ Object



78
79
80
# File 'lib/raykit/logger.rb', line 78

def set_log_level(level)
  DEFAULT_LOGGER.level = level
end

#show(symbol) ⇒ Object



122
123
124
# File 'lib/raykit.rb', line 122

def show(symbol)
  show_binding(symbol, binding)
end

#show_binding(symbol, the_binding) ⇒ Object



126
127
128
# File 'lib/raykit.rb', line 126

def show_binding(symbol, the_binding)
  show_value symbol.to_s, eval(symbol.to_s, the_binding)
end

#show_table(symbols) ⇒ Object



135
136
137
# File 'lib/raykit.rb', line 135

def show_table(symbols)
  Raykit::Log.show_table(symbols)
end

#show_value(name, value) ⇒ Object



130
131
132
133
# File 'lib/raykit.rb', line 130

def show_value(name, value)
  Raykit::Log.show_value(name, value)
  PROJECT.values[name] = value
end

#start_task(task_name) ⇒ Object



118
119
120
# File 'lib/raykit.rb', line 118

def start_task(task_name)
  Raykit::Log.start_task(task_name)
end

#tag(name) ⇒ Object



114
115
116
# File 'lib/raykit.rb', line 114

def tag(name)
  puts Rainbow(": #{name}").blue.bright
end

#try(command) ⇒ Object



82
83
84
# File 'lib/raykit.rb', line 82

def try(command)
  Raykit::TopLevel.run(command, false)
end