biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / gi-crystal / src.patch
blobeb18035f994165fbb584bed0c776c5309ba7c72f
1 --- a/src/generator/main.cr 2023-07-14 18:30:47.687581729 +0300
2 +++ b/src/generator/main.cr 2023-07-17 07:55:24.177630085 +0300
3 @@ -1,6 +1,8 @@
4 require "colorize"
5 require "log"
6 require "option_parser"
7 +require "file"
8 +require "file_utils"
10 require "./binding_config"
11 require "./error"
12 @@ -43,7 +45,7 @@
13 end
14 end
16 - output_dir = Path.new(project_dir, "lib/gi-crystal/src/auto").normalize if output_dir.nil?
17 + output_dir = Path.new(Dir.current, "lib/gi-crystal/src/auto").normalize if output_dir.nil?
18 extra_bindings = argv.map { |path| Path.new(path).expand.to_s }
20 {output_dir: output_dir,
21 @@ -74,11 +76,23 @@
22 end
23 end
25 -private def find_bindings : Array(String)
26 - find_pattern = Path.new(project_dir, "**/binding.yml").normalize
27 +private def find_bindings_yml(path) : Array(String)
28 + find_pattern = File.join(path, "**/binding.yml")
29 Dir[find_pattern]
30 end
32 +private def find_bindings : Array(String)
33 + current_directory = Dir.current
35 + bindings = find_bindings_yml(current_directory)
36 + Dir.glob(File.join(current_directory, "**/*")).each do |path|
37 + if File.symlink?(path)
38 + bindings += find_bindings_yml(path)
39 + end
40 + end
41 + bindings
42 +end
44 private def format_files(dir)
45 # We need to chdir into output dir since the formatter ignores everything under `lib` dir.
46 Dir.cd(dir) { `crystal tool format` }
47 @@ -102,7 +116,9 @@
48 Log.info { "Generating bindings at #{options[:output_dir]}" }
50 Generator::DocRepo.disable! unless options[:doc_gen]
53 + FileUtils.cp_r(project_dir, File.join(Dir.current, "lib/gi-crystal"))
55 binding_yamls = find_bindings.concat(options[:extra_bindings])
56 binding_yamls.each do |file|
57 Log.info { "Using binding config at #{file}" }