def define_tasks!

      define_test_tasks!  if has_tests?
      define_rspec_tasks! if has_specs?

      namespace(@task_namespace) do
        desc "Updates the filelist in the gemspec file"
        task(:manifest) { manifest_task }

        desc "Builds the .gem package"
        task(:build => :manifest) { build_task }

        desc "Sets the version of the gem in the gemspec"
        task(:set_version => [:check_version, :check_current_branch]) { version_task }
        task(:check_version => :fetch_origin) { check_version_task }

        task(:fetch_origin) { fetch_origin_task }
        task(:check_current_branch) { check_current_branch_task }
        task(:check_clean_status) { check_clean_status_task }
        task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }

        checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]
        checks.unshift('spec:basic') if has_specs?
        checks.unshift('test:basic') if has_tests?
        # checks.push << [:check_rubyforge] if gemspec.rubyforge_project

        desc "Perform all checks that would occur before a release"
        task(:release_checks => checks)

        release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]
        # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project

        desc "Release a new version of the gem using the VERSION environment variable"
        task(:release => release_tasks) { release_task }
        
        namespace(:release) do
          desc "Release the next version of the gem, by incrementing the last version segment by 1"
          task(:next => [:next_version] + release_tasks) { release_task }

          desc "Release the next version of the gem, using a patch increment (0.0.1)"
          task(:patch => [:next_patch_version] + release_tasks) { release_task }

          desc "Release the next version of the gem, using a minor increment (0.1.0)"
          task(:minor => [:next_minor_version] + release_tasks) { release_task }

          desc "Release the next version of the gem, using a major increment (1.0.0)"
          task(:major => [:next_major_version] + release_tasks) { release_task }
        end

        # task(:check_rubyforge)   { check_rubyforge_task }
        # task(:rubyforge_release) { rubyforge_release_task }
        task(:gemcutter_release) { gemcutter_release_task }
        task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }
        task(:tag_version) { tag_version_task }
        task(:commit_modified_files) { commit_modified_files_task }

        task(:next_version)       { next_version_task }
        task(:next_patch_version)  { next_version_task(:patch) }
        task(:next_minor_version) { next_version_task(:minor) }
        task(:next_major_version) { next_version_task(:major) }
        
        desc "Updates the gem release tasks with the latest version on Github"
        task(:update_tasks) { update_tasks_task }
      end
    end
def define_tasks!

      define_test_tasks!  if has_tests?
      define_rspec_tasks! if has_specs?

      namespace(@task_namespace) do
        desc "Updates the filelist in the gemspec file"
        task(:manifest) { manifest_task }

        desc "Builds the .gem package"
        task(:build => :manifest) { build_task }

        desc "Sets the version of the gem in the gemspec"
        task(:set_version => [:check_version, :check_current_branch]) { version_task }
        task(:check_version => :fetch_origin) { check_version_task }

        task(:fetch_origin) { fetch_origin_task }
        task(:check_current_branch) { check_current_branch_task }
        task(:check_clean_status) { check_clean_status_task }
        task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }

        checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]
        checks.unshift('spec:basic') if has_specs?
        checks.unshift('test:basic') if has_tests?
        # checks.push << [:check_rubyforge] if gemspec.rubyforge_project

        desc "Perform all checks that would occur before a release"
        task(:release_checks => checks)

        release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]
        # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project

        desc "Release a new version of the gem using the VERSION environment variable"
        task(:release => release_tasks) { release_task }
        
        namespace(:release) do
          desc "Release the next version of the gem, by incrementing the last version segment by 1"
          task(:next => [:next_version] + release_tasks) { release_task }

          desc "Release the next version of the gem, using a patch increment (0.0.1)"
          task(:patch => [:next_patch_version] + release_tasks) { release_task }

          desc "Release the next version of the gem, using a minor increment (0.1.0)"
          task(:minor => [:next_minor_version] + release_tasks) { release_task }

          desc "Release the next version of the gem, using a major increment (1.0.0)"
          task(:major => [:next_major_version] + release_tasks) { release_task }
        end

        # task(:check_rubyforge)   { check_rubyforge_task }
        # task(:rubyforge_release) { rubyforge_release_task }
        task(:gemcutter_release) { gemcutter_release_task }
        task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }
        task(:tag_version) { tag_version_task }
        task(:commit_modified_files) { commit_modified_files_task }

        task(:next_version)       { next_version_task }
        task(:next_patch_version)  { next_version_task(:patch) }
        task(:next_minor_version) { next_version_task(:minor) }
        task(:next_major_version) { next_version_task(:major) }
        
        desc "Updates the gem release tasks with the latest version on Github"
        task(:update_tasks) { update_tasks_task }
      end
    end
Defines the rake tasks