module MacSetup

Constants

DEFAULT_CONFIG_PATH
DEFAULT_DOTFILES_PATH
DEFAULT_PLUGINS
INSTALLERS
VERSION

Public Class Methods

bootstrap(dotfiles_repo) click to toggle source
# File lib/mac_setup.rb, line 42
def bootstrap(dotfiles_repo)
  HomebrewInstaller.run
  GitRepoInstaller.install_repo(dotfiles_repo, dotfiles_path)

  config = Configuration.new(DEFAULT_CONFIG_PATH)

  plugins(config).each { |plugin| plugin.bootstrap(config) }
end
dotfiles_path() click to toggle source
# File lib/mac_setup.rb, line 83
def dotfiles_path
  DEFAULT_DOTFILES_PATH
end
encrypt() click to toggle source
# File lib/mac_setup.rb, line 65
def encrypt
  Secrets.encrypt(dotfiles_path)
end
install() click to toggle source
# File lib/mac_setup.rb, line 51
def install # (config_path, _options)
  config = Configuration.new(DEFAULT_CONFIG_PATH)

  Shell.raw("brew update")

  config = Configuration.new(DEFAULT_CONFIG_PATH)
  plugins(config).each { |plugin| plugin.add_requirements(config) }
  config.validate!
  status = SystemStatus.new

  INSTALLERS.each { |installer| installer.run(config, status) }
  plugins(config).each { |plugin| plugin.run(config, status) }
end
log(message) { || ... } click to toggle source
# File lib/mac_setup.rb, line 73
def log(message)
  if block_given?
    print "#{message}..."
    yield
    puts "Ok."
  else
    puts message
  end
end
plugins(config) click to toggle source

private

# File lib/mac_setup.rb, line 89
def plugins(config)
  DEFAULT_PLUGINS + config.plugins.map { |plugin_name| Plugin.load(plugin_name) }
  # @plugins ||= (DEFAULT_PLUGINS + config.plugins).map { |plugin_name| Plugin.load(plugin) }
end
shorten_path(path) click to toggle source
# File lib/mac_setup.rb, line 69
def shorten_path(path)
  path.to_s.sub(/#{ENV['HOME']}/, "~")
end