Class: Diffhub::GitHub
- Inherits:
-
Object
- Object
- Diffhub::GitHub
- Defined in:
- lib/diffhub/git_hub.rb
Instance Attribute Summary collapse
-
#github_gist ⇒ Object
readonly
Returns the value of attribute github_gist.
Instance Method Summary collapse
-
#initialize ⇒ GitHub
constructor
A new instance of GitHub.
- #upload_diff! ⇒ Object
Constructor Details
#initialize ⇒ GitHub
Returns a new instance of GitHub.
8 9 10 11 12 13 14 |
# File 'lib/diffhub/git_hub.rb', line 8 def initialize credentials = YAML.load_file(ENV['HOME'] + '/.github_config.yml') raise ArgumentError, "No password given" unless credentials['password'] raise ArgumentError, "No login given" unless credentials['login'] @github_gist = ::Github::Gists.new credentials end |
Instance Attribute Details
#github_gist ⇒ Object (readonly)
Returns the value of attribute github_gist.
6 7 8 |
# File 'lib/diffhub/git_hub.rb', line 6 def github_gist @github_gist end |
Instance Method Details
#upload_diff! ⇒ Object
16 17 18 19 20 21 |
# File 'lib/diffhub/git_hub.rb', line 16 def upload_diff! response = github_gist.create(:public => false, :files => {'git.diff' => {:content => `git diff`}}, :description => '') p response.html_url rescue Github::Error::UnprocessableEntity p 'no diff given' end |