Created
September 11, 2014 18:13
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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