Module: VpsCli
- Defined in:
- lib/vps_cli.rb,
lib/vps_cli/cli.rb,
lib/vps_cli/copy.rb,
lib/vps_cli/pull.rb,
lib/vps_cli/setup.rb,
lib/vps_cli/access.rb,
lib/vps_cli/install.rb,
lib/vps_cli/version.rb,
lib/vps_cli/packages.rb,
lib/vps_cli/configuration.rb,
lib/vps_cli/helpers/github_http.rb
Overview
Used for setting up a ubuntu environment
Defined Under Namespace
Classes: Access, Cli, Configuration, Copy, GithubHTTP, Install, Packages, Pull, Setup
Top Level Constants
collapse
- ROOT =
Project’s Root Directory
File.expand_path(File.expand_path('../', __dir__))
- FILES_DIR =
Projects config_files directory
File.join(ROOT, 'config_files')
- DOTFILES_DIR =
Projects Dotfiles directory
File.join(FILES_DIR, 'dotfiles')
- MISC_FILES_DIR =
Miscellaneous files like sshd_config
File.join(FILES_DIR, 'misc_files')
- BACKUP_FILES_DIR =
Directory of backup files
File.join(Dir.home, 'backup_files')
Constant Summary
collapse
- OMZ_DIR =
File.join(Dir.home, '.oh-my-zsh')
- OMZ_PLUGINS =
File.join(OMZ_DIR, 'custom', 'plugins')
- VERSION =
"0.1.31"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
46
47
48
|
# File 'lib/vps_cli/configuration.rb', line 46
def self.configuration
@configuration ||= Configuration.new
end
|
.errors ⇒ Object
Used for loggings errors same as self.errors && self.errors=(errors) VpsCli.errors now accessible module wide
42
43
44
|
# File 'lib/vps_cli.rb', line 42
def errors
@errors
end
|
Class Method Details
.add_error(error:) ⇒ Object
69
70
71
|
# File 'lib/vps_cli.rb', line 69
def add_error(error:)
VpsCli.errors << error
end
|
41
42
43
44
|
# File 'lib/vps_cli/configuration.rb', line 41
def self.configure
@configuration ||= Configuration.new
yield(configuration)
end
|
.create_configuration(file = File.join(Dir.home, '.vps_cli')) ⇒ Object
69
70
71
72
73
74
75
76
77
|
# File 'lib/vps_cli/configuration.rb', line 69
def self.create_configuration(file = File.join(Dir.home, '.vps_cli'))
msg = "Creating a default configuration files @ $HOME/.vps_cli"
msg += "\nPlease modify any values that are nil"
puts msg
default_config = File.join(File.expand_path(__dir__), 'configurations', 'default_configuration.rb')
Rake.cp(default_config, file)
end
|
.load_configuration(file = File.join(Dir.home, '.vps_cli')) ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'lib/vps_cli/configuration.rb', line 59
def self.load_configuration(file = File.join(Dir.home, '.vps_cli'))
msg = 'Unable to location a configuration file. The default location is'
msg += '$HOME/.vps_cli'
msg += "\nTo create a standard default config, run 'vps-cli init'"
raise Exception, msg unless File.exist?(file)
load file
end
|
.load_test_configuration ⇒ Object
54
55
56
57
|
# File 'lib/vps_cli/configuration.rb', line 54
def self.load_test_configuration
test_config = File.join(File.expand_path(__dir__), 'configurations', 'testing_configuration.rb')
load_configuration(test_config)
end
|
.print_errors ⇒ Object
62
63
64
65
66
67
|
# File 'lib/vps_cli.rb', line 62
def print_errors
VpsCli.errors.each do |error|
puts error.message if error.respond_to?(:message)
puts error unless error.respond_to?(:message)
end
end
|
.reset_configuration ⇒ Object
50
51
52
|
# File 'lib/vps_cli/configuration.rb', line 50
def self.reset_configuration
@configuration = Configuration.new
end
|