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
DEFAULT_GITIGNORE_CONTENT =
Raykit::DefaultContent::gitignore
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



48
49
50
51
52
53
54
55
# File 'lib/raykit.rb', line 48

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



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

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

#copy_files(src_dir, target_dir, glob) ⇒ Object



128
129
130
# File 'lib/raykit.rb', line 128

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

#dir(name) ⇒ Object



75
76
77
# File 'lib/raykit.rb', line 75

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



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/raykit.rb', line 79

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



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

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



67
68
69
# File 'lib/raykit.rb', line 67

def run(command, quit_on_failure = true)
  Raykit::TopLevel.run(command, quit_on_failure)
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



111
112
113
# File 'lib/raykit.rb', line 111

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

#show_binding(symbol, the_binding) ⇒ Object



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

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

#show_table(symbols) ⇒ Object



124
125
126
# File 'lib/raykit.rb', line 124

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

#show_value(name, value) ⇒ Object



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

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

#start_task(task_name) ⇒ Object



107
108
109
# File 'lib/raykit.rb', line 107

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

#tag(name) ⇒ Object



103
104
105
# File 'lib/raykit.rb', line 103

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

#try(command) ⇒ Object



71
72
73
# File 'lib/raykit.rb', line 71

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