Class: GitUpdateStrategy
- Inherits:
-
Object
- Object
- GitUpdateStrategy
- Includes:
- GitCommands
- Defined in:
- lib/lace/download_strategy.rb
Instance Method Summary collapse
-
#initialize(name) ⇒ GitUpdateStrategy
constructor
A new instance of GitUpdateStrategy.
- #update ⇒ Object
Methods included from GitCommands
#clone_args, #clone_repo, #git_dir, #repo_modified?, #repo_valid?, #reset, #submodules?, #update_repo, #update_submodules
Constructor Details
#initialize(name) ⇒ GitUpdateStrategy
Returns a new instance of GitUpdateStrategy.
110 111 112 |
# File 'lib/lace/download_strategy.rb', line 110 def initialize name @target_folder = Lace.pkgs_folder/name end |
Instance Method Details
#update ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/lace/download_strategy.rb', line 114 def update if repo_valid? puts "Updating #@target_folder" @target_folder.cd do update_repo reset update_submodules if submodules? end else puts "Removing invalid .git repo" FileUtils.rm_rf @target_folder clone_repo end end |