Class: GitHubLayer
- Inherits:
-
Object
- Object
- GitHubLayer
- Defined in:
- lib/homer/github_layer.rb
Class Method Summary collapse
Class Method Details
.create_repo_if_repo_does_not_exist(repo_name) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/homer/github_layer.rb', line 16 def create_repo_if_repo_does_not_exist(repo_name) token = FileLayer. github = Github.new(oauth_token: token) begin github.repos.get(github.login, repo_name) rescue Github::Error::NotFound github.repos.create(name: repo_name) end end |
.login(login, password) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/homer/github_layer.rb', line 8 def login(login, password) github = Github.new(login: login, password: password) = github.oauth.create(scopes: ['public_repo'], note: 'Homer') FileLayer.(.token) rescue Github::Error::Unauthorized raise "Invalid GitHub Login/Password" end |