Module: Dots::Installation

Includes:
Thor::Actions
Included in:
Command
Defined in:
lib/ruby/dots/installation.rb

Instance Method Summary collapse

Instance Method Details

#copy_to_home_directoryObject



31
32
33
# File 'lib/ruby/dots/installation.rb', line 31

def copy_to_home_directory
  system "mkdir -p #{Dots.home} cp -R #{Dots.root} #{Dots.home}"
end

#pull_latest_changesObject

Fetches and rebases the same code stored in Dots.root to ~/.dots. This essentially replays your own local changes on top of the official updates to the framework. If you’re using a fork, you can set DOTS_REMOTE to the remote’s name in origin (this will default to your Github username, by the way).



40
41
42
# File 'lib/ruby/dots/installation.rb', line 40

def pull_latest_changes
  system "cd #{Dots.home} && #{git_pull}"
end

#update_the_frameworkObject

Attempts to update DOTS, but fails if changes are detected in the repo beforehand.

The git ls-files -m command will return no results when there are no modified files in the repo. This method blocks DOTS from installing itself overtop of your committed changes, as well as saves the user from an ugly Git error…



23
24
25
26
27
28
29
# File 'lib/ruby/dots/installation.rb', line 23

def update_the_framework
  if repo_is_clean?
    pull_latest_changes and run 'reload_dots'
  else
    say "You have uncommitted changes in ~/.dots. Please resolve them before updating."
  end
end