lib/couch/generators/base.rb in couch-0.0.2 vs lib/couch/generators/base.rb in couch-0.0.3

- old
+ new

@@ -1,9 +1,8 @@ -require 'couch/core_ext/string/inflections' - require 'rubygems' require 'thor/group' +require 'active_support/inflector' module Couch module Generators class Error < Thor::Error end @@ -11,10 +10,13 @@ class Base < Thor::Group include Thor::Actions add_runtime_options! + class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false, + :desc => "Skip Git ignores and keeps" + # Automatically sets the source root based on the class name. # def self.source_root @_couch_source_root ||= begin if generator_name @@ -57,9 +59,14 @@ if generator = name.to_s.split('::').last generator.sub!(/Generator$/, '') generator.underscore end end + end + + def empty_directory_with_gitkeep(destination, config = {}) + empty_directory(destination, config) + create_file("#{destination}/.gitkeep") unless options[:skip_git] end end end end