<commit_before>require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "auto_tagger"))

Capistrano::Configuration.instance(:must_exist).load do
  namespace :release_tagger do
    desc %Q{
      Sets the branch to the latest tag from the previous stage.  
      Use -Shead=true to set the branch to master, -Stag=<tag> to specify the tag explicitly.
    }
    task :set_branch do
      if branch_name = CapistranoHelper.new(variables).branch
        set :branch, branch_name
        logger.info "setting branch to #{branch_name}"
      else
        logger.info "AUTO TAGGER WARNING: skipping auto-assignment of branch.  Branch will remain the default.}"
      end
    end

    task :latest_tags do
      logger.info "AUTOTAG release tag history is:"
      entries = CapistranoHelper.new(variables).release_tag_entries
      entries.each do |entry|
        logger.info entry
      end
    end

    desc %Q{Creates a tag using the current_stage variable}
    task :create_tag do
      if variables[:current_stage]
        tag_name = AutoTagger.new(variables[:current_stage], variables[:working_directory]).create_tag
        logger.info "created and pushed tag #{tag_name}"
      else
        logger.info "AUTO TAGGER WARNING: skipping auto-creation of tag.  Please specify :current_stage to enable auto-creation of tags (like set :current_stage, :ci)."
      end
    end
  end
end
<commit_msg>Added write_to_shared and read_from_shared tasks<commit_after>require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "auto_tagger"))

Capistrano::Configuration.instance(:must_exist).load do
  namespace :release_tagger do
    desc %Q{
      Sets the branch to the latest tag from the previous stage.  
      Use -Shead=true to set the branch to master, -Stag=<tag> to specify the tag explicitly.
    }
    task :set_branch do
      if branch_name = CapistranoHelper.new(variables).branch
        set :branch, branch_name
        logger.info "setting branch to #{branch_name}"
      else
        logger.info "AUTO TAGGER WARNING: skipping auto-assignment of branch.  Branch will remain the default.}"
      end
    end

    task :print_latest_tags, :roles => :app do
      logger.info "AUTOTAG release tag history is:"
      entries = CapistranoHelper.new(variables).release_tag_entries
      entries.each do |entry|
        logger.info entry
      end
    end

    task :write_tag_to_shared, :roles => :app do
      run "echo '#{branch}' > #{shared_path}/released_git_tag.txt"
    end

    task :read_tag_from_shared, :roles => :app do
      run "cat #{shared_path}/released_git_tag.txt"
    end

    desc %Q{Creates a tag using the current_stage variable}
    task :create_tag, :roles => :app do
      if variables[:current_stage]
        previous_tag = AutoTagger.new(StageManager.new(stages).previous_stage(current_stage), Dir.pwd).latest_tag
        tag_name = AutoTagger.new(variables[:current_stage], variables[:working_directory]).create_tag(previous_tag)
        logger.info "AUTO TAGGER created tag #{tag_name} from #{previous_tag.inspect}"
      else
        logger.info "AUTO TAGGER WARNING: skipping auto-creation of tag.  Please specify :current_stage to enable auto-creation of tags (like set :current_stage, :ci)."
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09052118256629077, 'fraction_numerical': 0.0, 'mean_word_length': 3.2568093385214008, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '7216609', 'n_tokens_mistral': 980, 'n_tokens_neox': 961, 'n_words': 294}