git-ready 0.8.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 +7 -0
- data/.document +5 -0
- data/.gitignore +50 -0
- data/.rspec +1 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +125 -0
- data/LICENSE.txt +20 -0
- data/README.md +37 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/bin/git-ready +19 -0
- data/lib/git-ready.rb +3 -0
- data/lib/git-ready/github.rb +25 -0
- data/lib/git-ready/interactive_setup.rb +104 -0
- data/lib/git-ready/settings.rb +22 -0
- data/lib/git-ready/workspace.rb +38 -0
- data/spec/git-ready_spec.rb +7 -0
- data/spec/spec_helper.rb +35 -0
- metadata +291 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: acda10bcb27a9c66fb216be4e2dcd75d4c0c928e
|
|
4
|
+
data.tar.gz: 6eb6eb3a0b8a7e3d2809f59276885405bc197476
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f0ac649dba682ad8b3cc4cb3c470f9be8ccf1cfd3cc610a584d2cf9860d089fddeae64974d44c68abc1885700c07fe592a5cee3599553e2f40fdcd6bed1c19ae
|
|
7
|
+
data.tar.gz: 6d6a073431686b660316dbfff5fc2242b3a93f6e2d20435f8d8eab517702ef2c3afff3bbcae4d2e08ea7377d005af78bd4574b9aa47a194bbefdbcac8ad1ef96
|
data/.document
ADDED
data/.gitignore
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# rcov generated
|
|
2
|
+
coverage
|
|
3
|
+
coverage.data
|
|
4
|
+
|
|
5
|
+
# rdoc generated
|
|
6
|
+
rdoc
|
|
7
|
+
|
|
8
|
+
# yard generated
|
|
9
|
+
doc
|
|
10
|
+
.yardoc
|
|
11
|
+
|
|
12
|
+
# bundler
|
|
13
|
+
.bundle
|
|
14
|
+
vendor
|
|
15
|
+
|
|
16
|
+
# jeweler generated
|
|
17
|
+
pkg
|
|
18
|
+
|
|
19
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
|
20
|
+
#
|
|
21
|
+
# * Create a file at ~/.gitignore
|
|
22
|
+
# * Include files you want ignored
|
|
23
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
|
24
|
+
#
|
|
25
|
+
# After doing this, these files will be ignored in all your git projects,
|
|
26
|
+
# saving you from having to 'pollute' every project you touch with them
|
|
27
|
+
#
|
|
28
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
|
29
|
+
#
|
|
30
|
+
# For MacOS:
|
|
31
|
+
#
|
|
32
|
+
#.DS_Store
|
|
33
|
+
|
|
34
|
+
# For TextMate
|
|
35
|
+
#*.tmproj
|
|
36
|
+
#tmtags
|
|
37
|
+
|
|
38
|
+
# For emacs:
|
|
39
|
+
#*~
|
|
40
|
+
#\#*
|
|
41
|
+
#.\#*
|
|
42
|
+
|
|
43
|
+
# For vim:
|
|
44
|
+
#*.swp
|
|
45
|
+
|
|
46
|
+
# For redcar:
|
|
47
|
+
#.redcar
|
|
48
|
+
|
|
49
|
+
# For rubinius:
|
|
50
|
+
#*.rbc
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color
|
data/Gemfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'contracts'
|
|
4
|
+
gem 'octokit'
|
|
5
|
+
gem 'progress_bar'
|
|
6
|
+
gem 'rugged', '~> 0.23.0b4'
|
|
7
|
+
gem 'settingslogic'
|
|
8
|
+
gem 'terminal-announce'
|
|
9
|
+
|
|
10
|
+
group :development do
|
|
11
|
+
gem "rspec", "~> 3.2"
|
|
12
|
+
gem "yard", "~> 0.7"
|
|
13
|
+
gem "rdoc", "~> 3.12"
|
|
14
|
+
gem "bundler", "~> 1.0"
|
|
15
|
+
gem "jeweler", "~> 2.0.1"
|
|
16
|
+
gem "simplecov", ">= 0"
|
|
17
|
+
gem "reek", "~> 1.2.8"
|
|
18
|
+
gem "roodi", "~> 2.1.0"
|
|
19
|
+
gem "autotest-standalone"
|
|
20
|
+
gem "rspec-autotest"
|
|
21
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
addressable (2.3.8)
|
|
5
|
+
autotest-standalone (4.5.11)
|
|
6
|
+
builder (3.2.2)
|
|
7
|
+
contracts (0.9)
|
|
8
|
+
descendants_tracker (0.0.4)
|
|
9
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
10
|
+
diff-lcs (1.2.5)
|
|
11
|
+
docile (1.1.5)
|
|
12
|
+
faraday (0.9.1)
|
|
13
|
+
multipart-post (>= 1.2, < 3)
|
|
14
|
+
git (1.2.9.1)
|
|
15
|
+
github_api (0.12.3)
|
|
16
|
+
addressable (~> 2.3)
|
|
17
|
+
descendants_tracker (~> 0.0.4)
|
|
18
|
+
faraday (~> 0.8, < 0.10)
|
|
19
|
+
hashie (>= 3.3)
|
|
20
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
21
|
+
nokogiri (~> 1.6.3)
|
|
22
|
+
oauth2
|
|
23
|
+
hashie (3.4.2)
|
|
24
|
+
highline (1.6.21)
|
|
25
|
+
jeweler (2.0.1)
|
|
26
|
+
builder
|
|
27
|
+
bundler (>= 1.0)
|
|
28
|
+
git (>= 1.2.5)
|
|
29
|
+
github_api
|
|
30
|
+
highline (>= 1.6.15)
|
|
31
|
+
nokogiri (>= 1.5.10)
|
|
32
|
+
rake
|
|
33
|
+
rdoc
|
|
34
|
+
json (1.8.3)
|
|
35
|
+
jwt (1.5.1)
|
|
36
|
+
mini_portile (0.6.2)
|
|
37
|
+
multi_json (1.11.1)
|
|
38
|
+
multi_xml (0.5.5)
|
|
39
|
+
multipart-post (2.0.0)
|
|
40
|
+
nokogiri (1.6.6.2)
|
|
41
|
+
mini_portile (~> 0.6.0)
|
|
42
|
+
oauth2 (1.0.0)
|
|
43
|
+
faraday (>= 0.8, < 0.10)
|
|
44
|
+
jwt (~> 1.0)
|
|
45
|
+
multi_json (~> 1.3)
|
|
46
|
+
multi_xml (~> 0.5)
|
|
47
|
+
rack (~> 1.2)
|
|
48
|
+
octokit (4.0.1)
|
|
49
|
+
sawyer (~> 0.6.0, >= 0.5.3)
|
|
50
|
+
options (2.3.2)
|
|
51
|
+
progress_bar (1.0.3)
|
|
52
|
+
highline (~> 1.6.1)
|
|
53
|
+
options (~> 2.3.0)
|
|
54
|
+
rack (1.6.4)
|
|
55
|
+
rainbow (2.0.0)
|
|
56
|
+
rake (10.4.2)
|
|
57
|
+
rdoc (3.12.2)
|
|
58
|
+
json (~> 1.4)
|
|
59
|
+
reek (1.2.13)
|
|
60
|
+
ripper_ruby_parser (~> 0.0.7)
|
|
61
|
+
ruby2ruby (~> 1.2.5)
|
|
62
|
+
ruby_parser (~> 2.0)
|
|
63
|
+
sexp_processor (~> 3.0)
|
|
64
|
+
ripper_ruby_parser (0.0.8)
|
|
65
|
+
sexp_processor (~> 3.0)
|
|
66
|
+
roodi (2.1.0)
|
|
67
|
+
ruby_parser
|
|
68
|
+
rspec (3.3.0)
|
|
69
|
+
rspec-core (~> 3.3.0)
|
|
70
|
+
rspec-expectations (~> 3.3.0)
|
|
71
|
+
rspec-mocks (~> 3.3.0)
|
|
72
|
+
rspec-autotest (1.0.0)
|
|
73
|
+
rspec-core (>= 2.99.0.beta1, < 4.0.0)
|
|
74
|
+
rspec-core (3.3.1)
|
|
75
|
+
rspec-support (~> 3.3.0)
|
|
76
|
+
rspec-expectations (3.3.0)
|
|
77
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
78
|
+
rspec-support (~> 3.3.0)
|
|
79
|
+
rspec-mocks (3.3.1)
|
|
80
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
81
|
+
rspec-support (~> 3.3.0)
|
|
82
|
+
rspec-support (3.3.0)
|
|
83
|
+
ruby2ruby (1.2.5)
|
|
84
|
+
ruby_parser (~> 2.0)
|
|
85
|
+
sexp_processor (~> 3.0)
|
|
86
|
+
ruby_parser (2.3.1)
|
|
87
|
+
sexp_processor (~> 3.0)
|
|
88
|
+
rugged (0.23.0b4)
|
|
89
|
+
sawyer (0.6.0)
|
|
90
|
+
addressable (~> 2.3.5)
|
|
91
|
+
faraday (~> 0.8, < 0.10)
|
|
92
|
+
settingslogic (2.0.9)
|
|
93
|
+
sexp_processor (3.2.0)
|
|
94
|
+
simplecov (0.10.0)
|
|
95
|
+
docile (~> 1.1.0)
|
|
96
|
+
json (~> 1.8)
|
|
97
|
+
simplecov-html (~> 0.10.0)
|
|
98
|
+
simplecov-html (0.10.0)
|
|
99
|
+
terminal-announce (1.0.0)
|
|
100
|
+
bundler
|
|
101
|
+
contracts
|
|
102
|
+
rainbow
|
|
103
|
+
thread_safe (0.3.5)
|
|
104
|
+
yard (0.8.7.6)
|
|
105
|
+
|
|
106
|
+
PLATFORMS
|
|
107
|
+
ruby
|
|
108
|
+
|
|
109
|
+
DEPENDENCIES
|
|
110
|
+
autotest-standalone
|
|
111
|
+
bundler (~> 1.0)
|
|
112
|
+
contracts
|
|
113
|
+
jeweler (~> 2.0.1)
|
|
114
|
+
octokit
|
|
115
|
+
progress_bar
|
|
116
|
+
rdoc (~> 3.12)
|
|
117
|
+
reek (~> 1.2.8)
|
|
118
|
+
roodi (~> 2.1.0)
|
|
119
|
+
rspec (~> 3.2)
|
|
120
|
+
rspec-autotest
|
|
121
|
+
rugged (~> 0.23.0b4)
|
|
122
|
+
settingslogic
|
|
123
|
+
simplecov
|
|
124
|
+
terminal-announce
|
|
125
|
+
yard (~> 0.7)
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2015 Chris Olstrom
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# git-ready
|
|
2
|
+
|
|
3
|
+
git-ready is a tool for quickly joining an organization on GitHub.
|
|
4
|
+
|
|
5
|
+
Installation
|
|
6
|
+
------------
|
|
7
|
+
|
|
8
|
+
`gem install git-ready`
|
|
9
|
+
|
|
10
|
+
Usage
|
|
11
|
+
-----
|
|
12
|
+
|
|
13
|
+
`git-ready <organization>`
|
|
14
|
+
|
|
15
|
+
Configuration
|
|
16
|
+
-------------
|
|
17
|
+
git-ready will search for configuration files in the following places:
|
|
18
|
+
* /etc/git-ready.yaml
|
|
19
|
+
* /usr/local/etc/git-ready.yaml
|
|
20
|
+
* ~/.config/git-ready.yaml
|
|
21
|
+
* ./git-ready.yaml
|
|
22
|
+
|
|
23
|
+
These will be loaded in order, and any conflicting keys will be overwritten.
|
|
24
|
+
|
|
25
|
+
If no configuration is found, git-ready will enter _Interactive Setup Mode_, and attempt to guide you through setup. It will prompt for your GitHub username and password, so it can issue itself an auth token (with `repo` scope only) for future use. This will be written to the configuration file.
|
|
26
|
+
|
|
27
|
+
If your GitHub account uses 2-Factor Authentication, git-ready will prompt you for a 2FA token.
|
|
28
|
+
|
|
29
|
+
If you would prefer to set up an auth token manually, that is supported too.
|
|
30
|
+
|
|
31
|
+
License
|
|
32
|
+
-------
|
|
33
|
+
[MIT](https://tldrlegal.com/license/mit-license)
|
|
34
|
+
|
|
35
|
+
Contributors
|
|
36
|
+
------------
|
|
37
|
+
* [Chris Olstrom](https://colstrom.github.io/) | [e-mail](mailto:chris@olstrom.com) | [Twitter](https://twitter.com/ChrisOlstrom)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'bundler'
|
|
5
|
+
begin
|
|
6
|
+
Bundler.setup(:default, :development)
|
|
7
|
+
rescue Bundler::BundlerError => e
|
|
8
|
+
$stderr.puts e.message
|
|
9
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
|
10
|
+
exit e.status_code
|
|
11
|
+
end
|
|
12
|
+
require 'rake'
|
|
13
|
+
|
|
14
|
+
require 'jeweler'
|
|
15
|
+
Jeweler::Tasks.new do |gem|
|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
|
17
|
+
gem.name = 'git-ready'
|
|
18
|
+
gem.homepage = 'http://github.com/colstrom/git-ready'
|
|
19
|
+
gem.license = 'MIT'
|
|
20
|
+
gem.summary = %(git-ready gets you read to work with an established team that already uses GitHub.)
|
|
21
|
+
gem.description = %(git-ready gets you read to work with an established team that already uses GitHub.)
|
|
22
|
+
gem.email = 'chris@olstrom.com'
|
|
23
|
+
gem.authors = ['Chris Olstrom']
|
|
24
|
+
gem.files = `git ls-files`.split("\n")
|
|
25
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
26
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
27
|
+
gem.require_paths = ['lib']
|
|
28
|
+
# dependencies defined in Gemfile
|
|
29
|
+
end
|
|
30
|
+
Jeweler::RubygemsDotOrgTasks.new
|
|
31
|
+
|
|
32
|
+
require 'rspec/core'
|
|
33
|
+
require 'rspec/core/rake_task'
|
|
34
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
35
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
desc 'Code coverage detail'
|
|
39
|
+
task :simplecov do
|
|
40
|
+
ENV['COVERAGE'] = 'true'
|
|
41
|
+
Rake::Task['spec'].execute
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
require 'reek/rake/task'
|
|
45
|
+
Reek::Rake::Task.new do |t|
|
|
46
|
+
t.fail_on_error = true
|
|
47
|
+
t.verbose = false
|
|
48
|
+
t.source_files = 'lib/**/*.rb'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
require 'roodi'
|
|
52
|
+
require 'roodi_task'
|
|
53
|
+
RoodiTask.new do |t|
|
|
54
|
+
t.verbose = false
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
task default: :spec
|
|
58
|
+
|
|
59
|
+
require 'yard'
|
|
60
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.8.0
|
data/bin/git-ready
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'git-ready'
|
|
4
|
+
require 'terminal-announce'
|
|
5
|
+
|
|
6
|
+
if ARGV.empty? || %w(-h --help help).include?(ARGV.first)
|
|
7
|
+
Announce.failure 'Missing an organization to git-ready with.' if ARGV.empty?
|
|
8
|
+
Announce.info 'Syntax: git-ready <organization>'
|
|
9
|
+
abort
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
organization = ARGV.first
|
|
13
|
+
username = GitHub.api.user[:login]
|
|
14
|
+
|
|
15
|
+
Announce.info "Forking all #{organization} repositories to #{username}"
|
|
16
|
+
repositories = GitHub.fork_all organization
|
|
17
|
+
|
|
18
|
+
Announce.info "Cloning all forked repositories into #{Settings.workspace}"
|
|
19
|
+
Workspace.setup repositories
|
data/lib/git-ready.rb
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'contracts'
|
|
2
|
+
require 'octokit'
|
|
3
|
+
require 'progress_bar'
|
|
4
|
+
require_relative 'settings'
|
|
5
|
+
|
|
6
|
+
module GitHub
|
|
7
|
+
include Contracts
|
|
8
|
+
|
|
9
|
+
Contract String => ArrayOf[({ upstream: Sawyer::Resource, origin: Sawyer::Resource })]
|
|
10
|
+
def self.fork_all(organization)
|
|
11
|
+
repositories = %w(public, private).flat_map do |type|
|
|
12
|
+
api.org_repos(organization, type: type)
|
|
13
|
+
end
|
|
14
|
+
progress = ProgressBar.new repositories.length
|
|
15
|
+
repositories.first(2).flat_map do |repository|
|
|
16
|
+
progress.increment!
|
|
17
|
+
{ upstream: repository, origin: api.fork(repository[:full_name]) }
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Contract nil => Octokit::Client
|
|
22
|
+
def self.api
|
|
23
|
+
@api ||= Octokit::Client.new access_token: Settings.github_access_token
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
require 'contracts'
|
|
2
|
+
require 'highline/import'
|
|
3
|
+
require 'octokit'
|
|
4
|
+
require 'terminal-announce'
|
|
5
|
+
require 'yaml'
|
|
6
|
+
require 'pry'
|
|
7
|
+
|
|
8
|
+
module InteractiveSetup
|
|
9
|
+
include Contracts
|
|
10
|
+
|
|
11
|
+
Contract nil => Any
|
|
12
|
+
def self.start
|
|
13
|
+
Announce.info 'Entering Interactive Setup (^c to exit)'
|
|
14
|
+
settings = {}
|
|
15
|
+
settings['workspace'] = Workspace.setup
|
|
16
|
+
settings['github_access_token'] = GitHubAccessToken.setup
|
|
17
|
+
save settings if validate settings
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.validate(settings)
|
|
21
|
+
if settings.value? nil
|
|
22
|
+
Announce.failure 'Settings are not valid.'
|
|
23
|
+
Announce.info "Settings were #{settings}"
|
|
24
|
+
false
|
|
25
|
+
else
|
|
26
|
+
true
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.save(settings)
|
|
31
|
+
config_path = File.expand_path('~/.config/git-ready.yaml')
|
|
32
|
+
File.write config_path, YAML.dump(settings)
|
|
33
|
+
Announce.success "Configuration saved to #{config_path}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
module Workspace
|
|
37
|
+
def self.setup
|
|
38
|
+
path = ask 'Enter the path to your workspace.'
|
|
39
|
+
actual_path = File.expand_path path
|
|
40
|
+
Announce.warning "No path given, assuming #{actual_path}" if path.empty?
|
|
41
|
+
if Dir.exist? actual_path
|
|
42
|
+
actual_path
|
|
43
|
+
else
|
|
44
|
+
Announce.failure 'Directory does not exist.'
|
|
45
|
+
setup
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
module GitHubAccessToken
|
|
51
|
+
def self.setup
|
|
52
|
+
Announce.info 'If you leave this blank, git-ready will do most of the work for you. As a fallback, you can generate your own at https://github.com/settings/tokens/new'
|
|
53
|
+
token = ask 'Enter your GitHub Personal Access Token:', String
|
|
54
|
+
token = guided_generation[:token] if token.empty?
|
|
55
|
+
token if works? token
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.guided_generation
|
|
59
|
+
login = ask 'Enter your GitHub login:'
|
|
60
|
+
password = ask('Enter your GitHub password:') { |c| c.echo = '*' }
|
|
61
|
+
generate login, password
|
|
62
|
+
rescue Octokit::OneTimePasswordRequired
|
|
63
|
+
Announce.info 'Your account has 2-Factor Authentication enabled. Awesome!'
|
|
64
|
+
headers = { 'X-GitHub-OTP' => ask('Enter a valid 2-Factor Auth Token') }
|
|
65
|
+
generate login, password, headers
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.generate(login, password, headers = {}, first_attempt = true)
|
|
69
|
+
github = Octokit::Client.new login: login, password: password
|
|
70
|
+
github.create_authorization(note: 'git-ready',
|
|
71
|
+
scopes: ['repo'],
|
|
72
|
+
headers: headers)
|
|
73
|
+
rescue Octokit::Unauthorized
|
|
74
|
+
Announce.failure 'Invalid Credentials'
|
|
75
|
+
rescue Octokit::UnprocessableEntity
|
|
76
|
+
if first_attempt
|
|
77
|
+
Announce.warning 'Found an old token. Replacing it.'
|
|
78
|
+
delete_existing_authorization github, headers
|
|
79
|
+
generate login, password, headers, false
|
|
80
|
+
else
|
|
81
|
+
Announce.failure "It looked like you had already issued a token, but deleting it didn't help. You're on your own at this point. You should should use the link at the start to generate a token manually."
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def self.delete_existing_authorization(session, headers)
|
|
86
|
+
existing = old_auth_tokens('git-ready', session, headers).first[:id]
|
|
87
|
+
session.delete_authorization existing, headers: headers
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def self.old_auth_tokens(note, session, headers)
|
|
91
|
+
session.authorizations(headers: headers).select do |auth|
|
|
92
|
+
auth[:note] == note
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def self.works?(token)
|
|
97
|
+
github = Octokit::Client.new access_token: token
|
|
98
|
+
true if github.repos
|
|
99
|
+
rescue Octokit::Unauthorized
|
|
100
|
+
Announce.failure 'Invalid Credentials'
|
|
101
|
+
false
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'contracts'
|
|
2
|
+
require 'settingslogic'
|
|
3
|
+
require 'terminal-announce'
|
|
4
|
+
|
|
5
|
+
require_relative 'interactive_setup'
|
|
6
|
+
|
|
7
|
+
# Singleton for loading configs from common paths.
|
|
8
|
+
class Settings < Settingslogic
|
|
9
|
+
include InteractiveSetup
|
|
10
|
+
|
|
11
|
+
config_paths = %w(/etc /usr/local/etc ~/.config .)
|
|
12
|
+
|
|
13
|
+
config_paths.each do |config_path|
|
|
14
|
+
config_file = File.expand_path "#{ config_path }/git-ready.yaml"
|
|
15
|
+
source config_file if File.exist? config_file
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
load!
|
|
19
|
+
rescue Errno::ENOENT
|
|
20
|
+
Announce.warning "Unable to find a configuration in #{config_paths}"
|
|
21
|
+
InteractiveSetup.start
|
|
22
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'contracts'
|
|
2
|
+
require 'rugged'
|
|
3
|
+
|
|
4
|
+
module Workspace
|
|
5
|
+
include Contracts
|
|
6
|
+
|
|
7
|
+
Contract String => Bool
|
|
8
|
+
def self.git_repository?(path)
|
|
9
|
+
true if Rugged::Repository.new path
|
|
10
|
+
rescue Rugged::OSError, Rugged::RepositoryError
|
|
11
|
+
false
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Contract String, String, String => Any
|
|
15
|
+
def self.configure_remotes(path, origin_url, upstream_url)
|
|
16
|
+
repository = Rugged::Repository.new path
|
|
17
|
+
repository.remotes.set_url 'origin', origin_url
|
|
18
|
+
repository.remotes.set_url 'upstream', upstream_url
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Contract String, String => Any
|
|
22
|
+
def self.clone(url, path)
|
|
23
|
+
credentials = Rugged::Credentials::SshKeyFromAgent.new username: 'git'
|
|
24
|
+
Rugged::Repository.clone_at(url, path, credentials: credentials) unless git_repository? path
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Contract ArrayOf[Hash] => Any
|
|
28
|
+
def self.setup(repositories)
|
|
29
|
+
progress = ProgressBar.new repositories.length
|
|
30
|
+
repositories.each do |repo|
|
|
31
|
+
# binding.pry
|
|
32
|
+
path = "#{Settings.workspace}/#{repo[:origin][:name]}"
|
|
33
|
+
clone repo[:origin][:ssh_url], path
|
|
34
|
+
configure_remotes path, repo[:origin][:ssh_url], repo[:upstream][:ssh_url]
|
|
35
|
+
progress.increment!
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'simplecov'
|
|
2
|
+
|
|
3
|
+
module SimpleCov
|
|
4
|
+
module Configuration
|
|
5
|
+
def clean_filters
|
|
6
|
+
@filters = []
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
SimpleCov.configure do
|
|
12
|
+
clean_filters
|
|
13
|
+
load_profile 'test_frameworks'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
ENV['COVERAGE'] && SimpleCov.start do
|
|
17
|
+
add_filter '/.rvm/'
|
|
18
|
+
add_filter '/.rubies/'
|
|
19
|
+
add_filter '/vendor/'
|
|
20
|
+
end
|
|
21
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
22
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
23
|
+
|
|
24
|
+
require 'rspec'
|
|
25
|
+
require 'git-ready'
|
|
26
|
+
|
|
27
|
+
# Requires supporting files with custom matchers and macros, etc,
|
|
28
|
+
# in ./support/ and its subdirectories.
|
|
29
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
30
|
+
|
|
31
|
+
RSpec.configure do |config|
|
|
32
|
+
config.expect_with :rspec do |c|
|
|
33
|
+
c.syntax = :expect
|
|
34
|
+
end
|
|
35
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: git-ready
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.8.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Chris Olstrom
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: contracts
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: octokit
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: progress_bar
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rugged
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.23.0b4
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 0.23.0b4
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: settingslogic
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: terminal-announce
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '3.2'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '3.2'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: yard
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0.7'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0.7'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: rdoc
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '3.12'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '3.12'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: bundler
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - "~>"
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '1.0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '1.0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: jeweler
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: 2.0.1
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - "~>"
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: 2.0.1
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: simplecov
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - ">="
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: '0'
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - ">="
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: '0'
|
|
181
|
+
- !ruby/object:Gem::Dependency
|
|
182
|
+
name: reek
|
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
|
184
|
+
requirements:
|
|
185
|
+
- - "~>"
|
|
186
|
+
- !ruby/object:Gem::Version
|
|
187
|
+
version: 1.2.8
|
|
188
|
+
type: :development
|
|
189
|
+
prerelease: false
|
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
191
|
+
requirements:
|
|
192
|
+
- - "~>"
|
|
193
|
+
- !ruby/object:Gem::Version
|
|
194
|
+
version: 1.2.8
|
|
195
|
+
- !ruby/object:Gem::Dependency
|
|
196
|
+
name: roodi
|
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
|
198
|
+
requirements:
|
|
199
|
+
- - "~>"
|
|
200
|
+
- !ruby/object:Gem::Version
|
|
201
|
+
version: 2.1.0
|
|
202
|
+
type: :development
|
|
203
|
+
prerelease: false
|
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
205
|
+
requirements:
|
|
206
|
+
- - "~>"
|
|
207
|
+
- !ruby/object:Gem::Version
|
|
208
|
+
version: 2.1.0
|
|
209
|
+
- !ruby/object:Gem::Dependency
|
|
210
|
+
name: autotest-standalone
|
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
|
212
|
+
requirements:
|
|
213
|
+
- - ">="
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: '0'
|
|
216
|
+
type: :development
|
|
217
|
+
prerelease: false
|
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - ">="
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '0'
|
|
223
|
+
- !ruby/object:Gem::Dependency
|
|
224
|
+
name: rspec-autotest
|
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
|
226
|
+
requirements:
|
|
227
|
+
- - ">="
|
|
228
|
+
- !ruby/object:Gem::Version
|
|
229
|
+
version: '0'
|
|
230
|
+
type: :development
|
|
231
|
+
prerelease: false
|
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
233
|
+
requirements:
|
|
234
|
+
- - ">="
|
|
235
|
+
- !ruby/object:Gem::Version
|
|
236
|
+
version: '0'
|
|
237
|
+
description: git-ready gets you read to work with an established team that already
|
|
238
|
+
uses GitHub.
|
|
239
|
+
email: chris@olstrom.com
|
|
240
|
+
executables:
|
|
241
|
+
- git-ready
|
|
242
|
+
extensions: []
|
|
243
|
+
extra_rdoc_files:
|
|
244
|
+
- LICENSE.txt
|
|
245
|
+
- README.md
|
|
246
|
+
files:
|
|
247
|
+
- ".document"
|
|
248
|
+
- ".gitignore"
|
|
249
|
+
- ".rspec"
|
|
250
|
+
- Gemfile
|
|
251
|
+
- Gemfile.lock
|
|
252
|
+
- LICENSE.txt
|
|
253
|
+
- README.md
|
|
254
|
+
- Rakefile
|
|
255
|
+
- VERSION
|
|
256
|
+
- bin/git-ready
|
|
257
|
+
- lib/git-ready.rb
|
|
258
|
+
- lib/git-ready/github.rb
|
|
259
|
+
- lib/git-ready/interactive_setup.rb
|
|
260
|
+
- lib/git-ready/settings.rb
|
|
261
|
+
- lib/git-ready/workspace.rb
|
|
262
|
+
- spec/git-ready_spec.rb
|
|
263
|
+
- spec/spec_helper.rb
|
|
264
|
+
homepage: http://github.com/colstrom/git-ready
|
|
265
|
+
licenses:
|
|
266
|
+
- MIT
|
|
267
|
+
metadata: {}
|
|
268
|
+
post_install_message:
|
|
269
|
+
rdoc_options: []
|
|
270
|
+
require_paths:
|
|
271
|
+
- lib
|
|
272
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
273
|
+
requirements:
|
|
274
|
+
- - ">="
|
|
275
|
+
- !ruby/object:Gem::Version
|
|
276
|
+
version: '0'
|
|
277
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
|
+
requirements:
|
|
279
|
+
- - ">="
|
|
280
|
+
- !ruby/object:Gem::Version
|
|
281
|
+
version: '0'
|
|
282
|
+
requirements: []
|
|
283
|
+
rubyforge_project:
|
|
284
|
+
rubygems_version: 2.4.5
|
|
285
|
+
signing_key:
|
|
286
|
+
specification_version: 4
|
|
287
|
+
summary: git-ready gets you read to work with an established team that already uses
|
|
288
|
+
GitHub.
|
|
289
|
+
test_files:
|
|
290
|
+
- spec/git-ready_spec.rb
|
|
291
|
+
- spec/spec_helper.rb
|