backup_repos 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +22 -0
- data/.hound.yml +5 -0
- data/.rubocop.yml +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +7 -1
- data/LICENSE.md +21 -0
- data/README.md +45 -3
- data/Rakefile +3 -3
- data/backup_repos.gemspec +7 -6
- data/bin/console +6 -6
- data/lib/backup_repos.rb +1 -1
- data/lib/backup_repos/backup.rb +20 -5
- data/lib/backup_repos/backup_bitbucket.rb +0 -6
- data/lib/backup_repos/backup_github.rb +14 -7
- data/lib/backup_repos/backup_gitlab.rb +15 -0
- data/lib/backup_repos/backup_gitlab_endpoint.rb +46 -0
- data/lib/backup_repos/cli/setup.rb +98 -0
- data/lib/backup_repos/commander.rb +20 -2
- data/lib/backup_repos/config.rb +6 -6
- data/lib/backup_repos/performers/base_git.rb +3 -2
- data/lib/backup_repos/performers/bitbucket_git_wiki.rb +1 -11
- data/lib/backup_repos/performers/gitlab_repository.rb +17 -0
- data/lib/backup_repos/version.rb +1 -1
- data/lib/core_ext/object.rb +4 -0
- metadata +40 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4274a6ab90f801376a89a90d55b438cca9ec7d66
|
4
|
+
data.tar.gz: de82161c31a999843ed27eb1028c085d18896df3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5975e16c635d31044ac28c8c15a3cc8bd4b4c6e4036283226414321ee104dd9df793eb70400ef40eb09e1df770cbbc849bee9a47d692cb93f4b41af85e0f342d
|
7
|
+
data.tar.gz: 34bd0389d432a1846db0d58e30b00fc4ed57bf714f5a89616eaebdc8144eac557b6af94a6a030c1a66cc92801353876580170b2e2496aa52c02087ffd6fce47d
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
engines:
|
2
|
+
duplication:
|
3
|
+
enabled: true
|
4
|
+
config:
|
5
|
+
languages:
|
6
|
+
- ruby
|
7
|
+
fixme:
|
8
|
+
enabled: true
|
9
|
+
rubocop:
|
10
|
+
enabled: true
|
11
|
+
exclude_fingerprints:
|
12
|
+
- 580ec239bc6e53e62cd63ce219b812e6
|
13
|
+
- 39dfc9669aec43e3e76abb09d3b5fcc1
|
14
|
+
- 016d5b320f02cb900b27631f3c7c0a20
|
15
|
+
checks:
|
16
|
+
Rubocop/Rails/Output:
|
17
|
+
enabled: false
|
18
|
+
ratings:
|
19
|
+
paths:
|
20
|
+
- "**.rb"
|
21
|
+
exclude_paths:
|
22
|
+
- spec/
|
data/.hound.yml
ADDED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -2,3 +2,10 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 2.2.3
|
4
4
|
before_install: gem install bundler -v 1.11.2
|
5
|
+
notifications:
|
6
|
+
webhooks:
|
7
|
+
urls:
|
8
|
+
- https://webhooks.gitter.im/e/42b88a12ac0d365e7709
|
9
|
+
on_success: change # options: [always|never|change] default: always
|
10
|
+
on_failure: always # options: [always|never|change] default: always
|
11
|
+
on_start: never # options: [always|never|change] default: always
|
data/Gemfile
CHANGED
@@ -3,6 +3,12 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in backup_repos.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
group :development do
|
6
|
+
group :development, :test do
|
7
7
|
gem 'pry'
|
8
8
|
end
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem 'codeclimate-test-reporter'
|
12
|
+
gem 'coveralls'
|
13
|
+
gem 'simplecov', require: false
|
14
|
+
end
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Justas Palumickas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# Backup Repos
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/backup_repos.svg?style=flat-square)][rubygems]
|
4
|
+
[![Gitter](https://img.shields.io/gitter/room/jpalumickas/jpalumickas.svg?style=flat-square)][gitter]
|
5
|
+
[![Build Status](https://img.shields.io/travis/jpalumickas/backup-repos.svg?style=flat-square)][travis]
|
6
|
+
[![Dependency Status](https://img.shields.io/gemnasium/jpalumickas/backup-repos.svg?style=flat-square)][gemnasium]
|
7
|
+
[![Coverage Status](https://img.shields.io/coveralls/jpalumickas/backup-repos.svg?branch=master&style=flat-square)][coveralls]
|
8
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/jpalumickas/backup-repos.svg?style=flat-square)][codeclimate]
|
9
|
+
|
10
|
+
|
11
|
+
Backup your GitHub, BitBucket and GitLab repositories to specified directory.
|
4
12
|
|
5
13
|
## Installation
|
6
14
|
|
@@ -10,7 +18,28 @@ $ gem install backup_repos
|
|
10
18
|
|
11
19
|
## Usage
|
12
20
|
|
13
|
-
|
21
|
+
#### Setup your settings
|
22
|
+
|
23
|
+
```shell
|
24
|
+
$ backup-repos setup
|
25
|
+
```
|
26
|
+
|
27
|
+
Settings will be written to your home directory `.backup-repos` file.
|
28
|
+
|
29
|
+
#### Backup your repositories
|
30
|
+
|
31
|
+
Backup all your providers:
|
32
|
+
|
33
|
+
```shell
|
34
|
+
$ backup-repos backup
|
35
|
+
```
|
36
|
+
|
37
|
+
Or specify one:
|
38
|
+
|
39
|
+
```shell
|
40
|
+
$ backup-repos backup github
|
41
|
+
```
|
42
|
+
|
14
43
|
|
15
44
|
## Development
|
16
45
|
|
@@ -20,4 +49,17 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
20
49
|
|
21
50
|
## Contributing
|
22
51
|
|
23
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jpalumickas/backup-repos.
|
53
|
+
|
54
|
+
## Copyright
|
55
|
+
Copyright (c) 2016 Justas Palumickas.
|
56
|
+
See [LICENSE][] for details.
|
57
|
+
|
58
|
+
[rubygems]: https://rubygems.org/gems/backup_repos
|
59
|
+
[travis]: http://travis-ci.org/jpalumickas/backup-repos
|
60
|
+
[gemnasium]: https://gemnasium.com/jpalumickas/backup-repos
|
61
|
+
[coveralls]: https://coveralls.io/r/jpalumickas/backup-repos
|
62
|
+
[codeclimate]: https://codeclimate.com/github/jpalumickas/backup-repos
|
63
|
+
[gitter]: https://gitter.im/jpalumickas/backup-repos
|
64
|
+
|
65
|
+
[license]: LICENSE.md
|
data/Rakefile
CHANGED
data/backup_repos.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['jpalumickas@gmail.com']
|
11
11
|
|
12
12
|
spec.summary = 'Backup your repositories'
|
13
|
-
spec.description = 'Backup your GitHub, BitBucket repositories to '\
|
13
|
+
spec.description = 'Backup your GitHub, BitBucket, GitLab repositories to '\
|
14
14
|
'specified directory.'
|
15
15
|
spec.homepage = 'https://github.com/jpalumickas/backup-repos'
|
16
16
|
|
@@ -20,13 +20,14 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = ['backup-repos']
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.add_dependency 'commander', '~> 4.3'
|
24
|
-
spec.add_dependency 'colorize', '~> 0.7.7'
|
25
|
-
spec.add_dependency 'hashie', '~> 3.4'
|
26
|
-
spec.add_dependency 'octokit', '~> 4.2'
|
27
23
|
spec.add_dependency 'bitbucket_rest_api', '~> 0.1.7'
|
24
|
+
spec.add_dependency 'colorize', '~> 0.8.1'
|
25
|
+
spec.add_dependency 'commander', '~> 4.4'
|
26
|
+
spec.add_dependency 'gitlab', '~> 3.7'
|
27
|
+
spec.add_dependency 'hashie', '~> 3.4'
|
28
|
+
spec.add_dependency 'octokit', '~> 4.3'
|
28
29
|
|
29
30
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
30
31
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
32
|
+
spec.add_development_dependency 'rspec', '~> 3.5'
|
32
33
|
end
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'backup_repos'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
10
|
+
require 'pry'
|
11
|
+
Pry.start
|
12
12
|
|
13
|
-
require
|
14
|
-
IRB.start
|
13
|
+
# require 'irb'
|
14
|
+
# IRB.start
|
data/lib/backup_repos.rb
CHANGED
data/lib/backup_repos/backup.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require_relative 'performers/base_git'
|
2
2
|
require_relative 'backup_github'
|
3
3
|
require_relative 'backup_bitbucket'
|
4
|
+
require_relative 'backup_gitlab_endpoint'
|
5
|
+
require_relative 'backup_gitlab'
|
4
6
|
|
5
7
|
module BackupRepos
|
6
8
|
class Backup
|
@@ -13,10 +15,24 @@ module BackupRepos
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def process
|
18
|
+
process_github
|
19
|
+
process_bitbucket
|
20
|
+
process_gitlab
|
21
|
+
end
|
22
|
+
|
23
|
+
def process_github
|
24
|
+
return unless valid?
|
25
|
+
BackupGithub.new.process
|
26
|
+
end
|
27
|
+
|
28
|
+
def process_bitbucket
|
16
29
|
return unless valid?
|
30
|
+
BackupBitbucket.new.process
|
31
|
+
end
|
17
32
|
|
18
|
-
|
19
|
-
|
33
|
+
def process_gitlab
|
34
|
+
return unless valid?
|
35
|
+
BackupGitlab.new.process
|
20
36
|
end
|
21
37
|
|
22
38
|
def valid?
|
@@ -37,9 +53,8 @@ module BackupRepos
|
|
37
53
|
errors.push('Backup directory is not specified.') && return
|
38
54
|
end
|
39
55
|
|
40
|
-
|
41
|
-
|
42
|
-
end
|
56
|
+
return if File.exist?(backup_root)
|
57
|
+
errors << 'Backup directory does not exists.'
|
43
58
|
end
|
44
59
|
|
45
60
|
def inform_about_error!
|
@@ -6,12 +6,6 @@ require_relative 'performers/github_gist'
|
|
6
6
|
|
7
7
|
module BackupRepos
|
8
8
|
class BackupGithub
|
9
|
-
class << self
|
10
|
-
def process
|
11
|
-
new.process
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
9
|
def process
|
16
10
|
process_repositories
|
17
11
|
process_wiki
|
@@ -19,7 +13,7 @@ module BackupRepos
|
|
19
13
|
end
|
20
14
|
|
21
15
|
def repos
|
22
|
-
@repos ||= client.repos
|
16
|
+
@repos ||= client.repos.reject { |repo| exclude_repo?(repo) }
|
23
17
|
end
|
24
18
|
|
25
19
|
def client
|
@@ -49,5 +43,18 @@ module BackupRepos
|
|
49
43
|
Performers::GithubGist.new(gist_params).backup
|
50
44
|
end
|
51
45
|
end
|
46
|
+
|
47
|
+
def exclude_repos
|
48
|
+
@exclude_repos ||= BackupRepos.config.github.exclude.to_a.map(&:downcase)
|
49
|
+
end
|
50
|
+
|
51
|
+
def exclude_repo?(repo)
|
52
|
+
return false if exclude_repos.blank?
|
53
|
+
|
54
|
+
repo_owner = repo.owner.login.to_s.downcase
|
55
|
+
full_name = repo.full_name.to_s.downcase
|
56
|
+
|
57
|
+
exclude_repos.include?(repo_owner) || exclude_repos.include?(full_name)
|
58
|
+
end
|
52
59
|
end
|
53
60
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'gitlab'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
require_relative 'performers/gitlab_repository'
|
5
|
+
|
6
|
+
module BackupRepos
|
7
|
+
class BackupGitlabEndpoint
|
8
|
+
attr_reader :endpoint, :private_token
|
9
|
+
|
10
|
+
def initialize(settings)
|
11
|
+
@endpoint = settings.endpoint
|
12
|
+
@private_token = settings.private_token
|
13
|
+
end
|
14
|
+
|
15
|
+
def call
|
16
|
+
backup_repositories
|
17
|
+
end
|
18
|
+
|
19
|
+
def repos
|
20
|
+
@repos ||= client.projects.auto_paginate
|
21
|
+
end
|
22
|
+
|
23
|
+
def client
|
24
|
+
@client ||= ::Gitlab.client(
|
25
|
+
private_token: private_token,
|
26
|
+
endpoint: endpoint
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def endpoint_host
|
31
|
+
@endpoint_host ||= URI.parse(endpoint).host
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def backup_repositories
|
37
|
+
repos.each do |repo_params|
|
38
|
+
performer = Performers::GitlabRepository.new(
|
39
|
+
repo_params, endpoint_host: endpoint_host
|
40
|
+
)
|
41
|
+
|
42
|
+
performer.backup
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module BackupRepos
|
2
|
+
module CLI
|
3
|
+
class Setup
|
4
|
+
attr_reader :options, :config
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
@options = options
|
8
|
+
@config = {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def call
|
12
|
+
configure_from_options
|
13
|
+
configure_backup_directory
|
14
|
+
configure_providers
|
15
|
+
write_config
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def write_config
|
21
|
+
File.write(BackupRepos.config.config_file, YAML.dump(config))
|
22
|
+
end
|
23
|
+
|
24
|
+
def configure_from_options
|
25
|
+
@config[:debug] = true if options.debug
|
26
|
+
end
|
27
|
+
|
28
|
+
def configure_providers
|
29
|
+
if cli.agree '* Are you want to backup GitHub repositories?'
|
30
|
+
configure_github
|
31
|
+
end
|
32
|
+
|
33
|
+
if cli.agree '* Are you want to backup BitBucket repositories?'
|
34
|
+
configure_bitbucket
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def configure_backup_directory
|
39
|
+
cli.say '* To what directory you want to backup?'
|
40
|
+
@backup_directory = cli.ask ' Backup directory: ' do |q|
|
41
|
+
q.readline = true
|
42
|
+
q.completion = Pathname
|
43
|
+
q.directory = Pathname.new('/')
|
44
|
+
q.default = BackupRepos.config.backup_root
|
45
|
+
q.glob = '*'
|
46
|
+
end
|
47
|
+
|
48
|
+
check_backup_directory
|
49
|
+
end
|
50
|
+
|
51
|
+
def check_backup_directory
|
52
|
+
@backup_directory = File.expand_path(@backup_directory)
|
53
|
+
|
54
|
+
unless File.exist?(@backup_directory)
|
55
|
+
if cli.agree "Directory '#{@backup_directory} not exists... Want to create it?"
|
56
|
+
FileUtils.mkdir_p(@backup_directory)
|
57
|
+
else
|
58
|
+
configure_backup_directory
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
@config[:backup_root] = @backup_directory
|
63
|
+
end
|
64
|
+
|
65
|
+
def configure_github
|
66
|
+
@config[:github] ||= {}
|
67
|
+
|
68
|
+
cli.say ' What is your GitHub access token?'
|
69
|
+
access_token = cli.ask ' Access Token: '
|
70
|
+
exclude_repositories = cli.ask(' Exclude repositories (separate by space): ', Array)
|
71
|
+
|
72
|
+
if access_token.present?
|
73
|
+
@config[:github][:access_token] = access_token
|
74
|
+
end
|
75
|
+
|
76
|
+
if exclude_repositories.present?
|
77
|
+
@config[:github][:exclude] = exclude_repositories
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def configure_bitbucket
|
82
|
+
cli.say ' What is your BitBucket credentials?'
|
83
|
+
username = ask(' Username: ')
|
84
|
+
password = ask(' Password: ') { |q| q.echo = '*' }
|
85
|
+
|
86
|
+
if username.present? && password.present?
|
87
|
+
@config[:bitbucket] ||= {}
|
88
|
+
@config[:bitbucket][:username] = username
|
89
|
+
@config[:bitbucket][:password] = password
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def cli
|
94
|
+
@cli ||= HighLine.new
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'commander'
|
2
2
|
|
3
|
+
require_relative 'cli/setup'
|
4
|
+
|
3
5
|
module BackupRepos
|
4
6
|
class Commander
|
5
7
|
include ::Commander::Methods
|
@@ -16,9 +18,25 @@ module BackupRepos
|
|
16
18
|
c.option '--backup_root DIR', String, 'Backup destination directory'
|
17
19
|
c.option '--debug', String, 'Show debug information'
|
18
20
|
|
21
|
+
c.action do |args, options|
|
22
|
+
BackupRepos.config_options = options
|
23
|
+
|
24
|
+
if args[0] && %w(github bitbucket gitlab).include?(args[0].downcase)
|
25
|
+
BackupRepos::Backup.new.send("process_#{args[0]}")
|
26
|
+
else
|
27
|
+
BackupRepos::Backup.new.process
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
command :setup do |c|
|
33
|
+
c.syntax = 'backup-repos setup'
|
34
|
+
c.description = 'Setup settings.'
|
35
|
+
|
36
|
+
c.option '--debug', String, 'Setup with debug flag.'
|
37
|
+
|
19
38
|
c.action do |_args, options|
|
20
|
-
BackupRepos.
|
21
|
-
BackupRepos::Backup.new.process
|
39
|
+
BackupRepos::CLI::Setup.new(options).call
|
22
40
|
end
|
23
41
|
end
|
24
42
|
|
data/lib/backup_repos/config.rb
CHANGED
@@ -5,7 +5,7 @@ module BackupRepos
|
|
5
5
|
class Config
|
6
6
|
attr_reader :options
|
7
7
|
|
8
|
-
def initialize(options = {})
|
8
|
+
def initialize(options = Hashie::Mash.new({}))
|
9
9
|
@options = options
|
10
10
|
end
|
11
11
|
|
@@ -28,7 +28,11 @@ module BackupRepos
|
|
28
28
|
# ===
|
29
29
|
|
30
30
|
def method_missing(name, *_args)
|
31
|
-
config[name.to_s]
|
31
|
+
options.send(name) || config[name.to_s]
|
32
|
+
end
|
33
|
+
|
34
|
+
def config_file
|
35
|
+
File.join(Dir.home, '.backup-repos')
|
32
36
|
end
|
33
37
|
|
34
38
|
private
|
@@ -37,10 +41,6 @@ module BackupRepos
|
|
37
41
|
@config ||= Hashie::Mash.new(file_config)
|
38
42
|
end
|
39
43
|
|
40
|
-
def config_file
|
41
|
-
File.join(Dir.home, '.backup-repos')
|
42
|
-
end
|
43
|
-
|
44
44
|
def file_config
|
45
45
|
return {} unless File.exist?(config_file)
|
46
46
|
@file_config ||= (YAML.load_file(config_file) || {})
|
@@ -1,10 +1,6 @@
|
|
1
1
|
module BackupRepos
|
2
2
|
module Performers
|
3
|
-
class BitbucketGitWiki <
|
4
|
-
def provider
|
5
|
-
'BitBucket'
|
6
|
-
end
|
7
|
-
|
3
|
+
class BitbucketGitWiki < BitbucketGitRepository
|
8
4
|
def clone_url
|
9
5
|
"git@bitbucket.org:#{full_name}.git/wiki"
|
10
6
|
end
|
@@ -12,12 +8,6 @@ module BackupRepos
|
|
12
8
|
def backup_path
|
13
9
|
"#{full_name}.wiki.git"
|
14
10
|
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def full_name
|
19
|
-
"#{params.owner}/#{params.slug}"
|
20
|
-
end
|
21
11
|
end
|
22
12
|
end
|
23
13
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module BackupRepos
|
2
|
+
module Performers
|
3
|
+
class GitlabRepository < BaseGit
|
4
|
+
def provider
|
5
|
+
'GitLab'
|
6
|
+
end
|
7
|
+
|
8
|
+
def clone_url
|
9
|
+
params.ssh_url_to_repo
|
10
|
+
end
|
11
|
+
|
12
|
+
def backup_path
|
13
|
+
"#{options[:endpoint_host]}/#{params.path_with_namespace}.git"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/backup_repos/version.rb
CHANGED
data/lib/core_ext/object.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup_repos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justas Palumickas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bitbucket_rest_api
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.1.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.1.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colorize
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.8.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.8.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: commander
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '4.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '4.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: gitlab
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.7'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '3.7'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: hashie
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '3.4'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '3.4'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: octokit
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.3'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.3'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,15 +128,15 @@ dependencies:
|
|
114
128
|
requirements:
|
115
129
|
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
131
|
+
version: '3.5'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
136
|
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
125
|
-
description: Backup your GitHub, BitBucket repositories to specified directory.
|
138
|
+
version: '3.5'
|
139
|
+
description: Backup your GitHub, BitBucket, GitLab repositories to specified directory.
|
126
140
|
email:
|
127
141
|
- jpalumickas@gmail.com
|
128
142
|
executables:
|
@@ -130,11 +144,14 @@ executables:
|
|
130
144
|
extensions: []
|
131
145
|
extra_rdoc_files: []
|
132
146
|
files:
|
147
|
+
- ".codeclimate.yml"
|
133
148
|
- ".gitignore"
|
149
|
+
- ".hound.yml"
|
134
150
|
- ".rspec"
|
135
151
|
- ".rubocop.yml"
|
136
152
|
- ".travis.yml"
|
137
153
|
- Gemfile
|
154
|
+
- LICENSE.md
|
138
155
|
- README.md
|
139
156
|
- Rakefile
|
140
157
|
- backup_repos.gemspec
|
@@ -145,6 +162,9 @@ files:
|
|
145
162
|
- lib/backup_repos/backup.rb
|
146
163
|
- lib/backup_repos/backup_bitbucket.rb
|
147
164
|
- lib/backup_repos/backup_github.rb
|
165
|
+
- lib/backup_repos/backup_gitlab.rb
|
166
|
+
- lib/backup_repos/backup_gitlab_endpoint.rb
|
167
|
+
- lib/backup_repos/cli/setup.rb
|
148
168
|
- lib/backup_repos/commander.rb
|
149
169
|
- lib/backup_repos/config.rb
|
150
170
|
- lib/backup_repos/performers/base_git.rb
|
@@ -153,6 +173,7 @@ files:
|
|
153
173
|
- lib/backup_repos/performers/github_gist.rb
|
154
174
|
- lib/backup_repos/performers/github_repository.rb
|
155
175
|
- lib/backup_repos/performers/github_wiki.rb
|
176
|
+
- lib/backup_repos/performers/gitlab_repository.rb
|
156
177
|
- lib/backup_repos/shell.rb
|
157
178
|
- lib/backup_repos/version.rb
|
158
179
|
- lib/core_ext/object.rb
|