module Fontana::ServerRake

Public Instance Methods

call_fontana_task(name, options) click to toggle source
# File lib/fontana/server_rake.rb, line 11
def call_fontana_task(name, options)
  # options = task_options[name]
  options[:before].call if options[:before]

  cmd = ""
  if (envs = options[:env]) && !envs.empty?
    cmd << envs.map{|(k,v)| "#{k}=#{v}"}.join(" ") << ' '
  end
  cmd << "BUNDLE_GEMFILE=#{Fontana.gemfile} bundle exec rake #{name}"
  if Rake.application.options.trace
    cmd << " --trace -v"
  end
  FileUtils::Verbose.chdir(Fontana.home) do
    system!(cmd)
  end

  options[:after].call if options[:after]
end
fontana_task(name, options = {}) click to toggle source
# File lib/fontana/server_rake.rb, line 30
def fontana_task(name, options = {})
  full_name = (@namespaces + [name]).join(':')
  task(name => :"bundle:unset_env") do
    call_fontana_task(full_name, options)
  end
end
namespace_with_fontana(name, target = nil, &block) click to toggle source
# File lib/fontana/server_rake.rb, line 37
def namespace_with_fontana(name, target = nil, &block)
  @namespaces ||= []
  @namespaces.push(target || name)
  begin
    namespace(name, &block)
  ensure
    @namespaces.pop
  end
end