gurney_client 0.5.0 → 0.6.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: 1097c1c98d3799765d40e6a5263a1fe58baa6a4df542570f91654247218b7d64
4
- data.tar.gz: 953fe191235e0c338cb71a690284ff5beed7e36f26a511fe1cb3f6311493ef82
3
+ metadata.gz: f97820b2ae67e568a14d65e7d5d700d97ee0cb402e755237f4bd2c3f735105d1
4
+ data.tar.gz: 2c6adc8f7f8c608b5d0a7b728ad1847e44e524b3e7449aee997becd70ac3178a
5
5
  SHA512:
6
- metadata.gz: 41cd13cf0b65dca7b568cd00f2a3dc95045ae3a6cdb8e896b24e9dcc755efc21fd24d3a328388604d3e783ce2a64f1dfe864d17f745df6ae957f032a4a1131b5
7
- data.tar.gz: b00a53d0aa50995c7be657090d50c906e5914cf5ee1dd5d3b14c74679400f356b49ded4fc653c525ca962d1a2755ceba12be27f32c0361b358c6011d19477cad
6
+ metadata.gz: 55ba64f495bfc3cd10f60e4caff368b26d341075d10d89fc1742bd17dd0af044d3cc8788daeea36ca403cadc947c3a196866bd140066d3e451cffc561c891a81
7
+ data.tar.gz: 4054647a511f7936c6c9e1f6c18ee65d76df6bc582d35ad290fac0e79010f1696431c5c7ed130c701392d1860af012ccbdeb1ad37cc7c1dab953c351fdb8d841
data/CHANGELOG.md CHANGED
@@ -10,6 +10,13 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
10
10
  ### Breaking changes
11
11
 
12
12
 
13
+ ## 0.6.0 2025-06-16
14
+
15
+ ### Compatible changes
16
+ * Added: New option `--prefix` to specify the location of the dependency files
17
+ in case they are not on root level of your git repository.
18
+
19
+
13
20
  ## 0.5.0 2025-03-26
14
21
 
15
22
  ### Compatible changes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gurney_client (0.5.0)
4
+ gurney_client (0.6.0)
5
5
  bundler (< 3)
6
6
  colorize (~> 0.8)
7
7
  git (~> 1.5)
data/README.md CHANGED
@@ -22,6 +22,7 @@ Usage: gurney [options]
22
22
  -h, --hook Run as a Git post-receive hook
23
23
  --client-hook Run as a Git pre-push hook
24
24
  -p, --project-id [PROJECT ID] Specify project id for API
25
+ --prefix [PATH] Specify the prefix of dependency paths
25
26
  --help Print this help
26
27
  ```
27
28
 
@@ -41,6 +41,10 @@ module Gurney
41
41
  options.project_id = project_id
42
42
  end
43
43
 
44
+ opts.on('', '--prefix [PATH]', 'Specify the prefix of dependency paths') do |prefix|
45
+ options.prefix = prefix
46
+ end
47
+
44
48
  opts.on_tail('', '--help', 'Prints this help') do
45
49
  puts opts
46
50
  exit
data/lib/gurney/cli.rb CHANGED
@@ -56,8 +56,9 @@ module Gurney
56
56
  options.api_token ||= config&.api_token
57
57
  options.api_url ||= config&.api_url
58
58
  options.project_id ||= config&.project_id
59
+ options.prefix ||= config&.prefix
59
60
 
60
- missing_options = [:project_id, :branches, :api_url, :api_token].select { |option| options.send(option).nil? }
61
+ missing_options = [:project_id, :branches, :api_url, :api_token, :prefix].select { |option| options.send(option).nil? }
61
62
  # Use the line below in development
62
63
  # missing_options = [:project_id, :branches, :api_token].select { |option| options.send(option).nil? }
63
64
  raise Gurney::Error.new("Incomplete config - missing #{missing_options.map(&:inspect).join(', ')}.") unless missing_options.empty?
@@ -65,7 +66,7 @@ module Gurney
65
66
 
66
67
  def run
67
68
  reporting_branches.each do |branch|
68
- git_file_reader = GitFileReader.new(git, branch, read_from_git: options.hook || options.client_hook)
69
+ git_file_reader = GitFileReader.new(git, branch, read_from_git: options.hook || options.client_hook, prefix: options.prefix)
69
70
  dependencies = DependencyCollector.new(git_file_reader).collect_all
70
71
 
71
72
  api = Gurney::Api.new(base_url: options.api_url, token: options.api_token)
data/lib/gurney/config.rb CHANGED
@@ -3,13 +3,14 @@ require 'yaml'
3
3
  module Gurney
4
4
  class Config
5
5
 
6
- attr_accessor :branches, :api_url, :api_token, :project_id
6
+ attr_accessor :branches, :api_url, :api_token, :project_id, :prefix
7
7
 
8
- def initialize(branches: nil, api_url: nil, api_token: nil, project_id: nil)
8
+ def initialize(branches: nil, api_url: nil, api_token: nil, project_id: nil, prefix: '.')
9
9
  @branches = branches
10
10
  @api_url = api_url
11
11
  @api_token = api_token&.to_s
12
12
  @project_id = project_id&.to_s
13
+ @prefix = prefix&.to_s
13
14
  end
14
15
 
15
16
  def self.from_yaml(yaml)
@@ -1,21 +1,23 @@
1
1
  module Gurney
2
2
  class GitFileReader
3
3
 
4
- def initialize(git, branch, read_from_git:)
4
+ def initialize(git, branch, read_from_git:, prefix: '.')
5
5
  @git = git
6
6
  @branch = branch
7
7
  @read_from_git = read_from_git
8
+ @prefix = prefix
8
9
  end
9
10
 
10
11
  def read(filename)
12
+ prefixed_filename = File.join(@prefix, filename)
11
13
  if @read_from_git
12
14
  begin
13
- @git.show("#{@branch}:#{filename}")
15
+ @git.show("#{@branch}:#{prefixed_filename}")
14
16
  rescue Git::GitExecuteError
15
17
  # happens if branch does not exist
16
18
  end
17
19
  else
18
- File.read(filename) if File.exist?(filename)
20
+ File.read(prefixed_filename) if File.exist?(prefixed_filename)
19
21
  end
20
22
  end
21
23
 
@@ -1,3 +1,3 @@
1
1
  module Gurney
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gurney_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Schaflitzl
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-26 00:00:00.000000000 Z
11
+ date: 2025-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.5'
69
- description:
69
+ description:
70
70
  email:
71
71
  - martin.schaflitzl@makandra.de
72
72
  executables:
@@ -107,7 +107,7 @@ licenses:
107
107
  - MIT
108
108
  metadata:
109
109
  rubygems_mfa_required: 'true'
110
- post_install_message:
110
+ post_install_message:
111
111
  rdoc_options: []
112
112
  require_paths:
113
113
  - lib
@@ -122,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.1.0
126
- signing_key:
125
+ rubygems_version: 3.3.27
126
+ signing_key:
127
127
  specification_version: 4
128
128
  summary: Gurney is a small tool to extract yarn and RubyGems dependencies from project
129
129
  files and report them to a web api.