giexp 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/giexp +7 -6
- data/giexp.gemspec +2 -2
- data/lib/giexp.rb +1 -1
- data/lib/giexp/client.rb +35 -11
- data/lib/giexp/run.rb +3 -7
- data/spec/giexp_spec.rb +2 -2
- data/spec/issues_spec.rb +36 -6
- data/spec/repos_spec.rb +21 -1
- metadata +10 -10
data/bin/giexp
CHANGED
@@ -41,6 +41,10 @@ begin
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
+
opts.on("-r REPOSITORY", "--repository REPOSITORY", "Repository name") do |x|
|
45
|
+
options[:repository] = x
|
46
|
+
end
|
47
|
+
|
44
48
|
opts.on("-o ORGANIZATION", "--organization ORGANIZATION", "Organization name") do |x|
|
45
49
|
options[:organization] = x
|
46
50
|
end
|
@@ -56,12 +60,9 @@ begin
|
|
56
60
|
|
57
61
|
opts.parse!
|
58
62
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
# options[:all] = true
|
63
|
-
# end
|
64
|
-
options[:all] = true
|
63
|
+
if options.key?(:repository)
|
64
|
+
options[:all] = true
|
65
|
+
end
|
65
66
|
|
66
67
|
if options[:require_password]
|
67
68
|
options[:password] = input_password("password: ")
|
data/giexp.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
5
5
|
|
6
6
|
s.name = 'giexp'
|
7
|
-
s.version = '0.1.
|
8
|
-
s.date = '2012-03-
|
7
|
+
s.version = '0.1.1'
|
8
|
+
s.date = '2012-03-19'
|
9
9
|
|
10
10
|
s.summary = "a tool to export issues on github"
|
11
11
|
s.description = "a tool to export issues on github"
|
data/lib/giexp.rb
CHANGED
data/lib/giexp/client.rb
CHANGED
@@ -16,6 +16,17 @@ module Giexp
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def repository(params)
|
20
|
+
if params.key?(:organization)
|
21
|
+
user = params[:organization]
|
22
|
+
else
|
23
|
+
user = params[:user]
|
24
|
+
end
|
25
|
+
|
26
|
+
repoName = "%s/%s" % [user, params[:repository]]
|
27
|
+
@client.repository(repoName)
|
28
|
+
end
|
29
|
+
|
19
30
|
def issues(params)
|
20
31
|
if params.key?(:organization)
|
21
32
|
user = params[:organization]
|
@@ -23,21 +34,34 @@ module Giexp
|
|
23
34
|
user = params[:user]
|
24
35
|
end
|
25
36
|
|
26
|
-
|
27
|
-
repoName = "%s/%s" % [user,
|
37
|
+
if params.key?(:repository)
|
38
|
+
repoName = "%s/%s" % [user, params[:repository]]
|
39
|
+
repo = self.repository(params)
|
40
|
+
if repo.has_issues
|
41
|
+
repo["issues"] = self.fetch_issues(repoName)
|
42
|
+
end
|
43
|
+
repo
|
44
|
+
else
|
45
|
+
self.repositories(params).map { |repo|
|
46
|
+
repoName = "%s/%s" % [user, repo.name]
|
28
47
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
issues.concat(@client.issues(repoName, {:status => status}))
|
33
|
-
}
|
34
|
-
repo["issues"] = issues
|
48
|
+
if repo.has_issues
|
49
|
+
repo["issues"] = self.fetch_issues(repoName)
|
50
|
+
end
|
35
51
|
repo
|
36
|
-
|
37
|
-
|
38
|
-
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
def fetch_issues(repoName)
|
58
|
+
issues = []
|
59
|
+
['open', 'closed'].each { |status|
|
60
|
+
issues.concat(@client.issues(repoName, {:status => status}))
|
39
61
|
}
|
62
|
+
issues
|
40
63
|
end
|
64
|
+
protected :fetch_issues
|
41
65
|
|
42
66
|
def authenticated?
|
43
67
|
@client.authenticated?
|
data/lib/giexp/run.rb
CHANGED
@@ -7,13 +7,9 @@ module Giexp
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def start(options = {})
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
pp issues
|
14
|
-
else
|
15
|
-
raise "Not implement"
|
16
|
-
end
|
10
|
+
require 'pp'
|
11
|
+
issues = @client.issues(options)
|
12
|
+
pp issues
|
17
13
|
end
|
18
14
|
end
|
19
15
|
end
|
data/spec/giexp_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'helper'
|
2
|
-
require 'giexp'
|
2
|
+
require 'giexp/run'
|
3
3
|
|
4
4
|
describe Giexp do
|
5
5
|
describe "with a issues command" do
|
6
6
|
it "should not raise an error" do
|
7
7
|
lambda {
|
8
|
-
Giexp.
|
8
|
+
Giexp::Run.new({:login => "octocat", :password => "passpass"})
|
9
9
|
}.should_not raise_error
|
10
10
|
end
|
11
11
|
end
|
data/spec/issues_spec.rb
CHANGED
@@ -14,9 +14,6 @@ describe Giexp::Client do
|
|
14
14
|
stub_get("/users/octocat/repos").
|
15
15
|
to_return(:body => fixture("repos_user.json"))
|
16
16
|
|
17
|
-
stub_get("/repos/octocat/DummyRepo").
|
18
|
-
to_return(:body => fixture("repo.json"))
|
19
|
-
|
20
17
|
stub_get("/repos/octocat/DummyRepo/issues?status=open").
|
21
18
|
to_return(:body => fixture("issues_open.json"))
|
22
19
|
|
@@ -35,9 +32,6 @@ describe Giexp::Client do
|
|
35
32
|
stub_get("/orgs/iroha/repos").
|
36
33
|
to_return(:body => fixture("repos_org.json"))
|
37
34
|
|
38
|
-
stub_get("/repos/iroha/DummyRepo").
|
39
|
-
to_return(:body => fixture("repo.json"))
|
40
|
-
|
41
35
|
stub_get("/repos/iroha/DummyRepo/issues?status=open").
|
42
36
|
to_return(:body => fixture("issues_open.json"))
|
43
37
|
|
@@ -51,6 +45,42 @@ describe Giexp::Client do
|
|
51
45
|
end
|
52
46
|
end
|
53
47
|
|
48
|
+
context "with a user name and the specified repository" do
|
49
|
+
it "should return user's repository" do
|
50
|
+
stub_get("/repos/octocat/DummyRepo").
|
51
|
+
to_return(:body => fixture("repo.json"))
|
52
|
+
|
53
|
+
stub_get("/repos/octocat/DummyRepo/issues?status=open").
|
54
|
+
to_return(:body => fixture("issues_open.json"))
|
55
|
+
|
56
|
+
stub_get("/repos/octocat/DummyRepo/issues?status=closed").
|
57
|
+
to_return(:body => fixture("issues_close.json"))
|
58
|
+
|
59
|
+
issues = @client.issues(:user => "octocat", :repository => "DummyRepo")
|
60
|
+
issues.name.should == "DummyRepo"
|
61
|
+
issues.issues.should have(4).items
|
62
|
+
issues.issues.first.number == "1348"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context "with an organization name and the specified repository" do
|
67
|
+
it "should return organization's repository" do
|
68
|
+
stub_get("/repos/iroha/DummyRepo").
|
69
|
+
to_return(:body => fixture("repo.json"))
|
70
|
+
|
71
|
+
stub_get("/repos/iroha/DummyRepo/issues?status=open").
|
72
|
+
to_return(:body => fixture("issues_open.json"))
|
73
|
+
|
74
|
+
stub_get("/repos/iroha/DummyRepo/issues?status=closed").
|
75
|
+
to_return(:body => fixture("issues_close.json"))
|
76
|
+
|
77
|
+
issues = @client.issues(:organization => "iroha", :repository => "DummyRepo")
|
78
|
+
issues.name.should == "DummyRepo"
|
79
|
+
issues.issues.should have(4).items
|
80
|
+
issues.issues.first.number == "1348"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
54
84
|
end
|
55
85
|
|
56
86
|
end
|
data/spec/repos_spec.rb
CHANGED
@@ -18,7 +18,7 @@ describe Giexp::Client do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
context "with
|
21
|
+
context "with an organization name" do
|
22
22
|
it "should return organization's repositories" do
|
23
23
|
stub_get("/orgs/iroha/repos").
|
24
24
|
to_return(:body => fixture("repos_org.json"))
|
@@ -30,4 +30,24 @@ describe Giexp::Client do
|
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
+
describe ".repository" do
|
34
|
+
context "with a user name" do
|
35
|
+
it "should return user's repository" do
|
36
|
+
stub_get("/repos/octocat/DummyRepo").
|
37
|
+
to_return(:body => fixture("repo.json"))
|
38
|
+
repository = @client.repository(:user => "octocat", :repository => "DummyRepo")
|
39
|
+
repository.name.should == "DummyRepo"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "with an organization name" do
|
44
|
+
it "should return organization's repository" do
|
45
|
+
stub_get("/repos/iroha/DummyRepo").
|
46
|
+
to_return(:body => fixture("repo.json"))
|
47
|
+
repository = @client.repository(:organization => "iroha", :repository => "DummyRepo")
|
48
|
+
repository.name.should == "DummyRepo"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
33
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giexp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70308036444540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.8.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70308036444540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70308036442380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.9'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70308036442380
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: octokit
|
38
|
-
requirement: &
|
38
|
+
requirement: &70308036441720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70308036441720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: webmock
|
49
|
-
requirement: &
|
49
|
+
requirement: &70308036440720 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 1.8.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70308036440720
|
58
58
|
description: a tool to export issues on github
|
59
59
|
email: potix2@gmail.com
|
60
60
|
executables:
|