lib/github-status/out.rb in concourse-github-status-0.2.2 vs lib/github-status/out.rb in concourse-github-status-0.2.4
- old
+ new
@@ -1,18 +1,20 @@
#!/usr/bin/env ruby
require 'concourse-fuselage'
require 'contracts'
-require 'git'
-require 'octokit'
require_relative 'core'
require_relative 'support/params'
+require_relative 'support/git'
+require_relative 'support/github'
module GitHubStatus
class Out < Fuselage::Out
include Core
include Support::Params
+ include Support::Git
+ include Support::GitHub
Contract None => Sawyer::Resource
def update!
github.create_status repo, sha, state, options
rescue Octokit::Error => error
@@ -35,26 +37,8 @@
@options ||= {
context: context,
target_url: target_url,
description: description
}
- end
-
- Contract None => Git::Base
- def git
- @git ||= Git.open "#{workdir}/#{path}"
- rescue ArgumentError
- STDERR.puts "#{path} is not a git repository"
- abort
- end
-
- Contract None => String
- def sha
- @sha ||= git.revparse 'HEAD'
- end
-
- Contract None => Octokit::Client
- def github
- @github ||= Octokit::Client.new access_token: access_token
end
end
end