lib/middleman-deploy/commands.rb in middleman-deploy-0.0.9 vs lib/middleman-deploy/commands.rb in middleman-deploy-0.0.10

- old
+ new

@@ -90,10 +90,16 @@ if (!options.host || !options.user || !options.path) print_usage_and_die "The rsync deploy method requires host, user, and path to be set." end end + if (options.method == :ftp) + if (!options.host || !options.user || !options.password || !options.path) + print_usage_and_die "The ftp deploy method requires host, user, password, and path to be set." + end + end + options end def deploy_rsync host = self.deploy_options.host @@ -175,16 +181,17 @@ ftp.login(user, pass) ftp.chdir(path) ftp.passive = true Dir.chdir('build/') do - Dir['**/*'].each do |f| + files = Dir.glob('**/*', File::FNM_DOTMATCH) + files.reject { |a| a =~ Regexp.new('\.$') }.each do |f| if File.directory?(f) begin ftp.mkdir(f) + puts "Created directory #{f}" rescue - puts "Folder '#{f}' exists. skipping..." end else begin if File.binary?(f) ftp.putbinaryfile(f, f) @@ -200,9 +207,10 @@ else ftp.puttextfile(f, f) end end end + puts "Copied #{f}" end end end ftp.close end