summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-02-23 09:27:36 -0600
committerDouwe Maan <douwe@selenight.nl>2017-02-23 09:33:20 -0600
commitf88ff0cc0c5c1db7089a5f0062a53d38eb27ebde (patch)
tree54f1501e16405636d62bf7e1af83a8b34d54951b /lib
parent6f5cd03fcb63b379d218cf0b475f85f675dd9fb6 (diff)
downloadgitlab-ce-f88ff0cc0c5c1db7089a5f0062a53d38eb27ebde.tar.gz
Stylistic tweaks
Diffstat (limited to 'lib')
-rw-r--r--lib/extracts_path.rb2
-rw-r--r--lib/gitlab/ci/build/artifacts/metadata/entry.rb4
-rw-r--r--lib/gitlab/git/repository.rb8
-rw-r--r--lib/gitlab/redis.rb7
-rw-r--r--lib/tasks/gemojione.rake6
-rw-r--r--lib/tasks/gitlab/task_helpers.rb15
6 files changed, 21 insertions, 21 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index 1a6ad039bc0..9ece84cc469 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -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
diff --git a/lib/gitlab/ci/build/artifacts/metadata/entry.rb b/lib/gitlab/ci/build/artifacts/metadata/entry.rb
index c1d4d541efb..6f799c2f031 100644
--- a/lib/gitlab/ci/build/artifacts/metadata/entry.rb
+++ b/lib/gitlab/ci/build/artifacts/metadata/entry.rb
@@ -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|
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index d1dd3da5ed2..4b6ad8037ce 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -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
diff --git a/lib/gitlab/redis.rb b/lib/gitlab/redis.rb
index e9c07095042..62dbd429156 100644
--- a/lib/gitlab/redis.rb
+++ b/lib/gitlab/redis.rb
@@ -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) }
diff --git a/lib/tasks/gemojione.rake b/lib/tasks/gemojione.rake
index f5ff29415e8..993112aee3b 100644
--- a/lib/tasks/gemojione.rake
+++ b/lib/tasks/gemojione.rake
@@ -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|
diff --git a/lib/tasks/gitlab/task_helpers.rb b/lib/tasks/gitlab/task_helpers.rb
index e5de3e22165..2a999ad6959 100644
--- a/lib/tasks/gitlab/task_helpers.rb
+++ b/lib/tasks/gitlab/task_helpers.rb
@@ -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