reality-generators 1.17.0 → 1.19.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: 0bee2228de7a874d5c2608878982967909c8377131b466f86b1d7710c7d00611
4
- data.tar.gz: 149169940b0dd2e931e361e57d31f58cbafffb0c872915647badb6fe542063bf
3
+ metadata.gz: fa4919cb877db35f5c799506c93cc2b15f614690c67e47900387e03ca53b59b1
4
+ data.tar.gz: 855853b9e0d2383a465abce2bfc85a9cc856edc9f1b8e88d73c5f16ec4ce8152
5
5
  SHA512:
6
- metadata.gz: c4f83176ca1f14970c4feb732c61278053c9fc8dc02695d1e40f5bbd3131cb1c8fb6af4247729d5764c4be232443de359c6e7e717f72715be657aaeb8a6b6c7f
7
- data.tar.gz: 9cb3b310ed7780790a702cb3549ca467456fe420325747f040990a69905c7a41d131fd80185aa60816763459419eca59a2d282787be0378f86ee5473c38a94ce
6
+ metadata.gz: a461a9b209af0ba0eb3050568bca14d667fbdb2d85487e83282f8dd040e61cd5641b16adbfb7ea4da560d5a9f8b39f07f831a2e716792d70343b3683dbe43147
7
+ data.tar.gz: cebe74c5524c03fb256c52b85e1b55011e373408a24ebf817ebfe2e97840fcd39ab47f56f37176b38fbd536dc47b0c0b49259b88fe04ad78fead254d69856374
@@ -19,7 +19,7 @@ module Reality #nodoc
19
19
  # This method is called from a Rake or Buildr task to configure the Buildr
20
20
  # project so that it knows the location of all the generated artifacts and
21
21
  # adds them to the appropriate compile paths etc.
22
- def configure_buildr_project(buildr_project, generator_task, templates, target_dir)
22
+ def configure_buildr_project(buildr_project, generator_task, templates, target_dir, mark_as_generated_in_ide)
23
23
  if buildr_project.nil?
24
24
  task('clean') do
25
25
  rm_rf target_dir
@@ -37,7 +37,7 @@ module Reality #nodoc
37
37
  buildr_project.compile.using :javac
38
38
  buildr_project.compile.from main_java_dir
39
39
  # Need to force this as it may have already been cached and thus will not recalculate
40
- buildr_project.iml.main_generated_source_directories << main_java_dir if buildr_project.iml?
40
+ buildr_project.iml.main_generated_source_directories << main_java_dir if mark_as_generated_in_ide && buildr_project.iml?
41
41
  end
42
42
 
43
43
  # Is there resources generated in project?
@@ -56,7 +56,7 @@ module Reality #nodoc
56
56
  end
57
57
  end
58
58
  end
59
- buildr_project.iml.main_generated_resource_directories << main_resources_dir if buildr_project.iml?
59
+ buildr_project.iml.main_generated_resource_directories << main_resources_dir if mark_as_generated_in_ide && buildr_project.iml?
60
60
  end
61
61
 
62
62
  # Is there assets generated in project?
@@ -76,7 +76,7 @@ module Reality #nodoc
76
76
  end
77
77
  buildr_project.test.compile.from test_java_dir
78
78
  # Need to force this as it may have already been cached and thus will not recalculate
79
- buildr_project.iml.test_generated_source_directories << test_java_dir if buildr_project.iml?
79
+ buildr_project.iml.test_generated_source_directories << test_java_dir if mark_as_generated_in_ide && buildr_project.iml?
80
80
  end
81
81
 
82
82
  # Is there resources generated in project?
@@ -95,7 +95,7 @@ module Reality #nodoc
95
95
  end
96
96
  end
97
97
  end
98
- buildr_project.iml.test_generated_resource_directories << test_resources_dir if buildr_project.iml?
98
+ buildr_project.iml.test_generated_resource_directories << test_resources_dir if mark_as_generated_in_ide && buildr_project.iml?
99
99
  end
100
100
  end
101
101
  end
@@ -74,6 +74,7 @@ module Reality #nodoc
74
74
  attr_accessor :namespace_key
75
75
  attr_accessor :filter
76
76
  attr_writer :verbose
77
+ attr_writer :mark_as_generated_in_ide
77
78
 
78
79
  attr_reader :root_element_key
79
80
  attr_reader :key
@@ -90,11 +91,12 @@ module Reality #nodoc
90
91
  @filter = nil
91
92
  # Turn on verbose messages if buildr is turned on tracing
92
93
  @verbose = trace?
94
+ @mark_as_generated_in_ide = true
93
95
  @target_dir = target_dir
94
96
  yield self if block_given?
95
97
  define
96
98
  @templates = self.template_set_container.generator.load_templates_from_template_sets(generator_keys)
97
- Reality::Generators::Buildr.configure_buildr_project(buildr_project, task_name, @templates, target_dir)
99
+ Reality::Generators::Buildr.configure_buildr_project(buildr_project, task_name, @templates, target_dir, mark_as_generated_in_ide?)
98
100
  end
99
101
 
100
102
  protected
@@ -149,6 +151,10 @@ module Reality #nodoc
149
151
 
150
152
  private
151
153
 
154
+ def mark_as_generated_in_ide?
155
+ !!@mark_as_generated_in_ide
156
+ end
157
+
152
158
  def verbose?
153
159
  !!@verbose
154
160
  end
@@ -111,10 +111,12 @@ module Reality #nodoc
111
111
  # Base class for templates that generate a single file
112
112
  class SingleFileOutputTemplate < Template
113
113
  attr_reader :output_filename_pattern
114
+ attr_reader :output_filter
114
115
 
115
116
  def initialize(template_set, facets, target, template_key, output_filename_pattern, helpers = [], options = {})
116
117
  super(template_set, facets, target, template_key, helpers, options)
117
118
  @output_filename_pattern = output_filename_pattern
119
+ @output_filter = options[:output_filter]
118
120
  end
119
121
 
120
122
  def output_path
@@ -132,6 +134,7 @@ module Reality #nodoc
132
134
  output_filename = File.join(target_basedir, output_filename)
133
135
  unprocessed_files.delete(output_filename)
134
136
  result = self.render_to_string(context_binding)
137
+ result = self.output_filter.call(result) unless self.output_filter.nil?
135
138
  FileUtils.mkdir_p File.dirname(output_filename) unless File.directory?(File.dirname(output_filename))
136
139
  if File.exist?(output_filename) && IO.read(output_filename) == result
137
140
  Generators.debug "Skipped generation of #{self.name} for #{self.target} #{object_name} to #{output_filename} due to no changes"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{reality-generators}
5
- s.version = '1.17.0'
5
+ s.version = '1.19.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.17.0
4
+ version: 1.19.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-09-25 00:00:00.000000000 Z
11
+ date: 2023-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reality-core