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



137
138
139
# File 'lib/raykit.rb', line 137

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

#copy_files(src_dir, target_dir, glob) ⇒ Object



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

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

#dir(name) ⇒ Object



80
81
82
# File 'lib/raykit.rb', line 80

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



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/raykit.rb', line 84

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



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/raykit.rb', line 96

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

#run_details(command) ⇒ Object



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

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



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

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

#show_binding(symbol, the_binding) ⇒ Object



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

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

#show_table(symbols) ⇒ Object



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

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

#show_value(name, value) ⇒ Object



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

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

#start_task(task_name) ⇒ Object



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

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

#tag(name) ⇒ Object



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

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

#try(command) ⇒ Object



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

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