ghdeploy 0.1.6 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 140953bd505abe84a47b3cf3d8c84ee65c505e1d
4
- data.tar.gz: 45e3c81c232408d5a0afcace8bf844258c1b0c5b
3
+ metadata.gz: 6b7337590fe342d7eb0847bfc0db55f427fa21ee
4
+ data.tar.gz: caae3973494652dd50d238456cecbe7d1cb0eb7c
5
5
  SHA512:
6
- metadata.gz: 36493e7d58f7f09ac28df1f5ed1a7982b3462cb0e32045b041d0e1ac2f7edf7eb526317ab176593ff691cd01504c59d0c8a67340345fe58828d7f95eebd3aede
7
- data.tar.gz: 39aea51e2c888c3e2ff05d20e3db9ee1c677aab89716ef94121d4f5c8f26acd416586cdc2a15762a64828a86f313b4bf84cd463c023ef90e3e6c456c9c991464
6
+ metadata.gz: c52cfbd42ea137d34b85b55bd455c39e967832b36e37fea95a40f5239b2ff99ed00ecfe841de6d03428865b6b25bbafafe2b2cd7e54dd06f461166326d40b902
7
+ data.tar.gz: 335e4db5a62e75f9b90290624b322fed40fd7112cd4d84d79c241cdfc59d070a67356842c8c6aaec8b7b1cb82550b11967887a043e3c5c03b477ddbe1160ee2b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ghdeploy (0.1.5)
4
+ ghdeploy (0.1.6)
5
5
  git (~> 1.5)
6
6
  octokit (~> 4.0)
7
7
  thor (~> 0.20)
data/README.md CHANGED
@@ -6,7 +6,17 @@ This gem adds a command to git for publishing [GitHub deployments](https://devel
6
6
 
7
7
  ```ruby
8
8
  gem install 'ghdeploy'
9
- ghdeploy init # creates a config file at ~/.ghdeploy
9
+ ```
10
+
11
+ # Setup
12
+ The only additional setup is to create a [personal access token](https://github.com/settings/tokens) in Github and set the environment variable.
13
+ ```
14
+ export GHDEPLOY_TOKEN=<token-from-github>
15
+ ```
16
+ If you're using an internal github server, you'll want to specify a host-specific token.
17
+ For example, if you're internal host is `https://my-enterprise-github.com`, then specify a token like so:
18
+ ```
19
+ export GHDEPLOY_MY_ENTERPRISE_GITHUB_COM_TOKEN=<token-from-internal-github>
10
20
  ```
11
21
 
12
22
  ## Usage
@@ -15,12 +25,5 @@ From within a git repository run:
15
25
 
16
26
  Basic deploy of master branch to production:
17
27
  ```
18
- git deploy
19
- ```
20
-
21
- More specific:
22
- ```
23
- git deploy origin branch-name \
24
- --environment staging \
25
- --description "Short description"
28
+ git deploy production master
26
29
  ```
@@ -15,7 +15,7 @@ module Ghdeploy
15
15
 
16
16
  facts = RepoFactFinder.new(remote_name)
17
17
  Octokit.configure { |c| c.api_endpoint = facts.host }
18
- client = Octokit::Client.new(access_token: ENV.fetch('GHDEPLOY_TOKEN'))
18
+ client = Octokit::Client.new(access_token: facts.token)
19
19
  deployment = client.create_deployment(facts.repo, ref, environment: environment)
20
20
  puts "Deployment created!" if deployment.url
21
21
  end
@@ -28,6 +28,16 @@ class RepoFactFinder
28
28
  @repo = repo.gsub(/(\.git)$/, '')
29
29
  end
30
30
 
31
+ def token
32
+ github_host = host.gsub(/^http[s]?:\/\/api\./, '')
33
+ if github_host == 'github.com'
34
+ ENV.fetch('GHDEPLOY_TOKEN')
35
+ else
36
+ key = github_host.gsub(/[\.\-]/, '_').upcase
37
+ ENV.fetch("GHDEPLOY_#{key}_TOKEN")
38
+ end
39
+ end
40
+
31
41
  private
32
42
 
33
43
  def url
@@ -1,3 +1,3 @@
1
1
  module Ghdeploy
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghdeploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Joyce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor