Class: ExtconfTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- ExtconfTask
- Defined in:
- lib/extconf_task.rb
Overview
Note:
ExtconfTask search files by the pattern “**/extconf.rb”
and create tasks for the found ‘extconf.rb’.
ExtconfTask.new do |et|
et.extconf_pattern = "pattern/extconf.rb"
end
ExtconfTask.new do |et|
et.extconf_paths << "path1/extconf.rb"
et.extconf_paths << "path2/extconf.rb"
end
Constant Summary collapse
- VERSION =
ExtconfTaskVersion::VERSION
- DEFAULT_COMMAND_MAKE =
"make"- DEFAULT_COMMAND_RUBY =
"ruby"
Instance Attribute Summary collapse
-
#command_make ⇒ Object
Returns the value of attribute command_make.
-
#command_ruby ⇒ Object
Returns the value of attribute command_ruby.
-
#extconf_paths ⇒ Object
readonly
Returns the value of attribute extconf_paths.
-
#extconf_pattern ⇒ Object
Returns the value of attribute extconf_pattern.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize {|_self| ... } ⇒ ExtconfTask
constructor
A new instance of ExtconfTask.
Constructor Details
#initialize {|_self| ... } ⇒ ExtconfTask
Returns a new instance of ExtconfTask.
28 29 30 31 32 33 34 35 |
# File 'lib/extconf_task.rb', line 28 def initialize(&block) @extconf_pattern = "**/extconf.rb" @extconf_paths = [] @command_ruby = nil @command_make = nil yield(self) if block_given? define end |
Instance Attribute Details
#command_make ⇒ Object
Returns the value of attribute command_make.
23 24 25 |
# File 'lib/extconf_task.rb', line 23 def command_make @command_make end |
#command_ruby ⇒ Object
Returns the value of attribute command_ruby.
22 23 24 |
# File 'lib/extconf_task.rb', line 22 def command_ruby @command_ruby end |
#extconf_paths ⇒ Object (readonly)
Returns the value of attribute extconf_paths.
21 22 23 |
# File 'lib/extconf_task.rb', line 21 def extconf_paths @extconf_paths end |
#extconf_pattern ⇒ Object
Returns the value of attribute extconf_pattern.
20 21 22 |
# File 'lib/extconf_task.rb', line 20 def extconf_pattern @extconf_pattern end |
Instance Method Details
#define ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/extconf_task.rb', line 78 def define desc "Create Makefile from extconf.rb" task "extconf:makefile" do |t| each_extconf_directory do |extconf| create_makefile(extconf) end end desc "Compile according to Makefile" task "extconf:compile" do |t| each_extconf_directory do |extconf| create_makefile(extconf) compile_according_to_makefile end end desc "Clean generated files (exclude Makefile)" task "extconf:clean" do |t| each_extconf_directory do |extconf| if makefile_exist? make("clean") end end end desc "Clean generated files (include Makefile)" task "extconf:distclean" do |t| each_extconf_directory do |extconf| if makefile_exist? make("distclean") end end end end |