Class: Pulsar::Helpers::Capistrano::DSL
- Inherits:
-
Object
- Object
- Pulsar::Helpers::Capistrano::DSL
- Includes:
- Pulsar::Helpers::Clamp
- Defined in:
- lib/pulsar/helpers/capistrano.rb
Instance Method Summary collapse
-
#initialize(capistrano, opts, &dsl_code) ⇒ DSL
constructor
A new instance of DSL.
- #method_missing(meth, *args, &block) ⇒ Object
Methods included from Pulsar::Helpers::Clamp
Methods included from Path
#capfile_path, #config_app_defaults_path, #config_app_path, #config_app_recipes_path, #config_app_stage_recipes_path, #config_apps_path, #config_base_path, #config_path, #config_stage_path
Methods included from Shell
Constructor Details
#initialize(capistrano, opts, &dsl_code) ⇒ DSL
Returns a new instance of DSL.
7 8 9 10 11 |
# File 'lib/pulsar/helpers/capistrano.rb', line 7 def initialize(capistrano, opts, &dsl_code) @capistrano = capistrano @options = opts instance_eval(&dsl_code) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pulsar/helpers/capistrano.rb', line 13 def method_missing(meth, *args, &block) return if !@capistrano.from_application_path? && @options[:app_only] recipes = "#{ENV['CONFIG_PATH']}/recipes/#{meth}" File.directory?(recipes) || raise("There are no recipes of type #{meth}") args.each do |arg| recipe = "#{recipes}/#{arg}.rb" File.exists?(recipe) || raise("There is no #{arg} recipe") @capistrano.send(:load, recipe) end end |