Module: RakeCompile
- Defined in:
- lib/rake-compile/target.rb,
lib/rake-compile/install.rb,
lib/rake-compile/logging.rb,
lib/rake-compile/version.rb,
lib/rake-compile/compiler.rb,
lib/rake-compile/application.rb,
lib/rake-compile/dsl_definition.rb
Defined Under Namespace
Modules: DSL
Classes: Application, Target
Constant Summary
collapse
- VERSION =
"0.3.0"
Class Method Summary
collapse
Class Method Details
.compiler_for_source(source, flags = nil) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/rake-compile/compiler.rb', line 2
def self.compiler_for_source(source, flags=nil)
cpp_flags = cc_flags = flags
if flags.is_a? Hash
cpp_flags = flags[:cpp_flags]
cc_flags = flags[:cc_flags]
end
case File.extname(source)
when '.cpp', '.cc', '.hpp'
"c++ #{cpp_flags}"
when ".c", ".h"
"cc #{cc_flags}"
else
raise("Don't know how to compile #{source}")
end
end
|
.install(src, dst) ⇒ Object
2
3
4
5
6
|
# File 'lib/rake-compile/install.rb', line 2
def self.install(src, dst)
RakeCompile.log("INSTALL".yellow, dst)
FileUtils.rm_f(dst)
FileUtils.cp(src, dst)
end
|
.log(key, msg) ⇒ Object
2
3
4
|
# File 'lib/rake-compile/logging.rb', line 2
def self.log(key, msg)
puts "[#{key}] #{msg}"
end
|
.uninstall(path) ⇒ Object
7
8
9
10
|
# File 'lib/rake-compile/install.rb', line 7
def self.uninstall(path)
RakeCompile.log("UNINSTALL".yellow, path)
FileUtils.rm_rf(path)
end
|