Make remote paths configurable
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -22,5 +22,6 @@
 | 
			
		||||
*.phar
 | 
			
		||||
 | 
			
		||||
/slackbuilds/
 | 
			
		||||
/config/config.rb
 | 
			
		||||
/vendor/
 | 
			
		||||
/.bundle/
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								Rakefile
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								Rakefile
									
									
									
									
									
								
							@@ -7,6 +7,7 @@
 | 
			
		||||
require 'infra/rake/ruby'
 | 
			
		||||
require 'digest/md5'
 | 
			
		||||
require 'net/http'
 | 
			
		||||
require_relative 'config/config'
 | 
			
		||||
require_relative 'lib/package'
 | 
			
		||||
require_relative 'lib/download'
 | 
			
		||||
 | 
			
		||||
@@ -80,7 +81,7 @@ task :dmd do
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
task :composer do
 | 
			
		||||
  version = '2.0.7'
 | 
			
		||||
  version = '2.0.8'
 | 
			
		||||
 | 
			
		||||
  package = Package.new 'development/composer',
 | 
			
		||||
    version: version,
 | 
			
		||||
@@ -103,8 +104,15 @@ task 'universal-ctags' do
 | 
			
		||||
  ENV['HASH'] = ENV['COMMIT'][0...7]
 | 
			
		||||
 | 
			
		||||
  sh 'git', 'clone', '--recurse-submodules', 'https://github.com/universal-ctags/ctags.git', "ctags-#{ENV['COMMIT']}"
 | 
			
		||||
 | 
			
		||||
  rm_rf ["ctags-#{ENV['COMMIT']}/.git", "ctags-#{ENV['COMMIT']}/.gitignore"], secure: true
 | 
			
		||||
  sh 'tar', 'Jcvf', "ctags-#{ENV['COMMIT']}.tar.xz", "ctags-#{ENV['COMMIT']}"
 | 
			
		||||
 | 
			
		||||
  rm_rf "ctags-#{ENV['COMMIT']}", secure: true
 | 
			
		||||
 | 
			
		||||
  checksum = Digest::MD5.file "ctags-#{ENV['COMMIT']}.tar.xz"
 | 
			
		||||
  ENV['CHECKSUM'] = checksum.hexdigest
 | 
			
		||||
 | 
			
		||||
  sh 'scp', "ctags-#{ENV['COMMIT']}.tar.xz", "#{CONFIG[:remote_path]}/universal-ctags"
 | 
			
		||||
 | 
			
		||||
  sh 'bash', 'scripts/universal-ctags.sh'
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								config/config.rb.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								config/config.rb.example
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
CONFIG = {
 | 
			
		||||
  remote_path: 'example.com:/srv/httpd/some/path',
 | 
			
		||||
  download_url: 'https://example.com/some/path'
 | 
			
		||||
}
 | 
			
		||||
@@ -4,6 +4,7 @@
 | 
			
		||||
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
require_relative '../config/config'
 | 
			
		||||
require_relative 'package'
 | 
			
		||||
require 'net/http'
 | 
			
		||||
 | 
			
		||||
@@ -56,7 +57,7 @@ def download(uri, target)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def hosted_sources(absolute_url)
 | 
			
		||||
  "https://download.dlackware.com/hosted-sources#{absolute_url}"
 | 
			
		||||
  CONFIG[:download_url] + absolute_url
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def remote_file_exists?(url)
 | 
			
		||||
@@ -70,8 +71,7 @@ def remote_file_exists?(url)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def upload_command(local_path, remote_path)
 | 
			
		||||
  "scp slackbuilds/#{local_path} "\
 | 
			
		||||
    "caraus.de:/srv/httpd/dlackware/download/hosted-sources#{remote_path}"
 | 
			
		||||
  ['scp', "slackbuilds/#{local_path} ", CONFIG[:remote_path] + remote_path]
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def clone_and_archive(repo, name_version, tarball)
 | 
			
		||||
@@ -99,7 +99,7 @@ def clone(repo, tarball)
 | 
			
		||||
 | 
			
		||||
  clone_and_archive repo, name_version, tarball
 | 
			
		||||
 | 
			
		||||
  sh upload_command(tarball, remote_path)
 | 
			
		||||
  sh(*upload_command(tarball, remote_path))
 | 
			
		||||
 | 
			
		||||
  Digest::MD5.hexdigest File.read("slackbuilds/#{tarball}")
 | 
			
		||||
end
 | 
			
		||||
@@ -113,7 +113,7 @@ def download_and_deploy(uri, tarball)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  checksum = download uri, "slackbuilds/#{tarball}"
 | 
			
		||||
  sh upload_command(tarball, remote_path)
 | 
			
		||||
  sh(*upload_command(tarball, remote_path))
 | 
			
		||||
  checksum.hexdigest
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,13 +6,6 @@
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
tar Jcvf ctags-$COMMIT.tar.xz ctags-$COMMIT
 | 
			
		||||
 | 
			
		||||
rm -rf ctags-$COMMIT
 | 
			
		||||
CHECKSUM=`md5sum ctags-$COMMIT.tar.xz | cut -d ' ' -f 1`
 | 
			
		||||
 | 
			
		||||
scp ctags-$COMMIT.tar.xz caraus.de:/srv/httpd/dlackware/download/hosted-sources/universal-ctags
 | 
			
		||||
 | 
			
		||||
cat <<EOF > universal-ctags.info
 | 
			
		||||
PRGNAM="universal-ctags"
 | 
			
		||||
VERSION="$HASH"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user