Sha256: 7f1e4e2f216dea7b7e931d8f2d048ef3bb99c8fe30c75adce5a96fcee5a6c8b5
Contents?: true
Size: 1.34 KB
Versions: 42
Compression:
Stored size: 1.34 KB
Contents
require 'capistrano' module CapistranoDeployManagement def self.load_into(configuration) configuration.load do @used_recipes = [] class << self attr_reader :used_recipes end def use_recipe(recipe_name) return if @used_recipes.include?(recipe_name.to_sym) begin require "capistrano-deploy-management/#{recipe_name}" recipe = CapistranoDeployManagement.const_get(recipe_name.to_s.capitalize.gsub(/_(\w)/) { $1.upcase }) recipe.load_into(self) @used_recipes << recipe.to_s.split('::').last.downcase.to_sym rescue LoadError abort "Did you misspell `#{recipe_name}` recipe name?" end end def use_recipes(*recipes) recipes.each do |recipe| use_recipe(recipe) end end def using_recipe?(recipe) used_recipes.include?(recipe.to_sym) end namespace :deploy do desc 'Run deploy' task :default do update restart end task :update do transaction do update_code create_symlink end end task :restart do # nothing end end end end end if Capistrano::Configuration.instance CapistranoDeployManagement.load_into(Capistrano::Configuration.instance) end
Version data entries
42 entries across 42 versions & 1 rubygems