reality-generators 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/reality/generators/rake_integration.rb +46 -0
- data/reality-generators.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb271940ea03018e01b712e7b48e7c398f0b60b1
|
4
|
+
data.tar.gz: ef6ca7b54c3f3b6bc59998a9286db225170702d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a19d5020200dd18b3597ed8f0cd4c5fca8a6f5b898cafcdee27bee85eddfdca29174dec5a2c1e3839c48844ab6b23359f345acb4900d095ca9fe1257614e7336
|
7
|
+
data.tar.gz: 73deadfbfdbfdd6cba4d3b418d12d165e8993cb03ba3908960ff5b58c83079f12c90434ffb0851b1773e0f6145cd4eec3143dbd8bed443be964a2c9dcac871aa
|
@@ -16,6 +16,50 @@ module Reality #nodoc
|
|
16
16
|
module Generators #nodoc
|
17
17
|
module Rake #nodoc
|
18
18
|
|
19
|
+
# This class is typically mixed into Myproject::Build constants to add simplified mechanisms for defining build tasks
|
20
|
+
module BuildTasksMixin
|
21
|
+
def define_load_task(filename = nil, &block)
|
22
|
+
base_directory = File.dirname(::Buildr.application.buildfile.to_s)
|
23
|
+
candidate_file = File.expand_path("#{base_directory}/#{default_descriptor_filename}")
|
24
|
+
if filename.nil?
|
25
|
+
filename = candidate_file
|
26
|
+
elsif File.expand_path(filename) == candidate_file
|
27
|
+
self.log_container.warn("#{self.name}.define_load_task() passed parameter '#{filename}' which is the same value as the default parameter. This parameter can be removed.")
|
28
|
+
end
|
29
|
+
self.const_get(:LoadDescriptor).new(File.expand_path(filename), &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def define_generate_task(generator_keys, options = {}, &block)
|
33
|
+
element_key = options[:"#{root_element_type}_key"]
|
34
|
+
target_dir = options[:target_dir]
|
35
|
+
buildr_project = options[:buildr_project]
|
36
|
+
|
37
|
+
if buildr_project.nil? && ::Buildr.application.current_scope.size > 0
|
38
|
+
buildr_project = ::Buildr.project(::Buildr.application.current_scope.join(':')) rescue nil
|
39
|
+
end
|
40
|
+
|
41
|
+
build_key = options[:key] || (buildr_project.nil? ? :default : buildr_project.name.split(':').last)
|
42
|
+
|
43
|
+
if target_dir
|
44
|
+
base_directory = File.dirname(::Buildr.application.buildfile.to_s)
|
45
|
+
target_dir = File.expand_path(target_dir, base_directory)
|
46
|
+
end
|
47
|
+
|
48
|
+
if target_dir.nil? && !buildr_project.nil?
|
49
|
+
target_dir = buildr_project._(:target, :generated, self.generated_type_path_prefix, build_key)
|
50
|
+
elsif !target_dir.nil? && !buildr_project.nil?
|
51
|
+
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
|
+
end
|
53
|
+
|
54
|
+
if target_dir.nil?
|
55
|
+
self.log_container.error("#{self.name}.define_generate_task should specify a target directory as it can not be derived from the context.")
|
56
|
+
end
|
57
|
+
|
58
|
+
self.const_get(:GenerateTask).new(element_key, build_key, generator_keys, target_dir, buildr_project, &block)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# This is the base class used to define tasks that generate artifacts using templates
|
19
63
|
class BaseGenerateTask
|
20
64
|
attr_accessor :description
|
21
65
|
attr_accessor :namespace_key
|
@@ -134,6 +178,8 @@ module Reality #nodoc
|
|
134
178
|
end
|
135
179
|
end
|
136
180
|
|
181
|
+
# Base class that defines tasks to load the resource descriptors into application
|
182
|
+
# This will load the file such as 'architecture.rb', 'noft.rb' or 'resgen.rb'
|
137
183
|
class BaseLoadDescriptor
|
138
184
|
attr_accessor :description
|
139
185
|
attr_accessor :namespace_key
|
data/reality-generators.gemspec
CHANGED