avmtrf1-tools 0.35.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3596640cb42d9331fc9a64994e5c9e0bc2804b17ea6683985317c6b8bd18a025
4
- data.tar.gz: ffdc002e2061a896be7e43396fc4e16526cafda04a32383297d6fd95f8c34ff0
3
+ metadata.gz: 493f91da0b605f4a9a83c65ad7147af44d9cae1d2776647fc0daeeaa911351ff
4
+ data.tar.gz: 4ab6779365c2601f3a913aeeb658ad39f42273f8f6bbc05a93a89817006d89ca
5
5
  SHA512:
6
- metadata.gz: ce9c393bbaaae052c799ba9b67e5767b97d247e5672d9fbe3073cfd22084583a0e59db48faa1bc63709c0e683474c54d27cd7a5dee3d47d921d3e1e7c202fd0a
7
- data.tar.gz: 72c41df2ae775716cb562fa13905edb0ae6704462d3e7993293b005edb1ef885f479f3b67f5063f88779c8e010f24f8948f43f82ac4abc66369d4f62a9399091
6
+ metadata.gz: 1b945f2e35f0d2b79be9fb7ec67d9b6cfd2c3c2e0381918626ed966136a2136b50c161844dc78c3b7337abe269ca93aa3eb2d73a9aafc77d7b72a4d7b32ecc36
7
+ data.tar.gz: cc0e2ebe992386740b907725086b9e29184bf8f18aded506db9a7f5c3eb774eba38cd86eed6738f89b05a042ad7c06cbf17c15d5e16a0fac146839198acd4f2e
@@ -86,7 +86,7 @@ module Avmtrf1
86
86
  end
87
87
 
88
88
  def recache?
89
- !data_cache.cached? || yesterday_uncached?
89
+ !data_cache.stored? || yesterday_uncached?
90
90
  end
91
91
 
92
92
  def yesterday_uncached?
@@ -114,7 +114,7 @@ module Avmtrf1
114
114
  end
115
115
 
116
116
  def cached_data
117
- raise 'There is no data cached' unless data_cache.cached?
117
+ raise 'There is no data cached' unless data_cache.stored?
118
118
 
119
119
  ::EacRubyUtils::Yaml.load(data_cache.read)
120
120
  end
@@ -7,22 +7,25 @@ module Avmtrf1
7
7
  enable_simple_cache
8
8
  common_constructor :repository, :git, :source
9
9
 
10
+ delegate :id, to: :git_commit
11
+
10
12
  def to_s
11
13
  source
12
14
  end
13
15
 
16
+ # @return [String]
17
+ def textile_link(object_type = 'commit')
18
+ "\"#{git_commit.abbreviated_commit_hash}\":#{web_url(object_type)}"
19
+ end
20
+
14
21
  def web_url(object_type = 'commit')
15
- "#{repository.web_url}/#{object_type}/#{full_id}"
22
+ "#{repository.web_url}/#{object_type}/#{git_commit.commit_hash}"
16
23
  end
17
24
 
18
25
  private
19
26
 
20
- def full_id_uncached
21
- git.rev_parse(source)
22
- end
23
-
24
- def short_id_uncached
25
- git.execute!('rev-parse', '--short', full_id).strip
27
+ def git_commit_uncached
28
+ git.commit(git.rev_parse(source))
26
29
  end
27
30
  end
28
31
  end
@@ -14,6 +14,7 @@ module Avmtrf1
14
14
  runner_with :help, :output do
15
15
  desc 'Mostra o link de uma revisão no Gitlab do TRF1.'
16
16
  bool_opt '-t', '--tree', 'URL com "tree" no lugar de "commit".'
17
+ bool_opt '-T', '--textile', 'Formata URL como link Textile.'
17
18
  pos_arg 'revisions', optional: true, repeat: true
18
19
  end
19
20
 
@@ -35,22 +36,29 @@ module Avmtrf1
35
36
 
36
37
  def commits_uncached
37
38
  parsed.revisions.if_present(['HEAD'])
38
- .map { |source| ::Avmtrf1::Gitlab::Commit.new(repository, git, source) }
39
+ .map { |source| ::Avmtrf1::Gitlab::Commit.new(repository, git_repo, source) }
39
40
  end
40
41
 
41
42
  def commit_banner(commit)
42
43
  separator
43
44
  infov 'Source', commit.source
44
- infov 'Commit ID', commit.full_id
45
+ infov 'Commit ID', commit.id
45
46
  infov 'Web URL', commit.web_url
46
47
  end
47
48
 
48
- def git
49
- runner_context.call(:git)
49
+ # @return [String]
50
+ def commit_output(commit)
51
+ return commit.textile_link if parsed.textile?
52
+
53
+ commit.web_url(object_type)
54
+ end
55
+
56
+ def git_repo
57
+ runner_context.call(:git_repo)
50
58
  end
51
59
 
52
60
  def output_content
53
- commits.map { |c| c.web_url(object_type) + "\n" }.join
61
+ commits.map { |c| commit_output(c) + "\n" }.join
54
62
  end
55
63
 
56
64
  def repository_banner
@@ -59,9 +67,9 @@ module Avmtrf1
59
67
  end
60
68
 
61
69
  def repository_uncached
62
- git.git.remotes.lazy
63
- .map { |r| ::Avmtrf1::Gitlab::Repository.by_uri(r.url) }
64
- .find(&:present?) || raise('Gitlab remote not found')
70
+ git_repo.remotes.lazy
71
+ .map { |r| ::Avmtrf1::Gitlab::Repository.by_uri(r.url) }
72
+ .find(&:present?) || raise('Gitlab remote not found')
65
73
  end
66
74
  end
67
75
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avmtrf1
4
4
  module Tools
5
- VERSION = '0.35.0'
5
+ VERSION = '0.36.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avmtrf1-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.35.0
4
+ version: 0.36.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-19 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-selenium
@@ -36,20 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.113'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 0.113.6
39
+ version: '0.114'
43
40
  type: :runtime
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
44
  - - "~>"
48
45
  - !ruby/object:Gem::Version
49
- version: '0.113'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 0.113.6
46
+ version: '0.114'
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: inifile
55
49
  requirement: !ruby/object:Gem::Requirement