Generate a .gitgnore file by default. Fixes #375.

This commit is contained in:
Ben Hollis 2012-05-04 21:11:11 -07:00
parent cb65916e6d
commit 35d1a67dd1
3 changed files with 25 additions and 0 deletions

View file

@ -6,6 +6,7 @@ Feature: Middleman CLI
When I cd to "MY_PROJECT" When I cd to "MY_PROJECT"
Then the following files should exist: Then the following files should exist:
| Gemfile | | Gemfile |
| .gitignore |
| config.rb | | config.rb |
| source/index.html.erb | | source/index.html.erb |
| source/images/background.png | | source/images/background.png |

View file

@ -63,6 +63,16 @@ module Middleman::Templates
run('bundle install', :capture => true) run('bundle install', :capture => true)
end end
end end
# Output a .gitignore file
class_option :git, :type => :boolean, :default => true
# Write a .gitignore file for project
# @return [void]
def generate_gitignore!
return unless options[:git]
copy_file "shared/gitignore", File.join(location, ".gitignore")
end
end end
end end

View file

@ -0,0 +1,14 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
# Ignore bundler config
/.bundle
# Ignore the build directory
/build
# Ignore Sass' cache
/.sass-cache