ghuls 1.7.2 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/lib/ghuls/cli.rb +18 -20
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb0d7da6a7c3622878e58fd49cee49b409216c7e
4
- data.tar.gz: 567e813ec3590b9b609f4f5f9cce4007e3b5c686
3
+ metadata.gz: c2a1583bcc254a0226a9732a6c91211ac434d7cd
4
+ data.tar.gz: 14bf1f4d0df9ee1c842dab53a5b4fa67a4b60633
5
5
  SHA512:
6
- metadata.gz: 8af7d6a7368c94068635f48a9d643ff42dd62defef8a7b3dc29017a9461c880bb14aa7b0221a1381c6a043d3b5bbc03fbe4f510eaebfb2b08736b90fa06fa834
7
- data.tar.gz: 25815f04357385cfa4dee197415f3c9c6e936ba28259beff16e3c355c7910dd8e9472609d101ea7596f9a7c3070fa95ad63a226e9ea41d163611d80b15d0a9ef
6
+ metadata.gz: 462a5e9c90b16292ff02ac88137c02bfc11ce71f5890091c299be53fa7a4a995fb9990ef120c05be6040c3a98a0bff6f13552188cf381e6796666a76b6f81195
7
+ data.tar.gz: cd6f4caa6c55fc262b21b2434e702f9927dda18444175397d313dad7e70876525b2bb3a87340297da3380a4fe37162368eec15229d238d71135e997757a95864
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
  ## Version 1
3
+ ### Version 1.8.0
4
+ * Update to ghuls-lib 3.0.
5
+
3
6
  ### Version 1.7.2
4
7
  * Require github-calendar in the gemspec.
5
8
 
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
- config = GHULS::Lib.configure_stuff(@opts)
61
- increment
62
- if config == false
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
- @gh = config[:git]
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 = GHULS::Lib.get_color_for_language(l.to_s, @colors)
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 = GHULS::Lib.get_user_langs(@opts[:get], @gh)
96
+ user_langs = @ghuls.get_user_langs(@opts[:get])
99
97
  increment
100
- org_langs = GHULS::Lib.get_org_langs(@opts[:get], @gh)
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 = GHULS::Lib.get_language_percentages(user_langs)
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 = GHULS::Lib.get_language_percentages(org_langs)
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(GHULS::Lib.get_language_percentages(user_langs))
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 = GHULS::Lib.get_forks_stars_watchers(r, @gh)
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 = GHULS::Lib.get_followers_following(@opts[:get], @gh)
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 = GHULS::Lib.get_issues_pulls(r, @gh)
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] = GHULS::Lib.get_random_user(@gh) if @opts[:get].nil?
185
+ @opts[:get] = @ghuls.get_random_user if @opts[:get].nil?
188
186
 
189
- user = GHULS::Lib.get_user_and_check(@opts[:get], @gh)
190
- if user == false
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 = GHULS::Lib.get_user_repos(@opts[:get], @gh)
196
- @org_repos = GHULS::Lib.get_org_repos(@opts[:get], @gh)
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.7.2
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-04-16 00:00:00.000000000 Z
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: '2.3'
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: '2.3'
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: progress_bar
43
43
  requirement: !ruby/object:Gem::Requirement