octokit 3.0.0.pre → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba2a0b7ef2fe7ccfc4d47d20101e1bf1df5352b6
4
- data.tar.gz: 00d6d398a4682911be8b46d7cc0e0a5320afbdd4
3
+ metadata.gz: 3127ed71ac877e994dfeaae2386caba2cfe91d38
4
+ data.tar.gz: aeb738769c892c656de0d0971e18763de18f8e3a
5
5
  SHA512:
6
- metadata.gz: d754b8c098880c8e738ba09b2c96db93e5ec70961cb8b3a9b20876ebf6f3034f70f662bf63f6268f596d5aaa740c6fb06996db714148319a1e20d95028ba4f9d
7
- data.tar.gz: 8c164081ca60967730307c8d98dd1822cb0bc3ada9876cd192ca39d9ac790881e7424f53b1762929b64078bd374211d215a5c0ee65708c64c68fbe122ee70dd1
6
+ metadata.gz: d14f5d8127f946870995ff7a92ccb31945ef90da7b82fce8878f921bf53c8a1ce8e285c2dc13eeae12189d7416673136b98bba1813b77b1a8cabc647323a3d9b
7
+ data.tar.gz: 69f7d0a715685c0506a25b44bc44533fb7baff7a815db31587a8ce260f9b7445a4d9a13995a64667d05afc538a4636deec7bb2a4d588921c06592951e520ae3a
data/README.md CHANGED
@@ -285,6 +285,10 @@ Octokit.api_endpoint
285
285
  # => "http://api.github.dev"
286
286
  ```
287
287
 
288
+ Deprecation warnings and API endpoints in development preview warnings are
289
+ printed to STDOUT by default, these can be disabled by setting the ENV
290
+ `OCTOKIT_SILENT=true`.
291
+
288
292
  ## Hypermedia agent
289
293
 
290
294
  Starting in version 2.0, Octokit is [hypermedia][]-enabled. Under the hood,
@@ -60,13 +60,13 @@ module Octokit
60
60
  creds = info[netrc_host]
61
61
  if creds.nil?
62
62
  # creds will be nil if there is no netrc for this end point
63
- warn "Error loading credentials from netrc file for #{api_endpoint}"
63
+ octokit_warn "Error loading credentials from netrc file for #{api_endpoint}"
64
64
  else
65
65
  self.login = creds.shift
66
66
  self.password = creds.shift
67
67
  end
68
68
  rescue LoadError
69
- warn "Please install netrc gem for .netrc support"
69
+ octokit_warn "Please install netrc gem for .netrc support"
70
70
  end
71
71
 
72
72
  end
@@ -300,5 +300,14 @@ module Octokit
300
300
  opts
301
301
  end
302
302
 
303
+ # Wrapper around Kernel#warn to print warnings unless
304
+ # OCTOKIT_SILENT is set to true.
305
+ #
306
+ # @return [nil]
307
+ def octokit_warn(*message)
308
+ unless ENV['OCTOKIT_SILENT']
309
+ warn message
310
+ end
311
+ end
303
312
  end
304
313
  end
@@ -51,6 +51,7 @@ module Octokit
51
51
  # @return [Sawyer::Resource] A single authorization for the authenticated user
52
52
  # @see http://developer.github.com/v3/oauth/#scopes Available scopes
53
53
  # @see http://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
54
+ # @see http://developer.github.com/v3/oauth_authorizations/#get-or-create-an-authorization-for-a-specific-app
54
55
  # @example Create a new authorization for user ctshryock's project Zoidberg
55
56
  # client = Octokit::Client.new(:login => 'ctshryock', :password => 'secret')
56
57
  # client.create_authorization({:scopes => ["public_repo","gist"], :note => "Why not Zoidberg?", :note_url=> "https://en.wikipedia.org/wiki/Zoidberg"})
@@ -42,7 +42,7 @@ module Octokit
42
42
  # @param repo [String, Repository, Hash] A GitHub repository
43
43
  # @param path [String] A path for the new content
44
44
  # @param message [String] A commit message for adding the content
45
- # @param optional content [String] The Base64-encoded content for the file
45
+ # @param optional content [String] The content for the file
46
46
  # @option options [String] :branch The branch on which to add the content
47
47
  # @option options [String] :file Path or Ruby File object for content
48
48
  # @return [Sawyer::Resource] The contents and commit info for the addition
@@ -51,7 +51,7 @@ module Octokit
51
51
  # Octokit.create_contents("octokit/octokit.rb",
52
52
  # "lib/octokit.rb",
53
53
  # "Adding content",
54
- # "asdf9as0df9asdf8as0d9f8==...",
54
+ # "File content",
55
55
  # :branch => "my-new-feature")
56
56
  def create_contents(*args)
57
57
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -91,7 +91,7 @@ module Octokit
91
91
  # @param path [String] A path for the content to update
92
92
  # @param message [String] A commit message for updating the content
93
93
  # @param sha [String] The _blob sha_ of the content to update
94
- # @param content [String] The Base64-encoded content for the file
94
+ # @param content [String] The content for the file
95
95
  # @option options [String] :branch The branch on which to update the content
96
96
  # @option options [String] :file Path or Ruby File object for content
97
97
  # @return [Sawyer::Resource] The contents and commit info for the update
@@ -101,7 +101,7 @@ module Octokit
101
101
  # "lib/octokit.rb",
102
102
  # "Updating content",
103
103
  # "7eb95f97e1a0636015df3837478d3f15184a5f49",
104
- # "asdf9as0df9asdf8as0d9f8==...",
104
+ # "File content",
105
105
  # :branch => "my-new-feature")
106
106
  def update_contents(*args)
107
107
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -72,7 +72,7 @@ module Octokit
72
72
  end
73
73
 
74
74
  def warn_deployments_preview
75
- warn <<-EOS
75
+ octokit_warn <<-EOS
76
76
  WARNING: The preview version of the Deployments API is not yet suitable for production use.
77
77
  You can avoid this message by supplying an appropriate media type in the 'Accept' request
78
78
  header. See the blog post for details: http://git.io/o2XZRA
@@ -26,7 +26,7 @@ module Octokit
26
26
  opts = arguments.options
27
27
  repo = arguments.shift
28
28
  if state = arguments.shift
29
- warn "DEPRECATED: Client#pull_requests: Passing state as positional argument is deprecated. Please use :state => '#{state}'"
29
+ octokit_warn "DEPRECATED: Client#pull_requests: Passing state as positional argument is deprecated. Please use :state => '#{state}'"
30
30
  opts[:state] = state if state
31
31
  end
32
32
  paginate "repos/#{Repository.new(repo)}/pulls", opts
@@ -23,7 +23,7 @@ module Octokit
23
23
  # @see http://developer.github.com/v3/rate_limit/#rate-limit
24
24
  # @return [Fixnum] Number of requests remaining in this period
25
25
  def rate_limit_remaining(options = {})
26
- puts "Deprecated: Please use .rate_limit.remaining"
26
+ octokit_warn "Deprecated: Please use .rate_limit.remaining"
27
27
  rate_limit.remaining
28
28
  end
29
29
  alias ratelimit_remaining rate_limit_remaining
@@ -43,7 +43,7 @@ module Octokit
43
43
  # @see http://developer.github.com/v3/rate_limit/#rate-limit
44
44
  # @return [Fixnum] Number of requests remaining in this period
45
45
  def rate_limit_remaining!(options = {})
46
- puts "Deprecated: Please use .rate_limit!.remaining"
46
+ octokit_warn "Deprecated: Please use .rate_limit!.remaining"
47
47
  rate_limit!.remaining
48
48
  end
49
49
  alias ratelimit_remaining! rate_limit_remaining!
@@ -50,13 +50,17 @@ module Octokit
50
50
  alias :update_repository :edit_repository
51
51
  alias :update :edit_repository
52
52
 
53
- # List repositories
53
+ # List user repositories
54
54
  #
55
55
  # If username is not supplied, repositories for the current
56
- # authenticated user are returned
56
+ # authenticated user are returned.
57
57
  #
58
+ # @note If the username provided is a GitHub organization, only the
59
+ # organization's public repositories will be listed. For retrieving
60
+ # organization repositories the {Organizations#organization_repositories}
61
+ # method should be used instead.
58
62
  # @see http://developer.github.com/v3/repos/#list-your-repositories
59
- # @see http://developer.github.com/v3/repos/#list-user-repositories
63
+ # @see http://developer.github.com/v3/repos/#list-user-repositories
60
64
  # @param username [String] Optional username for which to list repos
61
65
  # @return [Array<Sawyer::Resource>] List of repositories
62
66
  def repositories(username=nil, options = {})
@@ -484,7 +488,7 @@ module Octokit
484
488
  #
485
489
  # @param repo [String, Hash, Repository] A GitHub repository.
486
490
  # @return [Array<Sawyer::Resource>] Array of hashes representing hooks.
487
- # @see http://developer.github.com/v3/repos/hooks/#list
491
+ # @see http://developer.github.com/v3/repos/hooks/#list-hooks
488
492
  # @example
489
493
  # @client.hooks('octokit/octokit.rb')
490
494
  def hooks(repo, options = {})
@@ -5,6 +5,7 @@ module Octokit
5
5
  #
6
6
  # @see http://developer.github.com/v3/repos/statuses/
7
7
  module Statuses
8
+ COMBINED_STATUS_MEDIA_TYPE = "application/vnd.github.she-hulk-preview+json"
8
9
 
9
10
  # List all statuses for a given commit
10
11
  #
@@ -17,17 +18,50 @@ module Octokit
17
18
  end
18
19
  alias :list_statuses :statuses
19
20
 
21
+ # Get the combined status for a ref
22
+ #
23
+ # @param repo [String, Repository, Hash] a GitHub repository
24
+ # @param ref [String] A Sha or Ref to fetch the status of
25
+ # @return [Sawyer::Resource] The combined status for the commit
26
+ # @see https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref
27
+ def combined_status(repo, ref, options = {})
28
+ ensure_combined_status_api_media_type(options)
29
+ get "repos/#{Repository.new(repo)}/commits/#{ref}/status", options
30
+ end
31
+ alias :status :combined_status
32
+
20
33
  # Create status for a commit
21
34
  #
22
35
  # @param repo [String, Repository, Hash] A GitHub repository
23
36
  # @param sha [String] The SHA1 for the commit
24
37
  # @param state [String] The state: pending, success, failure, error
38
+ # @option options [String] :context A context to differentiate this status from others
39
+ # @option options [String] :target_url A link to more details about this status
40
+ # @option options [String] :description A short human-readable description of this status
25
41
  # @return [Sawyer::Resource] A status
26
42
  # @see http://developer.github.com/v3/repos/statuses/#create-a-status
27
43
  def create_status(repo, sha, state, options = {})
28
44
  options.merge!(:state => state)
29
45
  post "repos/#{Repository.new(repo)}/statuses/#{sha}", options
30
46
  end
47
+
48
+ private
49
+
50
+ def ensure_combined_status_api_media_type(options = {})
51
+ unless options[:accept]
52
+ options[:accept] = COMBINED_STATUS_MEDIA_TYPE
53
+ warn_combined_status_preview
54
+ end
55
+ options
56
+ end
57
+
58
+ def warn_combined_status_preview
59
+ octokit_warn <<-EOS
60
+ WARNING: The preview version of the combined status API is not yet suitable
61
+ for production use. You can avoid this message by supplying an appropriate
62
+ media type in the 'Accept' header. See the blog post for details http://git.io/wtsdaA
63
+ EOS
64
+ end
31
65
  end
32
66
  end
33
67
  end
@@ -41,8 +41,8 @@ module Octokit
41
41
  # Retrieve the access_token.
42
42
  #
43
43
  # @param code [String] Authorization code generated by GitHub.
44
- # @param app_id [String] Client Id we received when our application was registered with GitHub.
45
- # @param app_secret [String] Client Secret we received when our application was registered with GitHub.
44
+ # @param app_id [String] Client Id we received when our application was registered with GitHub. Defaults to client_id.
45
+ # @param app_secret [String] Client Secret we received when our application was registered with GitHub. Defaults to client_secret.
46
46
  # @return [Sawyer::Resource] Hash holding the access token.
47
47
  # @see http://developer.github.com/v3/oauth/#web-application-flow
48
48
  # @example
@@ -2,6 +2,6 @@ module Octokit
2
2
 
3
3
  # Current version
4
4
  # @return [String]
5
- VERSION = "3.0.0.pre".freeze
5
+ VERSION = "3.0.0".freeze
6
6
 
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-03-06 00:00:00.000000000 Z
13
+ date: 2014-03-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -119,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  version: 1.9.2
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>'
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
- version: 1.3.1
124
+ version: 1.3.5
125
125
  requirements: []
126
126
  rubyforge_project:
127
127
  rubygems_version: 2.0.3