lib/middleman-deploy/commands.rb in middleman-deploy-0.0.11 vs lib/middleman-deploy/commands.rb in middleman-deploy-0.0.12

- old
+ new

@@ -71,15 +71,19 @@ deploy.path = "/srv/www/site" end EOF end + def inst + ::Middleman::Application.server.inst + end + def deploy_options options = nil begin - options = ::Middleman::Application.server.inst.options + options = inst.options rescue print_usage_and_die "You need to activate the deploy extension in config.rb." end if (!options.method) @@ -107,11 +111,11 @@ user = self.deploy_options.user path = self.deploy_options.path puts "## Deploying via rsync to #{user}@#{host}:#{path} port=#{port}" - command = "rsync -avze '" + "ssh -p #{port}" + "' build/ #{user}@#{host}:#{path}" + command = "rsync -avze '" + "ssh -p #{port}" + "' #{self.inst.build_dir}/ #{user}@#{host}:#{path}" if options.has_key? "clean" clean = options.clean else clean = self.deploy_options.clean @@ -139,11 +143,11 @@ if remote == '' puts "Can't deploy! Please add a remote with the name '#{self.deploy_options.remote}' to your repo." exit end - Dir.chdir('build') do + Dir.chdir(self.inst.build_dir) do unless File.exists?('.git') `git init` `git remote add origin #{remote}` else #check if the remote repo has changed @@ -180,10 +184,10 @@ ftp = Net::FTP.new(host) ftp.login(user, pass) ftp.chdir(path) ftp.passive = true - Dir.chdir('build/') do + Dir.chdir(self.inst.build_dir) do files = Dir.glob('**/*', File::FNM_DOTMATCH) files.reject { |a| a =~ Regexp.new('\.$') }.each do |f| if File.directory?(f) begin ftp.mkdir(f)