<commit_before><commit_msg>Add rake tasks for great deployments<commit_after>require 'active_support/ordered_options'

namespace :half_pipe do

  half_pipe = ActiveSupport::OrderedOptions.new

  task :clean do
    Rake::Task["half_pipe:environment"].invoke
    Rake::Task["half_pipe:execute_grunt_command"].invoke("clean")
  end

  task :execute_grunt_command, [:command] => ["half_pipe:environment",
                                              "half_pipe:generate_grunt_runner"] do |_,params|
    half_pipe.grunt_command = "#{half_pipe.grunt_runner} #{params[:command]}"
    puts "executing: #{half_pipe.grunt_command.inspect}"
    system half_pipe.grunt_command
  end

  task :generate_grunt_runner do
    paths = %W(#{half_pipe.cwd} node_modules .bin grunt)
    half_pipe.grunt_runner = File.join(*paths)
  end

  task :environment do

    # For great Capistrano
    half_pipe.cwd = (respond_to?(:release_path) ? release_path : Dir.pwd)

  end

  namespace :precompile do

    task :noop

    task :all do
      Rake::Task["half_pipe:environment"].invoke
      Rake::Task["half_pipe:execute_grunt_command"].invoke("build")
    end

  end

  desc "Precompile half-pipe-managed assets"
  task :precompile => ["half_pipe:precompile:all"]

end

task "assets:precompile" => ["half_pipe:precompile"]
task "assets:clean" => ["half_pipe:clean"]
task "assets:clobber" => ["half_pipe:clean"]
task "assets:environemnt" => ["half_pipe:environment"]
{'fraction_non_alphanumeric': 0.12630117973629423, 'fraction_numerical': 0.0, 'mean_word_length': 4.380597014925373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '881042', 'n_tokens_mistral': 476, 'n_tokens_neox': 464, 'n_words': 88}