Sha256: 60d938e9c9e6b5df808619b3fd7130e4bceb98ea20917411f70f5f53b9764054

Contents?: true

Size: 926 Bytes

Versions: 1

Compression:

Stored size: 926 Bytes

Contents

module Ing
  module Commands
  
    class Setup < Ing::Generator
    
      desc  "Set up a default ing.rb and tasks directory"
      usage "  ing setup"
      
      def initial_options(given)
        given[:dest]   ||= Dir.pwd
        given[:source] ||= File.dirname(__FILE__)
        given
      end
      
      # note manual shell setup because `ing setup` is not routed through 
      # `ing implicit` (boot)
      #
      def call
        setup_shell unless shell
        in_root do
          create_file     'ing.rb', <<_____
# Ing tasks
# Store your tasks in ./tasks and they will be available to `ing`.
# Or simply overwrite this file.

Dir[File.expand_path("tasks/**/*.rb", File.dirname(__FILE__))].each do |rb|
  load rb
end

_____
          empty_directory 'tasks'
        end
      end
      
      private
      def setup_shell
        self.shell = Ing.shell_class.new
      end
      
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ing-0.2.7 lib/ing/commands/setup.rb