octopi 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
5
+ gem 'jeweler' # will be deprecated eventually
@@ -0,0 +1,36 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ octopi (0.4.2)
5
+ api_cache
6
+ httparty (>= 0.4.5)
7
+ mechanize (>= 0.9.3)
8
+ nokogiri (>= 1.3.1)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ api_cache (0.2.3)
14
+ crack (0.1.8)
15
+ fakeweb (1.3.0)
16
+ git (1.2.5)
17
+ httparty (0.7.7)
18
+ crack (= 0.1.8)
19
+ jeweler (1.6.0)
20
+ bundler (~> 1.0.0)
21
+ git (>= 1.2.5)
22
+ rake
23
+ mechanize (1.0.0)
24
+ nokogiri (>= 1.2.1)
25
+ nokogiri (1.4.4)
26
+ rake (0.8.7)
27
+ shoulda (2.11.3)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ fakeweb
34
+ jeweler
35
+ octopi!
36
+ shoulda
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 2
4
+ :patch: 3
5
5
  :build:
@@ -31,6 +31,17 @@ module Octopi
31
31
  super username
32
32
  end
33
33
 
34
+ # Finds the user with this email.
35
+ #
36
+ # Example:
37
+ #
38
+ # user = User.find_by_email("test@example.com")
39
+ # puts user.email # should return 'test@example.com'
40
+ def self.find_by_email(email)
41
+ response = Api.api.get("/user/email/:email", {:email => email})
42
+ User.new(response["user"])
43
+ end
44
+
34
45
  # Finds all users whose username matches a given string
35
46
  #
36
47
  # Example:
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{octopi}
8
- s.version = "0.4.2"
8
+ s.version = "0.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Felipe Coury"]
12
- s.date = %q{2011-04-28}
12
+ s.date = %q{2011-05-12}
13
13
  s.email = %q{felipe.coury@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.files = [
19
19
  ".yardoc",
20
20
  "CHANGELOG.md",
21
+ "Gemfile",
22
+ "Gemfile.lock",
21
23
  "LICENSE",
22
24
  "README.markdown",
23
25
  "Rakefile",
@@ -52,37 +54,17 @@ Gem::Specification.new do |s|
52
54
  s.homepage = %q{http://github.com/fcoury/octopi}
53
55
  s.require_paths = ["lib"]
54
56
  s.rubyforge_project = %q{octopi}
55
- s.rubygems_version = %q{1.5.2}
57
+ s.rubygems_version = %q{1.6.2}
56
58
  s.summary = %q{A Ruby interface to GitHub API v2}
57
- s.test_files = [
58
- "examples/authenticated.rb",
59
- "examples/issues.rb",
60
- "examples/overall.rb",
61
- "test/api_test.rb",
62
- "test/authenticated_test.rb",
63
- "test/base_test.rb",
64
- "test/blob_test.rb",
65
- "test/branch_test.rb",
66
- "test/commit_test.rb",
67
- "test/file_object_test.rb",
68
- "test/gist_test.rb",
69
- "test/issue_comment.rb",
70
- "test/issue_set_test.rb",
71
- "test/issue_test.rb",
72
- "test/key_set_test.rb",
73
- "test/key_test.rb",
74
- "test/repository_set_test.rb",
75
- "test/repository_test.rb",
76
- "test/stubs/commits/fcoury/octopi/octopi.rb",
77
- "test/tag_test.rb",
78
- "test/test_helper.rb",
79
- "test/user_test.rb"
80
- ]
81
59
 
82
60
  if s.respond_to? :specification_version then
83
61
  s.specification_version = 3
84
62
 
85
63
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
64
+ s.add_runtime_dependency(%q<octopi>, [">= 0"])
65
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
66
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
67
+ s.add_development_dependency(%q<fakeweb>, [">= 0"])
86
68
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.1"])
87
69
  s.add_runtime_dependency(%q<httparty>, [">= 0.4.5"])
88
70
  s.add_runtime_dependency(%q<mechanize>, [">= 0.9.3"])
@@ -90,6 +72,10 @@ Gem::Specification.new do |s|
90
72
  s.add_development_dependency(%q<shoulda>, [">= 0"])
91
73
  s.add_development_dependency(%q<fakeweb>, [">= 0"])
92
74
  else
75
+ s.add_dependency(%q<octopi>, [">= 0"])
76
+ s.add_dependency(%q<jeweler>, [">= 0"])
77
+ s.add_dependency(%q<shoulda>, [">= 0"])
78
+ s.add_dependency(%q<fakeweb>, [">= 0"])
93
79
  s.add_dependency(%q<nokogiri>, [">= 1.3.1"])
94
80
  s.add_dependency(%q<httparty>, [">= 0.4.5"])
95
81
  s.add_dependency(%q<mechanize>, [">= 0.9.3"])
@@ -98,6 +84,10 @@ Gem::Specification.new do |s|
98
84
  s.add_dependency(%q<fakeweb>, [">= 0"])
99
85
  end
100
86
  else
87
+ s.add_dependency(%q<octopi>, [">= 0"])
88
+ s.add_dependency(%q<jeweler>, [">= 0"])
89
+ s.add_dependency(%q<shoulda>, [">= 0"])
90
+ s.add_dependency(%q<fakeweb>, [">= 0"])
101
91
  s.add_dependency(%q<nokogiri>, [">= 1.3.1"])
102
92
  s.add_dependency(%q<httparty>, [">= 0.4.5"])
103
93
  s.add_dependency(%q<mechanize>, [">= 0.9.3"])
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: octopi
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.2
5
+ version: 0.4.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Felipe Coury
@@ -10,75 +10,119 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-28 00:00:00 +10:00
13
+ date: 2011-05-12 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: nokogiri
18
- prerelease: false
17
+ name: octopi
19
18
  requirement: &id001 !ruby/object:Gem::Requirement
20
19
  none: false
21
20
  requirements:
22
21
  - - ">="
23
22
  - !ruby/object:Gem::Version
24
- version: 1.3.1
23
+ version: "0"
25
24
  type: :runtime
25
+ prerelease: false
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: httparty
29
- prerelease: false
28
+ name: jeweler
30
29
  requirement: &id002 !ruby/object:Gem::Requirement
31
30
  none: false
32
31
  requirements:
33
32
  - - ">="
34
33
  - !ruby/object:Gem::Version
35
- version: 0.4.5
34
+ version: "0"
36
35
  type: :runtime
36
+ prerelease: false
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: mechanize
40
- prerelease: false
39
+ name: shoulda
41
40
  requirement: &id003 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: fakeweb
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: nokogiri
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.3.1
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: httparty
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 0.4.5
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: mechanize
84
+ requirement: &id007 !ruby/object:Gem::Requirement
42
85
  none: false
43
86
  requirements:
44
87
  - - ">="
45
88
  - !ruby/object:Gem::Version
46
89
  version: 0.9.3
47
90
  type: :runtime
48
- version_requirements: *id003
91
+ prerelease: false
92
+ version_requirements: *id007
49
93
  - !ruby/object:Gem::Dependency
50
94
  name: api_cache
51
- prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
95
+ requirement: &id008 !ruby/object:Gem::Requirement
53
96
  none: false
54
97
  requirements:
55
98
  - - ">="
56
99
  - !ruby/object:Gem::Version
57
100
  version: "0"
58
101
  type: :runtime
59
- version_requirements: *id004
102
+ prerelease: false
103
+ version_requirements: *id008
60
104
  - !ruby/object:Gem::Dependency
61
105
  name: shoulda
62
- prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
106
+ requirement: &id009 !ruby/object:Gem::Requirement
64
107
  none: false
65
108
  requirements:
66
109
  - - ">="
67
110
  - !ruby/object:Gem::Version
68
111
  version: "0"
69
112
  type: :development
70
- version_requirements: *id005
113
+ prerelease: false
114
+ version_requirements: *id009
71
115
  - !ruby/object:Gem::Dependency
72
116
  name: fakeweb
73
- prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
117
+ requirement: &id010 !ruby/object:Gem::Requirement
75
118
  none: false
76
119
  requirements:
77
120
  - - ">="
78
121
  - !ruby/object:Gem::Version
79
122
  version: "0"
80
123
  type: :development
81
- version_requirements: *id006
124
+ prerelease: false
125
+ version_requirements: *id010
82
126
  description:
83
127
  email: felipe.coury@gmail.com
84
128
  executables: []
@@ -91,6 +135,8 @@ extra_rdoc_files:
91
135
  files:
92
136
  - .yardoc
93
137
  - CHANGELOG.md
138
+ - Gemfile
139
+ - Gemfile.lock
94
140
  - LICENSE
95
141
  - README.markdown
96
142
  - Rakefile
@@ -121,28 +167,6 @@ files:
121
167
  - lib/octopi/tag.rb
122
168
  - lib/octopi/user.rb
123
169
  - octopi.gemspec
124
- - examples/authenticated.rb
125
- - examples/issues.rb
126
- - examples/overall.rb
127
- - test/api_test.rb
128
- - test/authenticated_test.rb
129
- - test/base_test.rb
130
- - test/blob_test.rb
131
- - test/branch_test.rb
132
- - test/commit_test.rb
133
- - test/file_object_test.rb
134
- - test/gist_test.rb
135
- - test/issue_comment.rb
136
- - test/issue_set_test.rb
137
- - test/issue_test.rb
138
- - test/key_set_test.rb
139
- - test/key_test.rb
140
- - test/repository_set_test.rb
141
- - test/repository_test.rb
142
- - test/stubs/commits/fcoury/octopi/octopi.rb
143
- - test/tag_test.rb
144
- - test/test_helper.rb
145
- - test/user_test.rb
146
170
  has_rdoc: true
147
171
  homepage: http://github.com/fcoury/octopi
148
172
  licenses: []
@@ -167,30 +191,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
191
  requirements: []
168
192
 
169
193
  rubyforge_project: octopi
170
- rubygems_version: 1.5.2
194
+ rubygems_version: 1.6.2
171
195
  signing_key:
172
196
  specification_version: 3
173
197
  summary: A Ruby interface to GitHub API v2
174
- test_files:
175
- - examples/authenticated.rb
176
- - examples/issues.rb
177
- - examples/overall.rb
178
- - test/api_test.rb
179
- - test/authenticated_test.rb
180
- - test/base_test.rb
181
- - test/blob_test.rb
182
- - test/branch_test.rb
183
- - test/commit_test.rb
184
- - test/file_object_test.rb
185
- - test/gist_test.rb
186
- - test/issue_comment.rb
187
- - test/issue_set_test.rb
188
- - test/issue_test.rb
189
- - test/key_set_test.rb
190
- - test/key_test.rb
191
- - test/repository_set_test.rb
192
- - test/repository_test.rb
193
- - test/stubs/commits/fcoury/octopi/octopi.rb
194
- - test/tag_test.rb
195
- - test/test_helper.rb
196
- - test/user_test.rb
198
+ test_files: []
199
+
@@ -1,20 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'lib', 'octopi')
2
-
3
- include Octopi
4
-
5
- authenticated :trace => "curl" do |g|
6
- repo = g.repository("api-labrat")
7
-
8
- issue = repo.open_issue :title => "Sample issue",
9
- :body => "This issue was opened using GitHub API and Octopi"
10
- puts "Successfully opened issue \##{issue.number}"
11
-
12
- # # labels = issue.add_label "Working", "Todo"
13
- # # puts "Labels: #{labels.inspect}"
14
-
15
- issue.close
16
- puts "Successfully closed issue \##{issue.number}"
17
-
18
- # labels = issue.remove_label "Todo"
19
- # puts "Successfully removed label Todo. Current labels: #{labels.inspect}"
20
- end
@@ -1,18 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'lib', 'octopi')
2
-
3
- include Octopi
4
-
5
- user = User.find("fcoury")
6
- puts user.name
7
-
8
- repo = user.repository("octopi")
9
- puts repo.description
10
-
11
- issue = Issue.find_all(user.login, repo.name).first
12
- puts "First open issue: #{issue.number} - #{issue.title} - Created at: #{issue.created_at}"
13
-
14
- issue2 = repo.issues.first
15
- puts "First open issue: #{issue.number} - #{issue.title} - Created at: #{issue.created_at}"
16
-
17
- issue3 = repo.issue(issue2.number)
18
- puts "First open issue: #{issue.number} - #{issue.title} - Created at: #{issue.created_at}"
@@ -1,50 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'lib', 'octopi')
2
-
3
- include Octopi
4
-
5
- # user information
6
- user = User.find("fcoury")
7
- puts "#{user.name} is being followed by #{user.followers.join(", ")} and following #{user.following.join(", ")}"
8
-
9
- # the bang version of followers and following
10
- # fetches user object for each user, but is
11
- # a lot more expensive
12
- user.followers!.each do |u|
13
- puts " - #{u.name} (#{u.login}) has #{u.public_repo_count} repo(s)"
14
- end
15
-
16
- # search user
17
- users = User.find_all("silva")
18
- puts "#{users.size} users found for 'silva':"
19
- users.each do |u|
20
- puts " - #{u.name}"
21
- end
22
-
23
- # repository information
24
- # to get all repos for user: user.repositories
25
- repo = user.repository("octopi") # same as: Repository.find("fcoury", "octopi")
26
- puts "Repository: #{repo.name} - #{repo.description} (by #{repo.owner}) - #{repo.url}"
27
- puts " Tags: #{repo.tags and repo.tags.map {|t| t.name}.join(", ")}"
28
-
29
- issue = repo.issues.first
30
- puts "Sample open issue: #{issue.number} - #{issue.title} - Created at: #{issue.created_at}"
31
-
32
- # commits of a the repository
33
- commit = repo.commits.first
34
- puts "Commit: #{commit.id} - #{commit.message} - by #{commit.author['name']}"
35
-
36
- # single commit information
37
- # details is the same as: Commit.find(commit)
38
- puts "Diff:"
39
- commit.modified.each {|m| puts "#{m['filename']} DIFF: #{m['diff']}" }
40
-
41
- # repository search
42
- repos = Repository.find_all("ruby", "git")
43
- puts "#{repos.size} repository(ies) with 'ruby' and 'git':"
44
- repos.each do |r|
45
- puts " - #{r.name}"
46
- end
47
-
48
- # connect "user", "<< token >>" do |github|
49
- # puts github.user.name
50
- # end