Skip to content

Instantly share code, notes, and snippets.

@ptierno
Created September 11, 2014 18:13
Show Gist options
  • Save ptierno/ef57a83afac4442e2a13 to your computer and use it in GitHub Desktop.
Save ptierno/ef57a83afac4442e2a13 to your computer and use it in GitHub Desktop.
Gitlab rake task to set all project's visibility level to private (0)
namespace :gitlab do
namespace :import do
desc "GITLAB | Set all projects visibility level to 'private'"
task all_to_private: :environment do |t, args|
require 'acts_as_taggable_on/taggable/core'
projects = Project.all
projects.each do |project|
if project.visibility_level != 0
puts "Setting #{project.name}'s visibility_level to 'private'"
project.visibility_level = 0
project.save
else
puts "#{project.name}'s visibility_level is already 'private', skipping..."
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment