reality-generators 1.15.0 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +5 -1
- data/README.md +1 -1
- data/lib/reality/generators/generator.rb +7 -3
- data/lib/reality/generators/rake_integration.rb +10 -1
- data/reality-generators.gemspec +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0bee2228de7a874d5c2608878982967909c8377131b466f86b1d7710c7d00611
|
4
|
+
data.tar.gz: 149169940b0dd2e931e361e57d31f58cbafffb0c872915647badb6fe542063bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f83176ca1f14970c4feb732c61278053c9fc8dc02695d1e40f5bbd3131cb1c8fb6af4247729d5764c4be232443de359c6e7e717f72715be657aaeb8a6b6c7f
|
7
|
+
data.tar.gz: 9cb3b310ed7780790a702cb3549ca467456fe420325747f040990a69905c7a41d131fd80185aa60816763459419eca59a2d282787be0378f86ee5473c38a94ce
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/.travis.yml
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
# Lock down dist to ensure that builds run on a distribution that supports oraclejdk8
|
2
|
+
dist: trusty
|
1
3
|
language: ruby
|
2
4
|
rvm:
|
3
|
-
- 2.
|
5
|
+
- 2.7.2
|
4
6
|
- jruby-19mode
|
5
7
|
jdk:
|
6
8
|
- oraclejdk8
|
7
9
|
git:
|
8
10
|
depth: 10
|
9
11
|
before_install:
|
12
|
+
- rvm install ruby-2.7.2
|
13
|
+
- rvm use 2.7.2
|
10
14
|
- gem update bundler
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# reality-generators
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://api.travis-ci.com/realityforge/reality-generators.svg?branch=master)](http://travis-ci.com/realityforge/reality-generators)
|
4
4
|
|
5
5
|
A basic toolkit for abstracting the generation of files from model objects. These classes
|
6
6
|
were extracted from several existing toolkits, primarily [Domgen](https://github.com/realityforge/domgen).
|
@@ -36,7 +36,7 @@ module Reality #nodoc
|
|
36
36
|
# The traversal starts from a root element of specified element_type and
|
37
37
|
# traverses all elements that are contained transitively by the root element.
|
38
38
|
# The templates then generate files from traversed elements.
|
39
|
-
def generate(element_type, element, directory, templates, filter)
|
39
|
+
def generate(element_type, element, directory, templates, filter, keep_filter = nil)
|
40
40
|
templates = load_templates_from_template_sets(templates) if templates.any? {|t| t.is_a?(Symbol) || t.is_a?(String)}
|
41
41
|
unprocessed_files = (Dir["#{directory}/**/*.*"] + Dir["#{directory}/**/*"]).uniq
|
42
42
|
|
@@ -66,8 +66,12 @@ module Reality #nodoc
|
|
66
66
|
FileUtils.rmdir file
|
67
67
|
end
|
68
68
|
else
|
69
|
-
|
70
|
-
|
69
|
+
if keep_filter && keep_filter.call(file)
|
70
|
+
Generators.debug "Keeping #{file} that is not generated as it matches the keep filter"
|
71
|
+
else
|
72
|
+
Generators.debug "Removing #{file} as no longer generated"
|
73
|
+
FileUtils.rm_f file
|
74
|
+
end
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
@@ -33,6 +33,7 @@ module Reality #nodoc
|
|
33
33
|
element_key = options[:"#{root_element_type}_key"]
|
34
34
|
target_dir = options[:target_dir]
|
35
35
|
buildr_project = options[:buildr_project]
|
36
|
+
clean_generated_files = options[:clean_generated_files].nil? ? true : !!options[:clean_generated_files]
|
36
37
|
|
37
38
|
if buildr_project.nil? && ::Buildr.application.current_scope.size > 0
|
38
39
|
buildr_project = ::Buildr.project(::Buildr.application.current_scope.join(':')) rescue nil
|
@@ -46,7 +47,11 @@ module Reality #nodoc
|
|
46
47
|
end
|
47
48
|
|
48
49
|
if target_dir.nil? && !buildr_project.nil?
|
49
|
-
|
50
|
+
if clean_generated_files
|
51
|
+
target_dir = buildr_project._(:target, :generated, self.generated_type_path_prefix, build_key)
|
52
|
+
else
|
53
|
+
target_dir = buildr_project._(:srcgen, self.generated_type_path_prefix, build_key)
|
54
|
+
end
|
50
55
|
elsif !target_dir.nil? && !buildr_project.nil?
|
51
56
|
self.log_container.warn("#{self.name}.define_generate_task specifies a target directory parameter but it can be be derived from the context. The parameter should be removed.")
|
52
57
|
end
|
@@ -55,6 +60,10 @@ module Reality #nodoc
|
|
55
60
|
self.log_container.error("#{self.name}.define_generate_task should specify a target directory as it can not be derived from the context.")
|
56
61
|
end
|
57
62
|
|
63
|
+
if clean_generated_files && buildr_project
|
64
|
+
buildr_project.clean { rm_rf target_dir }
|
65
|
+
end
|
66
|
+
|
58
67
|
self.const_get(:GenerateTask).new(element_key, build_key, generator_keys, target_dir, buildr_project, &block)
|
59
68
|
end
|
60
69
|
end
|
data/reality-generators.gemspec
CHANGED
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.
|
4
|
+
version: 1.17.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:
|
11
|
+
date: 2023-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reality-core
|
@@ -137,8 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
|
141
|
-
rubygems_version: 2.5.1
|
140
|
+
rubygems_version: 3.1.4
|
142
141
|
signing_key:
|
143
142
|
specification_version: 4
|
144
143
|
summary: A basic toolkit for abstracting the generation of files from model objects.
|