BigW Consortium Gitlab

Commit 12e93d6f by Robert Speicher

Rename `run` task helper method to prevent conflict with StateMachine

This prevents the following message from appearing whenever running a Rake task: Instance method "run" is already defined in Object, use generic helper instead or set StateMachines::Machine.ignore_method_conflicts = true.
parent bd1b8ae9
......@@ -46,7 +46,7 @@ namespace :gitlab do
}
correct_options = options.map do |name, value|
run(%W(#{Gitlab.config.git.bin_path} config --global --get #{name})).try(:squish) == value
run_command(%W(#{Gitlab.config.git.bin_path} config --global --get #{name})).try(:squish) == value
end
if correct_options.all?
......@@ -316,7 +316,7 @@ namespace :gitlab do
min_redis_version = "2.8.0"
print "Redis version >= #{min_redis_version}? ... "
redis_version = run(%W(redis-cli --version))
redis_version = run_command(%W(redis-cli --version))
redis_version = redis_version.try(:match, /redis-cli (\d+\.\d+\.\d+)/)
if redis_version &&
(Gem::Version.new(redis_version[1]) > Gem::Version.new(min_redis_version))
......@@ -893,7 +893,7 @@ namespace :gitlab do
def check_ruby_version
required_version = Gitlab::VersionInfo.new(2, 1, 0)
current_version = Gitlab::VersionInfo.parse(run(%W(ruby --version)))
current_version = Gitlab::VersionInfo.parse(run_command(%W(ruby --version)))
print "Ruby version >= #{required_version} ? ... "
......@@ -910,7 +910,7 @@ namespace :gitlab do
def check_git_version
required_version = Gitlab::VersionInfo.new(2, 7, 3)
current_version = Gitlab::VersionInfo.parse(run(%W(#{Gitlab.config.git.bin_path} --version)))
current_version = Gitlab::VersionInfo.parse(run_command(%W(#{Gitlab.config.git.bin_path} --version)))
puts "Your git bin path is \"#{Gitlab.config.git.bin_path}\""
print "Git version >= #{required_version} ? ... "
......
......@@ -8,7 +8,7 @@ namespace :gitlab do
# check Ruby version
ruby_version = run_and_match(%W(ruby --version), /[\d\.p]+/).try(:to_s)
# check Gem version
gem_version = run(%W(gem --version))
gem_version = run_command(%W(gem --version))
# check Bundler version
bunder_version = run_and_match(%W(bundle --version), /[\d\.]+/).try(:to_s)
# check Bundler version
......@@ -17,7 +17,7 @@ namespace :gitlab do
puts ""
puts "System information".color(:yellow)
puts "System:\t\t#{os_name || "unknown".color(:red)}"
puts "Current User:\t#{run(%W(whoami))}"
puts "Current User:\t#{run_command(%W(whoami))}"
puts "Using RVM:\t#{rvm_version.present? ? "yes".color(:green) : "no"}"
puts "RVM Version:\t#{rvm_version}" if rvm_version.present?
puts "Ruby Version:\t#{ruby_version || "unknown".color(:red)}"
......
......@@ -23,7 +23,7 @@ namespace :gitlab do
# It will primarily use lsb_relase to determine the OS.
# It has fallbacks to Debian, SuSE, OS X and systems running systemd.
def os_name
os_name = run(%W(lsb_release -irs))
os_name = run_command(%W(lsb_release -irs))
os_name ||= if File.readable?('/etc/system-release')
File.read('/etc/system-release')
end
......@@ -34,7 +34,7 @@ namespace :gitlab do
os_name ||= if File.readable?('/etc/SuSE-release')
File.read('/etc/SuSE-release')
end
os_name ||= if os_x_version = run(%W(sw_vers -productVersion))
os_name ||= if os_x_version = run_command(%W(sw_vers -productVersion))
"Mac OS X #{os_x_version}"
end
os_name ||= if File.readable?('/etc/os-release')
......@@ -62,10 +62,10 @@ namespace :gitlab do
# Returns nil if nothing matched
# Returns the MatchData if the pattern matched
#
# see also #run
# see also #run_command
# see also String#match
def run_and_match(command, regexp)
run(command).try(:match, regexp)
run_command(command).try(:match, regexp)
end
# Runs the given command
......@@ -74,7 +74,7 @@ namespace :gitlab do
# Returns the output of the command otherwise
#
# see also #run_and_match
def run(command)
def run_command(command)
output, _ = Gitlab::Popen.popen(command)
output
rescue Errno::ENOENT
......@@ -82,7 +82,7 @@ namespace :gitlab do
end
def uid_for(user_name)
run(%W(id -u #{user_name})).chomp.to_i
run_command(%W(id -u #{user_name})).chomp.to_i
end
def gid_for(group_name)
......@@ -96,7 +96,7 @@ namespace :gitlab do
def warn_user_is_not_gitlab
unless @warned_user_not_gitlab
gitlab_user = Gitlab.config.gitlab.user
current_user = run(%W(whoami)).chomp
current_user = run_command(%W(whoami)).chomp
unless current_user == gitlab_user
puts " Warning ".color(:black).background(:yellow)
puts " You are running as user #{current_user.color(:magenta)}, we hope you know what you are doing."
......
......@@ -34,17 +34,15 @@ task :spinach do
run_spinach_tests(nil)
end
def run_command(cmd)
def run_system_command(cmd)
system({'RAILS_ENV' => 'test', 'force' => 'yes'}, *cmd)
end
def run_spinach_command(args)
run_command(%w(spinach -r rerun) + args)
run_system_command(%w(spinach -r rerun) + args)
end
def run_spinach_tests(tags)
#run_command(%w(rake gitlab:setup)) or raise('gitlab:setup failed!')
success = run_spinach_command(%W(--tags #{tags}))
3.times do |_|
break if success
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment