module GithubTrending

Constants

VERSION

Public Class Methods

download_repos() click to toggle source
# File lib/github_trending.rb, line 6
def self.download_repos
      repos = ""
      _file = 'today_trending.sh'
      agent = Mechanize.new
              page = agent.get('http://github.com/trending')
              page.search('.repo-list-name').each do |repo|
                      repos << "git clone https://github.com/" + repo.text.strip.split.join + "\n"
              end
              File.open(_file, 'w') { |f| f.write repos }
              File.chmod(0755, _file)
              exec "sh #{_file}"
end
list_repos() click to toggle source
# File lib/github_trending.rb, line 19
def self.list_repos
      agent = Mechanize.new
              page = agent.get('http://github.com/trending')
              page.search('.repo-list-name').each do |repo|
                      puts repo.text.strip.split.join
              end
end