reality-generators 1.21.0 → 1.23.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: 24a270167a36968e1b2a11c7ebf8b868dbcb8eebf24adba10b6871d11751c786
4
- data.tar.gz: 60f8624c23c7a6fab098003ca7d25daffca0abc53b640c3fa6cd475088b99207
3
+ metadata.gz: ea2267d8d301e7e9851a006aea5c0c27fe32d000b3ef9239e23e474683f27346
4
+ data.tar.gz: 5e626c938d38675f2d4cb761579530838b8b3d06a5a59f6f67d141781be50460
5
5
  SHA512:
6
- metadata.gz: ea5d7d97328df16e74a2e33f3e711bb6694eaca7c6e6bcff59e7e1ff403e89d5b92737fc9a579d80bac0f9077f59de4b4f4353443f057dcf6b659ad47837180d
7
- data.tar.gz: cc2c2f1cc7eb677797d7514bf36bb6719601066c41316123aee89c1a4fc035f99afa22ef22a5765f78ca51df20c95954c7616e219d4fda0692ab06151d630872
6
+ metadata.gz: 1778bcd989def0ddb780bf1a053c4ac6397a50baccff1d3fa980d9a9abf56652358cc251729c3a7b2d609ba00906e1725dcff57a3647260e3227598002764582
7
+ data.tar.gz: 84b09cc0a485f7eee2e28952ee0e3b59fb4a04a8b11e73070d63aa84fe63e8cfca5f149f792ff454d968910f081390d64e870d4673e8a3f88e0a4c39fb099a62
@@ -34,6 +34,8 @@ module Reality #nodoc
34
34
  target_dir = options[:target_dir]
35
35
  buildr_project = options[:buildr_project]
36
36
  clean_generated_files = options[:clean_generated_files].nil? ? true : !!options[:clean_generated_files]
37
+ keep_file_patterns = options[:keep_file_patterns] || []
38
+ keep_file_names = options[:keep_file_names] || []
37
39
 
38
40
  if buildr_project.nil? && ::Buildr.application.current_scope.size > 0
39
41
  buildr_project = ::Buildr.project(::Buildr.application.current_scope.join(':')) rescue nil
@@ -49,6 +51,8 @@ module Reality #nodoc
49
51
  if target_dir.nil? && !buildr_project.nil?
50
52
  if clean_generated_files
51
53
  target_dir = buildr_project._(:target, :generated, self.generated_type_path_prefix, build_key)
54
+ elsif buildr_project.inline_generated_source?
55
+ target_dir = buildr_project._('src')
52
56
  else
53
57
  target_dir = buildr_project._(:srcgen, self.generated_type_path_prefix, build_key)
54
58
  end
@@ -64,7 +68,19 @@ module Reality #nodoc
64
68
  buildr_project.clean { rm_rf target_dir }
65
69
  end
66
70
 
67
- self.const_get(:GenerateTask).new(element_key, build_key, generator_keys, target_dir, buildr_project, clean_generated_files, &block)
71
+ self.const_get(:GenerateTask).new(element_key, build_key, generator_keys, target_dir, buildr_project, clean_generated_files) do |g|
72
+ g.keep_filter = Proc.new do |file|
73
+ filename = file.to_s
74
+ result = keep_file_names.include?(filename)
75
+ keep_file_patterns.each do |keep_file_pattern|
76
+ result = true if keep_file_pattern =~ filename
77
+ end
78
+ result
79
+ end if !keep_file_patterns.empty? || !keep_file_names.empty?
80
+ block.call(g)
81
+ end
82
+
83
+ target_dir
68
84
  end
69
85
  end
70
86
 
@@ -73,6 +89,7 @@ module Reality #nodoc
73
89
  attr_accessor :description
74
90
  attr_accessor :namespace_key
75
91
  attr_accessor :filter
92
+ attr_accessor :keep_filter
76
93
  attr_writer :verbose
77
94
  attr_writer :mark_as_generated_in_ide
78
95
 
@@ -89,6 +106,7 @@ module Reality #nodoc
89
106
  @generator_keys = generator_keys
90
107
  @namespace_key = self.default_namespace_key
91
108
  @filter = nil
109
+ @keep_filter = nil
92
110
  # Turn on verbose messages if buildr is turned on tracing
93
111
  @verbose = trace?
94
112
  @mark_as_generated_in_ide = true
@@ -180,7 +198,7 @@ module Reality #nodoc
180
198
  Reality::Facets::Logger) do
181
199
  self.log_container.info "Generator started: Generating #{self.generator_keys.inspect}"
182
200
  self.template_set_container.generator.
183
- generate(self.root_element_type, self.root_element, self.target_dir, @templates, self.filter)
201
+ generate(self.root_element_type, self.root_element, self.target_dir, @templates, self.filter, self.keep_filter)
184
202
  end
185
203
  rescue Reality::Generators::GeneratorError => e
186
204
  puts e.message
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reality-generators}
5
- s.version = '1.21.0'
5
+ s.version = '1.23.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
 
8
8
  s.authors = ['Peter Donald']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reality-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Donald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2024-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reality-core