github-cloner 0.4.0 → 0.5.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Rakefile +10 -9
- data/bin/github-cloner +2 -1
- data/lib/github_cloner/github_cloner.rb +4 -2
- data/lib/github_cloner/opt_parser.rb +12 -0
- data/lib/github_cloner/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ab1e01b111f34728e5d369f2523d0c3366c8d42
|
4
|
+
data.tar.gz: 228d5e9b6ba673d4a98958c465e1f5847d27ae91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 376f9c2c864ecc28cce5563542c3b76640bf646a32dc5a0243e5abce4ea4807f8a136e15000563f3a7e9422e027701d33d723e14a7c9dc0d428d8e14c2084073
|
7
|
+
data.tar.gz: ec7d392b8adca042bb5423ef4c09cd6c1f8faace39a0f50cb5c3f6341d72a90a9bf7e11eb83446fb9049b94d48c4f261fe09b3f8d841c71b5b6608c004aa9f56
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -15,12 +15,13 @@ task :pry do
|
|
15
15
|
ARGV.clear
|
16
16
|
Pry.start
|
17
17
|
end
|
18
|
-
|
19
|
-
|
20
|
-
RuboCop
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
|
19
|
+
# require 'rubocop/rake_task'
|
20
|
+
# desc 'Run RuboCop on the lib directory'
|
21
|
+
# RuboCop::RakeTask.new(:rubocop) do |task|
|
22
|
+
# task.patterns = ['lib/**/*.rb']
|
23
|
+
# # only show the files with failures
|
24
|
+
# task.formatters = ['files']
|
25
|
+
# # don't abort rake on failure
|
26
|
+
# task.fail_on_error = false
|
27
|
+
# end
|
data/bin/github-cloner
CHANGED
@@ -27,7 +27,8 @@ args = {
|
|
27
27
|
org: options.org,
|
28
28
|
all_repos: options.all_repos,
|
29
29
|
group_by_user: options.group_by_user,
|
30
|
-
clone_repos: options.clone_repos
|
30
|
+
clone_repos: options.clone_repos,
|
31
|
+
repo_host: options.repo_host
|
31
32
|
}
|
32
33
|
|
33
34
|
repos = GithubCloner::GithubUtils.list_all(args)
|
@@ -72,9 +72,11 @@ module GithubCloner
|
|
72
72
|
else
|
73
73
|
output_path = [base_path, language, org_name, repo_name].join(File::SEPARATOR)
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
|
+
puts "Process #{i+1} of #{projects.size} : git clone git@#{args[:repo_host]}:#{[org_name, repo_name].join(File::SEPARATOR)}.git #{output_path}"
|
77
|
+
|
76
78
|
if args[:clone_repos]
|
77
|
-
system("git clone git
|
79
|
+
system("git clone git@#{args[:repo_host]}:#{[org_name, repo_name].join(File::SEPARATOR)}.git #{output_path} 2> /dev/null")
|
78
80
|
end
|
79
81
|
end
|
80
82
|
end
|
@@ -10,6 +10,7 @@ module GithubCloner
|
|
10
10
|
|
11
11
|
# Set the sensible default for the options explicitly
|
12
12
|
options.base_dir = "."
|
13
|
+
options.repo_host = "github.com"
|
13
14
|
options.all_repos = false
|
14
15
|
options.group_by_user = false
|
15
16
|
options.clone_repos = false
|
@@ -51,6 +52,12 @@ module GithubCloner
|
|
51
52
|
options.languages = langs
|
52
53
|
end
|
53
54
|
|
55
|
+
opts.on("-r", "--repo-host REPO_HOST",
|
56
|
+
"where REPO_HOST is the repository host to be cloned from",
|
57
|
+
"If not specified, github.com will be used") do |host|
|
58
|
+
options.repo_host = host
|
59
|
+
end
|
60
|
+
|
54
61
|
# Boolean switch.
|
55
62
|
opts.on("-a", "--[no-]all-repos",
|
56
63
|
"All repository only (optional)",
|
@@ -94,6 +101,10 @@ module GithubCloner
|
|
94
101
|
puts "5) Clone all 'JavaScript' and 'Emacs Lisp' repositories for a given organization where a given user belongs to (include private repos)"
|
95
102
|
puts "$github-cloner -b ~/Desktop/projects -u awesome_user -o awesome_company -l -t GITHUB_TOKEN -l 'JavaScript,Emacs Lisp' -c"
|
96
103
|
puts ""
|
104
|
+
puts "6) Clone all 'JavaScript' and 'Emacs Lisp' repositories for a given organization where a given user belongs to (include private repos)"
|
105
|
+
puts " Using the host configured in ~/.ssh/config file instead of the default github.com"
|
106
|
+
puts "$github-cloner -b ~/Desktop/projects -u awesome_user -o awesome_company -l -t GITHUB_TOKEN -l 'JavaScript,Emacs Lisp' -r github-work -c"
|
107
|
+
puts ""
|
97
108
|
exit
|
98
109
|
end
|
99
110
|
end
|
@@ -104,6 +115,7 @@ module GithubCloner
|
|
104
115
|
end
|
105
116
|
end
|
106
117
|
|
118
|
+
## NOTE: for testing only
|
107
119
|
# options = GithubCloner::OptParser.parse(ARGV)
|
108
120
|
# puts options
|
109
121
|
# puts ARGV
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-cloner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.5.1
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: Clone/list Github repository for a given user/organization include private/public
|