Sha256: 1f8b3c6a5a9a29cba7ee153eba3651b8f1357c9c165bde713bb8b243ecfebb24

Contents?: true

Size: 1.35 KB

Versions: 37

Compression:

Stored size: 1.35 KB

Contents

require 'rubygems'
require 'thor/group'
# require File.dirname(__FILE__) + "/../lib/templates"

class CapRecipes < Thor::Group
  include Thor::Actions

  def self.source_root; File.expand_path(File.dirname(__FILE__)); end
  def self.banner; "cap-recipes [path] task task2 task3"; end

  desc "Description: Generate deploy.rb file with desired tasks!"

  argument :path, :desc => "path to capify", :type => :string, :default => '.'
  argument :requires, :desc => "list of tasks to require", :type => :array, :default => []
  class_option :list, :desc => "list all recipes", :aliases => '-l', :type => :boolean, :default => false

  def capify
    unless options[:list]
      capfile_temp = "templates/Capfile.tt"
      deploy_temp = "templates/deploy.rb.tt"
      @recipes = requires.collect { |task| "require 'cap_recipes/tasks/#{task}'" }.join("\n")
      template capfile_temp, File.join(path,'/Capfile')
      template deploy_temp, File.join(path,'/config/deploy.rb')
    else
      folders = Dir.glob( File.dirname(__FILE__) + "/../lib/cap_recipes/tasks/*.rb").inject({}) do |packages,file|
        desc =  IO.readlines(file).first
        packages[File.basename(file, ".rb")] = ((desc =~ /#/) ? desc : "No description")
        packages
      end
      puts "Available Recipes:\n"
      puts folders.collect { |folder,desc| "\t* #{folder} - #{desc}"}.join("\n")
    end
  end

end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
uhl-cap-recipes-0.2.11 lib/capify.rb
uhl-cap-recipes-0.2.10 lib/capify.rb
uhl-cap-recipes-0.1.10 lib/capify.rb
uhl-cap-recipes-0.1.9 lib/capify.rb
uhl-cap-recipes-0.1.8 lib/capify.rb
uhl-cap-recipes-0.1.7 lib/capify.rb
uhl-cap-recipes-0.1.6 lib/capify.rb
uhl-cap-recipes-0.1.5 lib/capify.rb
uhl-cap-recipes-0.1.4 lib/capify.rb
uhl-cap-recipes-0.1.3 lib/capify.rb
uhl-cap-recipes-0.1.2 lib/capify.rb
uhl-cap-recipes-0.1.1 lib/capify.rb
uhl-cap-recipes-0.1.0 lib/capify.rb
crazycode-cap-recipes-0.5.3 lib/capify.rb
crazycode-cap-recipes-0.5.2 lib/capify.rb
crazycode-cap-recipes-0.5.1 lib/capify.rb
crazycode-cap-recipes-0.5.0 lib/capify.rb
crazycode-cap-recipes-0.4.14 lib/capify.rb
crazycode-cap-recipes-0.4.13 lib/capify.rb
crazycode-cap-recipes-0.4.12 lib/capify.rb