From 03cb24fb9f5e8e23f8e6310430ddc1ef81c04eec Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Fri, 2 Nov 2012 23:45:40 +0600 Subject: [PATCH] [file-store-4] modify uploading script --- bin/calc_sha | 3 +-- bin/file-store.rb | 3 +-- lib/tasks/shrink_git_repo.rake | 6 ++++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/calc_sha b/bin/calc_sha index f0eaaf396..d647d1523 100755 --- a/bin/calc_sha +++ b/bin/calc_sha @@ -1,6 +1,5 @@ #!/bin/bash pwd=`pwd` -command="$(pwd)/calc_sha_help $2" cd $1 -git filter-branch --tree-filter "$pwd/bin/file-store" --prune-empty --tag-name-filter cat -- --all +git filter-branch --tree-filter "$pwd/bin/file-store $2" --prune-empty --tag-name-filter cat -- --all cd .. diff --git a/bin/file-store.rb b/bin/file-store.rb index f41502238..7ef874935 100755 --- a/bin/file-store.rb +++ b/bin/file-store.rb @@ -11,8 +11,7 @@ old_sources = if File.exist? abf_yml MAX_SIZE = 2 * 1024 * 1024 # 2.megabytes url = 'http://file-store.rosalinux.ru/api/v1/file_stores.json' #url = 'http://localhost:3001/api/v1/file_stores.json' -user, pass = ARGF.argv[0] || 'CENSORED', ARGF.argv[1] || 'CENSORED' # FIXME -rclient = RestClient::Resource.new(url, user, pass) +rclient = RestClient::Resource.new(url, :user => ARGF.argv[0]) # user auth token Dir.glob("*.{tar\.bz2,tar\.gz,bz2,rar,gz,tar,tbz2,tgz,zip,Z,7z}").uniq.sort.each do |file| begin diff --git a/lib/tasks/shrink_git_repo.rake b/lib/tasks/shrink_git_repo.rake index 92ea5356b..9518dd8b7 100644 --- a/lib/tasks/shrink_git_repo.rake +++ b/lib/tasks/shrink_git_repo.rake @@ -2,7 +2,9 @@ namespace :project do desc "Truncate blobs from git repo" task :remove_archives => :environment do raise 'Need set GIT_PROJECTS_DIR' if ENV['GIT_PROJECTS_DIR'].blank? - raise 'Need set CLONE_PATH' if ENV['CLONE_PATH'].blank? + raise 'Need special "rosa_system" user' + token = User.find_by_uname('rosa_system').authentication_token + abf_existing_log = File.open "#{ENV['CLONE_PATH']}/projects_with_abf_yml.log", 'w' projects = if uname = ENV['OWNER'] owner = User.find_by_uname(uname) || Group.find_by_uname(uname) @@ -40,7 +42,7 @@ namespace :project do abf_existing_log.puts message `rm -rf #{path}` elsif archives_exists.present? - system "bin/calc_sha #{path} #{ENV['CLONE_PATH']}/archives" # FIXME change filename + system "bin/calc_sha #{path} #{token}" # FIXME change filename ##### # This is dangerous !!!