module Hoe::Travis

def define_travis_tasks

def define_travis_tasks
  desc "Runs your tests for travis"
  task :travis => %w[test check_manifest]
  namespace :travis do
    desc "Run by travis-ci after running the default checks"
    task :after => %w[
      travis:fake_config
    ]
    desc "Run by travis-ci before running the default checks"
    task :before => %w[
      install_plugins
      travis:install_deps
    ]
    desc "Lint your .travis.yml"
    task :check do
      abort unless travis_yml_check '.travis.yml'
    end
    desc "Disables the travis-ci hook"
    task :disable do
      travis_disable
    end
    desc "Brings .travis.yml up in your EDITOR then checks it on save"
    task :edit do
      Tempfile.open 'travis.yml' do |io|
        io.write File.read '.travis.yml'
        io.rewind
        ok = travis_yml_edit io.path
        travis_yml_write io.path if ok
      end
    end
    desc "Enables the travis-ci hook"
    task :enable do
      travis_enable
    end
    desc "Triggers the travis-ci hook"
    task :force do
      travis_force
    end
    task :fake_config do
      travis_fake_config
    end
    desc "Generates a new .travis.yml and allows you to customize it with your EDITOR"
    task :generate do
      Tempfile.open 'travis.yml' do |io|
        io.write travis_yml_generate
        io.rewind
        ok = travis_yml_edit io.path
        travis_yml_write io.path if ok
      end
    end
    task :install_deps do
      (extra_deps + extra_dev_deps).each do |dep|
        begin
          gem(*dep)
        rescue Gem::LoadError
          name, req, = dep
          install_gem name, req, false
        end
      end
    end
  end
end