Module: Filament
- Defined in:
- lib/filament.rb,
lib/filament/plugin.rb,
lib/filament/target.rb,
lib/filament/context.rb,
lib/filament/package.rb,
lib/filament/platform.rb,
lib/filament/resolver.rb,
lib/filament/workspace.rb,
lib/filament/block_object.rb,
lib/filament/util/filelist2.rb,
lib/filament/util/fileutils.rb
Defined Under Namespace
Modules: OS, SCM, SrcUtil
Classes: Application, BlockObject, BuildContext, ExecutionContext, FileList2, Package, PackageList, PackageResolver, Platform, Plugin, Target, TargetList, TargetResolver, Task, Workspace
Constant Summary
collapse
- TAGS =
{}
Class Method Summary
collapse
Class Method Details
.cp_r_if(src, dest, &block) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/filament/util/fileutils.rb', line 5
def self.cp_r_if(src, dest, &block)
src_p = Pathname.new(src)
dest_p = Pathname.new(dest)
if yield src_p.to_s
dest_p = dest_p + src_p.basename if dest_p.exist? and dest_p.directory?
if src_p.directory?
if dest_p.exist?
raise "will not replace file with directory: #{dest_p}" unless dest_p.directory?
else
FileUtils.mkdir(dest_p)
end
src_p.children.each do |src_child_p|
relative = src_child_p.relative_path_from(src_p)
dest_child_p = dest_p + relative
cp_r_if(src_child_p, dest_child_p, &block)
end
else
log "copying #{src_p} to #{dest_p}"
FileUtils.cp_r(src_p, dest_p)
end
else
log "skipping #{src_p}"
end
end
|
.find_dir(package_dir, *files) ⇒ Object
returns first parent of package_dir to contain a root_file
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/filament/util/fileutils.rb', line 34
def self.find_dir(package_dir, *files)
p = Pathname.new(package_dir)
until p.root? do
if p.directory?
files.each do |file|
r = p + file
log "checking for #{r}"
return p.realpath if r.file?
end
end
p = p.parent
end
return nil
end
|
.get_plugin_dirs(path) ⇒ Object
155
156
157
158
|
# File 'lib/filament.rb', line 155
def get_plugin_dirs(path)
pn = Pathname.new(path)
return pn.children.sort
end
|
.load_plugins(plugin_base_dir) ⇒ Object
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# File 'lib/filament.rb', line 160
def load_plugins(plugin_base_dir)
plugins = []
dirs = get_plugin_dirs(plugin_base_dir)
dirs.each do |child|
ln = child + 'lib'
if ln.exist?
$LOAD_PATH << ln.realpath
cn = ln + 'init.rb'
raise "cannot init filament plugin '#{child}'" unless cn.exist?
load cn.realpath
plugins << child.basename.to_s
end
end
log "PLUGINS: #{plugins.join(', ')}"
end
|
.partition_args ⇒ Object
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/filament.rb', line 178
def partition_args
vars = {}
args = []
ARGV.each do |arg|
if arg =~ /^(\w+)=(.*)$/
vars[$1] = $2
else
args << arg
end
end
return { :vars => vars,
:args => args }
end
|
.run ⇒ Object
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
# File 'lib/filament.rb', line 192
def run
h = partition_args
vars = h[:vars]
args = h[:args]
vars.each do |key, val|
ENV[key] = val
end
$target_platform = (ENV['TARGET_PLATFORM'] || :mpp_sdk || :i860 || :wt2_2).to_sym
$build_type = (ENV['BUILD_TYPE'] || :DBG || :OPT || :TEST).to_sym
raise "unknown build type: '#{$build_type}'" unless [:DBG, :OPT, :TEST].member?($build_type)
$build_dir_prefix = "#{$build_type.to_s.downcase}/#{$target_platform.to_s}"
pn = Pathname.new(__FILE__).parent.parent + 'plugins'
Filament::load_plugins(pn.realpath)
Filament::Application.new.run(args)
end
|
.versioned_subdir(path) ⇒ Object
149
150
151
152
153
|
# File 'lib/filament.rb', line 149
def versioned_subdir(path)
base_dir = Pathname.new(path).parent
version = (base_dir + 'VERSION').read.chomp
return base_dir + version
end
|