Sha256: fe5f0cf8898fc379e58d7407a1f1a1f5c9545271a434b2ec31b2342c8a6a26c9
Contents?: true
Size: 1.38 KB
Versions: 4
Compression:
Stored size: 1.38 KB
Contents
module Love class Author attr_reader :name, :info, :gems, :username def initialize(name, fetch = true) @name = name @gems = [] fetch_info if fetch end def fetch_info uri = ERB::Util.url_encode(name) puts "search for #{name}" begin search_person = Love.octokit.search_users uri @info = \ if search_person.count > 1 puts '!!! THERE ARE SEVERAL PERSONS WITH THIS NAME IN GITHUB !!!' user_num = pick_user(search_person) Love.octokit.user search_person[user_num].login else Love.octokit.user search_person.first.login end puts "found #{@info.login}" rescue Octokit::Forbidden puts 'github have some unfair limits =(' rescue puts 'not found' end end def add_gem(gem) @gems << gem end private def pick_user(users) if Love.check_author puts "Please check right man with his number and we'll continue" else puts "To check author manually please restart with option -v" end users.each_with_index do |person, index| puts "#{index} - name: #{person.name}; login: #{person.login}; username: #{person.username}" end if Love.check_author $stdin.gets.chomp.to_i else puts "Taken first" 0 end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
share_some_love-0.1.4 | lib/love/author.rb |
share_some_love-0.1.3 | lib/love/author.rb |
share_some_love-0.1.2 | lib/love/author.rb |
share_some_love-0.1.1 | lib/love/author.rb |