ghi 0.2.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.
- data/History.rdoc +180 -0
- data/Manifest.txt +14 -0
- data/README.rdoc +92 -0
- data/bin/ghi +6 -0
- data/lib/ghi.rb +55 -0
- data/lib/ghi/api.rb +106 -0
- data/lib/ghi/cli.rb +608 -0
- data/lib/ghi/issue.rb +29 -0
- data/spec/ghi/api_spec.rb +194 -0
- data/spec/ghi/cli_spec.rb +258 -0
- data/spec/ghi/issue_spec.rb +26 -0
- data/spec/ghi_spec.rb +91 -0
- metadata +70 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require "ghi"
|
2
|
+
require "ghi/issue"
|
3
|
+
|
4
|
+
describe GHI::Issue do
|
5
|
+
before :each do
|
6
|
+
@now = Time.now
|
7
|
+
@issue = GHI::Issue.new "number" => 1,
|
8
|
+
"state" => "open",
|
9
|
+
"title" => "new issue",
|
10
|
+
"user" => "schacon",
|
11
|
+
"votes" => 0,
|
12
|
+
"created_at" => @now,
|
13
|
+
"updated_at" => @now,
|
14
|
+
"body" => "my sweet, sweet issue"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should read all keys" do
|
18
|
+
@issue.number.should == 1
|
19
|
+
@issue.state.should == "open"
|
20
|
+
@issue.title.should == "new issue"
|
21
|
+
@issue.user.should == "schacon"
|
22
|
+
@issue.votes.should == 0
|
23
|
+
@issue.created_at.should == @now
|
24
|
+
@issue.updated_at.should == @now
|
25
|
+
end
|
26
|
+
end
|
data/spec/ghi_spec.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
require "ghi"
|
2
|
+
|
3
|
+
LOGGED_OUT_YAML = <<-YAML
|
4
|
+
---
|
5
|
+
user:
|
6
|
+
id: 23
|
7
|
+
login: defunkt
|
8
|
+
name: Kristopher Walken Wanstrath
|
9
|
+
company: LA
|
10
|
+
location: SF
|
11
|
+
email: me@email.com
|
12
|
+
blog: http://myblog.com
|
13
|
+
following_count: 13
|
14
|
+
followers_count: 63
|
15
|
+
public_gist_count: 0
|
16
|
+
public_repo_count: 2
|
17
|
+
YAML
|
18
|
+
|
19
|
+
LOGGED_IN_YAML = <<-YAML
|
20
|
+
---
|
21
|
+
user:
|
22
|
+
id: 23
|
23
|
+
login: defunkt
|
24
|
+
name: Kristopher Walken Wanstrath
|
25
|
+
company: LA
|
26
|
+
location: SF
|
27
|
+
email: me@email.com
|
28
|
+
blog: http://myblog.com
|
29
|
+
following_count: 13
|
30
|
+
followers_count: 63
|
31
|
+
public_gist_count: 0
|
32
|
+
public_repo_count: 2
|
33
|
+
total_private_repo_count: 1
|
34
|
+
collaborators: 3
|
35
|
+
disk_usage: 50384
|
36
|
+
owned_private_repo_count: 1
|
37
|
+
private_gist_count: 0
|
38
|
+
plan:
|
39
|
+
name: mega
|
40
|
+
collaborators: 60
|
41
|
+
space: 20971520
|
42
|
+
private_repos: 125
|
43
|
+
YAML
|
44
|
+
|
45
|
+
describe GHI do
|
46
|
+
before :each do
|
47
|
+
GHI.instance_eval do
|
48
|
+
remove_instance_variable :@login if instance_variable_defined? :@login
|
49
|
+
remove_instance_variable :@token if instance_variable_defined? :@token
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return login" do
|
54
|
+
GHI.should_receive(:`).once.and_return "stephencelis\n"
|
55
|
+
GHI.login.should == "stephencelis"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should return token" do
|
59
|
+
GHI.should_receive(:`).once.and_return "da39a3ee5e6b4b0d3255bfef95601890\n"
|
60
|
+
GHI.token.should == "da39a3ee5e6b4b0d3255bfef95601890"
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should approve login input" do
|
64
|
+
GHI.instance_eval { instance_variable_defined?(:@login).should == false }
|
65
|
+
GHI.should_receive(:`).with("git config --get github.user").
|
66
|
+
and_return "\n"
|
67
|
+
GHI.should_receive(:print).twice
|
68
|
+
GHI.should_receive(:gets).twice.and_return "defunct\n", "defunkt\n"
|
69
|
+
Net::HTTP.should_receive(:get).and_return "500: invalid: response",
|
70
|
+
LOGGED_OUT_YAML
|
71
|
+
GHI.should_receive(:warn).once
|
72
|
+
GHI.should_receive(:`).with("git config --global github.user defunkt").
|
73
|
+
and_return "\n"
|
74
|
+
GHI.login.should == "defunkt"
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should approve token input" do
|
78
|
+
GHI.instance_eval { instance_variable_defined?(:@token).should == false }
|
79
|
+
GHI.stub!(:login).and_return "defunkt"
|
80
|
+
GHI.should_receive(:`).with("git config --get github.token").
|
81
|
+
and_return "\n"
|
82
|
+
GHI.should_receive(:print).twice
|
83
|
+
token = "da39a3ee5e6b4b0d3255bfef95601890"
|
84
|
+
GHI.should_receive(:gets).and_return "invalid\n", "#{token}\n"
|
85
|
+
Net::HTTP.should_receive(:get).and_return LOGGED_OUT_YAML, LOGGED_IN_YAML
|
86
|
+
GHI.should_receive(:warn).once
|
87
|
+
GHI.should_receive(:`).with("git config --global github.token #{token}").
|
88
|
+
and_return "\n"
|
89
|
+
GHI.token.should == token
|
90
|
+
end
|
91
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ghi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Celis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-03 00:00:00 -06:00
|
13
|
+
default_executable: ghi
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: GitHub Issues on the command line. Use your `$EDITOR`, not your browser.
|
17
|
+
email:
|
18
|
+
- stephen@stephencelis.com
|
19
|
+
executables:
|
20
|
+
- ghi
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- History.rdoc
|
25
|
+
- Manifest.txt
|
26
|
+
- README.rdoc
|
27
|
+
files:
|
28
|
+
- History.rdoc
|
29
|
+
- Manifest.txt
|
30
|
+
- README.rdoc
|
31
|
+
- bin/ghi
|
32
|
+
- lib/ghi/api.rb
|
33
|
+
- lib/ghi/cli.rb
|
34
|
+
- lib/ghi/issue.rb
|
35
|
+
- lib/ghi.rb
|
36
|
+
- spec/ghi/api_spec.rb
|
37
|
+
- spec/ghi/cli_spec.rb
|
38
|
+
- spec/ghi/issue_spec.rb
|
39
|
+
- spec/ghi_spec.rb
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: http://github.com/stephencelis/ghi
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options:
|
46
|
+
- --main
|
47
|
+
- README.rdoc
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project: ghi
|
65
|
+
rubygems_version: 1.3.5
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: GitHub Issues on the command line
|
69
|
+
test_files: []
|
70
|
+
|