Class: Magica::Application
- Defined in:
- lib/magica/application.rb
Overview
:nodoc:
Constant Summary collapse
- DEFAULT_MAGICAFILES =
[ 'magicafile', 'Magicafile', 'magicafile.rb', 'Magicafile.rb' ].freeze
Instance Method Summary collapse
- #handle_options ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #name ⇒ Object
- #run ⇒ Object
- #sort_options(options) ⇒ Object
- #top_level_tasks ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
11 12 13 14 |
# File 'lib/magica/application.rb', line 11 def initialize super @rakefiles = DEFAULT_MAGICAFILES.dup << magicafile end |
Instance Method Details
#handle_options ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/magica/application.rb', line 25 def .rakelib = ['rakelib'] .trace_output = $stderr OptionParser.new do |opts| opts.on_tail('-h', '--help', '-H', 'Display this help message.') do puts opts exit end .each { |args| opts.on(*args) } opts.environment('RAKEOPT') end.parse! end |
#name ⇒ Object
16 17 18 |
# File 'lib/magica/application.rb', line 16 def name 'magica' end |
#run ⇒ Object
20 21 22 23 |
# File 'lib/magica/application.rb', line 20 def run Rake.application = self super end |
#sort_options(options) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/magica/application.rb', line 40 def () # rubocop:disable Metrics/LineLength not_applicable_to_magica = %w[verbose execute execute-continue libdir no-search rakefile rakelibdir require system no-system where no-deprecation-warnings] # rubocop:enable Metrics/LineLEngth .reject! do |(switch, *)| switch =~ /--#{Regexp.union(not_applicable_to_magica)}/ end super.push(version, clean, clean_all, rebuild, target) end |
#top_level_tasks ⇒ Object
52 53 54 55 56 57 |
# File 'lib/magica/application.rb', line 52 def top_level_tasks unless File.exist?('Magicafile') @top_level_tasks.unshift(warning_not_init.to_s) unless default_tasks.include?(@top_level_tasks.first) end @top_level_tasks end |