Class: Setup::Compiler
- Inherits:
-
Base
- Object
- Base
- Setup::Compiler
show all
- Defined in:
- lib/setup/compiler.rb
Instance Attribute Summary
Attributes inherited from Base
#config, #force, #io, #project, #quiet, #trace, #trial
Instance Method Summary
collapse
Methods inherited from Base
#bash, #force?, #force_remove_file, #initialize, #initialize_hooks, #quiet?, #remove_file, #rm_f, #rmdir, #rootdir, #ruby, #trace?, #trace_off, #trial?
Constructor Details
This class inherits a constructor from Setup::Base
Instance Method Details
#clean ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/setup/compiler.rb', line 36
def clean
extdirs.each do |dir|
Dir.chdir(dir) do
make('clean')
end
end
end
|
#compile ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/setup/compiler.rb', line 27
def compile
extdirs.each do |dir|
Dir.chdir(dir) do
make
end
end
end
|
#compiles? ⇒ Boolean
9
10
11
12
|
# File 'lib/setup/compiler.rb', line 9
def compiles?
!extdirs.empty?
end
|
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/setup/compiler.rb', line 15
def configure
extdirs.each do |dir|
Dir.chdir(dir) do
if File.exist?('extconf.rb') && !FileUtils.uptodate?('Makefile', ['extconf.rb'])
ruby("extconf.rb")
end
end
end
end
|
#distclean ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/setup/compiler.rb', line 45
def distclean
extdirs.each do |dir|
Dir.chdir(dir) do
make('distclean')
end
end
end
|
#extdirs ⇒ Object
54
55
56
57
58
|
# File 'lib/setup/compiler.rb', line 54
def extdirs
Dir['ext/**/*/{MANIFEST,extconf.rb}'].map do |f|
File.dirname(f)
end.uniq
end
|
#make(task = nil) ⇒ Object
61
62
63
64
|
# File 'lib/setup/compiler.rb', line 61
def make(task=nil)
return unless File.exist?('Makefile')
bash(*[config.makeprog, task].compact)
end
|