github_cloner 0.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +13 -13
- data/Gemfile.lock +21 -20
- data/LICENSE.txt +20 -20
- data/README.rdoc +37 -36
- data/Rakefile +56 -54
- data/bin/github_cloner +75 -66
- data/github_cloner.gemspec +6 -3
- data/lib/github_cloner/github_helper.rb +44 -0
- data/lib/github_cloner/version.rb +10 -0
- data/lib/github_cloner.rb +14 -34
- data/pkg/github_cloner-0.3.0.gem +0 -0
- data/test/helper.rb +18 -18
- data/test/test_github_cloner.rb +7 -7
- metadata +7 -4
data/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
|
-
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem "shoulda", ">= 0"
|
10
|
-
gem "bundler", "~> 1.0.0"
|
11
|
-
gem "jeweler", "~> 1.5.2"
|
12
|
-
gem "rcov", ">= 0"
|
13
|
-
end
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.5.2"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
git (1.2.5)
|
5
|
-
jeweler (1.5.2)
|
6
|
-
bundler (~> 1.0.0)
|
7
|
-
git (>= 1.2.5)
|
8
|
-
rake
|
9
|
-
rake (0.8.7)
|
10
|
-
rcov (0.9.9)
|
11
|
-
shoulda (2.11.3)
|
12
|
-
|
13
|
-
PLATFORMS
|
14
|
-
ruby
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.5.2)
|
6
|
+
bundler (~> 1.0.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.8.7)
|
10
|
+
rcov (0.9.9)
|
11
|
+
shoulda (2.11.3)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
x86-mingw32
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
bundler (~> 1.0.0)
|
19
|
+
jeweler (~> 1.5.2)
|
20
|
+
rcov
|
21
|
+
shoulda
|
data/LICENSE.txt
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2011 nashby
|
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.
|
1
|
+
Copyright (c) 2011 nashby
|
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.rdoc
CHANGED
@@ -1,36 +1,37 @@
|
|
1
|
-
= github_cloner
|
2
|
-
|
3
|
-
With github_cloner you have an easy way to clone all your projects from github.
|
4
|
-
|
5
|
-
== Usage
|
6
|
-
|
7
|
-
gem install github_cloner
|
8
|
-
|
9
|
-
Usage: github_cloner [options]
|
10
|
-
|
11
|
-
Specific options:
|
12
|
-
-u, --username GITHUB_USERNAME Require the GITHUB_USERNAME before executing your script
|
13
|
-
-p, --path [PATH] PATH to new repos collection (default: current directory)
|
14
|
-
-
|
15
|
-
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
* Check out the
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
1
|
+
= github_cloner
|
2
|
+
|
3
|
+
With github_cloner you have an easy way to clone all your projects from github.
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
gem install github_cloner
|
8
|
+
|
9
|
+
Usage: github_cloner [options]
|
10
|
+
|
11
|
+
Specific options:
|
12
|
+
-u, --username GITHUB_USERNAME Require the GITHUB_USERNAME before executing your script
|
13
|
+
-p, --path [PATH] PATH to new repos collection (default: current directory)
|
14
|
+
-t, --timeout [TIMEOUT] Number of days from the last push befor repos will be placed in the inactive folder (default: disabled)
|
15
|
+
-m, --method [METHOD] git clone [METHOD] (http, git, ssh. default: http)
|
16
|
+
-r, --repos x,y,z List of needed repos (default: all repos from your profile)
|
17
|
+
|
18
|
+
Common options:
|
19
|
+
-h, --help Show this message
|
20
|
+
|
21
|
+
$ github_cloner --username nashby --method http --path ~/Desktop/github_projects
|
22
|
+
|
23
|
+
== Contributing to github_cloner
|
24
|
+
|
25
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
26
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
27
|
+
* Fork the project
|
28
|
+
* Start a feature/bugfix branch
|
29
|
+
* Commit and push until you are happy with your contribution
|
30
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
31
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
32
|
+
|
33
|
+
== Copyright
|
34
|
+
|
35
|
+
Copyright (c) 2011 nashby. See LICENSE.txt for
|
36
|
+
further details.
|
37
|
+
|
data/Rakefile
CHANGED
@@ -1,54 +1,56 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
|
11
|
-
$LOAD_PATH.unshift('lib')
|
12
|
-
|
13
|
-
require 'rake'
|
14
|
-
require 'jeweler'
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
gem.
|
19
|
-
gem.
|
20
|
-
gem.
|
21
|
-
gem.
|
22
|
-
gem.
|
23
|
-
gem.
|
24
|
-
gem.
|
25
|
-
gem.
|
26
|
-
gem.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
test.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
test.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
rdoc.
|
53
|
-
rdoc.
|
54
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift('lib')
|
12
|
+
|
13
|
+
require 'rake'
|
14
|
+
require 'jeweler'
|
15
|
+
require 'github_cloner/version'
|
16
|
+
|
17
|
+
Jeweler::Tasks.new do |gem|
|
18
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
19
|
+
gem.name = "github_cloner"
|
20
|
+
gem.homepage = "http://github.com/nashby/github_cloner"
|
21
|
+
gem.version = Cloner::Version::STRING
|
22
|
+
gem.license = "MIT"
|
23
|
+
gem.executables = ["github_cloner"]
|
24
|
+
gem.summary = %Q{an easy way to clone all your projects from github}
|
25
|
+
gem.description = %Q{an easy way to clone all your projects from github}
|
26
|
+
gem.email = "younash@gmail.com"
|
27
|
+
gem.authors = ["Vasiliy Ermolovich"]
|
28
|
+
gem.files.include Dir.glob('lib/**/*.rb')
|
29
|
+
end
|
30
|
+
Jeweler::RubygemsDotOrgTasks.new
|
31
|
+
|
32
|
+
require 'rake/testtask'
|
33
|
+
Rake::TestTask.new(:test) do |test|
|
34
|
+
test.libs << 'lib' << 'test'
|
35
|
+
test.pattern = 'test/**/test_*.rb'
|
36
|
+
test.verbose = true
|
37
|
+
end
|
38
|
+
|
39
|
+
require 'rcov/rcovtask'
|
40
|
+
Rcov::RcovTask.new do |test|
|
41
|
+
test.libs << 'test'
|
42
|
+
test.pattern = 'test/**/test_*.rb'
|
43
|
+
test.verbose = true
|
44
|
+
end
|
45
|
+
|
46
|
+
task :default => :test
|
47
|
+
|
48
|
+
require 'rake/rdoctask'
|
49
|
+
Rake::RDocTask.new do |rdoc|
|
50
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
51
|
+
|
52
|
+
rdoc.rdoc_dir = 'rdoc'
|
53
|
+
rdoc.title = "github_cloner #{version}"
|
54
|
+
rdoc.rdoc_files.include('README*')
|
55
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
56
|
+
end
|
data/bin/github_cloner
CHANGED
@@ -1,66 +1,75 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
-
|
4
|
-
require 'optparse'
|
5
|
-
require 'ostruct'
|
6
|
-
require 'github_cloner'
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
options =
|
13
|
-
options.
|
14
|
-
options.
|
15
|
-
options.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
opts.separator ""
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
opts.
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
options
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
require 'ostruct'
|
6
|
+
require 'github_cloner'
|
7
|
+
|
8
|
+
class OptionParser
|
9
|
+
def self.parse(args)
|
10
|
+
options = OpenStruct.new
|
11
|
+
options.username = nil
|
12
|
+
options.git_method = 'http'
|
13
|
+
options.path = "."
|
14
|
+
options.timeout = ""
|
15
|
+
options.repos = []
|
16
|
+
|
17
|
+
opts = OptionParser.new do |opts|
|
18
|
+
opts.banner = "Usage: github_cloner [options]"
|
19
|
+
|
20
|
+
opts.separator ""
|
21
|
+
opts.separator "Specific options:"
|
22
|
+
|
23
|
+
# Mandatory argument.
|
24
|
+
opts.on("-u", "--username GITHUB_USERNAME",
|
25
|
+
"Require the GITHUB_USERNAME before executing your script") do |username|
|
26
|
+
options.username = username
|
27
|
+
end
|
28
|
+
|
29
|
+
# Optional argument
|
30
|
+
opts.on("-p", "--path [PATH]",
|
31
|
+
"PATH to the new repos collection (default: current directory)") do |path|
|
32
|
+
options.path = path
|
33
|
+
end
|
34
|
+
|
35
|
+
opts.on("-t", "--timeout [TIMEOUT]",
|
36
|
+
"Number of days from the last push befor repos will be placed in the inactive folder (default: disabled)") do |timeout|
|
37
|
+
options.timeout = timeout
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.on("-m", "--method [METHOD]", ['http', 'git', 'ssh'],
|
41
|
+
"git clone [METHOD] (http, git, ssh. default: http)") do |git_method|
|
42
|
+
options.git_method = git_method
|
43
|
+
end
|
44
|
+
|
45
|
+
# List of the repos.
|
46
|
+
opts.on("-r", "--repos x,y,z", Array, "List of needed repos (default: all)") do |repos|
|
47
|
+
options.repos = repos
|
48
|
+
end
|
49
|
+
|
50
|
+
opts.separator ""
|
51
|
+
opts.separator "Common options:"
|
52
|
+
|
53
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
54
|
+
puts opts
|
55
|
+
exit
|
56
|
+
end
|
57
|
+
end
|
58
|
+
opts.parse!(args)
|
59
|
+
options
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
options = OptionParser.parse(ARGV)
|
64
|
+
|
65
|
+
unless options.username.nil?
|
66
|
+
opts = {:username => options.username.to_s,
|
67
|
+
:method => options.git_method.to_s,
|
68
|
+
:path => options.path.to_s,
|
69
|
+
:timeout => options.timeout.to_s,
|
70
|
+
:repos => options.repos}
|
71
|
+
cloner = Cloner.new opts
|
72
|
+
cloner.clone
|
73
|
+
else
|
74
|
+
puts 'Sorry, bro. I need to know your github name'
|
75
|
+
end
|
data/github_cloner.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{github_cloner}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Vasiliy Ermolovich"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-03-09}
|
13
13
|
s.default_executable = %q{github_cloner}
|
14
14
|
s.description = %q{an easy way to clone all your projects from github}
|
15
15
|
s.email = %q{younash@gmail.com}
|
@@ -27,15 +27,18 @@ Gem::Specification.new do |s|
|
|
27
27
|
"bin/github_cloner",
|
28
28
|
"github_cloner.gemspec",
|
29
29
|
"lib/github_cloner.rb",
|
30
|
+
"lib/github_cloner/github_helper.rb",
|
31
|
+
"lib/github_cloner/version.rb",
|
30
32
|
"pkg/github_cloner-0.1.gem",
|
31
33
|
"pkg/github_cloner-0.2.gem",
|
34
|
+
"pkg/github_cloner-0.3.0.gem",
|
32
35
|
"test/helper.rb",
|
33
36
|
"test/test_github_cloner.rb"
|
34
37
|
]
|
35
38
|
s.homepage = %q{http://github.com/nashby/github_cloner}
|
36
39
|
s.licenses = ["MIT"]
|
37
40
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.
|
41
|
+
s.rubygems_version = %q{1.6.2}
|
39
42
|
s.summary = %q{an easy way to clone all your projects from github}
|
40
43
|
s.test_files = [
|
41
44
|
"test/helper.rb",
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'time'
|
4
|
+
|
5
|
+
module Github
|
6
|
+
|
7
|
+
GITHUB_URL_API = 'http://github.com/api/v2/json/repos/show/'
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def get_repos(username, mode, timeout)
|
12
|
+
repos_json = JSON.parse(open(GITHUB_URL_API+username).read)
|
13
|
+
repos = []
|
14
|
+
repos_json['repositories'].each do |repo|
|
15
|
+
if timeout != "" && inactive?(repo, timeout)
|
16
|
+
repos << make_git_url(repo['name'], mode, username, "_inactive")
|
17
|
+
else
|
18
|
+
repos << make_git_url(repo['name'], mode, username, "")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def make_git_url(repo_name, mode, username, inactive)
|
24
|
+
case mode
|
25
|
+
when 'ssh'
|
26
|
+
{:link => "git@github.com:#{username}/#{repo_name}.git", :name => repo_name, :inactive => inactive}
|
27
|
+
when 'http'
|
28
|
+
{:link => "https://#{username}@github.com/#{username}/#{repo_name}.git", :name => repo_name, :inactive => inactive}
|
29
|
+
when 'git'
|
30
|
+
{:link => "git://github.com/#{username}/#{repo_name}.git", :name => repo_name, :inactive => inactive}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def inactive?(repo, timeout)
|
35
|
+
if ((Time.now - Time.parse(repo["pushed_at"])).to_i / 86400) > timeout.to_i
|
36
|
+
true
|
37
|
+
else
|
38
|
+
false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
data/lib/github_cloner.rb
CHANGED
@@ -1,38 +1,18 @@
|
|
1
|
-
require '
|
2
|
-
require 'open-uri'
|
1
|
+
require 'github_cloner/github_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
class Cloner
|
4
|
+
include Github
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
case @mode
|
18
|
-
when 'ssh'
|
19
|
-
{:link => "git@github.com:#{@github_uname}/#{repo_name}.git", :name => repo_name}
|
20
|
-
when 'http'
|
21
|
-
{:link => "https://#{@github_uname}@github.com/#{@github_uname}/#{repo_name}.git", :name => repo_name}
|
22
|
-
when 'git'
|
23
|
-
{:link => "git://github.com/#{@github_uname}/#{repo_name}.git", :name => repo_name}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def get_gits
|
28
|
-
repos = JSON.parse(open(GITHUB_URL_API+@github_uname).read)
|
29
|
-
gits = []
|
30
|
-
repos['repositories'].each { |repo| gits << make_git_url(repo['name']) if @repos.include? repo['name'] or @repos.empty? }
|
31
|
-
gits
|
32
|
-
end
|
33
|
-
|
34
|
-
def clone
|
35
|
-
get_gits.each {|repo| system("git clone #{repo[:link]} #{@path}/#{repo[:name]}")}
|
36
|
-
end
|
6
|
+
def initialize(options)
|
7
|
+
@github_uname = options[:username]
|
8
|
+
@mode = options[:method]
|
9
|
+
@path = options[:path]
|
10
|
+
@timeout = options[:timeout]
|
11
|
+
@repos = options[:repos]
|
12
|
+
end
|
13
|
+
|
14
|
+
def clone
|
15
|
+
Github::get_repos(@github_uname, @mode, @timeout).each {|repo| system("git clone #{repo[:link]} #{@path}#{repo[:inactive]}/#{repo[:name]}") if @repos.include? repo[:name] or @repos.empty? }
|
37
16
|
end
|
38
17
|
end
|
18
|
+
|
Binary file
|
data/test/helper.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
require 'shoulda'
|
12
|
-
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
-
require 'github_cloner'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
require 'github_cloner'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
data/test/test_github_cloner.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestGithubCloner < Test::Unit::TestCase
|
4
|
-
should "probably rename this file and start testing for real" do
|
5
|
-
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
|
-
end
|
7
|
-
end
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestGithubCloner < Test::Unit::TestCase
|
4
|
+
should "probably rename this file and start testing for real" do
|
5
|
+
flunk "hey buddy, you should probably rename this file and start testing for real"
|
6
|
+
end
|
7
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: github_cloner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version:
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Vasiliy Ermolovich
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-03-09 00:00:00 +02:00
|
14
14
|
default_executable: github_cloner
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -75,8 +75,11 @@ files:
|
|
75
75
|
- bin/github_cloner
|
76
76
|
- github_cloner.gemspec
|
77
77
|
- lib/github_cloner.rb
|
78
|
+
- lib/github_cloner/github_helper.rb
|
79
|
+
- lib/github_cloner/version.rb
|
78
80
|
- pkg/github_cloner-0.1.gem
|
79
81
|
- pkg/github_cloner-0.2.gem
|
82
|
+
- pkg/github_cloner-0.3.0.gem
|
80
83
|
- test/helper.rb
|
81
84
|
- test/test_github_cloner.rb
|
82
85
|
has_rdoc: true
|
@@ -93,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
96
|
requirements:
|
94
97
|
- - ">="
|
95
98
|
- !ruby/object:Gem::Version
|
96
|
-
hash: -
|
99
|
+
hash: -506048625
|
97
100
|
segments:
|
98
101
|
- 0
|
99
102
|
version: "0"
|
@@ -106,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
109
|
requirements: []
|
107
110
|
|
108
111
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.6.2
|
110
113
|
signing_key:
|
111
114
|
specification_version: 3
|
112
115
|
summary: an easy way to clone all your projects from github
|