backup_repos 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
  SHA256:
3
- metadata.gz: ee0ccc53eb5f8097ad961b8a142016a2ba038760375c45ee3a6517cd7e7bca41
4
- data.tar.gz: 112d547c552f67c56e336057e0b662b117f345328959f97f45c372497ca628a7
3
+ metadata.gz: 6df495b7849c24ffd8d654ef8bb3bc1a23db28cca0c9cd411a5920b39bc4b1bf
4
+ data.tar.gz: 111ea8ef9faa661914c93b04119ed7499e9c4f10d867877c23506b13b17bd31c
5
5
  SHA512:
6
- metadata.gz: 70a85ecf3341f550b9c934869070ad2b5ef942b721d058921e4a17c51544fc66bce235cdbebd6a75f7540ff720f58855dab34f478705b02655d3a8c4d04c6667
7
- data.tar.gz: 344842a33943f702aa3c111e5bf3f14353486df1a8e9cf78274d6bbf88e17b5a52abbd46b312131c874d0f73923463020d8bfde69e4e932a758f576a849d436d
6
+ metadata.gz: e48149c0fb4fa615b88149b70b20e9fe3e9a6a1f6a9ca03612c518b7a0f24bc88301c2c50a468c6b50071f4c8157aba4bdc514e2e406e68bd9d42f846145a368
7
+ data.tar.gz: aef6c69c0861043029b435f103a28c9f945c7ed42ef9aa1df371bd25964099f0154c1c453d1135bd44347b75c27f3032fa926f15d783a7dca11e36fbfae87f9c
@@ -20,7 +20,7 @@ module BackupRepos
20
20
  private
21
21
 
22
22
  def write_config
23
- File.write(BackupRepos.config.config_file, YAML.dump(config))
23
+ File.write(backup_config.config_file, YAML.dump(config))
24
24
  end
25
25
 
26
26
  def configure_from_options
@@ -47,7 +47,7 @@ module BackupRepos
47
47
  q.readline = true
48
48
  q.completion = Pathname
49
49
  q.directory = Pathname.new('/')
50
- q.default = BackupRepos.config.backup_root
50
+ q.default = backup_config.backup_root
51
51
  q.glob = '*'
52
52
  end
53
53
 
@@ -119,6 +119,10 @@ module BackupRepos
119
119
  def cli
120
120
  @cli ||= HighLine.new
121
121
  end
122
+
123
+ def backup_config
124
+ @backup_config || BackupRepos::Config.new(options)
125
+ end
122
126
  end
123
127
  end
124
128
  end
@@ -17,8 +17,8 @@ module BackupRepos
17
17
  c.syntax = 'backup-repos backup'
18
18
  c.description = 'Backup your repositories.'
19
19
 
20
- c.option '--config-path PATH', String, 'Path to configuration file'
21
- c.option '--backup-root DIR', String, 'Backup destination directory'
20
+ c.option '--config-file PATH', String, 'Path to configuration file'
21
+ c.option '--backup-dir DIR', String, 'Backup destination directory'
22
22
  c.option '--debug', String, 'Show debug information'
23
23
  c.option '--only LIST', String, 'Only backup specified repos or orgs. Separate by comma.'
24
24
 
@@ -37,6 +37,7 @@ module BackupRepos
37
37
  c.syntax = 'backup-repos setup'
38
38
  c.description = 'Setup settings.'
39
39
 
40
+ c.option '--config-file PATH', String, 'Path to configuration file'
40
41
  c.option '--debug', String, 'Setup with debug flag.'
41
42
 
42
43
  c.action do |_args, options|
@@ -47,9 +47,10 @@ module BackupRepos
47
47
  end
48
48
 
49
49
  def config_file
50
- return File.join(Dir.home, '.backup-repos') if options.config_path.blank?
50
+ return File.expand_path(ENV['CONFIG_PATH']) if ENV['CONFIG_PATH'].present?
51
+ return File.expand_path(options.config_file) if options.config_file.present?
51
52
 
52
- File.expand_path(options.config_path)
53
+ File.join(Dir.home, '.backup-repos')
53
54
  end
54
55
 
55
56
  def dig(*args)
@@ -69,6 +70,8 @@ module BackupRepos
69
70
  end
70
71
 
71
72
  def backup_root_dir
73
+ return File.expand_path(ENV['BACKUP_DIR']) if ENV['BACKUP_DIR'].present?
74
+
72
75
  options.backup_root || config['backup_root']
73
76
  end
74
77
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BackupRepos
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup_repos
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
  - Justas Palumickas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-29 00:00:00.000000000 Z
11
+ date: 2019-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitbucket_rest_api
@@ -158,19 +158,9 @@ executables:
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
- - ".github/workflows/test.yml"
162
- - ".gitignore"
163
- - ".hound.yml"
164
- - ".rspec"
165
- - ".rubocop.yml"
166
- - Gemfile
167
161
  - LICENSE
168
162
  - README.md
169
- - Rakefile
170
- - backup_repos.gemspec
171
163
  - bin/backup-repos
172
- - bin/console
173
- - bin/setup
174
164
  - lib/backup_repos.rb
175
165
  - lib/backup_repos/backup.rb
176
166
  - lib/backup_repos/backup_bitbucket.rb
@@ -1,22 +0,0 @@
1
- name: Test
2
-
3
- on: [push]
4
-
5
- jobs:
6
- build:
7
-
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - uses: actions/checkout@v1
12
- - name: Set up Ruby 2.6
13
- uses: actions/setup-ruby@v1
14
- with:
15
- ruby-version: 2.6.x
16
- - name: Build and test with Rake
17
- env:
18
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
19
- run: |
20
- gem install bundler
21
- bundle install --jobs 4 --retry 3
22
- bundle exec rspec
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.hound.yml DELETED
@@ -1,5 +0,0 @@
1
- fail_on_violations: true
2
-
3
- ruby:
4
- enabled: true
5
- config_file: .rubocop.yml
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,21 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
-
4
- Style/Documentation:
5
- Enabled: false
6
-
7
- Style/AlignParameters:
8
- Enabled: true
9
- EnforcedStyle: with_fixed_indentation
10
-
11
- Style/MultilineOperationIndentation:
12
- Enabled: true
13
- EnforcedStyle: indented
14
-
15
- Style/MultilineMethodCallIndentation:
16
- Enabled: true
17
- EnforcedStyle: indented
18
-
19
- Style/CaseIndentation:
20
- Enabled: true
21
- EnforcedStyle: end
data/Gemfile DELETED
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in backup_repos.gemspec
6
- gemspec
7
-
8
- group :development do
9
- gem 'rubocop', '~> 0.77'
10
- end
11
-
12
- group :development, :test do
13
- gem 'pry'
14
- end
15
-
16
- group :test do
17
- gem 'codecov', require: false
18
- gem 'simplecov', require: false
19
- end
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'backup_repos/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'backup_repos'
9
- spec.version = BackupRepos::VERSION
10
- spec.authors = ['Justas Palumickas']
11
- spec.email = ['jpalumickas@gmail.com']
12
-
13
- spec.summary = 'Backup your repositories'
14
- spec.description = 'Backup your GitHub, BitBucket, GitLab repositories to '\
15
- 'specified directory.'
16
- spec.homepage = 'https://github.com/jpalumickas/backup-repos'
17
-
18
- spec.files = `git ls-files -z`.split("\x0")
19
- .reject { |f| f.match(%r{^(test|spec|features)/}) }
20
- spec.bindir = 'bin'
21
- spec.executables = ['backup-repos']
22
- spec.require_paths = ['lib']
23
-
24
- spec.required_ruby_version = '>= 2.4.0'
25
-
26
- spec.add_dependency 'bitbucket_rest_api', '~> 0.1.7'
27
- spec.add_dependency 'colorize', '~> 0.8.1'
28
- spec.add_dependency 'commander', '~> 4.4'
29
- spec.add_dependency 'gitlab', '~> 4.12'
30
- spec.add_dependency 'hashie', '~> 4.0'
31
- spec.add_dependency 'highline', '~> 2.0'
32
- spec.add_dependency 'octokit', '~> 4.14'
33
-
34
- spec.add_development_dependency 'bundler', '~> 2.0'
35
- spec.add_development_dependency 'rake', '~> 12.0'
36
- spec.add_development_dependency 'rspec', '~> 3.8'
37
- end
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'backup_repos'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- require 'pry'
12
- Pry.start
13
-
14
- # require 'irb'
15
- # IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here