ghuls 1.7.2 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +3 -0
 - data/lib/ghuls/cli.rb +18 -20
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c2a1583bcc254a0226a9732a6c91211ac434d7cd
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 14bf1f4d0df9ee1c842dab53a5b4fa67a4b60633
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 462a5e9c90b16292ff02ac88137c02bfc11ce71f5890091c299be53fa7a4a995fb9990ef120c05be6040c3a98a0bff6f13552188cf381e6796666a76b6f81195
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cd6f4caa6c55fc262b21b2434e702f9927dda18444175397d313dad7e70876525b2bb3a87340297da3380a4fe37162368eec15229d238d71135e997757a95864
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/lib/ghuls/cli.rb
    CHANGED
    
    | 
         @@ -57,14 +57,12 @@ module GHULS 
     | 
|
| 
       57 
57 
     | 
    
         
             
                  parse_options(args)
         
     | 
| 
       58 
58 
     | 
    
         
             
                  @bar = ProgressBar.new(5) if @opts[:debug]
         
     | 
| 
       59 
59 
     | 
    
         
             
                  increment
         
     | 
| 
       60 
     | 
    
         
            -
                   
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
                   
     | 
| 
      
 60 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 61 
     | 
    
         
            +
                    @ghuls = GHULS::Lib.new(@opts)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  rescue Octokit::Unauthorized
         
     | 
| 
       63 
63 
     | 
    
         
             
                    puts 'Error: authentication failed, check your username/password or token'
         
     | 
| 
       64 
     | 
    
         
            -
                    exit
         
     | 
| 
       65 
64 
     | 
    
         
             
                  end
         
     | 
| 
       66 
     | 
    
         
            -
                   
     | 
| 
       67 
     | 
    
         
            -
                  @colors = config[:colors]
         
     | 
| 
      
 65 
     | 
    
         
            +
                  increment
         
     | 
| 
       68 
66 
     | 
    
         
             
                end
         
     | 
| 
       69 
67 
     | 
    
         | 
| 
       70 
68 
     | 
    
         
             
                # Whether or not the script should fail.
         
     | 
| 
         @@ -78,7 +76,7 @@ module GHULS 
     | 
|
| 
       78 
76 
     | 
    
         | 
| 
       79 
77 
     | 
    
         
             
                def output(percents)
         
     | 
| 
       80 
78 
     | 
    
         
             
                  percents.each do |l, p|
         
     | 
| 
       81 
     | 
    
         
            -
                    color =  
     | 
| 
      
 79 
     | 
    
         
            +
                    color = @ghuls.get_color_for_language(l.to_s)
         
     | 
| 
       82 
80 
     | 
    
         
             
                    puts Paint["#{l}: #{p}%", color]
         
     | 
| 
       83 
81 
     | 
    
         
             
                  end
         
     | 
| 
       84 
82 
     | 
    
         
             
                end
         
     | 
| 
         @@ -95,20 +93,20 @@ module GHULS 
     | 
|
| 
       95 
93 
     | 
    
         
             
                # Gets and outputs language data for the user and their organizations.
         
     | 
| 
       96 
94 
     | 
    
         
             
                # @param username [String] The username of the user.
         
     | 
| 
       97 
95 
     | 
    
         
             
                def language_data(username)
         
     | 
| 
       98 
     | 
    
         
            -
                  user_langs =  
     | 
| 
      
 96 
     | 
    
         
            +
                  user_langs = @ghuls.get_user_langs(@opts[:get])
         
     | 
| 
       99 
97 
     | 
    
         
             
                  increment
         
     | 
| 
       100 
     | 
    
         
            -
                  org_langs =  
     | 
| 
      
 98 
     | 
    
         
            +
                  org_langs = @ghuls.get_org_langs(@opts[:get])
         
     | 
| 
       101 
99 
     | 
    
         
             
                  increment
         
     | 
| 
       102 
100 
     | 
    
         
             
                  if !user_langs.empty?
         
     | 
| 
       103 
101 
     | 
    
         
             
                    puts "Getting language data for #{username}..."
         
     | 
| 
       104 
     | 
    
         
            -
                    user_percents =  
     | 
| 
      
 102 
     | 
    
         
            +
                    user_percents = @ghuls.get_language_percentages(user_langs)
         
     | 
| 
       105 
103 
     | 
    
         
             
                    output(user_percents)
         
     | 
| 
       106 
104 
     | 
    
         
             
                  else
         
     | 
| 
       107 
105 
     | 
    
         
             
                    puts 'Could not find any personal data to analyze.'
         
     | 
| 
       108 
106 
     | 
    
         
             
                  end
         
     | 
| 
       109 
107 
     | 
    
         
             
                  if !org_langs.empty?
         
     | 
| 
       110 
108 
     | 
    
         
             
                    puts 'Getting language data for their organizations...'
         
     | 
| 
       111 
     | 
    
         
            -
                    org_percents =  
     | 
| 
      
 109 
     | 
    
         
            +
                    org_percents = @ghuls.get_language_percentages(org_langs)
         
     | 
| 
       112 
110 
     | 
    
         
             
                    output(org_percents)
         
     | 
| 
       113 
111 
     | 
    
         
             
                  else
         
     | 
| 
       114 
112 
     | 
    
         
             
                    puts 'Could not find any organization data to analyze.'
         
     | 
| 
         @@ -118,19 +116,19 @@ module GHULS 
     | 
|
| 
       118 
116 
     | 
    
         | 
| 
       119 
117 
     | 
    
         
             
                  user_langs.update(org_langs) { |_, v1, v2| v1 + v2 }
         
     | 
| 
       120 
118 
     | 
    
         
             
                  puts 'Getting combined language data...'
         
     | 
| 
       121 
     | 
    
         
            -
                  output( 
     | 
| 
      
 119 
     | 
    
         
            +
                  output(@ghuls.get_language_percentages(user_langs))
         
     | 
| 
       122 
120 
     | 
    
         
             
                end
         
     | 
| 
       123 
121 
     | 
    
         | 
| 
       124 
122 
     | 
    
         
             
                def fork_data(repos)
         
     | 
| 
       125 
123 
     | 
    
         
             
                  repos[:public].each do |r|
         
     | 
| 
       126 
124 
     | 
    
         
             
                    next if repos[:forks].include? r
         
     | 
| 
       127 
     | 
    
         
            -
                    fsw =  
     | 
| 
      
 125 
     | 
    
         
            +
                    fsw = @ghuls.get_forks_stars_watchers(r)
         
     | 
| 
       128 
126 
     | 
    
         
             
                    puts "#{r}: #{fsw[:forks]} forks, #{fsw[:stars]} stars, and #{fsw[:watchers]} watchers"
         
     | 
| 
       129 
127 
     | 
    
         
             
                  end
         
     | 
| 
       130 
128 
     | 
    
         
             
                end
         
     | 
| 
       131 
129 
     | 
    
         | 
| 
       132 
130 
     | 
    
         
             
                def follower_data(username)
         
     | 
| 
       133 
     | 
    
         
            -
                  follows =  
     | 
| 
      
 131 
     | 
    
         
            +
                  follows = @ghuls.get_followers_following(@opts[:get])
         
     | 
| 
       134 
132 
     | 
    
         
             
                  followers = Paint["#{follows[:followers]} followers", :green]
         
     | 
| 
       135 
133 
     | 
    
         
             
                  following = Paint["following #{follows[:following]}", '#FFA500']
         
     | 
| 
       136 
134 
     | 
    
         
             
                  puts "#{username} has #{followers} and is #{following} people"
         
     | 
| 
         @@ -140,7 +138,7 @@ module GHULS 
     | 
|
| 
       140 
138 
     | 
    
         
             
                  puts 'Getting issue and pull request data...'
         
     | 
| 
       141 
139 
     | 
    
         
             
                  repos[:public].each do |r|
         
     | 
| 
       142 
140 
     | 
    
         
             
                    next if repos[:forks].include? r
         
     | 
| 
       143 
     | 
    
         
            -
                    things =  
     | 
| 
      
 141 
     | 
    
         
            +
                    things = @ghuls.get_issues_pulls(r)
         
     | 
| 
       144 
142 
     | 
    
         
             
                    open_issues = Paint["#{things[:issues][:open]} open", :green]
         
     | 
| 
       145 
143 
     | 
    
         
             
                    closed_issues = Paint["#{things[:issues][:closed]} closed", :red]
         
     | 
| 
       146 
144 
     | 
    
         
             
                    open_pulls = Paint["#{things[:pulls][:open]} open", :green]
         
     | 
| 
         @@ -184,16 +182,16 @@ module GHULS 
     | 
|
| 
       184 
182 
     | 
    
         
             
                  puts @help if @opts[:help]
         
     | 
| 
       185 
183 
     | 
    
         
             
                  exit if failed?
         
     | 
| 
       186 
184 
     | 
    
         
             
                  increment
         
     | 
| 
       187 
     | 
    
         
            -
                  @opts[:get] =  
     | 
| 
      
 185 
     | 
    
         
            +
                  @opts[:get] = @ghuls.get_random_user if @opts[:get].nil?
         
     | 
| 
       188 
186 
     | 
    
         | 
| 
       189 
     | 
    
         
            -
                  user =  
     | 
| 
       190 
     | 
    
         
            -
                  if user 
     | 
| 
      
 187 
     | 
    
         
            +
                  user = @ghuls.get_user_and_check(@opts[:get])
         
     | 
| 
      
 188 
     | 
    
         
            +
                  if !user
         
     | 
| 
       191 
189 
     | 
    
         
             
                    puts 'Sorry, something wen\'t wrong.'
         
     | 
| 
       192 
190 
     | 
    
         
             
                    puts "We could not find any user named #{@opts[:get]}."
         
     | 
| 
       193 
191 
     | 
    
         
             
                    puts 'If you believe this is an error, please report it as a bug.'
         
     | 
| 
       194 
192 
     | 
    
         
             
                  else
         
     | 
| 
       195 
     | 
    
         
            -
                    @repos =  
     | 
| 
       196 
     | 
    
         
            -
                    @org_repos =  
     | 
| 
      
 193 
     | 
    
         
            +
                    @repos = @ghuls.get_user_repos(@opts[:get])
         
     | 
| 
      
 194 
     | 
    
         
            +
                    @org_repos = @ghuls.get_org_repos(@opts[:get])
         
     | 
| 
       197 
195 
     | 
    
         
             
                    language_data(user[:username])
         
     | 
| 
       198 
196 
     | 
    
         
             
                    puts 'Getting forks, stars, and watchers of user repositories...'
         
     | 
| 
       199 
197 
     | 
    
         
             
                    fork_data(@repos)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ghuls
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.8.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Eli Foster
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-05-07 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: paint
         
     | 
| 
         @@ -30,14 +30,14 @@ dependencies: 
     | 
|
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
38 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: progress_bar
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |