class MTBuild::Application
This subclasses the Rake::Application class to override default Rake
behaviors with MTBuild-specific behaviors
Constants
- DEFAULT_RAKEFILES
Default list of mtbuildfile names
Attributes
rakefiles[R]
List of rakefile names to look for
Public Class Methods
new()
click to toggle source
This overrides the default rakefile names with the mtbuildfile names
Calls superclass method
# File lib/mtbuild/application.rb, line 28 def initialize super @rakefiles = DEFAULT_RAKEFILES.dup end
Public Instance Methods
create_default_task_if_none_exists()
click to toggle source
# File lib/mtbuild/application.rb, line 78 def create_default_task_if_none_exists if lookup(default_task_name).nil? task default_task_name do puts 'Nothing to do because no projects specified default tasks.' puts 'Use the -T flag to see the list of tasks you can build.' end end end
default_task_name()
click to toggle source
# File lib/mtbuild/application.rb, line 87 def default_task_name 'all' end
init(app_name='mtbuild')
click to toggle source
Override init to pass mtbuild as the app name
Calls superclass method
# File lib/mtbuild/application.rb, line 43 def init(app_name='mtbuild') super end
run()
click to toggle source
# File lib/mtbuild/application.rb, line 33 def run standard_exception_handling do init load_rakefile create_default_task_if_none_exists top_level end end
standard_rake_options()
click to toggle source
This modifies Rake's command line options to do MTBuild-specific things
Calls superclass method
# File lib/mtbuild/application.rb, line 48 def standard_rake_options # This hijacks the "--version" flag and displays the MTBuild version along # with the Rake version. options = super.map do |opt| if opt.first == '--version' ['--version', '-V', "Display the program version.", lambda { |value| puts "mtbuild, version #{MTBuild::VERSION}" puts "rake, version #{Rake::VERSION}" exit } ] else opt end end # This adds MTBuild-specific options options |= [ ['--super-dry-run', "Do a dry run printing actions, but not executing them.", lambda { |value| Rake.verbose(true) Rake.nowrite(true) } ], ] sort_options(options) end