lib/agile_notifier/configuration.rb in agile_notifier-2.1.4 vs lib/agile_notifier/configuration.rb in agile_notifier-3.0.0
- old
+ new
@@ -3,10 +3,12 @@
module AgileNotifier
class Configuration
def initialize(&blk)
@current_module = Object.const_get(self.class.to_s.split('::').first)
@its_args = Hash.new
+ options = Commander.order(ARGV)
+ @build_number = options[:build_number]
instance_eval(&blk)
end
class << self
def set(&blk)
@@ -17,16 +19,15 @@
def ci_url(url)
@ci_url = url
end
def ci_job(job)
- @ci_jobs ||= []
- @ci_jobs.push(job)
+ @ci_job = job
end
def ci_get(ci_type)
- @ci = @current_module.const_get(ci_type).new(@ci_url, *@ci_jobs)
+ @ci = @current_module.const_get(ci_type).new(@ci_url, @ci_job, @build_number)
end
def scm_url(url)
@scm_url = url
end
@@ -98,11 +99,12 @@
def alert(composer_type, judger_type)
composer_type = composer_type.to_s.downcase
judger_type = judger_type.to_s.downcase
composer_method = "#{composer_type}_committer_of_a_commit".intern
judger_method = "on_#{judger_type}".intern
- text = Composer.send(composer_method, repo: @scm.repository, revision: @ci.job.last_build.revision, language: @language)
- Judger.send(judger_method, @ci.job.last_build, text, organize_args)
+ build = @ci.job.current_build
+ text = Composer.send(composer_method, repo: @scm.repository, revision: build.revision, language: @language)
+ Judger.send(judger_method, build, text, organize_args)
end
def alert_on_wip
Judger.on_limit(@its, organize_args)
end
\ No newline at end of file