lib/awestruct/deploy/base_deploy.rb in awestruct-0.5.3 vs lib/awestruct/deploy/base_deploy.rb in awestruct-0.5.4.beta1

- old
+ new

@@ -1,21 +1,27 @@ require 'awestruct/deployers' -require 'git' +Dir[ File.join( File.dirname(__FILE__), '..', 'scm' '*.rb' ) ].each do |f| + begin + require f + rescue LoadError => e + raise e 'Something horribly, horribly wrong has happened' + end +end + module Awestruct module Deploy class Base - UNCOMMITTED_CHANGES = "You have uncommitted changes in the working branch. Please commit or stash them." + UNCOMMITTED_CHANGES = 'You have uncommitted changes in the working branch. Please commit or stash them.' def run(deploy_config) if deploy_config['uncommitted'] == true publish_site else - git.status.changed.empty? ? publish_site : existing_changes + scm = deploy_config['scm'] || 'git' + #require "awestruct/scm/#{scm}" + scm_class = Object.const_get('Awestruct').const_get('Scm').const_get(scm.slice(0, 1).capitalize + scm.slice(1..-1)) + scm_class.new.uncommitted_changes?(deploy_config['source_dir']) ? existing_changes() : publish_site() end - end - - def git - @git ||= ::Git.open('.') end def publish_site $LOG.error( "#{self.class.name}#publish_site not implemented." ) if $LOG.error? end