Sha256: b232dd56ceffef35d68dcb65679949f724d6814881fe00a46b9f1fe521824131

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

if File.exists? Rails.root.join('.git')
  namespace :git do
    desc 'Git pull'
    task :pull do
      zfben_rails_rake_system 'git pull'
    end

    desc 'Git commit with your comment'
    task :commit, [:comment] do |task, args|
      args = args.to_hash
      zfben_rails_rake_system 'git add .'
      comment = args.has_key?(:comment) ? args[:comment] : `git status`
      zfben_rails_rake_system "git commit -m '#{comment}' -a"
    end

    desc 'Git push with your comment'
    task :push, [:comment, :to] => [:commit] do |task, args|
      cmd = 'git push'
      cmd << ' ' << args[:to] if args[:to]
      zfben_rails_rake_system cmd
    end

    desc 'Clear files in .gitignore'
    task :clear do
      unless File.exists? Rails.root.join('.gitignore')
        zfben_rails_rake_err '.gitignore is not exists!'
      else
        zfben_rails_rake_system 'git clean -dfX'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
h2ocube_rails_tasks-0.0.11 lib/h2ocube_rails_tasks/tasks/git.rb
h2ocube_rails_tasks-0.0.10 lib/h2ocube_rails_tasks/tasks/git.rb