Sha256: 4c7ed328f8b843c4c8c7e66f403d53ec611afd662600662d4241c7c0df768857

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

module HackBoxen
  namespace :hb do

    desc "Ensure all required config options are contained in the WorkingConfig"
    task :validate_working_config do
      WorkingConfig.resolve!
      HackBoxen.verify_dependencies
      # failures = HackBoxen::ConfigValidator.failed_requirements
      # if failures.size > 0
      #   raise "Hackbox environment fails to meet requirements:\n-- " + failures.join("\n-- ") + "\n"
      # end
    end

    desc "Create the required output directories using the filesystem specified by the WorkingConfig"
    task :create_required_paths => [:validate_working_config] do
      output_dirs.each { |dir| HackBoxen.current_fs.mkpath(dir) unless HackBoxen.current_fs.exists? dir }
    end

    desc "Always save the WorkingConfig out to a file when running a hackbox"
    task :create_working_config => [:create_required_paths] do
      working_config = File.join(path_to(:env_dir), 'working_config.json')
      HackBoxen.current_fs.open(working_config, 'w') { |f| f.write WorkingConfig.to_hash.to_json }
    end

    desc "Execute the main file inside of the current hackbox directory"
    task :init => [:create_working_config] do
      main_file     = File.join(path_to(:hb_engine), 'main')
      sh "#{main_file} #{path_to(:hb_dataroot)} #{path_to(:data_dir)}" do |ok,res|
        if !ok
          puts "Processing script failed with #{res}"
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hackboxen-0.1.0 lib/hackboxen/tasks/init.rb