Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-03-07 14:30:34 +0300
committerTomasz Maczukin <tomasz@maczukin.pl>2017-03-07 14:30:34 +0300
commit32b09b8847955052765895063297181835c45b8c (patch)
treead8a173ec83c8d48dd246215b87b2c72c792252f /lib
parent0905fe4d7ad778eba78d57da2fa1f38575721622 (diff)
Add minor refactoring
Diffstat (limited to 'lib')
-rw-r--r--lib/api/runner.rb2
-rw-r--r--lib/gitlab/ci/build/image.rb3
-rw-r--r--lib/gitlab/ci/build/step.rb22
3 files changed, 8 insertions, 19 deletions
diff --git a/lib/api/runner.rb b/lib/api/runner.rb
index caa330c7234..c700d2ef4a1 100644
--- a/lib/api/runner.rb
+++ b/lib/api/runner.rb
@@ -115,7 +115,7 @@ module API
end
end
- desc 'Appends a patch to the job.trace' do
+ desc 'Appends a patch to the job trace' do
http_codes [[202, 'Trace was patched'],
[400, 'Missing Content-Range header'],
[403, 'Forbidden'],
diff --git a/lib/gitlab/ci/build/image.rb b/lib/gitlab/ci/build/image.rb
index c0663f1ae8a..c62aeb60fa9 100644
--- a/lib/gitlab/ci/build/image.rb
+++ b/lib/gitlab/ci/build/image.rb
@@ -21,8 +21,7 @@ module Gitlab
end
def initialize(image)
- type = image.class
- @name = image if type == String
+ @name = image
end
def valid?
diff --git a/lib/gitlab/ci/build/step.rb b/lib/gitlab/ci/build/step.rb
index f857ab6063a..1877429ac46 100644
--- a/lib/gitlab/ci/build/step.rb
+++ b/lib/gitlab/ci/build/step.rb
@@ -6,7 +6,9 @@ module Gitlab
WHEN_ON_SUCCESS = 'on_success'.freeze
WHEN_ALWAYS = 'always'.freeze
- attr_reader :name, :script, :timeout, :when, :allow_failure
+ attr_reader :name
+ attr_writer :script
+ attr_accessor :timeout, :when, :allow_failure
class << self
def from_commands(job)
@@ -25,7 +27,7 @@ module Gitlab
step.script = after_script
step.timeout = job.timeout
step.when = WHEN_ALWAYS
- step.allow_failure_on
+ step.allow_failure = true
end
end
end
@@ -35,20 +37,8 @@ module Gitlab
@allow_failure = false
end
- def script=(script)
- @script = script.split("\n")
- end
-
- def timeout=(timeout)
- @timeout = timeout
- end
-
- def when=(when_condition)
- @when = when_condition
- end
-
- def allow_failure_on
- @allow_failure = true
+ def script
+ @script.split("\n")
end
end
end