Module: Hubba
- Defined in:
- lib/hubba.rb,
lib/hubba/stats.rb,
lib/hubba/client.rb,
lib/hubba/config.rb,
lib/hubba/github.rb,
lib/hubba/reports.rb,
lib/hubba/reposet.rb,
lib/hubba/version.rb
Overview
add convenience alias for alternate spelling - why? why not?
Defined Under Namespace
Classes: Client, Configuration, Github, Orgs, Report, ReportStars, ReportSummary, ReportTimeline, ReportTrending, ReportUpdates, Repos, Resource, Stats, Summary
Constant Summary collapse
- GitHub =
Github- MAJOR =
todo: namespace inside version or something - why? why not??
0- MINOR =
6- PATCH =
1- VERSION =
[MAJOR,MINOR,PATCH].join('.')
Class Method Summary collapse
- .banner ⇒ Object
- .configuration ⇒ Object (also: config)
- .configure {|configuration| ... } ⇒ Object
-
.reposet(*users, orgs: true, cache: false) ⇒ Object
orgs - include repos form org(anizations) too cache - save json response to cache_dir - change to/use debug/tmp_dir? - why? why not?.
- .root ⇒ Object
-
.stats(hash_or_path = './repos.yml') ⇒ Object
use read_stats or such - why? why not?.
-
.update_stats(host_or_path = './repos.yml') ⇒ Object
move to reposet e.g.
- .version ⇒ Object
Class Method Details
.banner ⇒ Object
11 12 13 |
# File 'lib/hubba/version.rb', line 11 def self. "hubba/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]" end |
.configuration ⇒ Object Also known as: config
39 40 41 |
# File 'lib/hubba/config.rb', line 39 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
47 48 49 |
# File 'lib/hubba/config.rb', line 47 def self.configure yield( configuration ) end |
.reposet(*users, orgs: true, cache: false) ⇒ Object
orgs - include repos form org(anizations) too cache - save json response to cache_dir - change to/use debug/tmp_dir? - why? why not?
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/hubba/reposet.rb', line 93 def self.reposet( *users, orgs: true, cache: false ) # users = [users] if users.is_a?( String ) ### wrap in array if single user gh = Hubba::Github.new forks = [] h = {} users.each do |user| res = gh.user_repos( user ) save_json( "#{config.cache_dir}/users~#{user}~repos.json", res.data ) if cache repos = [] #### # check for forked repos (auto-exclude personal by default) # note: forked repos in orgs get NOT auto-excluded!!! res.data.each do |repo| fork = repo['fork'] if fork print "FORK " forks << "#{repo['full_name']} (AUTO-EXCLUDED)" else print " " repos << repo['name'] end print repo['full_name'] print "\n" end h[ "#{user} (#{repos.size})" ] = repos.sort end ## all repos from orgs ## note: for now only use first (primary user) - why? why not? if orgs user = users[0] res = gh.user_orgs( user ) save_json( "#{config.cache_dir}/users~#{user}~orgs.json", res.data ) if cache logins = res.logins.each do |login| ## next if ['xxx'].include?( login ) ## add orgs here to skip res = gh.org_repos( login ) save_json( "#{config.cache_dir}/orgs~#{login}~repos.json", res.data ) if cache repos = [] res.data.each do |repo| fork = repo['fork'] if fork print "FORK " forks << repo['full_name'] repos << repo['name'] else print " " repos << repo['name'] end print repo['full_name'] print "\n" end h[ "#{login} (#{repos.size})" ] = repos.sort end end if forks.size > 0 puts puts "#{forks.size} fork(s):" puts forks end h end |
.root ⇒ Object
15 16 17 |
# File 'lib/hubba/version.rb', line 15 def self.root "#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}" end |
.stats(hash_or_path = './repos.yml') ⇒ Object
use read_stats or such - why? why not?
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hubba/reposet.rb', line 17 def self.stats( hash_or_path='./repos.yml' ) ## use read_stats or such - why? why not? h = if hash_or_path.is_a?( String ) ## assume it is a file path!!! path = hash_or_path YAML.load_file( path ) else hash_or_path # assume its a hash / reposet already!!! end Summary.new( h ) ## wrap in "easy-access" facade / wrapper end |
.update_stats(host_or_path = './repos.yml') ⇒ Object
move to reposet e.g. Reposet#update_status!!!!
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/hubba/reposet.rb', line 4 def self.update_stats( host_or_path='./repos.yml' ) ## move to reposet e.g. Reposet#update_status!!!! h = if hash_or_path.is_a?( String ) ## assume it is a file path!!! path = hash_or_path YAML.load_file( path ) else hash_or_path # assume its a hash / reposet already!!! end gh = Github.new gh.update_stats( h ) end |
.version ⇒ Object
7 8 9 |
# File 'lib/hubba/version.rb', line 7 def self.version VERSION end |