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
DEFAULT_GITIGNORE_CONTENT =

Constants

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")
LOG =
Raykit::Logging.new
MARKDOWN =
Raykit::Markdown.new

Instance Method Summary collapse

Instance Method Details

#backup_git_directoryObject



38
39
40
41
42
43
44
45
# File 'lib/raykit.rb', line 38

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



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

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

#copy_files(src_dir, target_dir, glob) ⇒ Object



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

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

#dir(name) ⇒ Object



65
66
67
# File 'lib/raykit.rb', line 65

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

#make(artifact, command) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/raykit.rb', line 69

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



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

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



57
58
59
# File 'lib/raykit.rb', line 57

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

#show(symbol) ⇒ Object



101
102
103
# File 'lib/raykit.rb', line 101

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

#show_binding(symbol, the_binding) ⇒ Object



105
106
107
# File 'lib/raykit.rb', line 105

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

#show_table(symbols) ⇒ Object



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

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

#show_value(name, value) ⇒ Object



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

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

#start_task(task_name) ⇒ Object



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

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

#tag(name) ⇒ Object



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

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

#try(command) ⇒ Object



61
62
63
# File 'lib/raykit.rb', line 61

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