<commit_before>require 'rubygems'
require 'rubyforge'
require 'rake'
require 'rake/tasklib'
require 'date'

module Rake 
  
  class GithubGem < TaskLib
    
    attr_accessor :name
    attr_accessor :specification
   
    def self.define_tasks!
      gem_task_builder = Rake::GithubGem.new      
      gem_task_builder.register_all_tasks!
    end
    

    def initialize
      reload_gemspec!
    end

    def register_all_tasks!
      namespace(:gem) do
        desc "Updates the file lists for this gem"
        task(:manifest) { manifest_task }

        desc "Releases a new version of #{@name}"
        task(:build => [:manifest]) { build_task } 
        
        desc "Releases a new version of #{@name}"
        task(:release => [:check_clean_master_branch, :version, :build]) { release_task } 
        
        # helper task for releasing
        task(:check_clean_master_branch) { verify_clean_status('master') }
        task(:check_version) { verify_version(ENV['VERSION'] || @specification.version) }
        task(:version => [:check_version]) { set_gem_version! }        
      end
      
      # Register RDoc tasks
      if @specification.has_rdoc
        require 'rake/rdoctask'
        
        namespace(:doc) do 
          desc 'Generate documentation for request-log-analyzer'
          Rake::RDocTask.new(:compile) do |rdoc|
            rdoc.rdoc_dir = 'doc'
            rdoc.title    = @name
            rdoc.options += @specification.rdoc_options
            rdoc.rdoc_files.include(@specification.extra_rdoc_files)
            rdoc.rdoc_files.include('lib/**/*.rb')
          end
          
          desc "Publish RDoc files for #{@name} to Github"
          task(:publish => :compile) do
            sh 'git checkout gh-pages'
            sh 'cp -rf doc/* .'
            sh "git commit -am \"Publishing newest RDoc documentation for #{@name}\""
            sh "git push origin gh-pages"
            sh "git checkout master"
          end
        end
      end
    
      # Setup :spec task if RSpec files exist
      if Dir['spec/**/*_spec.rb'].any?
        require 'spec/rake/spectask'

        desc "Run all specs for #{@name}"
        Spec::Rake::SpecTask.new(:spec) do |t|
          t.spec_files = FileList['spec/**/*_spec.rb']
        end
      end
      
      # Setup :test task if unit test files exist<commit_msg>Small improvement to the doc:publish task<commit_after>require 'rubygems'
require 'rubyforge'
require 'rake'
require 'rake/tasklib'
require 'date'

module Rake 
  
  class GithubGem < TaskLib
    
    attr_accessor :name
    attr_accessor :specification
   
    def self.define_tasks!
      gem_task_builder = Rake::GithubGem.new      
      gem_task_builder.register_all_tasks!
    end
    

    def initialize
      reload_gemspec!
    end

    def register_all_tasks!
      namespace(:gem) do
        desc "Updates the file lists for this gem"
        task(:manifest) { manifest_task }

        desc "Releases a new version of #{@name}"
        task(:build => [:manifest]) { build_task } 
        
        desc "Releases a new version of #{@name}"
        task(:release => [:check_clean_master_branch, :version, :build]) { release_task } 
        
        # helper task for releasing
        task(:check_clean_master_branch) { verify_clean_status('master') }
        task(:check_version) { verify_version(ENV['VERSION'] || @specification.version) }
        task(:version => [:check_version]) { set_gem_version! }        
      end
      
      # Register RDoc tasks
      if @specification.has_rdoc
        require 'rake/rdoctask'
        
        namespace(:doc) do 
          desc 'Generate documentation for request-log-analyzer'
          Rake::RDocTask.new(:compile) do |rdoc|
            rdoc.rdoc_dir = 'doc'
            rdoc.title    = @name
            rdoc.options += @specification.rdoc_options
            rdoc.rdoc_files.include(@specification.extra_rdoc_files)
            rdoc.rdoc_files.include('lib/**/*.rb')
          end
          
          desc "Publish RDoc files for #{@name} to Github"
          task(:publish => :compile) do
            sh 'git checkout gh-pages'
            sh 'git pull origin gh-pages'
            sh 'cp -rf doc/* .'
            sh "git commit -am \"Publishing newest RDoc documentation for #{@name}\""
            sh "git push origin gh-pages"
            sh "git checkout master"
          end
        end
      end
    
      # Setup :spec task if RSpec files exist
      if Dir['spec/**/*_spec.rb'].any?
        require 'spec/rake/spectask'

        desc "Run all specs for #{@name}"
        Spec::Rake::SpecTask.new(:spec) do |t|
          t.spec_files = FileList['spec/**/*_spec.rb']
        end
      end
      
      # Setup :test task if unit test files exist
{'fraction_non_alphanumeric': 0.1036943744752309, 'fraction_numerical': 0.0, 'mean_word_length': 2.035031847133758, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3268549', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1398, 'n_words': 363}