summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvin Efendi <elvin.efendiyev@gmail.com>2015-12-04 00:30:39 -0500
committerElvin Efendi <elvin.efendiyev@gmail.com>2015-12-04 00:30:39 -0500
commitaaab6f34b966e69e5c01af844827dd13c5899ecf (patch)
treef9753ab3307ae57a8e6fe93ce0e8c4c394eebfa6
parent84697f6440d156e264962cf74b61c8ef90ed187c (diff)
parent71f38cc19411c482c3cd932976a5183e089226eb (diff)
Merge pull request #5 from Shopify/https-auth
user password username for github api
-rw-r--r--lib/oxidized/hook/githubrepo.rb2
-rw-r--r--spec/githubrepo_spec.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb
index 85adaab..fe73015 100644
--- a/lib/oxidized/hook/githubrepo.rb
+++ b/lib/oxidized/hook/githubrepo.rb
@@ -4,7 +4,7 @@ class GithubRepo < Oxidized::Hook
end
def run_hook(ctx)
- credentials = Rugged::Credentials::SshKeyFromAgent.new(username: 'git')
+ credentials = Rugged::Credentials::UserPassword.new(username: cfg.username, password: cfg.password)
repo = Rugged::Repository.new(Oxidized.config.output.git.repo)
log "Pushing local repository(#{repo.path})..."
remote = repo.remotes['origin'] || repo.remotes.create('origin', cfg.remote_repo)
diff --git a/spec/githubrepo_spec.rb b/spec/githubrepo_spec.rb
index c98244d..a193cd6 100644
--- a/spec/githubrepo_spec.rb
+++ b/spec/githubrepo_spec.rb
@@ -6,6 +6,10 @@ describe Oxidized::Node do
before(:each) do
asetus = Asetus.new
asetus.cfg.output.git.repo = 'foo.git'
+ asetus.cfg.hooks.github_repo_hook.remote_repo = 'https://github.com/blah/blah.git'
+ asetus.cfg.hooks.github_repo_hook.username = 'username'
+ asetus.cfg.hooks.github_repo_hook.password = 'password'
+ GithubRepo.any_instance.stubs(:cfg).returns(asetus.cfg.hooks.github_repo_hook)
Oxidized.stubs(:asetus).returns(asetus)
repo = mock()
remote = mock()