Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Apply DMCA Takedown Reqs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lakr233 committed Dec 6, 2024
1 parent 91fa943 commit d5cf656
Showing 1 changed file with 11 additions and 41 deletions.
52 changes: 11 additions & 41 deletions src/scan.features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
require 'json'
require 'optparse'

#
# this file was removed due to DMCA report
# following action was taken
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository
#

OptionParser.new do |opts|
opts.banner = "Usage: scan.features.rb [options]"

opts.on("-s", "--src-dir PATH", "Specify gitlab source dir (required if --features-file is ommited)") do |v|
GITLAB_FEATURES_FILE="#{File.expand_path(v)}/ee/app/models/gitlab_subscriptions/features.rb"
opts.on("-s", "--src-dir PATH", "") do |v|
# empty block
end

opts.on("-f", "--features-file PATH", "Specify gitlab features path (required if --src-dir is ommited)") do |v|
GITLAB_FEATURES_FILE = File.expand_path(v)
opts.on("-f", "--features-file PATH", "") do |v|
# empty block
end

opts.on("-o", "--output PATH", "Output to json file (required)") do |v|
Expand All @@ -25,41 +31,5 @@
end
end
.parse!
if GITLAB_FEATURES_FILE.nil? || EXPORT_JSON_FILE.nil?
puts "[!] missing required options"
puts "[!] use -h for help"
exit 1
end
puts "Reading features from #{GITLAB_FEATURES_FILE}"

def ignore_exception
begin
yield
rescue Exception
end
end

puts "[*] loading features.rb..."
ignore_exception do
require_relative "#{GITLAB_FEATURES_FILE}"
end

ALL_FEATURES = []
GitlabSubscriptions::Features.constants.each do |const_name|
puts "[*] gathering features from #{const_name}"
if const_name.to_s.include? 'FEATURE'
ALL_FEATURES.concat(GitlabSubscriptions::Features.const_get(const_name))
else
puts "[?] unrecognized constant #{const_name}"
end
end

ALL_FEATURES.uniq!
ALL_FEATURES.sort_by! { |feature| feature }

puts "[*] total features: #{ALL_FEATURES.size}"

puts "[*] writing to #{EXPORT_JSON_FILE}"
File.write(EXPORT_JSON_FILE, JSON.pretty_generate(ALL_FEATURES))

puts "[*] done"
File.open(EXPORT_JSON_FILE, 'w') { |file| file.write("{}") }

0 comments on commit d5cf656

Please sign in to comment.