module GithubDash

Constants

VERSION

Public Class Methods

add_repo_to_following(name, token=nil) click to toggle source

Add a repository to the list of followed repositories

# File lib/github_dash.rb, line 13
def self.add_repo_to_following(name, token=nil)
  token ||= DataDepository.get_token
  # Check that the repository exists
  client = Octokit::Client.new(:access_token => token)
  client.repository name

  DataDepository.add_repo name, token
end
add_token(token, token_name) click to toggle source

Add a token and set it to be used first when fetching repositories

# File lib/github_dash.rb, line 44
def self.add_token(token, token_name)
  DataDepository.save_token(token, token_name)
end
add_user(username, password) click to toggle source

Save a user's token for getting private repositories

# File lib/github_dash.rb, line 34
def self.add_user(username, password)
  # Create new token
  client = Octokit::Client.new :login => username, :password => password
  token = client.create_authorization(:scopes => ["repo"], :note => "github-dash token").token

  # Save it
  DataDepository.save_token(token, username)
end
fetch_repository(repository_name) click to toggle source

Fetch repository information given a reposoitory name

# File lib/github_dash.rb, line 8
def self.fetch_repository(repository_name)
  Repository.new repository_name
end
get_following() click to toggle source

Get an array of the names of followed repositories

# File lib/github_dash.rb, line 29
def self.get_following
  DataDepository.get_following
end
remove_repo_from_following(name) click to toggle source

Remove a repository from the list of followed repositories

# File lib/github_dash.rb, line 23
def self.remove_repo_from_following(name)
  # Tell the user whether it removed a repo or not
  DataDepository.remove_repo name
end