reaver 0.13.0 → 0.14.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: 71aeb61cce0d233f4805e0c63a95fd171638a4d0142379bc63d18f2e459be020
4
- data.tar.gz: 4d5b980f10d77ff049425246af3860e1c4a3742c1d1248036afb622e472b90b6
3
+ metadata.gz: 11f9df0aabd618b5bf7aab285589005337370b29d434aa31609299a859a3a3df
4
+ data.tar.gz: 1a7cd410c41212268eb2a7d4f481d514912f5a337ab3d1619423c11d2b1263ca
5
5
  SHA512:
6
- metadata.gz: db92437ff4c2a4ccb20455fed86107dc5a7d5739552ff77a8c2053cfe6b4d047ed025db3553b1c537242948b157686b86c5e02726e578c7f728798e7409f3d27
7
- data.tar.gz: fd890ce9dc9e2d74d14b4f838e892082761d3862e284ccab3781792289a8263460b9a65378a5d2894ab1929d7234730d950b7090fa0bf66810d7858911dea06d
6
+ metadata.gz: a30ca1a17864e1f7bfa169d357df180125b362d84cc36e115a43e6f08a6b1a9c92b1f287fa7c22d6fa1be0d6d8d7f9464d24132bee83b3d577e8ec14a43d784c
7
+ data.tar.gz: 042e5aaa0569b07318f6a9437bf6463bea0a282946edebae1242a6035fafea1eeb3b63ef96792fe7f5c68d59ccf48cf397fdbf30341ed68682465e2c7537a713
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.14.0, release 11/2024
2
+ - Can `git clone` && `git pull` if use `things[].git: true`
3
+
1
4
  ## 0.12.0
2
5
  - Add `--strip-components=1` to tar, by default set to `1` may be changed by
3
6
  `things[].strip_components: <number>` variable
data/README.md CHANGED
@@ -9,7 +9,7 @@ move things to the right spot.
9
9
 
10
10
  ## Dependencies
11
11
 
12
- Reaver need only `unzip`, `xz` and `tar`.
12
+ Reaver need only `unzip`, `xz`, `tar` and `git`, depending what you'll use.
13
13
 
14
14
  ## Collections
15
15
 
@@ -48,13 +48,14 @@ To see more examples, go
48
48
  A collection can include:
49
49
  - `all_into_dir: <dirname>` if all files go in a directory. Directory is created
50
50
  if not exist.
51
- - `keep_name: <boolean>`, if `true`, use the name of the thing for the dest, e.g, for a name `ombre.tar.gz`, the final dest will be `all_into_dir/ombre` or `dest_dir/ombre`.
51
+ - `keep_name: <boolean>`, if `true`, create a directory with the name of the thing, e.g, for a name `ombre.tar.gz`, the final dest will be `all_into_dir/ombre` or `dest_dir/ombre`.
52
52
  - `force_download: <boolean>`, if you make change and want to download now, change to `true`.
53
53
  - `things[].dest_dir: <dirname>`, if each files go in differents directory, use this.
54
54
  - `things[].name` the new name after download, may include the file extension.
55
55
  - `things[].strip_components: <number>`, used on `tar`, default to 1, skip the first
56
56
  directory from an archive, if no subdirectory exist, you should set to 0.
57
57
  - `things[].url: <string>`
58
+ - `things[].git: <boolean>`, If the thing need to be managed with git.
58
59
  - `time: 86000` (in second) is for search every day ( 60 * 60 * 24 ).
59
60
 
60
61
  If `all_into_dir` is defined, `things[].dest_dir` is not used.
@@ -34,7 +34,11 @@ module Reaver
34
34
  return unless @tasks || @tasks['things'].length.zero?
35
35
 
36
36
  @tasks['things'].each do |task|
37
- do_thing(task)
37
+ if task['git']
38
+ Reaver::Git.new(task['url'], task['dest_dir'])
39
+ else
40
+ do_thing(task)
41
+ end
38
42
  metadata.info['changed'] = @changed
39
43
  end
40
44
  end
data/lib/reaver/git.rb ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Reaver
6
+ # Treat git
7
+ class Git
8
+ def initialize(url, dest)
9
+ @dest = "#{ENV['HOME']}/#{dest}"
10
+ @url = url
11
+ x
12
+ end
13
+
14
+ protected
15
+
16
+ def x
17
+ if !Dir.exist?(@dest)
18
+ git_clone
19
+ elsif Dir.exist?(@dest) && !Dir.exist?("#{@dest}/.git")
20
+ FileUtils.rm_rf @dest
21
+ git_clone
22
+ elsif Dir.exist?(@dest) && Dir.exist?("#{@dest}/.git")
23
+ git_sync
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def git_clone
30
+ puts "Git cloning #{@url} to #{@dest}..."
31
+ `git clone #{@url} #{@dest}`
32
+ end
33
+
34
+ def git_sync
35
+ puts "Git fetching update(s) on #{@dest}..."
36
+ `cd #{@dest} && git pull`
37
+ end
38
+ end
39
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reaver
4
- VERSION = '0.13.0'
4
+ VERSION = '0.14.0'
5
5
  end
data/lib/reaver.rb CHANGED
@@ -6,6 +6,7 @@ require_relative 'reaver/download'
6
6
  require_relative 'reaver/metadata'
7
7
  require_relative 'reaver/collection'
8
8
  require_relative 'reaver/walk'
9
+ require_relative 'reaver/git'
9
10
 
10
11
  require 'whirly'
11
12
  require 'fileutils'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reaver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - szorfein
@@ -34,7 +34,7 @@ cert_chain:
34
34
  1Eu31LqT9K75BZgLoHDybDlvVJ1B2hZI31jZOFjqpCgVxwoHmuigy2iCUcLsCTJJ
35
35
  6ct0vZN7gCQ/YSLa3jJf1N/CH4rQokbof1fehel4SPA=
36
36
  -----END CERTIFICATE-----
37
- date: 2024-10-25 00:00:00.000000000 Z
37
+ date: 2024-11-29 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: marcel
@@ -96,6 +96,7 @@ files:
96
96
  - lib/reaver/banner.rb
97
97
  - lib/reaver/collection.rb
98
98
  - lib/reaver/download.rb
99
+ - lib/reaver/git.rb
99
100
  - lib/reaver/metadata.rb
100
101
  - lib/reaver/version.rb
101
102
  - lib/reaver/walk.rb
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
125
  - !ruby/object:Gem::Version
125
126
  version: '0'
126
127
  requirements: []
127
- rubygems_version: 3.3.25
128
+ rubygems_version: 3.5.16
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: A tool to downloads and track updates of things on the Net.
metadata.gz.sig CHANGED
Binary file