spaarti 2.0.2 → 3.0.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: 7ade6ab474a55354cb5493add5565c61497bf9267d41fff098cace26ee2ac1ea
4
- data.tar.gz: 10a6eea7bd684f8ded035c4f6a881b878ae577089013f77759b4b5e27d5e6556
3
+ metadata.gz: '085c22477ef728b91f8f6a512fe8d0a684654d681a3b8e54cae9b5fff7b3b3dd'
4
+ data.tar.gz: 87fb4fbca2fbeda0716e2f131eb9564de2220679e9b15f470d7310f53dc43230
5
5
  SHA512:
6
- metadata.gz: 1625d7d2f924b3c604afa558abc43a638a806e1ac6e02d036d9b0a8f7f5d302a315f6d15cb8a586e4b36a3bdaa7208a790189bbef6cf366f0b8604156c953472
7
- data.tar.gz: f4d7ba48a318e4e5add916b6add3beaad74d3e7c6e01b68eb5bdccbb1b1ec200573201db4b8ed06f48ab0d5eba08df294e2e121d854ad271d953d40911d7216d
6
+ metadata.gz: 7f492c98572363b48982cb75f15e05713a6adaeaa5fc4a9ebea53fcb23fa108719a2cdd45eac289c64b8bc0bbbf38edd095cb5688694aa0c2d2e8168546472b7
7
+ data.tar.gz: '09c409f6ce8b8656cd3d6ec4f15588b9c177baaee655b9504736fbec87b1afda96c4a58e51dff34c9571420889ae6e841835f78189b861b4ed73d2e3fd29e0be'
@@ -0,0 +1,46 @@
1
+ name: Build
2
+ on:
3
+ pull_request:
4
+ push:
5
+ jobs:
6
+ build:
7
+ name: Build
8
+ runs-on: ubuntu-22.04
9
+ permissions:
10
+ contents: write
11
+ steps:
12
+ - name: Checkout
13
+ uses: actions/checkout@v3
14
+ with:
15
+ submodules: recursive
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: '3.1'
19
+ bundler-cache: true
20
+ - name: Build
21
+ run: bundle exec rake
22
+ - name: Release
23
+ if: github.ref_type == 'tag'
24
+ run: bundle exec rake release
25
+ env:
26
+ GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
27
+ - name: Post to a Slack channel
28
+ if: ${{ failure() }}
29
+ uses: slackapi/slack-github-action@v1.23.0
30
+ env:
31
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
32
+ SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
33
+ with:
34
+ payload: |
35
+ {
36
+ "text": "*${{ github.repository }}*\nBuild failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
37
+ "blocks": [
38
+ {
39
+ "type": "section",
40
+ "text": {
41
+ "type": "mrkdwn",
42
+ "text": "*${{ github.repository }}*\nBuild failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
43
+ }
44
+ }
45
+ ]
46
+ }
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 3.0.0 / 2022-10-21
2
+
3
+ * [FEATURE] Uses formats instead of format, to support multiple paths based on repo name
4
+
1
5
  # 2.0.2 / 2020-05-12
2
6
 
3
7
  * [BUGFIX] Fix Octokit error
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Les Aker
3
+ Copyright (c) 2022 Les Aker
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,9 +2,7 @@ spaarti
2
2
  =========
3
3
 
4
4
  [![Gem Version](https://img.shields.io/gem/v/spaarti.svg)](https://rubygems.org/gems/spaarti)
5
- [![Build Status](https://img.shields.io/travis/com/akerl/spaarti.svg)](https://travis-ci.com/akerl/spaarti)
6
- [![Coverage Status](https://img.shields.io/codecov/c/github/akerl/spaarti.svg)](https://codecov.io/github/akerl/spaarti)
7
- [![Code Quality](https://img.shields.io/codacy/65bacb9d92d948f6ae637ce63ade3557.svg)](https://www.codacy.com/app/akerl/spaarti)
5
+ [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/akerl/spaarti/Build)](https://github.com/akerl/spaarti/actions)
8
6
  [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
9
7
 
10
8
  Tool to maintain local clones of repos you have access to on GitHub
data/lib/spaarti/repo.rb CHANGED
@@ -8,7 +8,7 @@ module Spaarti
8
8
  @data = data
9
9
  @client = client
10
10
  @options = params
11
- @path = @options[:format] % @data
11
+ @path = resolve_path(@options[:formats], @data) % @data
12
12
  end
13
13
 
14
14
  def sync!
@@ -26,6 +26,15 @@ module Spaarti
26
26
 
27
27
  private
28
28
 
29
+ def resolve_path(formats, data)
30
+ formats.each do |format|
31
+ return format[:path] if format[:match].nil?
32
+ next unless data[:full_name].include? format[:match]
33
+ return format[:path]
34
+ end
35
+ raise 'No valid path format found'
36
+ end
37
+
29
38
  def log(msg)
30
39
  puts msg unless @options[:quiet]
31
40
  end
data/lib/spaarti/site.rb CHANGED
@@ -12,7 +12,7 @@ module Spaarti
12
12
  auth_file: :default,
13
13
  config_file: File.expand_path('~/.spaarti.yml'),
14
14
  exclude: [],
15
- format: '%<full_name>s',
15
+ formats: [{ path: '%<full_name>s' }],
16
16
  git_config: {},
17
17
  quiet: false,
18
18
  purge: false,
@@ -3,5 +3,5 @@
3
3
  ##
4
4
  # Set the version (needed for Mercenary -v)
5
5
  module Spaarti
6
- VERSION = '2.0.2'.freeze
6
+ VERSION = '3.0.0'
7
7
  end
data/spaarti.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'spaarti/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'spaarti'
7
7
  s.version = Spaarti::VERSION
8
- s.date = Time.now.strftime('%Y-%m-%d')
8
+ s.required_ruby_version = '>= 2.6'
9
9
 
10
10
  s.summary = 'Helper for cloning GitHub repos'
11
11
  s.description = 'Maintain local clones of repos you have access to on GitHub'
@@ -15,20 +15,15 @@ Gem::Specification.new do |s|
15
15
  s.license = 'MIT'
16
16
 
17
17
  s.files = `git ls-files`.split
18
- s.test_files = `git ls-files spec/*`.split
19
18
  s.executables = ['spaarti']
20
19
 
21
20
  s.add_dependency 'cymbal', '~> 2.0.0'
22
21
  s.add_dependency 'mercenary', '~> 0.3.4'
23
- s.add_dependency 'octoauth', '~> 1.7.0'
24
- s.add_dependency 'octokit', '~> 4.18.0'
22
+ s.add_dependency 'octoauth', '~> 2.0.0'
23
+ s.add_dependency 'octokit', '~> 5.6.1'
25
24
 
26
- s.add_development_dependency 'codecov', '~> 0.1.1'
27
- s.add_development_dependency 'fuubar', '~> 2.5.0'
28
- s.add_development_dependency 'goodcop', '~> 0.8.0'
29
- s.add_development_dependency 'rake', '~> 13.0.0'
30
- s.add_development_dependency 'rspec', '~> 3.9.0'
31
- s.add_development_dependency 'rubocop', '~> 0.76.0'
25
+ s.add_development_dependency 'goodcop', '~> 0.9.7'
32
26
  s.add_development_dependency 'vcr', '~> 5.0.0'
33
27
  s.add_development_dependency 'webmock', '~> 3.7.6'
28
+ s.metadata['rubygems_mfa_required'] = 'true'
34
29
  end
data/spec/bin_spec.rb CHANGED
@@ -1,4 +1 @@
1
1
  require 'spec_helper'
2
-
3
- describe Spaarti do
4
- end
@@ -1,4 +1 @@
1
1
  require 'spec_helper'
2
-
3
- describe Spaarti do
4
- end
@@ -1,65 +1,2 @@
1
1
  require 'spec_helper'
2
2
  require 'fileutils'
3
-
4
- describe Spaarti do
5
- describe 'Site' do
6
- let(:path) { 'tmp/base' }
7
- let(:config) { 'spec/examples/config.yml' }
8
- let(:subject) { Spaarti::Site.new config_file: config }
9
-
10
- before(:each) do
11
- FileUtils.rm_rf path
12
- FileUtils.mkdir_p path
13
- end
14
-
15
- after(:each) do
16
- FileUtils.rm_rf path
17
- end
18
-
19
- describe '#sync!' do
20
- it 'clones repo' do
21
- expect(File.exist?("#{path}/akerl/spaarti/.git")).to be_falsey
22
- VCR.use_cassette('repos') { subject.sync! }
23
- expect(File.exist?("#{path}/akerl/spaarti/.git")).to be_truthy
24
- end
25
-
26
- context 'with purge enabled' do
27
- it 'purges repos that are orphaned' do
28
- FileUtils.mkdir_p "#{path}/akerl/orphan/.git"
29
- VCR.use_cassette('repos') do
30
- Spaarti::Site.new(purge: true, config_file: config).sync!
31
- end
32
- expect(File.exist?("#{path}/akerl/orphan")).to be_falsey
33
- end
34
- end
35
- context 'with purge disabled' do
36
- it 'does not purge repos that are orphaned' do
37
- FileUtils.mkdir_p "#{path}/akerl/orphan/.git"
38
- VCR.use_cassette('repos') do
39
- Spaarti::Site.new(purge: false, config_file: config).sync!
40
- end
41
- expect(File.exist?("#{path}/akerl/orphan")).to be_truthy
42
- end
43
- end
44
-
45
- it 'supports excluding repos' do
46
- VCR.use_cassette('repos') do
47
- Spaarti::Site.new(
48
- exclude: { full_name: ['[ab]a'] }, config_file: config
49
- ).sync!
50
- end
51
- expect(File.exist?("#{path}/akerl/spaarti")).to be_falsey
52
- end
53
- end
54
-
55
- describe '#purge!' do
56
- it 'purges repos that are orphaned' do
57
- FileUtils.mkdir_p "#{path}/akerl/orphan/.git"
58
- VCR.use_cassette('repos') do
59
- Spaarti::Site.new(purge: true, config_file: config).sync!
60
- end
61
- expect(File.exist?("#{path}/akerl/orphan")).to be_falsey
62
- end
63
- end
64
- end
65
- end
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,3 @@
1
- if ENV['CI'] == 'true'
2
- require 'simplecov'
3
- require 'codecov'
4
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
5
- SimpleCov.start do
6
- add_filter '/spec/'
7
- end
8
- end
9
-
10
1
  require 'rspec'
11
2
  require 'spaarti'
12
3
  require 'webmock/rspec'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spaarti
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2022-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cymbal
@@ -44,112 +44,42 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.7.0
47
+ version: 2.0.0
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: 1.7.0
54
+ version: 2.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: octokit
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 4.18.0
61
+ version: 5.6.1
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: 4.18.0
69
- - !ruby/object:Gem::Dependency
70
- name: codecov
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.1.1
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.1.1
83
- - !ruby/object:Gem::Dependency
84
- name: fuubar
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 2.5.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 2.5.0
68
+ version: 5.6.1
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: goodcop
99
71
  requirement: !ruby/object:Gem::Requirement
100
72
  requirements:
101
73
  - - "~>"
102
74
  - !ruby/object:Gem::Version
103
- version: 0.8.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.8.0
111
- - !ruby/object:Gem::Dependency
112
- name: rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 13.0.0
75
+ version: 0.9.7
118
76
  type: :development
119
77
  prerelease: false
120
78
  version_requirements: !ruby/object:Gem::Requirement
121
79
  requirements:
122
80
  - - "~>"
123
81
  - !ruby/object:Gem::Version
124
- version: 13.0.0
125
- - !ruby/object:Gem::Dependency
126
- name: rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 3.9.0
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 3.9.0
139
- - !ruby/object:Gem::Dependency
140
- name: rubocop
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: 0.76.0
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: 0.76.0
82
+ version: 0.9.7
153
83
  - !ruby/object:Gem::Dependency
154
84
  name: vcr
155
85
  requirement: !ruby/object:Gem::Requirement
@@ -185,12 +115,10 @@ executables:
185
115
  extensions: []
186
116
  extra_rdoc_files: []
187
117
  files:
188
- - ".circle-ruby"
118
+ - ".github/workflows/build.yml"
189
119
  - ".gitignore"
190
- - ".prospectus"
191
120
  - ".rspec"
192
121
  - ".rubocop.yml"
193
- - ".travis.yml"
194
122
  - CHANGELOG.md
195
123
  - Gemfile
196
124
  - LICENSE
@@ -213,7 +141,8 @@ files:
213
141
  homepage: https://github.com/akerl/spaarti
214
142
  licenses:
215
143
  - MIT
216
- metadata: {}
144
+ metadata:
145
+ rubygems_mfa_required: 'true'
217
146
  post_install_message:
218
147
  rdoc_options: []
219
148
  require_paths:
@@ -222,23 +151,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
151
  requirements:
223
152
  - - ">="
224
153
  - !ruby/object:Gem::Version
225
- version: '0'
154
+ version: '2.6'
226
155
  required_rubygems_version: !ruby/object:Gem::Requirement
227
156
  requirements:
228
157
  - - ">="
229
158
  - !ruby/object:Gem::Version
230
159
  version: '0'
231
160
  requirements: []
232
- rubygems_version: 3.1.2
161
+ rubygems_version: 3.3.7
233
162
  signing_key:
234
163
  specification_version: 4
235
164
  summary: Helper for cloning GitHub repos
236
- test_files:
237
- - spec/bin_spec.rb
238
- - spec/examples/auth.yml
239
- - spec/examples/config.yml
240
- - spec/fixtures/cassettes/repos.yml
241
- - spec/spaarti/repo_spec.rb
242
- - spec/spaarti/site_spec.rb
243
- - spec/spaarti_spec.rb
244
- - spec/spec_helper.rb
165
+ test_files: []
data/.circle-ruby DELETED
@@ -1,4 +0,0 @@
1
- 2.6.1
2
- 2.5.3
3
- 2.4.5
4
- 2.3.8
data/.prospectus DELETED
@@ -1,11 +0,0 @@
1
- my_slug = 'akerl/spaarti'
2
-
3
- Prospectus.extra_dep('file', 'prospectus_travis')
4
- Prospectus.extra_dep('file', 'prospectus_gems')
5
-
6
- item do
7
- noop
8
-
9
- extend ProspectusGems::Gemspec.new
10
- extend ProspectusTravis::Build.new(my_slug)
11
- end
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- dist: xenial
2
- install:
3
- - for i in $(cat .circle-ruby) ; do rvm install $i || exit 1 ; done
4
- - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle install || exit 1 ; done
5
- script:
6
- - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle exec rake || exit 1 ; done
7
- notifications:
8
- email: false
9
- slack:
10
- secure: F9goVE9+dDE3FpGNgzV4419xmNk/TtrExS2vPYBZsQ1BfCz+frL4TWR+BzLp9iOKk3quMAzxw8sLVXxeUV4GjEoy00UJ7gcOcPHyFyA5ku1LlMc+PMy+85rGORc/Ks00MxkWNGXhWKNCA7Cb5QpPYqNoSzgdatk9DdA2pz+X8RCRUoaTKgWpKQvqbgAXt/ErtS6fXLzCPjSVGSg2rEC0nt0I1+vVpe8ZbQ8Q/nbroHeBIKcL6mV+YFPQ/ED69teGF1ptgAkESRhQNEZEyukDHG2SzgxxBq5ez3lTvHOqqSAlHVDH4mEil+xeh7n8antmeBbwZPSw6vwJdbFMYh9v2Pds2VWnMidAowzUrftUBAgRBFVXtjP+BQiL07Y51QaK0cpZ/OkuwrdA/PxeeUJpTXyHxNiIcdYGrgN6GSaB7Va2oSSRe0s6gjegOqdbRcR15+n9E2OPKwSSApKYsYTW85y/l0Lo9X0ANsuftDlKaS2yBV1rpdOCU5h1pgyiluidIq+gh+av7FarD9EAoMF/UBzEXpD7WPF41cCJr7MdxoolzAajYpO/ssexhRTue2953Rkii2Eg5rhTl0lZCzF3q5rGZGb00mU2gf3JvJLuy808uGV2tOd0bbCsbXFBiVxyoKkE6EQ8R1zS94FjUvdFRgQL+nMcvbdS2d30DlTHxhk=