octopi 0.4.3 → 0.4.4
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/.gitignore +5 -0
- data/Rakefile +2 -84
- data/examples/authenticated.rb +20 -0
- data/examples/github.yml.example +14 -0
- data/examples/issues.rb +18 -0
- data/examples/overall.rb +50 -0
- data/lib/octopi/version.rb +3 -0
- data/octopi.gemspec +20 -93
- data/real_world_test/commit_test.rb +20 -0
- data/real_world_test/repository_test.rb +19 -0
- data/real_world_test/test_helper.rb +11 -0
- data/test/.gitconfig +3 -0
- data/test/api_test.rb +58 -0
- data/test/authenticated_test.rb +39 -0
- data/test/base_test.rb +20 -0
- data/test/blob_test.rb +23 -0
- data/test/branch_test.rb +20 -0
- data/test/commit_test.rb +89 -0
- data/test/file_object_test.rb +39 -0
- data/test/gist_test.rb +16 -0
- data/test/issue_comment.rb +19 -0
- data/test/issue_set_test.rb +33 -0
- data/test/issue_test.rb +136 -0
- data/test/key_set_test.rb +29 -0
- data/test/key_test.rb +35 -0
- data/test/repository_set_test.rb +23 -0
- data/test/repository_test.rb +164 -0
- data/test/stubs/account +691 -0
- data/test/stubs/blob/fcoury/octopi/plain/f6609209c3ac0badd004512d318bfaa508ea10ae +20 -0
- data/test/stubs/comments/fcoury/octopi/comments +30 -0
- data/test/stubs/comments/fcoury/octopi/comments.atom +48 -0
- data/test/stubs/commits/fcoury/octopi/f6609209c3ac0badd004512d318bfaa508ea10ae +94 -0
- data/test/stubs/commits/fcoury/octopi/lazy +491 -0
- data/test/stubs/commits/fcoury/octopi/master +477 -0
- data/test/stubs/commits/fcoury/octopi/octopi.rb +818 -0
- data/test/stubs/commits/fcoury/rboard/master +437 -0
- data/test/stubs/dashboard +231 -0
- data/test/stubs/errors/repository/not_found +16 -0
- data/test/stubs/gists/159579 +18 -0
- data/test/stubs/issues/fcoury/octopi/27 +42 -0
- data/test/stubs/issues/fcoury/octopi/27-reopened +27 -0
- data/test/stubs/issues/fcoury/octopi/28 +27 -0
- data/test/stubs/issues/fcoury/octopi/28-closed +27 -0
- data/test/stubs/issues/fcoury/octopi/28-edited +27 -0
- data/test/stubs/issues/fcoury/octopi/closed +175 -0
- data/test/stubs/issues/fcoury/octopi/comment/28-comment +15 -0
- data/test/stubs/issues/fcoury/octopi/labels/28-maybe-two-point-oh +16 -0
- data/test/stubs/issues/fcoury/octopi/labels/28-one-point-oh +16 -0
- data/test/stubs/issues/fcoury/octopi/labels/28-remove-maybe-two-point-oh +14 -0
- data/test/stubs/issues/fcoury/octopi/labels/28-remove-one-point-oh +15 -0
- data/test/stubs/issues/fcoury/octopi/new +27 -0
- data/test/stubs/issues/fcoury/octopi/open +329 -0
- data/test/stubs/issues/fcoury/octopi/search +139 -0
- data/test/stubs/login +157 -0
- data/test/stubs/repos/fcoury/octopi/branches +18 -0
- data/test/stubs/repos/fcoury/octopi/collaborators +16 -0
- data/test/stubs/repos/fcoury/octopi/delete-token +13 -0
- data/test/stubs/repos/fcoury/octopi/languages +16 -0
- data/test/stubs/repos/fcoury/octopi/main +12 -0
- data/test/stubs/repos/fcoury/octopi/master +24 -0
- data/test/stubs/repos/fcoury/octopi/tags +23 -0
- data/test/stubs/repos/fcoury/octopus/main +24 -0
- data/test/stubs/repos/fcoury/rboard/main +12 -0
- data/test/stubs/repos/fcoury/rboard/master +24 -0
- data/test/stubs/repos/search +238 -0
- data/test/stubs/repos/show/fcoury +463 -0
- data/test/stubs/repos/show/fcoury-private +454 -0
- data/test/stubs/tree/fcoury/octopi/f6609209c3ac0badd004512d318bfaa508ea10ae +54 -0
- data/test/stubs/users/Caged +26 -0
- data/test/stubs/users/FooBarWidget +26 -0
- data/test/stubs/users/aslakhellesoy +26 -0
- data/test/stubs/users/augustl +26 -0
- data/test/stubs/users/bcalloway +26 -0
- data/test/stubs/users/benaskins +26 -0
- data/test/stubs/users/benhoskings +26 -0
- data/test/stubs/users/bjeanes +27 -0
- data/test/stubs/users/cldwalker +26 -0
- data/test/stubs/users/danlucraft +26 -0
- data/test/stubs/users/dchelimsky +26 -0
- data/test/stubs/users/dcrec1 +26 -0
- data/test/stubs/users/defunkt +26 -0
- data/test/stubs/users/derencius +26 -0
- data/test/stubs/users/diy +21 -0
- data/test/stubs/users/documentcloud +26 -0
- data/test/stubs/users/drnic +26 -0
- data/test/stubs/users/dustin +26 -0
- data/test/stubs/users/eladmeidar +26 -0
- data/test/stubs/users/elliottcable +26 -0
- data/test/stubs/users/entp +26 -0
- data/test/stubs/users/fcoury +26 -0
- data/test/stubs/users/fcoury-private +36 -0
- data/test/stubs/users/follow +15 -0
- data/test/stubs/users/follow-rails +15 -0
- data/test/stubs/users/followers +24 -0
- data/test/stubs/users/following +28 -0
- data/test/stubs/users/giraffesoft +26 -0
- data/test/stubs/users/gwoliveira +26 -0
- data/test/stubs/users/hashrocket +26 -0
- data/test/stubs/users/hcatlin +26 -0
- data/test/stubs/users/jamis +26 -0
- data/test/stubs/users/jnicklas +26 -0
- data/test/stubs/users/jnunemaker +26 -0
- data/test/stubs/users/jruby +21 -0
- data/test/stubs/users/kballard +26 -0
- data/test/stubs/users/kchris +26 -0
- data/test/stubs/users/key-added +20 -0
- data/test/stubs/users/key-removed +17 -0
- data/test/stubs/users/keys +21 -0
- data/test/stubs/users/knewter +26 -0
- data/test/stubs/users/lachie +26 -0
- data/test/stubs/users/lachlanhardy +26 -0
- data/test/stubs/users/lenary +26 -0
- data/test/stubs/users/lifo +26 -0
- data/test/stubs/users/maccman +26 -0
- data/test/stubs/users/markgandolfo +26 -0
- data/test/stubs/users/mbleigh +26 -0
- data/test/stubs/users/mhodgson +26 -0
- data/test/stubs/users/mocra +26 -0
- data/test/stubs/users/mojombo +26 -0
- data/test/stubs/users/newbamboo +26 -0
- data/test/stubs/users/notahat +26 -0
- data/test/stubs/users/opscode +26 -0
- data/test/stubs/users/paulorv +26 -0
- data/test/stubs/users/pvande +21 -0
- data/test/stubs/users/rack +26 -0
- data/test/stubs/users/radar +26 -0
- data/test/stubs/users/rails +26 -0
- data/test/stubs/users/railscampau +21 -0
- data/test/stubs/users/redinger +26 -0
- data/test/stubs/users/remi +26 -0
- data/test/stubs/users/search-radar +27 -0
- data/test/stubs/users/shanesveller +26 -0
- data/test/stubs/users/shuber +26 -0
- data/test/stubs/users/softprops +26 -0
- data/test/stubs/users/superfeedr +26 -0
- data/test/stubs/users/svenfuchs +26 -0
- data/test/stubs/users/taylorrf +26 -0
- data/test/stubs/users/technoweenie +26 -0
- data/test/stubs/users/tgraham +26 -0
- data/test/stubs/users/thoughtbot +26 -0
- data/test/stubs/users/tmm1 +26 -0
- data/test/stubs/users/tobi +26 -0
- data/test/stubs/users/tpope +26 -0
- data/test/stubs/users/unfollow-rails +14 -0
- data/test/stubs/users/watched-repos +1668 -0
- data/test/stubs/users/webbynode +26 -0
- data/test/stubs/users/wvanbergen +26 -0
- data/test/stubs/users/wycats +26 -0
- data/test/tag_test.rb +20 -0
- data/test/test_helper.rb +251 -0
- data/test/user_test.rb +97 -0
- data/test_auth.rb +5 -0
- metadata +359 -73
data/.gitignore
ADDED
data/Rakefile
CHANGED
|
@@ -1,60 +1,8 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'rake'
|
|
3
|
-
require '
|
|
3
|
+
require 'bundler'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require 'jeweler'
|
|
7
|
-
Jeweler::Tasks.new do |gem|
|
|
8
|
-
gem.name = "octopi"
|
|
9
|
-
gem.summary = %Q{A Ruby interface to GitHub API v2}
|
|
10
|
-
gem.email = "felipe.coury@gmail.com"
|
|
11
|
-
gem.homepage = "http://github.com/fcoury/octopi"
|
|
12
|
-
gem.authors = ["Felipe Coury"]
|
|
13
|
-
gem.rubyforge_project = "octopi"
|
|
14
|
-
gem.add_dependency('nokogiri', '>= 1.3.1')
|
|
15
|
-
gem.add_dependency('httparty', '>= 0.4.5')
|
|
16
|
-
gem.add_dependency('mechanize', '>= 0.9.3')
|
|
17
|
-
gem.add_dependency('api_cache', '>= 0')
|
|
18
|
-
gem.add_development_dependency 'shoulda'
|
|
19
|
-
gem.add_development_dependency 'fakeweb'
|
|
20
|
-
gem.files.exclude 'test/**/*'
|
|
21
|
-
gem.files.exclude 'test*'
|
|
22
|
-
gem.files.exclude 'doc/**/*'
|
|
23
|
-
gem.files.exclude 'examples/**/*'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
27
|
-
end
|
|
28
|
-
Jeweler::GemcutterTasks.new
|
|
29
|
-
rescue LoadError
|
|
30
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
begin
|
|
34
|
-
require 'rake/contrib/sshpublisher'
|
|
35
|
-
namespace :rubyforge do
|
|
36
|
-
|
|
37
|
-
desc "Release gem and RDoc documentation to RubyForge"
|
|
38
|
-
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
|
39
|
-
|
|
40
|
-
namespace :release do
|
|
41
|
-
desc "Publish RDoc to RubyForge."
|
|
42
|
-
task :docs => [:rdoc] do
|
|
43
|
-
config = YAML.load(
|
|
44
|
-
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
host = "#{config['username']}@rubyforge.org"
|
|
48
|
-
remote_dir = "/var/www/gforge-projects/octopi/"
|
|
49
|
-
local_dir = 'rdoc'
|
|
50
|
-
|
|
51
|
-
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
rescue LoadError
|
|
56
|
-
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
|
57
|
-
end
|
|
5
|
+
Bundler::GemHelper.install_tasks
|
|
58
6
|
|
|
59
7
|
require 'rake/testtask'
|
|
60
8
|
Rake::TestTask.new(:test) do |test|
|
|
@@ -64,34 +12,4 @@ Rake::TestTask.new(:test) do |test|
|
|
|
64
12
|
test.verbose = false
|
|
65
13
|
end
|
|
66
14
|
|
|
67
|
-
begin
|
|
68
|
-
require 'rcov/rcovtask'
|
|
69
|
-
Rcov::RcovTask.new do |test|
|
|
70
|
-
test.libs << 'test'
|
|
71
|
-
test.pattern = 'test/**/*_test.rb'
|
|
72
|
-
test.verbose = true
|
|
73
|
-
end
|
|
74
|
-
rescue LoadError
|
|
75
|
-
task :rcov do
|
|
76
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
|
|
81
15
|
task :default => :test
|
|
82
|
-
|
|
83
|
-
require 'rake/rdoctask'
|
|
84
|
-
Rake::RDocTask.new do |rdoc|
|
|
85
|
-
if File.exist?('VERSION.yml')
|
|
86
|
-
config = YAML.load(File.read('VERSION.yml'))
|
|
87
|
-
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
|
88
|
-
else
|
|
89
|
-
version = ""
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
93
|
-
rdoc.title = "octopi #{version}"
|
|
94
|
-
rdoc.rdoc_files.include('README*')
|
|
95
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
96
|
-
end
|
|
97
|
-
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Octopi GitHub API configuration file
|
|
3
|
+
#
|
|
4
|
+
|
|
5
|
+
# GitHub user login and token
|
|
6
|
+
login: github-username
|
|
7
|
+
token: github-token
|
|
8
|
+
|
|
9
|
+
# Trace level
|
|
10
|
+
# Possible values:
|
|
11
|
+
# false - no tracing, same as if the param is ommited
|
|
12
|
+
# true - will output each POST or GET operation to the stdout
|
|
13
|
+
# curl - same as true, but in addition will output the curl equivalent of each command (for debugging)
|
|
14
|
+
trace: curl
|
data/examples/issues.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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}"
|
data/examples/overall.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
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
|
data/octopi.gemspec
CHANGED
|
@@ -1,99 +1,26 @@
|
|
|
1
|
-
# Generated by jeweler
|
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
+
require "octopi/version"
|
|
5
4
|
|
|
6
5
|
Gem::Specification.new do |s|
|
|
7
|
-
s.name
|
|
8
|
-
s.version
|
|
6
|
+
s.name = "octopi"
|
|
7
|
+
s.version = Octopi::VERSION
|
|
8
|
+
s.platform = Gem::Platform::RUBY
|
|
9
|
+
s.authors = ["Felipe Coury", "Ryan Bigg"]
|
|
10
|
+
s.email = ["felipe.coury@gmail.com", "radarlistener@gmail.com"]
|
|
11
|
+
s.homepage = ""
|
|
12
|
+
s.summary = %q{A Ruby interface to GitHub API v2}
|
|
13
|
+
s.description = %q{A Ruby interface to GitHub API v2}
|
|
9
14
|
|
|
10
|
-
s.
|
|
11
|
-
s.
|
|
12
|
-
s.
|
|
13
|
-
s.email = %q{felipe.coury@gmail.com}
|
|
14
|
-
s.extra_rdoc_files = [
|
|
15
|
-
"LICENSE",
|
|
16
|
-
"README.markdown"
|
|
17
|
-
]
|
|
18
|
-
s.files = [
|
|
19
|
-
".yardoc",
|
|
20
|
-
"CHANGELOG.md",
|
|
21
|
-
"Gemfile",
|
|
22
|
-
"Gemfile.lock",
|
|
23
|
-
"LICENSE",
|
|
24
|
-
"README.markdown",
|
|
25
|
-
"Rakefile",
|
|
26
|
-
"VERSION.yml",
|
|
27
|
-
"contrib/backup.rb",
|
|
28
|
-
"lib/ext/string_ext.rb",
|
|
29
|
-
"lib/octopi.rb",
|
|
30
|
-
"lib/octopi/api.rb",
|
|
31
|
-
"lib/octopi/base.rb",
|
|
32
|
-
"lib/octopi/blob.rb",
|
|
33
|
-
"lib/octopi/branch.rb",
|
|
34
|
-
"lib/octopi/branch_set.rb",
|
|
35
|
-
"lib/octopi/comment.rb",
|
|
36
|
-
"lib/octopi/commit.rb",
|
|
37
|
-
"lib/octopi/error.rb",
|
|
38
|
-
"lib/octopi/file_object.rb",
|
|
39
|
-
"lib/octopi/gist.rb",
|
|
40
|
-
"lib/octopi/issue.rb",
|
|
41
|
-
"lib/octopi/issue_comment.rb",
|
|
42
|
-
"lib/octopi/issue_set.rb",
|
|
43
|
-
"lib/octopi/key.rb",
|
|
44
|
-
"lib/octopi/key_set.rb",
|
|
45
|
-
"lib/octopi/plan.rb",
|
|
46
|
-
"lib/octopi/repository.rb",
|
|
47
|
-
"lib/octopi/repository_set.rb",
|
|
48
|
-
"lib/octopi/resource.rb",
|
|
49
|
-
"lib/octopi/self.rb",
|
|
50
|
-
"lib/octopi/tag.rb",
|
|
51
|
-
"lib/octopi/user.rb",
|
|
52
|
-
"octopi.gemspec"
|
|
53
|
-
]
|
|
54
|
-
s.homepage = %q{http://github.com/fcoury/octopi}
|
|
15
|
+
s.files = `git ls-files`.split("\n")
|
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
55
18
|
s.require_paths = ["lib"]
|
|
56
|
-
|
|
57
|
-
s.
|
|
58
|
-
s.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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"])
|
|
68
|
-
s.add_runtime_dependency(%q<nokogiri>, [">= 1.3.1"])
|
|
69
|
-
s.add_runtime_dependency(%q<httparty>, [">= 0.4.5"])
|
|
70
|
-
s.add_runtime_dependency(%q<mechanize>, [">= 0.9.3"])
|
|
71
|
-
s.add_runtime_dependency(%q<api_cache>, [">= 0"])
|
|
72
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
|
73
|
-
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
|
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"])
|
|
79
|
-
s.add_dependency(%q<nokogiri>, [">= 1.3.1"])
|
|
80
|
-
s.add_dependency(%q<httparty>, [">= 0.4.5"])
|
|
81
|
-
s.add_dependency(%q<mechanize>, [">= 0.9.3"])
|
|
82
|
-
s.add_dependency(%q<api_cache>, [">= 0"])
|
|
83
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
84
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
|
85
|
-
end
|
|
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"])
|
|
91
|
-
s.add_dependency(%q<nokogiri>, [">= 1.3.1"])
|
|
92
|
-
s.add_dependency(%q<httparty>, [">= 0.4.5"])
|
|
93
|
-
s.add_dependency(%q<mechanize>, [">= 0.9.3"])
|
|
94
|
-
s.add_dependency(%q<api_cache>, [">= 0"])
|
|
95
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
96
|
-
s.add_dependency(%q<fakeweb>, [">= 0"])
|
|
97
|
-
end
|
|
19
|
+
|
|
20
|
+
s.add_dependency(%q<nokogiri>, [">= 1.3.1"])
|
|
21
|
+
s.add_dependency(%q<httparty>, [">= 0.4.5"])
|
|
22
|
+
s.add_dependency(%q<mechanize>, [">= 0.9.3"])
|
|
23
|
+
s.add_dependency(%q<api_cache>, [">= 0"])
|
|
24
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
|
25
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
|
98
26
|
end
|
|
99
|
-
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# IF TEST FAILS PLEASE SEE TEST_HELPER FOR REASON
|
|
2
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
|
3
|
+
|
|
4
|
+
class CommitTest < Test::Unit::TestCase
|
|
5
|
+
include Octopi
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@user = User.find("radar")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
context Commit do
|
|
13
|
+
should "return a commit for a private repository when authed" do
|
|
14
|
+
authenticated do
|
|
15
|
+
repository = @user.repository(:name => "select-copiers")
|
|
16
|
+
assert_not_nil repository.commits
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# IF TEST FAILS PLEASE SEE TEST_HELPER FOR REASON
|
|
2
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
|
3
|
+
|
|
4
|
+
class RepositoryTest < Test::Unit::TestCase
|
|
5
|
+
include Octopi
|
|
6
|
+
|
|
7
|
+
def setup
|
|
8
|
+
@user = User.find("radar")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
context Repository do
|
|
13
|
+
should "return a private repository when authed" do
|
|
14
|
+
authenticated do
|
|
15
|
+
assert_not_nil @user.repository(:name => "select-copiers")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# These are the real world tests using real world data.
|
|
2
|
+
# Whilst the tests are good for ensuring Nothing Goes Wrong,
|
|
3
|
+
# It isn't good to always use fake data because you're fooling yourself.
|
|
4
|
+
# This test data uses my own personal ~/.gitconfig and will probably not work for you.
|
|
5
|
+
require 'rubygems'
|
|
6
|
+
require 'test/unit'
|
|
7
|
+
require 'shoulda'
|
|
8
|
+
|
|
9
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
10
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
11
|
+
require 'octopi'
|
data/test/.gitconfig
ADDED
data/test/api_test.rb
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
|
2
|
+
|
|
3
|
+
class AuthenticatedTest < Test::Unit::TestCase
|
|
4
|
+
include Octopi
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
fake_everything
|
|
8
|
+
@user = User.find("fcoury")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
context "following" do
|
|
12
|
+
|
|
13
|
+
should "not be able to follow anyone if not authenticated" do
|
|
14
|
+
exception = assert_raise AuthenticationRequired do
|
|
15
|
+
Api.me.follow!("rails")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
should "be able to follow a user" do
|
|
20
|
+
auth do
|
|
21
|
+
assert_not_nil Api.me.follow!("rails")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context "unfollowing" do
|
|
27
|
+
|
|
28
|
+
should "not be able to follow anyone if not authenticated" do
|
|
29
|
+
exception = assert_raise AuthenticationRequired do
|
|
30
|
+
Api.me.unfollow!("rails")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
should "be able to follow a user" do
|
|
35
|
+
auth do
|
|
36
|
+
assert_not_nil Api.me.unfollow!("rails")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context "keys" do
|
|
42
|
+
should "not be able to see keys if not authenticated" do
|
|
43
|
+
exception = assert_raise AuthenticationRequired do
|
|
44
|
+
Api.me.keys
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
assert_equal "To view keys, you must be authenticated", exception.message
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
should "have some keys" do
|
|
51
|
+
auth do
|
|
52
|
+
keys = Api.me.keys
|
|
53
|
+
assert keys.is_a?(KeySet)
|
|
54
|
+
assert_equal 2, keys.size
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|