github-cloner 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 757ebae0d662268f47ec94f7f152be783d2c5b12
4
- data.tar.gz: cf8f8eaec3306e172381e77e7ea042c138a011ca
3
+ metadata.gz: 9ab1e01b111f34728e5d369f2523d0c3366c8d42
4
+ data.tar.gz: 228d5e9b6ba673d4a98958c465e1f5847d27ae91
5
5
  SHA512:
6
- metadata.gz: db4a4903f8f2a4aa6560dd893860e6e6ed338366024f231bdc59d353e0960c215295484b54b6aa12973e55aef9dcb9bb7a189c800410eea06855cf74a53d3b1a
7
- data.tar.gz: 02f137143ba9756709e9adbd6257766c3711213d1331f642cfea00e5a96701ad58a4340520fa1ca781c87af10375934d7107a72ca094917723aa42448cf07892
6
+ metadata.gz: 376f9c2c864ecc28cce5563542c3b76640bf646a32dc5a0243e5abce4ea4807f8a136e15000563f3a7e9422e027701d33d723e14a7c9dc0d428d8e14c2084073
7
+ data.tar.gz: ec7d392b8adca042bb5423ef4c09cd6c1f8faace39a0f50cb5c3f6341d72a90a9bf7e11eb83446fb9049b94d48c4f261fe09b3f8d841c71b5b6608c004aa9f56
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ### Changelogs
2
2
 
3
+ #### 0.5.0
4
+
5
+ - Allow new option -r to use config file from `~/.ssh/config`
6
+
3
7
  #### 0.4.0
4
8
 
5
9
  - Allow more than one languages to be cloned (new feature)
data/Rakefile CHANGED
@@ -15,12 +15,13 @@ task :pry do
15
15
  ARGV.clear
16
16
  Pry.start
17
17
  end
18
- require 'rubocop/rake_task'
19
- desc 'Run RuboCop on the lib directory'
20
- RuboCop::RakeTask.new(:rubocop) do |task|
21
- task.patterns = ['lib/**/*.rb']
22
- # only show the files with failures
23
- task.formatters = ['files']
24
- # don't abort rake on failure
25
- task.fail_on_error = false
26
- end
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
- puts "Process #{i+1} of #{projects.size} : git clone git@github.com:#{[org_name, repo_name].join(File::SEPARATOR)}.git #{output_path}"
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@github.com:#{[org_name, repo_name].join(File::SEPARATOR)}.git #{output_path} 2> /dev/null")
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
@@ -1,3 +1,3 @@
1
1
  module GithubCloner
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
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.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-04-07 00:00:00.000000000 Z
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.4.5.1
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