module BranchableCDNAssets::FileManager::Checks
Public Instance Methods
local_file_conflict()
click to toggle source
# File lib/branchable_cdn_assets/file_manager/checks.rb, line 13 def local_file_conflict intersection = list(:both) if !intersection.empty? puts "#{intersection.length} files detected locally and in the manifest" if Shell.get_input("would you like to list the conflicting files? (y|n) ") == "y" puts "the conflicting files: \n#{intersection.join("\n")}" end unless Shell.get_input("do you want to continue? (y|n) ") == "y" abort end end end
manifest_list_clean_for_master()
click to toggle source
# File lib/branchable_cdn_assets/file_manager/checks.rb, line 5 def manifest_list_clean_for_master manifests = Dir[ File.join( root, "*.manifest" ) ] if Asgit.current_branch == "master" && manifests.length > 1 raise "the master branch should only have a production manifest\n" + "move branched assets to production with the `move_to_production` task" end end
ready_for_production()
click to toggle source
# File lib/branchable_cdn_assets/file_manager/checks.rb, line 28 def ready_for_production if Asgit.current_branch != "master" puts "you shouldn't move to production except from master branch" abort end if !Asgit.remote_up_to_date? puts "make sure you're repo is in sync with the remote" abort end if config.allow_local && !(list(:both) - list(:local)).empty? puts "local assets detected that aren't on the cdn\n" + "you should push or remove them to continue\n" + " " + (list(:both) - list(:local)).join("\n ") abort elsif !list(:local).empty? puts "assets detected in the local cdn directory\n" + "remove them by running the `prune` task" abort end end