lib/danger/ci_source/circle.rb in danger-0.1.0 vs lib/danger/ci_source/circle.rb in danger-0.1.1
- old
+ new
@@ -1,21 +1,19 @@
# https://circleci.com/docs/environment-variables
require 'uri'
module Danger
- class CircleCI
+ module CISource
+ class CircleCI < CI
+ def self.validates?(env)
+ return !env["CIRCLE_BUILD_NUM"].nil? && !env["CI_PULL_REQUEST"].nil?
+ end
- attr_accessor :repo_slug, :pull_request_id
-
- def self.validates?(env)
- return env["CIRCLE_BUILD_NUM"] != nil && ["CI_PULL_REQUEST"] != nil
+ def initialize(env)
+ paths = URI.parse(env["CI_PULL_REQUEST"]).path.split("/")
+ # the first one is an extra slash, ignore it
+ self.repo_slug = paths[1] + "/" + paths[2]
+ self.pull_request_id = paths[4]
+ end
end
-
- def initialize(env)
- paths = URI::parse(env["CI_PULL_REQUEST"]).path.split("/")
- # the first one is an extra slash, ignore it
- self.repo_slug = paths[1] + "/" + paths[2]
- self.pull_request_id = paths[4]
- end
-
end
end