hubhumans 0.0.1 → 0.0.2
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.
- data/.travis.yml +5 -0
- data/Rakefile +4 -0
- data/hubhumans.gemspec +2 -0
- data/lib/hubhumans.rb +8 -1
- data/lib/hubhumans/version.rb +1 -1
- data/spec/humanifier_spec.rb +40 -0
- data/spec/spec_helper.rb +7 -0
- metadata +45 -2
data/.travis.yml
ADDED
data/Rakefile
CHANGED
data/hubhumans.gemspec
CHANGED
data/lib/hubhumans.rb
CHANGED
@@ -4,6 +4,7 @@ require "octokit"
|
|
4
4
|
module Hubhumans
|
5
5
|
|
6
6
|
class Humanifier
|
7
|
+
attr_reader :client
|
7
8
|
|
8
9
|
def initialize
|
9
10
|
@client = Octokit::Client.new(:auto_traversal => true)
|
@@ -21,12 +22,18 @@ module Hubhumans
|
|
21
22
|
def render_user(login)
|
22
23
|
user = @client.user(login)
|
23
24
|
output = ""
|
24
|
-
output << " #{user.name
|
25
|
+
output << " #{format_name(user.name,user.login)}\n"
|
25
26
|
output << " Site: #{user.blog}\n" unless user.blog.nil?
|
26
27
|
output << " Location: #{user.location}\n" unless user.location.nil?
|
27
28
|
output + "\n"
|
28
29
|
end
|
29
30
|
|
31
|
+
protected
|
32
|
+
def format_name(user_name, user_login)
|
33
|
+
return user_login if user_name.nil?
|
34
|
+
"#{user_name} (#{user_login})"
|
35
|
+
end
|
36
|
+
|
30
37
|
end
|
31
38
|
|
32
39
|
end
|
data/lib/hubhumans/version.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
include Hubhumans
|
4
|
+
|
5
|
+
describe Humanifier do
|
6
|
+
describe ".new" do
|
7
|
+
it "should be instantiated without any args" do
|
8
|
+
lambda { Humanifier.new() }.should_not raise_error
|
9
|
+
lambda { Humanifier.new( "moo ") }.should raise_error(ArgumentError)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#render_user' do
|
14
|
+
let(:humanifier) { Humanifier.new }
|
15
|
+
before(:each) do
|
16
|
+
@user = double("user")
|
17
|
+
@user.stub(:name) {'Matthew Rothenberg'}
|
18
|
+
@user.stub(:login) {'mroth'}
|
19
|
+
@user.stub(:blog) {'http://mroth.info'}
|
20
|
+
@user.stub(:location) {'Brooklyn, NY'}
|
21
|
+
humanifier.client.should_receive(:user).and_return(@user)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should render appropriate text for a user" do
|
25
|
+
humanifier.render_user('mroth').should == " Matthew Rothenberg (mroth)\n Site: http://mroth.info\n Location: Brooklyn, NY\n\n"
|
26
|
+
end
|
27
|
+
it "should properly handle a user without a full name set" do
|
28
|
+
@user.stub(:name) { nil }
|
29
|
+
humanifier.render_user('mroth').should match(/^ mroth$/)
|
30
|
+
end
|
31
|
+
it "should properly omit location if user doesnt have one" do
|
32
|
+
@user.stub(:location) { nil }
|
33
|
+
humanifier.render_user('mroth').should_not match(/^ Location:/)
|
34
|
+
end
|
35
|
+
it "should properly omit blog if user doesnt have one" do
|
36
|
+
@user.stub(:blog) { nil }
|
37
|
+
humanifier.render_user('mroth').should_not match(/^ Site:/)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubhumans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,38 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.23.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.12.0
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.12.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 10.0.3
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 10.0.3
|
30
62
|
description: Automatically create a `humans.txt` file based upon public members of
|
31
63
|
a GitHub organization.
|
32
64
|
email:
|
@@ -38,6 +70,7 @@ extra_rdoc_files: []
|
|
38
70
|
files:
|
39
71
|
- .gitignore
|
40
72
|
- .rvmrc
|
73
|
+
- .travis.yml
|
41
74
|
- Gemfile
|
42
75
|
- LICENSE.txt
|
43
76
|
- README.md
|
@@ -46,6 +79,8 @@ files:
|
|
46
79
|
- hubhumans.gemspec
|
47
80
|
- lib/hubhumans.rb
|
48
81
|
- lib/hubhumans/version.rb
|
82
|
+
- spec/humanifier_spec.rb
|
83
|
+
- spec/spec_helper.rb
|
49
84
|
homepage: http://github.com/mroth/hubhumans
|
50
85
|
licenses:
|
51
86
|
- MIT
|
@@ -59,12 +94,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
94
|
- - ! '>='
|
60
95
|
- !ruby/object:Gem::Version
|
61
96
|
version: '0'
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
hash: -2791626561800668847
|
62
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
101
|
none: false
|
64
102
|
requirements:
|
65
103
|
- - ! '>='
|
66
104
|
- !ruby/object:Gem::Version
|
67
105
|
version: '0'
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
hash: -2791626561800668847
|
68
109
|
requirements: []
|
69
110
|
rubyforge_project:
|
70
111
|
rubygems_version: 1.8.25
|
@@ -72,4 +113,6 @@ signing_key:
|
|
72
113
|
specification_version: 3
|
73
114
|
summary: Automatically create a `humans.txt` file based upon public members of a GitHub
|
74
115
|
organization.
|
75
|
-
test_files:
|
116
|
+
test_files:
|
117
|
+
- spec/humanifier_spec.rb
|
118
|
+
- spec/spec_helper.rb
|