sbfaulkner / tasks

standard rake tasks

This URL has Read+Write access

sbfaulkner (author)
Mon Sep 08 08:34:28 -0700 2008
commit  3e4915413c00f9e493eff8d7104ea6b011784fbb
tree    a65a4ed5cafda7473022564a281eb49bf2c594a9
parent  1d52ce166903b7e4ed0749e3254e12a09d23b439
tasks / git.rake
100644 31 lines (28 sloc) 0.796 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
namespace 'git' do
  desc 'Add files to git repository'
  task 'add' do
    files = ENV['FILES'] || '.'
    sh %Q(git add #{files.gsub(/,/, ' ')})
  end
 
  desc 'Commit changes to repository'
  task 'commit' do
    if message = ENV['MESSAGE']
      sh %Q(git commit -m "#{message}")
    else
      sh %Q(git commit)
    end
  end
 
  desc 'Create a new git repository'
  task 'init' do
    sh %Q(git init)
    if Rake::Task[:environment]
      File.open('.gitignore', 'w') do |file|
        ['log/*.log', 'tmp/**/*', '.DS_Store', 'doc/api', 'doc/app'].each { |path| file.puts path }
      end
      FileUtils.touch %w(log tmp).collect { |dir| File.join(dir, '.gitignore') }
    end
    Rake::Task['git:add'].invoke
    ENV['MESSAGE']='Initial commit'
    Rake::Task['git:commit'].invoke
  end
end