Commit f88ff0cc authored by Douwe Maan's avatar Douwe Maan

Stylistic tweaks

parent 6f5cd03f
......@@ -42,7 +42,7 @@ module ExtractsPath
return pair unless @project
if id =~ /^([[:alnum:]]{40})(.+)/
if id =~ /^(\h{40})(.+)/
# If the ref appears to be a SHA, we're done, just split the string
pair = $~.captures
else
......
......@@ -27,6 +27,8 @@ module Gitlab
end
end
delegate :empty?, to: :children
def directory?
blank_node? || @path.end_with?('/')
end
......@@ -91,8 +93,6 @@ module Gitlab
blank_node? || @entries.include?(@path)
end
delegate :empty?, to: :children
def total_size
descendant_pattern = %r{^#{Regexp.escape(@path)}}
entries.sum do |path, entry|
......
......@@ -31,6 +31,10 @@ module Gitlab
@attributes = Gitlab::Git::Attributes.new(path)
end
delegate :empty?,
:bare?,
to: :rugged
# Default branch in the repository
def root_ref
@root_ref ||= discover_default_branch
......@@ -160,10 +164,6 @@ module Gitlab
!empty?
end
delegate :empty?,
:bare?,
to: :rugged
def repo_exists?
!!rugged
end
......
......@@ -12,12 +12,7 @@ module Gitlab
CONFIG_FILE = File.expand_path('../../config/resque.yml', __dir__)
class << self
# Do NOT cache in an instance variable. Result may be mutated by caller.
delegate :params, to: :new
# Do NOT cache in an instance variable. Result may be mutated by caller.
# @deprecated Use .params instead to get sentinel support
delegate :url, to: :new
delegate :params, :url, to: :new
def with
@pool ||= ConnectionPool.new(size: pool_size) { ::Redis.new(params) }
......
......@@ -81,9 +81,9 @@ namespace :gemojione do
# SpriteFactory's SCSS is a bit too verbose for our purposes here, so
# let's simplify it
system(%(sed -i '' "s/width: #{SIZE}px; height: #{SIZE}px; background: image-url('emoji.png')/background-position:/" #{style_path}))
system(%(sed -i '' "s/ no-repeat//" #{style_path}))
system(%(sed -i '' "s/ 0px/ 0/" #{style_path}))
system(%Q(sed -i '' "s/width: #{SIZE}px; height: #{SIZE}px; background: image-url('emoji.png')/background-position:/" #{style_path}))
system(%Q(sed -i '' "s/ no-repeat//" #{style_path}))
system(%Q(sed -i '' "s/ 0px/ 0/" #{style_path}))
# Append a generic rule that applies to all Emojis
File.open(style_path, 'a') do |f|
......
......@@ -20,14 +20,19 @@ module Gitlab
# It has fallbacks to Debian, SuSE, OS X and systems running systemd.
def os_name
os_name = run_command(%w(lsb_release -irs))
os_name ||= File.read('/etc/system-release') if File.readable?('/etc/system-release')
os_name ||= "Debian #{File.read('/etc/debian_version')}" if File.readable?('/etc/debian_version')
os_name ||= File.read('/etc/SuSE-release') if File.readable?('/etc/SuSE-release')
os_name ||=
if os_x_version = run_command(%w(sw_vers -productVersion))
if File.readable?('/etc/system-release')
File.read('/etc/system-release')
elsif File.readable?('/etc/debian_version')
"Debian #{File.read('/etc/debian_version')}"
elsif File.readable?('/etc/SuSE-release')
File.read('/etc/SuSE-release')
elsif os_x_version = run_command(%w(sw_vers -productVersion))
"Mac OS X #{os_x_version}"
elsif File.readable?('/etc/os-release')
File.read('/etc/os-release').match(/PRETTY_NAME=\"(.+)\"/)[1]
end
os_name ||= File.read('/etc/os-release').match(/PRETTY_NAME=\"(.+)\"/)[1] if File.readable?('/etc/os-release')
os_name.try(:squish!)
end
......
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