class KubsCLI::Pull
Used to pull items into your config-files repo
Attributes
config[RW]
Public Class Methods
new(config = KubsCLI.configuration)
click to toggle source
# File lib/kubs_cli/pull.rb, line 9 def initialize(config = KubsCLI.configuration) @config = config @fh = FileHelper.new end
Public Instance Methods
copy_files(orig_file, new_file)
click to toggle source
# File lib/kubs_cli/pull.rb, line 31 def copy_files(orig_file, new_file) if File.directory?(new_file) || File.directory?(new_file) Dir.each_child(orig_file) do |o_file| Dir.each_child(new_file) do |n_file| next unless o_file == n_file o_file = File.join(File.expand_path(orig_file), o_file) n_file = File.expand_path(new_file) Rake.cp_r(o_file, n_file) end end else Rake.cp(orig_file, new_file) end end
pull_all()
click to toggle source
@see pull_dotfiles
@see pull_gnome_terminal_settings
# File lib/kubs_cli/pull.rb, line 16 def pull_all pull_dotfiles pull_gnome_terminal_settings end
pull_dotfiles()
click to toggle source
Pulls dotfiles into your dotfiles inside your repo
# File lib/kubs_cli/pull.rb, line 22 def pull_dotfiles dotfiles = @config.dotfiles local_dir = @config.local_dir shared_dotfiles(dotfiles, local_dir) do |remote, local| copy_files(local, remote) end end
pull_gnome_terminal_settings()
click to toggle source
Pulls gnome_terminal_settings into your dotfiles inside your repo
# File lib/kubs_cli/pull.rb, line 63 def pull_gnome_terminal_settings unless @config.gnome_terminal_settings return end # This is where dconf stores gnome terminal gnome_dconf = '/org/gnome/terminal/' orig_remote_contents = File.read(@config.gnome_terminal_settings) Rake.sh("dconf dump #{gnome_dconf} > #{@config.gnome_terminal_settings}") rescue RuntimeError => e KubsCLI.add_error(e: e, msg: 'Ran into issues dumping gnome terminal settings') # if dconf errors, it will erase the config file contents # So this protects against that File.write(@config.gnome_terminal_settings, orig_remote_contents) end