git_reflow 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/multi-ruby-tests.yml +33 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +18 -0
- data/Gemfile.lock +77 -45
- data/README.md +2 -2
- data/Rakefile +8 -1
- data/git_reflow.gemspec +23 -21
- data/lib/git_reflow/config.rb +26 -0
- data/lib/git_reflow/git_server/git_hub.rb +52 -40
- data/lib/git_reflow/version.rb +1 -1
- data/spec/fixtures/authentication_failure.json +3 -0
- data/spec/fixtures/users/user.json +32 -0
- data/spec/lib/git_reflow/git_server/git_hub_spec.rb +77 -3
- metadata +49 -31
- data/circle.yml +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7692bb55eed68ee06c7ef9e1b2fe26875e47f9bf312d1f255632adba2d67e86a
|
4
|
+
data.tar.gz: 2a84dec6c6c94bcdf9ed06c2fa6759a7a241cd3cf90330f3f4c56c82758650c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b27fc6914668bf71637cc55cdb551e603eaa9584c4c2ff140dfc186fe942ebd50cfabab180d20a526ff322c908db7383dd68a912a432437a622e91cbc2469f3a
|
7
|
+
data.tar.gz: f4053198734d076e4e3b53385091be46fc00d4b182287db22f5bd0be93355a17fbe77cc28536ceb0c47e9a3d2a5079dcf73e7f2f255745aa931c2e15ef479d83
|
@@ -0,0 +1,33 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
strategy:
|
12
|
+
fail-fast: true
|
13
|
+
matrix:
|
14
|
+
os: [ ubuntu-latest, macos-latest ]
|
15
|
+
ruby: ['2.5.8', '2.6.6', '2.7.1 ']
|
16
|
+
runs-on: ${{ matrix.os }}
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby }}
|
22
|
+
- uses: actions/cache@v1
|
23
|
+
with:
|
24
|
+
path: vendor/bundle
|
25
|
+
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
26
|
+
restore-keys: |
|
27
|
+
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-
|
28
|
+
- name: bundle install
|
29
|
+
run: |
|
30
|
+
bundle config path vendor/bundle
|
31
|
+
bundle install --jobs 4 --retry 3
|
32
|
+
- name: Run Tests for Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
|
33
|
+
run: bundle exec rake
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,24 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/reenhanced/gitreflow/tree/HEAD)
|
4
4
|
|
5
|
+
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.2...v0.9.3)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Add documention for GitReflow::Config [\#237](https://github.com/reenhanced/gitreflow/issues/237)
|
10
|
+
- Add documentation [\#157](https://github.com/reenhanced/gitreflow/issues/157)
|
11
|
+
|
12
|
+
**Closed issues:**
|
13
|
+
|
14
|
+
- GitHub authentication issues [\#193](https://github.com/reenhanced/gitreflow/issues/193)
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- Upgrade dependencies [\#242](https://github.com/reenhanced/gitreflow/pull/242) ([codenamev](https://github.com/codenamev))
|
19
|
+
- Creates multi-ruby-tests.yml [\#241](https://github.com/reenhanced/gitreflow/pull/241) ([codenamev](https://github.com/codenamev))
|
20
|
+
- Documention for GitReflow::Config [\#238](https://github.com/reenhanced/gitreflow/pull/238) ([PuZZleDucK](https://github.com/PuZZleDucK))
|
21
|
+
- Fixes several issues related to git-reflow setup [\#236](https://github.com/reenhanced/gitreflow/pull/236) ([codenamev](https://github.com/codenamev))
|
22
|
+
|
5
23
|
[Full Changelog](https://github.com/reenhanced/gitreflow/compare/v0.9.1...v0.9.2)
|
6
24
|
|
7
25
|
**Closed issues:**
|
data/Gemfile.lock
CHANGED
@@ -1,99 +1,130 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_reflow (0.9.
|
4
|
+
git_reflow (0.9.3)
|
5
5
|
bundler (>= 1.10.0)
|
6
|
+
codenamev_bitbucket_api (= 0.4.1)
|
6
7
|
colorize (>= 0.7.0)
|
7
8
|
github_api (= 0.18.2)
|
8
9
|
highline
|
9
10
|
httpclient
|
10
|
-
reenhanced_bitbucket_api (= 0.3.2)
|
11
11
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
+
activesupport (6.0.3.1)
|
16
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
+
i18n (>= 0.7, < 2)
|
18
|
+
minitest (~> 5.1)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
15
21
|
addressable (2.7.0)
|
16
22
|
public_suffix (>= 2.0.2, < 5.0)
|
17
23
|
appraisal (2.2.0)
|
18
24
|
bundler
|
19
25
|
rake
|
20
26
|
thor (>= 0.14.0)
|
21
|
-
byebug (11.
|
27
|
+
byebug (11.1.3)
|
22
28
|
chronic (0.10.2)
|
29
|
+
codenamev_bitbucket_api (0.4.1)
|
30
|
+
faraday (< 2.0)
|
31
|
+
faraday_middleware (< 2.0)
|
32
|
+
hashie
|
33
|
+
multi_json (< 2.0)
|
34
|
+
nokogiri (>= 1.5.2)
|
35
|
+
simple_oauth (>= 0.3.0)
|
23
36
|
coderay (1.1.2)
|
24
37
|
colorize (0.8.1)
|
38
|
+
concurrent-ruby (1.1.6)
|
25
39
|
crack (0.4.3)
|
26
40
|
safe_yaml (~> 1.0.0)
|
27
41
|
descendants_tracker (0.0.4)
|
28
42
|
thread_safe (~> 0.3, >= 0.3.1)
|
29
43
|
diff-lcs (1.3)
|
30
|
-
faraday (0.
|
44
|
+
faraday (0.17.3)
|
31
45
|
multipart-post (>= 1.2, < 3)
|
32
|
-
|
33
|
-
faraday (>= 0.
|
46
|
+
faraday-http-cache (2.2.0)
|
47
|
+
faraday (>= 0.8)
|
48
|
+
faraday_middleware (0.14.0)
|
49
|
+
faraday (>= 0.7.4, < 1.0)
|
34
50
|
github_api (0.18.2)
|
35
51
|
addressable (~> 2.4)
|
36
52
|
descendants_tracker (~> 0.0.4)
|
37
53
|
faraday (~> 0.8)
|
38
54
|
hashie (~> 3.5, >= 3.5.2)
|
39
55
|
oauth2 (~> 1.0)
|
40
|
-
|
56
|
+
github_changelog_generator (1.15.2)
|
57
|
+
activesupport
|
58
|
+
faraday-http-cache
|
59
|
+
multi_json
|
60
|
+
octokit (~> 4.6)
|
61
|
+
rainbow (>= 2.2.1)
|
62
|
+
rake (>= 10.0)
|
63
|
+
retriable (~> 3.0)
|
64
|
+
hashdiff (1.0.1)
|
41
65
|
hashie (3.6.0)
|
42
|
-
highline (2.0.
|
66
|
+
highline (2.0.3)
|
43
67
|
httpclient (2.8.3)
|
68
|
+
i18n (1.8.2)
|
69
|
+
concurrent-ruby (~> 1.0)
|
44
70
|
jwt (2.2.1)
|
45
|
-
method_source (0.
|
71
|
+
method_source (1.0.0)
|
46
72
|
mini_portile2 (2.4.0)
|
47
|
-
|
73
|
+
minitest (5.14.1)
|
74
|
+
multi_json (1.14.1)
|
48
75
|
multi_xml (0.6.0)
|
49
76
|
multipart-post (2.1.1)
|
50
|
-
nokogiri (1.10.
|
77
|
+
nokogiri (1.10.9)
|
51
78
|
mini_portile2 (~> 2.4.0)
|
52
|
-
oauth2 (1.4.
|
53
|
-
faraday (>= 0.8, <
|
79
|
+
oauth2 (1.4.4)
|
80
|
+
faraday (>= 0.8, < 2.0)
|
54
81
|
jwt (>= 1.0, < 3.0)
|
55
82
|
multi_json (~> 1.3)
|
56
83
|
multi_xml (~> 0.5)
|
57
84
|
rack (>= 1.2, < 3)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
pry
|
85
|
+
octokit (4.18.0)
|
86
|
+
faraday (>= 0.9)
|
87
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
88
|
+
pry (0.13.1)
|
89
|
+
coderay (~> 1.1)
|
90
|
+
method_source (~> 1.0)
|
91
|
+
pry-byebug (3.9.0)
|
62
92
|
byebug (~> 11.0)
|
63
|
-
pry (~> 0.
|
64
|
-
public_suffix (4.0.
|
65
|
-
rack (2.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
rspec-expectations (~> 3.8.0)
|
78
|
-
rspec-mocks (~> 3.8.0)
|
79
|
-
rspec-core (3.8.2)
|
80
|
-
rspec-support (~> 3.8.0)
|
81
|
-
rspec-expectations (3.8.4)
|
93
|
+
pry (~> 0.13.0)
|
94
|
+
public_suffix (4.0.5)
|
95
|
+
rack (2.2.2)
|
96
|
+
rainbow (3.0.0)
|
97
|
+
rake (13.0.1)
|
98
|
+
rdoc (6.2.1)
|
99
|
+
retriable (3.1.2)
|
100
|
+
rspec (3.9.0)
|
101
|
+
rspec-core (~> 3.9.0)
|
102
|
+
rspec-expectations (~> 3.9.0)
|
103
|
+
rspec-mocks (~> 3.9.0)
|
104
|
+
rspec-core (3.9.2)
|
105
|
+
rspec-support (~> 3.9.3)
|
106
|
+
rspec-expectations (3.9.2)
|
82
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-mocks (3.
|
108
|
+
rspec-support (~> 3.9.0)
|
109
|
+
rspec-mocks (3.9.1)
|
85
110
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-support (3.
|
111
|
+
rspec-support (~> 3.9.0)
|
112
|
+
rspec-support (3.9.3)
|
88
113
|
safe_yaml (1.0.5)
|
114
|
+
sawyer (0.8.2)
|
115
|
+
addressable (>= 2.3.5)
|
116
|
+
faraday (> 0.8, < 2.0)
|
89
117
|
simple_oauth (0.3.1)
|
90
|
-
thor (0.
|
118
|
+
thor (1.0.1)
|
91
119
|
thread_safe (0.3.6)
|
92
|
-
|
120
|
+
tzinfo (1.2.7)
|
121
|
+
thread_safe (~> 0.1)
|
122
|
+
webmock (3.8.3)
|
93
123
|
addressable (>= 2.3.6)
|
94
124
|
crack (>= 0.3.2)
|
95
125
|
hashdiff (>= 0.4.0, < 2.0.0)
|
96
126
|
wwtd (1.4.0)
|
127
|
+
zeitwerk (2.3.0)
|
97
128
|
|
98
129
|
PLATFORMS
|
99
130
|
ruby
|
@@ -102,12 +133,13 @@ DEPENDENCIES
|
|
102
133
|
appraisal (= 2.2.0)
|
103
134
|
chronic
|
104
135
|
git_reflow!
|
136
|
+
github_changelog_generator
|
105
137
|
pry-byebug
|
106
|
-
rake (~>
|
138
|
+
rake (~> 13.0.1)
|
107
139
|
rdoc
|
108
|
-
rspec (~> 3.
|
140
|
+
rspec (~> 3.9)
|
109
141
|
webmock
|
110
142
|
wwtd (= 1.4)
|
111
143
|
|
112
144
|
BUNDLED WITH
|
113
|
-
2.
|
145
|
+
2.1.4
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
</h1>
|
5
5
|
|
6
6
|
<p>
|
7
|
-
<a href="https://
|
8
|
-
<img alt="
|
7
|
+
<a href="https://actions-badge.atrox.dev/reenhanced/gitreflow/goto?ref=master" title="git workflow">
|
8
|
+
<img alt="Git workflow powered by git-reflow" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Freenhanced%2Fgitreflow%2Fbadge%3Fref%3Dmaster&style=flat">
|
9
9
|
</a>
|
10
10
|
<a href="https://github.com/reenhanced/gitreflow" title="git workflow">
|
11
11
|
<img alt="Git workflow powered by git-reflow" src="https://img.shields.io/badge/git--reflow-v0.9.0-blue.svg?style=flat">
|
data/Rakefile
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
3
|
require "rspec/core/rake_task"
|
4
|
+
require "github_changelog_generator/task"
|
4
5
|
|
5
6
|
RSpec::Core::RakeTask.new(:spec)
|
6
7
|
|
7
|
-
|
8
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
9
|
+
config.user = 'reenhanced'
|
10
|
+
config.project = 'gitreflow'
|
11
|
+
config.since_tag = 'v0.9.2'
|
12
|
+
config.future_release = 'master'
|
13
|
+
end
|
8
14
|
|
15
|
+
task :default => :spec
|
data/git_reflow.gemspec
CHANGED
@@ -1,38 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Ensure we require the local version and not one we might have installed already
|
2
|
-
require File.join([File.dirname(__FILE__),'lib','git_reflow/version.rb'])
|
4
|
+
require File.join([File.dirname(__FILE__), 'lib', 'git_reflow/version.rb'])
|
3
5
|
Gem::Specification.new do |s|
|
4
|
-
s.name
|
5
|
-
s.version
|
6
|
-
s.license
|
7
|
-
s.authors
|
8
|
-
s.email
|
9
|
-
s.homepage
|
10
|
-
s.summary
|
11
|
-
s.description
|
12
|
-
s.platform
|
13
|
-
s.files
|
14
|
-
s.test_files
|
15
|
-
s.executables
|
16
|
-
s.
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
s.rdoc_options << '--title' << 'git_reflow' << '-ri'
|
6
|
+
s.name = 'git_reflow'
|
7
|
+
s.version = GitReflow::VERSION
|
8
|
+
s.license = 'MIT'
|
9
|
+
s.authors = ['Valentino Stoll', 'Robert Stern', 'Nicholas Hance']
|
10
|
+
s.email = ['dev@reenhanced.com']
|
11
|
+
s.homepage = 'http://github.com/reenhanced/gitreflow'
|
12
|
+
s.summary = 'A better git process'
|
13
|
+
s.description = 'Git Reflow manages your git workflow.'
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
s.bindir = 'exe'
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
s.rdoc_options << '--title' << 'git_reflow' << '-ri'
|
20
21
|
|
21
22
|
s.add_development_dependency('appraisal', '2.2.0')
|
22
23
|
s.add_development_dependency('chronic')
|
24
|
+
s.add_development_dependency('github_changelog_generator')
|
23
25
|
s.add_development_dependency('pry-byebug')
|
24
|
-
s.add_development_dependency('rake',
|
26
|
+
s.add_development_dependency('rake', '~> 13.0.1')
|
25
27
|
s.add_development_dependency('rdoc')
|
26
|
-
s.add_development_dependency('rspec',
|
28
|
+
s.add_development_dependency('rspec', '~> 3.9')
|
27
29
|
s.add_development_dependency('webmock')
|
28
30
|
s.add_development_dependency('wwtd', '1.4')
|
29
31
|
|
30
32
|
s.add_dependency('bundler', '>= 1.10.0')
|
33
|
+
s.add_dependency('codenamev_bitbucket_api', '0.4.1')
|
31
34
|
s.add_dependency('colorize', '>= 0.7.0')
|
35
|
+
s.add_dependency('github_api', '0.18.2')
|
32
36
|
s.add_dependency('highline')
|
33
37
|
s.add_dependency('httpclient')
|
34
|
-
s.add_dependency('github_api', '0.18.2')
|
35
|
-
s.add_dependency('reenhanced_bitbucket_api', '0.3.2')
|
36
38
|
|
37
39
|
s.post_install_message = "You need to setup your GitHub OAuth token\nPlease run 'git-reflow setup'"
|
38
40
|
end
|
data/lib/git_reflow/config.rb
CHANGED
@@ -7,6 +7,13 @@ module GitReflow
|
|
7
7
|
|
8
8
|
module_function
|
9
9
|
|
10
|
+
# Gets the reqested git configuration variable.
|
11
|
+
#
|
12
|
+
# @param [String] key The key to get the value(s) for
|
13
|
+
# @option options [Boolean] :reload (false) whether to reload the value or use a cached value if available
|
14
|
+
# @option options [Boolean] :all (false) whether to return all keys for a multi-valued key
|
15
|
+
# @option options [Boolean] :local (false) whether to get the value specific to the current project
|
16
|
+
# @return the value of the git configuration
|
10
17
|
def get(key, reload: false, all: false, local: false)
|
11
18
|
return cached_git_config_value(key) unless reload || cached_git_config_value(key).empty?
|
12
19
|
|
@@ -19,6 +26,12 @@ module GitReflow
|
|
19
26
|
cache_git_config_key(key, new_value)
|
20
27
|
end
|
21
28
|
|
29
|
+
# Sets the reqested git configuration variable.
|
30
|
+
#
|
31
|
+
# @param [String] key The key to set the value for
|
32
|
+
# @param [String] value The value to set it to
|
33
|
+
# @option options [Boolean] :local (false) whether to set the value specific to the current project
|
34
|
+
# @return the value of the git configuration
|
22
35
|
def set(key, value, local: false)
|
23
36
|
value = value.to_s.strip
|
24
37
|
if local
|
@@ -28,6 +41,12 @@ module GitReflow
|
|
28
41
|
end
|
29
42
|
end
|
30
43
|
|
44
|
+
# Remove values of the reqested git configuration variable.
|
45
|
+
#
|
46
|
+
# @param [String] key The key to remove
|
47
|
+
# @option options [Boolean] :value (nil) The value of the key to remove
|
48
|
+
# @option options [Boolean] :local (false) whether to remove the value specific to the current project
|
49
|
+
# @return the result of running the git command
|
31
50
|
def unset(key, value: nil, local: false)
|
32
51
|
value = value.nil? ? '' : "\"#{value}\""
|
33
52
|
if local
|
@@ -37,6 +56,13 @@ module GitReflow
|
|
37
56
|
end
|
38
57
|
end
|
39
58
|
|
59
|
+
# Adds a new git configuration variable.
|
60
|
+
#
|
61
|
+
# @param [String] key The new key to set the value for
|
62
|
+
# @param [String] value The value to set it to
|
63
|
+
# @option options [Boolean] :local (false) whether to set the value specific to the current project
|
64
|
+
# @option options [Boolean] :global (false) whether to set the value globaly. if neither local or global is set gitreflow will default to using a configuration file
|
65
|
+
# @return the result of running the git command
|
40
66
|
def add(key, value, local: false, global: false)
|
41
67
|
if global
|
42
68
|
GitReflow::Sandbox.run "git config --global --add #{key} \"#{value}\"", loud: false, blocking: false
|
@@ -84,56 +84,68 @@ module GitReflow
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def authenticate(options = {silent: false})
|
87
|
+
self.class.user = options[:user]
|
88
|
+
if self.class.user.empty?
|
89
|
+
self.class.user = ask("Please enter your GitHub username: ")
|
90
|
+
end
|
91
|
+
|
87
92
|
if connection and self.class.oauth_token.length > 0
|
88
|
-
unless options[:silent]
|
89
|
-
GitReflow.say "Your GitHub account was already setup with: "
|
90
|
-
GitReflow.say "\tUser Name: #{self.class.user}"
|
91
|
-
GitReflow.say "\tEndpoint: #{self.class.api_endpoint}"
|
92
|
-
end
|
93
|
-
else
|
94
93
|
begin
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
config.endpoint = GitServer::GitHub.api_endpoint
|
101
|
-
config.site = GitServer::GitHub.site_url
|
102
|
-
config.adapter = :net_http
|
94
|
+
connection.users.get
|
95
|
+
unless options[:silent]
|
96
|
+
GitReflow.say "Your GitHub account was already setup with: "
|
97
|
+
GitReflow.say "\tUser Name: #{self.class.user}"
|
98
|
+
GitReflow.say "\tEndpoint: #{self.class.api_endpoint}"
|
103
99
|
end
|
100
|
+
return connection
|
101
|
+
rescue ::Github::Error::Unauthorized => e
|
102
|
+
GitReflow.logger.debug "[GitHub Error] Current oauth-token is invalid or expired..."
|
103
|
+
end
|
104
|
+
end
|
104
105
|
|
105
|
-
|
106
|
+
begin
|
107
|
+
gh_password = options[:password] || ask("Please enter your GitHub password (we do NOT store this): ") { |q| q.echo = false }
|
106
108
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
else
|
114
|
-
authorization = @connection.oauth.create scopes: ['repo'], note: "git-reflow (#{run('hostname', loud: false).strip})"
|
115
|
-
end
|
109
|
+
@connection = ::Github.new do |config|
|
110
|
+
config.basic_auth = "#{self.class.user}:#{gh_password}"
|
111
|
+
config.endpoint = GitServer::GitHub.api_endpoint
|
112
|
+
config.site = GitServer::GitHub.site_url
|
113
|
+
config.adapter = :net_http
|
114
|
+
end
|
116
115
|
|
117
|
-
|
116
|
+
@connection.connection_options = {headers: {"X-GitHub-OTP" => options[:two_factor_auth_code]}} if options[:two_factor_auth_code]
|
118
117
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
118
|
+
previous_authorizations = @connection.oauth.all.select {|auth| auth.note == "git-reflow (#{run('hostname', loud: false).strip})" }
|
119
|
+
if previous_authorizations.any?
|
120
|
+
authorization = previous_authorizations.last
|
121
|
+
GitReflow.say "You have previously setup git-reflow on this machine, but we can no longer find the stored token.", :error
|
122
|
+
GitReflow.say "Please visit https://github.com/settings/tokens and delete the token for: git-reflow (#{run('hostname', loud: false).strip})", :notice
|
123
|
+
raise "Setup could not be completed."
|
124
|
+
else
|
125
|
+
authorization = @connection.oauth.create scopes: ['repo'], note: "git-reflow (#{run('hostname', loud: false).strip})"
|
126
|
+
end
|
127
|
+
|
128
|
+
self.class.oauth_token = authorization.token
|
129
|
+
|
130
|
+
rescue ::Github::Error::Unauthorized => e
|
131
|
+
if e.inspect.to_s.include?('two-factor')
|
132
|
+
begin
|
133
|
+
# dummy request to trigger a 2FA SMS since a HTTP GET won't do it
|
134
|
+
@connection.oauth.create scopes: ['repo'], note: "thank Github for not making this straightforward"
|
135
|
+
rescue ::Github::Error::Unauthorized
|
136
|
+
ensure
|
137
|
+
two_factor_code = ask("Please enter your two-factor authentication code: ")
|
138
|
+
self.authenticate options.merge({user: self.class.user, password: gh_password, two_factor_auth_code: two_factor_code})
|
131
139
|
end
|
132
|
-
rescue StandardError => e
|
133
|
-
raise "We were unable to authenticate with Github."
|
134
140
|
else
|
135
|
-
GitReflow.say "
|
141
|
+
GitReflow.say "Github Authentication Error: #{e.inspect}", :error
|
142
|
+
raise "Setup could not be completed."
|
136
143
|
end
|
144
|
+
rescue StandardError => e
|
145
|
+
raise "We were unable to authenticate with Github."
|
146
|
+
else
|
147
|
+
GitReflow.say "Your GitHub account was successfully setup!", :success
|
148
|
+
|
137
149
|
end
|
138
150
|
|
139
151
|
@connection
|
data/lib/git_reflow/version.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"login": "reenhanced",
|
3
|
+
"id": 1,
|
4
|
+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
5
|
+
"gravatar_id": "somehexcode",
|
6
|
+
"url": "https://api.github.com/users/reenhanced",
|
7
|
+
"name": "monalisa octocat",
|
8
|
+
"company": "GitHub",
|
9
|
+
"blog": "https://github.com/blog",
|
10
|
+
"location": "San Francisco",
|
11
|
+
"email": "octocat@github.com",
|
12
|
+
"hireable": false,
|
13
|
+
"bio": "There once was...",
|
14
|
+
"public_repos": 2,
|
15
|
+
"public_gists": 1,
|
16
|
+
"followers": 20,
|
17
|
+
"following": 0,
|
18
|
+
"html_url": "https://github.com/reenhanced",
|
19
|
+
"created_at": "2008-01-14T04:33:35Z",
|
20
|
+
"type": "User",
|
21
|
+
"total_private_repos": 100,
|
22
|
+
"owned_private_repos": 100,
|
23
|
+
"private_gists": 81,
|
24
|
+
"disk_usage": 10000,
|
25
|
+
"collaborators": 8,
|
26
|
+
"plan": {
|
27
|
+
"name": "Medium",
|
28
|
+
"space": 400,
|
29
|
+
"collaborators": 10,
|
30
|
+
"private_repos": 20
|
31
|
+
}
|
32
|
+
}
|
@@ -78,7 +78,7 @@ describe GitReflow::GitServer::GitHub do
|
|
78
78
|
subject { github.authenticate }
|
79
79
|
|
80
80
|
before do
|
81
|
-
allow(GitReflow::GitServer::GitHub).to receive(:user).and_return(
|
81
|
+
allow(GitReflow::GitServer::GitHub).to receive(:user).and_return(user)
|
82
82
|
allow(github_api).to receive(:oauth).and_return(github_authorizations)
|
83
83
|
allow(github_api).to receive_message_chain(:oauth, :all).and_return([])
|
84
84
|
allow(github).to receive(:run).with('hostname', loud: false).and_return(hostname)
|
@@ -151,12 +151,86 @@ describe GitReflow::GitServer::GitHub do
|
|
151
151
|
body: { error: "GET https://api.github.com/authorizations: 401 Bad credentials" }
|
152
152
|
}}
|
153
153
|
|
154
|
+
before do
|
155
|
+
allow(GitReflow::Config).to receive(:get).and_call_original
|
156
|
+
allow(GitReflow::Config).to receive(:get).with('github.oauth-token').and_return(oauth_token_hash[:token])
|
157
|
+
allow(Github::Client).to receive(:new).and_return(github_api)
|
158
|
+
allow(github_authorizations).to receive(:authenticated?).and_return(true)
|
159
|
+
allow(github_api.oauth).to receive(:create).with({ scopes: ['repo'], note: "git-reflow (#{hostname})" }).and_return(oauth_token_hash)
|
160
|
+
|
161
|
+
stub_request(:get, %r{/user}).
|
162
|
+
to_return(
|
163
|
+
body: Fixture.new('authentication_failure.json').to_s,
|
164
|
+
status: 401,
|
165
|
+
headers: {'content-type' => 'application/json; charset=utf-8', status: 'Unauthorized'},
|
166
|
+
)
|
167
|
+
end
|
168
|
+
|
169
|
+
it "notifies the user of successful setup" do
|
170
|
+
expect { subject }.to have_said "Your GitHub account was successfully setup!", :success
|
171
|
+
end
|
172
|
+
|
173
|
+
it "creates a new GitHub oauth token" do
|
174
|
+
expect(github_api.oauth).to receive(:create).and_return(oauth_token_hash)
|
175
|
+
subject
|
176
|
+
end
|
177
|
+
|
178
|
+
it "creates git config keys for github connections" do
|
179
|
+
expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.site \"#{github_site}\"", blocking: false
|
180
|
+
expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.endpoint \"#{github_api_endpoint}\"", blocking: false
|
181
|
+
expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.oauth-token \"#{oauth_token_hash[:token]}\"", blocking: false
|
182
|
+
expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all reflow.git-server \"GitHub\"", blocking: false
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
context 'already authenticated' do
|
189
|
+
let(:oauth_token) { "abc123" }
|
190
|
+
|
191
|
+
before do
|
192
|
+
allow(GitReflow::Config).to receive(:get).and_call_original
|
193
|
+
allow(GitReflow::Config).to receive(:get).with('github.oauth-token').and_return(oauth_token)
|
194
|
+
end
|
195
|
+
|
196
|
+
context "and authentication token is still valid" do
|
197
|
+
before do
|
198
|
+
stub_request(:get, %r{/user}).
|
199
|
+
to_return(
|
200
|
+
body: Fixture.new('users/user.json').to_s,
|
201
|
+
status: 200,
|
202
|
+
headers: { content_type: "application/json; charset=utf-8" }
|
203
|
+
)
|
204
|
+
|
205
|
+
allow(Github::Client).to receive(:new).and_return(github_api)
|
206
|
+
allow(github_api).to receive(:oauth).and_return(github_authorizations)
|
207
|
+
allow(github_authorizations).to receive(:authenticated?).and_return(true)
|
208
|
+
allow(github_api.oauth).to receive(:create).with({ scopes: ['repo'], note: "git-reflow (#{hostname})" }).and_return(oauth_token_hash)
|
209
|
+
end
|
210
|
+
|
211
|
+
it "resolves all missing git-reflow configurations" do
|
212
|
+
expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.site \"#{github_site}\"", blocking: false
|
213
|
+
expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all github.endpoint \"#{github_api_endpoint}\"", blocking: false
|
214
|
+
expect{ subject }.to have_run_command_silently "git config -f #{GitReflow::Config::CONFIG_FILE_PATH} --replace-all reflow.git-server \"GitHub\"", blocking: false
|
215
|
+
expect { subject }.to have_said "Your GitHub account was already setup with: "
|
216
|
+
expect { subject }.to have_said "\tUser Name: #{user}"
|
217
|
+
expect { subject }.to have_said "\tEndpoint: #{github_api_endpoint}"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context "and authentication token is expired" do
|
222
|
+
let(:unauthorized_error_response) {{
|
223
|
+
response_headers: {'content-type' => 'application/json; charset=utf-8', status: 'Unauthorized'},
|
224
|
+
method: 'GET',
|
225
|
+
status: '401',
|
226
|
+
body: { error: "GET https://api.github.com/authorizations: 401 Bad credentials" }
|
227
|
+
}}
|
228
|
+
|
154
229
|
before do
|
155
230
|
allow(Github::Client).to receive(:new).and_raise Github::Error::Unauthorized.new(unauthorized_error_response)
|
156
231
|
end
|
157
232
|
|
158
|
-
it "
|
159
|
-
expect { subject }.to have_said "Github Authentication Error: #{Github::Error::Unauthorized.new(unauthorized_error_response).inspect}", :error
|
233
|
+
it "requests a new oauth token" do
|
160
234
|
end
|
161
235
|
end
|
162
236
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_reflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valentino Stoll
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: appraisal
|
@@ -40,6 +40,20 @@ dependencies:
|
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: github_changelog_generator
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: pry-byebug
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,14 +74,14 @@ dependencies:
|
|
60
74
|
requirements:
|
61
75
|
- - "~>"
|
62
76
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
77
|
+
version: 13.0.1
|
64
78
|
type: :development
|
65
79
|
prerelease: false
|
66
80
|
version_requirements: !ruby/object:Gem::Requirement
|
67
81
|
requirements:
|
68
82
|
- - "~>"
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
84
|
+
version: 13.0.1
|
71
85
|
- !ruby/object:Gem::Dependency
|
72
86
|
name: rdoc
|
73
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,14 +102,14 @@ dependencies:
|
|
88
102
|
requirements:
|
89
103
|
- - "~>"
|
90
104
|
- !ruby/object:Gem::Version
|
91
|
-
version: '3.
|
105
|
+
version: '3.9'
|
92
106
|
type: :development
|
93
107
|
prerelease: false
|
94
108
|
version_requirements: !ruby/object:Gem::Requirement
|
95
109
|
requirements:
|
96
110
|
- - "~>"
|
97
111
|
- !ruby/object:Gem::Version
|
98
|
-
version: '3.
|
112
|
+
version: '3.9'
|
99
113
|
- !ruby/object:Gem::Dependency
|
100
114
|
name: webmock
|
101
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,75 +153,75 @@ dependencies:
|
|
139
153
|
- !ruby/object:Gem::Version
|
140
154
|
version: 1.10.0
|
141
155
|
- !ruby/object:Gem::Dependency
|
142
|
-
name:
|
156
|
+
name: codenamev_bitbucket_api
|
143
157
|
requirement: !ruby/object:Gem::Requirement
|
144
158
|
requirements:
|
145
|
-
- -
|
159
|
+
- - '='
|
146
160
|
- !ruby/object:Gem::Version
|
147
|
-
version: 0.
|
161
|
+
version: 0.4.1
|
148
162
|
type: :runtime
|
149
163
|
prerelease: false
|
150
164
|
version_requirements: !ruby/object:Gem::Requirement
|
151
165
|
requirements:
|
152
|
-
- -
|
166
|
+
- - '='
|
153
167
|
- !ruby/object:Gem::Version
|
154
|
-
version: 0.
|
168
|
+
version: 0.4.1
|
155
169
|
- !ruby/object:Gem::Dependency
|
156
|
-
name:
|
170
|
+
name: colorize
|
157
171
|
requirement: !ruby/object:Gem::Requirement
|
158
172
|
requirements:
|
159
173
|
- - ">="
|
160
174
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
175
|
+
version: 0.7.0
|
162
176
|
type: :runtime
|
163
177
|
prerelease: false
|
164
178
|
version_requirements: !ruby/object:Gem::Requirement
|
165
179
|
requirements:
|
166
180
|
- - ">="
|
167
181
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
182
|
+
version: 0.7.0
|
169
183
|
- !ruby/object:Gem::Dependency
|
170
|
-
name:
|
184
|
+
name: github_api
|
171
185
|
requirement: !ruby/object:Gem::Requirement
|
172
186
|
requirements:
|
173
|
-
- -
|
187
|
+
- - '='
|
174
188
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
189
|
+
version: 0.18.2
|
176
190
|
type: :runtime
|
177
191
|
prerelease: false
|
178
192
|
version_requirements: !ruby/object:Gem::Requirement
|
179
193
|
requirements:
|
180
|
-
- -
|
194
|
+
- - '='
|
181
195
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
196
|
+
version: 0.18.2
|
183
197
|
- !ruby/object:Gem::Dependency
|
184
|
-
name:
|
198
|
+
name: highline
|
185
199
|
requirement: !ruby/object:Gem::Requirement
|
186
200
|
requirements:
|
187
|
-
- -
|
201
|
+
- - ">="
|
188
202
|
- !ruby/object:Gem::Version
|
189
|
-
version: 0
|
203
|
+
version: '0'
|
190
204
|
type: :runtime
|
191
205
|
prerelease: false
|
192
206
|
version_requirements: !ruby/object:Gem::Requirement
|
193
207
|
requirements:
|
194
|
-
- -
|
208
|
+
- - ">="
|
195
209
|
- !ruby/object:Gem::Version
|
196
|
-
version: 0
|
210
|
+
version: '0'
|
197
211
|
- !ruby/object:Gem::Dependency
|
198
|
-
name:
|
212
|
+
name: httpclient
|
199
213
|
requirement: !ruby/object:Gem::Requirement
|
200
214
|
requirements:
|
201
|
-
- -
|
215
|
+
- - ">="
|
202
216
|
- !ruby/object:Gem::Version
|
203
|
-
version: 0
|
217
|
+
version: '0'
|
204
218
|
type: :runtime
|
205
219
|
prerelease: false
|
206
220
|
version_requirements: !ruby/object:Gem::Requirement
|
207
221
|
requirements:
|
208
|
-
- -
|
222
|
+
- - ">="
|
209
223
|
- !ruby/object:Gem::Version
|
210
|
-
version: 0
|
224
|
+
version: '0'
|
211
225
|
description: Git Reflow manages your git workflow.
|
212
226
|
email:
|
213
227
|
- dev@reenhanced.com
|
@@ -216,6 +230,7 @@ executables:
|
|
216
230
|
extensions: []
|
217
231
|
extra_rdoc_files: []
|
218
232
|
files:
|
233
|
+
- ".github/workflows/multi-ruby-tests.yml"
|
219
234
|
- ".gitignore"
|
220
235
|
- ".rubocop.yml"
|
221
236
|
- ".ruby-version"
|
@@ -230,7 +245,6 @@ files:
|
|
230
245
|
- _config.yml
|
231
246
|
- bin/console
|
232
247
|
- bin/setup
|
233
|
-
- circle.yml
|
234
248
|
- exe/git-reflow
|
235
249
|
- git_reflow.gemspec
|
236
250
|
- lib/git_reflow.rb
|
@@ -255,6 +269,7 @@ files:
|
|
255
269
|
- lib/git_reflow/workflow.rb
|
256
270
|
- lib/git_reflow/workflows/FlatMergeWorkflow
|
257
271
|
- lib/git_reflow/workflows/core.rb
|
272
|
+
- spec/fixtures/authentication_failure.json
|
258
273
|
- spec/fixtures/awesome_workflow.rb
|
259
274
|
- spec/fixtures/git/git_config
|
260
275
|
- spec/fixtures/issues/comment.json.erb
|
@@ -276,6 +291,7 @@ files:
|
|
276
291
|
- spec/fixtures/repositories/commit.json.erb
|
277
292
|
- spec/fixtures/repositories/commits.json.erb
|
278
293
|
- spec/fixtures/repositories/statuses.json
|
294
|
+
- spec/fixtures/users/user.json
|
279
295
|
- spec/lib/git_reflow/config_spec.rb
|
280
296
|
- spec/lib/git_reflow/git_helpers_spec.rb
|
281
297
|
- spec/lib/git_reflow/git_server/bit_bucket_spec.rb
|
@@ -319,11 +335,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
319
335
|
- !ruby/object:Gem::Version
|
320
336
|
version: '0'
|
321
337
|
requirements: []
|
322
|
-
rubygems_version: 3.
|
338
|
+
rubygems_version: 3.1.2
|
323
339
|
signing_key:
|
324
340
|
specification_version: 4
|
325
341
|
summary: A better git process
|
326
342
|
test_files:
|
343
|
+
- spec/fixtures/authentication_failure.json
|
327
344
|
- spec/fixtures/awesome_workflow.rb
|
328
345
|
- spec/fixtures/git/git_config
|
329
346
|
- spec/fixtures/issues/comment.json.erb
|
@@ -345,6 +362,7 @@ test_files:
|
|
345
362
|
- spec/fixtures/repositories/commit.json.erb
|
346
363
|
- spec/fixtures/repositories/commits.json.erb
|
347
364
|
- spec/fixtures/repositories/statuses.json
|
365
|
+
- spec/fixtures/users/user.json
|
348
366
|
- spec/lib/git_reflow/config_spec.rb
|
349
367
|
- spec/lib/git_reflow/git_helpers_spec.rb
|
350
368
|
- spec/lib/git_reflow/git_server/bit_bucket_spec.rb
|
data/circle.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
dependencies:
|
2
|
-
cache_directories:
|
3
|
-
- '~/.rvm/rubies'
|
4
|
-
- 'vendor'
|
5
|
-
|
6
|
-
override:
|
7
|
-
- >
|
8
|
-
case $CIRCLE_NODE_INDEX in
|
9
|
-
0)
|
10
|
-
rvm-exec 2.3.8 gem install bundler
|
11
|
-
rvm-exec 2.3.8 bash -c "bundle check --path=vendor/bundle_2.3 || bundle install --path=vendor/bundle_2.3"
|
12
|
-
;;
|
13
|
-
1)
|
14
|
-
rvm-exec 2.4.5 gem install bundler
|
15
|
-
rvm-exec 2.4.5 bash -c "bundle check --path=vendor/bundle_2.4 || bundle install --path=vendor/bundle_2.4"
|
16
|
-
;;
|
17
|
-
2)
|
18
|
-
rvm-exec ruby-head gem install bundler
|
19
|
-
rvm-exec ruby-head bash -c "bundle check --path=vendor/bundle_head || bundle install --path=vendor/bundle_head"
|
20
|
-
;;
|
21
|
-
esac
|
22
|
-
|
23
|
-
test:
|
24
|
-
override:
|
25
|
-
- case $CIRCLE_NODE_INDEX in 0) rvm-exec 2.3.8 bundle exec rake ;; 1) rvm-exec 2.4.5 bundle exec rake ;; 2) rvm-exec ruby-head bundle exec rake ;; esac:
|
26
|
-
parallel: true
|