Sha256: f31689d9551f726d3b59a70f56e2bdd4b31f4d4d77dc7960039384d982565656

Contents?: true

Size: 758 Bytes

Versions: 4

Compression:

Stored size: 758 Bytes

Contents

require 'erb'

module Capistrano
  module UnicornNginx
    module Helpers

      def bundle_unicorn(*args)
        SSHKit::Command.new(:bundle, :exec, :unicorn, args).to_command
      end

      def template(template_name, target)
        config_file = "#{fetch(:templates_path)}/#{template_name}"
        # if no customized file, proceed with default
        unless File.exists?(config_file)
          config_file = File.join(File.dirname(__FILE__), "../../generators/capistrano/unicorn_nginx/templates/#{template_name}")
        end
        config_stream = StringIO.new(ERB.new(File.read(config_file)).result(binding))
        upload! config_stream, target
      end

      def file_exists?(path)
        test "[ -e #{path} ]"
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano-unicorn-nginx-1.0.0 lib/capistrano/unicorn_nginx/helpers.rb
capistrano-unicorn-nginx-0.0.4 lib/capistrano/unicorn_nginx/helpers.rb
capistrano-unicorn-nginx-0.0.2 lib/capistrano/unicorn_nginx/helpers.rb
capistrano-unicorn-nginx-0.0.1 lib/capistrano/unicorn_nginx/helpers.rb