Class: Fulmar::Domain::Service::Application
- Inherits:
-
Rake::Application
- Object
- Rake::Application
- Fulmar::Domain::Service::Application
- Defined in:
- lib/fulmar/domain/model/application.rb
Overview
The main application which extends rake
Instance Method Summary collapse
- #define_task(task_class, *args, &block) ⇒ Object
-
#fulmar_task_dir ⇒ Object
Add fulmar application tasks.
- #init ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #name ⇒ Object
- #raw_load_rakefile ⇒ Object
- #run ⇒ Object
- #standard_rake_options ⇒ Object
- #wrap_environment ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
9 10 11 12 |
# File 'lib/fulmar/domain/model/application.rb', line 9 def initialize super @rakefiles = %w[fulmarfile Fulmarfile fulmarfile.rb Fulmarfile.rb] end |
Instance Method Details
#define_task(task_class, *args, &block) ⇒ Object
29 30 31 |
# File 'lib/fulmar/domain/model/application.rb', line 29 def define_task(task_class, *args, &block) super(task_class, *args, &wrap_environment(&block)) end |
#fulmar_task_dir ⇒ Object
Add fulmar application tasks
57 58 59 |
# File 'lib/fulmar/domain/model/application.rb', line 57 def fulmar_task_dir File.(File.join(File.dirname(__FILE__), '..', 'task')) end |
#init ⇒ Object
23 24 25 26 27 |
# File 'lib/fulmar/domain/model/application.rb', line 23 def init super .rakelib << fulmar_task_dir .rakelib << 'Fulmar' end |
#name ⇒ Object
14 15 16 |
# File 'lib/fulmar/domain/model/application.rb', line 14 def name 'fulmar' end |
#raw_load_rakefile ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/fulmar/domain/model/application.rb', line 33 def raw_load_rakefile glob("#{fulmar_task_dir}/initialization/*.rake") do |name| Rake.load_rakefile name end Fulmar::Domain::Service::PluginService.instance.rake_files.each do |name| Rake.load_rakefile name end super end |
#run ⇒ Object
18 19 20 21 |
# File 'lib/fulmar/domain/model/application.rb', line 18 def run Rake.application = self super end |
#standard_rake_options ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fulmar/domain/model/application.rb', line 61 def = super .reject { |option| option[0] == '--version' } << [ '--version', '-V', 'Display the program version.', lambda do |_value| puts "fulmar #{Fulmar::VERSION} (using rake, version #{Rake::VERSION})" exit end ] << [ '--debug', nil, 'Run in debug mode.', lambda do |_value| configuration = Fulmar::Domain::Service::ConfigurationService.instance configuration.debug = true end ] end |
#wrap_environment ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fulmar/domain/model/application.rb', line 43 def wrap_environment proc do |t, args| configuration = Fulmar::Domain::Service::ConfigurationService.instance.configuration environment = configuration.environment target = configuration.target yield(t, args) if block_given? configuration.environment = environment unless environment.nil? configuration.target = target unless target.nil? end end |