Module: GithubTrending

Defined in:
lib/github_trending.rb,
lib/github_trending/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.download_reposObject



6
7
8
9
10
11
12
13
14
15
16
17
# 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_reposObject



19
20
21
22
23
24
25
# 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