octokit-enterprise 0.0.1 → 0.0.2
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/VERSION +1 -1
- data/lib/octokit/enterprise.rb +5 -8
- data/lib/octokit/enterprise/configuration.rb +17 -0
- data/spec/octokit/enterprise_spec.rb +4 -2
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/octokit/enterprise.rb
CHANGED
@@ -1,17 +1,14 @@
|
|
1
1
|
require 'octokit'
|
2
|
+
require 'octokit/enterprise/configuration'
|
2
3
|
|
3
4
|
module Octokit
|
4
5
|
module Enterprise
|
5
|
-
|
6
|
+
extend Configuration
|
6
7
|
|
7
|
-
|
8
|
+
module_function
|
8
9
|
|
9
|
-
def
|
10
|
-
Octokit.
|
11
|
-
CUSTOM_ENDPOINTS.each do |endpoint|
|
12
|
-
c.send "#{endpoint}=", c.send(endpoint).sub('github.com', _hostname_)
|
13
|
-
end
|
14
|
-
end
|
10
|
+
def new(options = {})
|
11
|
+
Octokit::Client.new(options)
|
15
12
|
end
|
16
13
|
end
|
17
14
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Octokit
|
2
|
+
module Enterprise
|
3
|
+
module Configuration
|
4
|
+
include Octokit::Configuration
|
5
|
+
|
6
|
+
CUSTOM_ENDPOINTS = [:api_endpoint, :web_endpoint, :status_api_endpoint]
|
7
|
+
|
8
|
+
def hostname=(_hostname_)
|
9
|
+
Octokit.configure do |c|
|
10
|
+
CUSTOM_ENDPOINTS.each do |endpoint|
|
11
|
+
c.send "#{endpoint}=", c.send(endpoint).sub('github.com', _hostname_)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -5,10 +5,12 @@ describe Octokit::Enterprise do
|
|
5
5
|
let(:base_hostname) { 'git.enterprise.example.com' }
|
6
6
|
|
7
7
|
before do
|
8
|
-
Octokit::Enterprise.
|
8
|
+
Octokit::Enterprise.configure do |c|
|
9
|
+
c.hostname = base_hostname
|
10
|
+
end
|
9
11
|
end
|
10
12
|
|
11
|
-
Octokit::Enterprise::CUSTOM_ENDPOINTS.each do |endpoint|
|
13
|
+
Octokit::Enterprise::Configuration::CUSTOM_ENDPOINTS.each do |endpoint|
|
12
14
|
context endpoint do
|
13
15
|
let(:expected_hostname) do
|
14
16
|
case endpoint
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octokit-enterprise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- Rakefile
|
58
58
|
- VERSION
|
59
59
|
- lib/octokit/enterprise.rb
|
60
|
+
- lib/octokit/enterprise/configuration.rb
|
60
61
|
- octokit-enterprise.gemspec
|
61
62
|
- spec/octokit/enterprise_spec.rb
|
62
63
|
- spec/spec_helper.rb
|