$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[lib]))

require '_APPLICATION_DOWNCODE_'

namespace :_APPLICATION_DOWNCODE_ do

  namespace :process do

    desc 'Create console'
    task :console do |task|
      system("clear; bundle exec ruby_app console")
    end

    desc 'Run'
    task :run => ['_APPLICATION_DOWNCODE_:cache:destroy'] do |task|
      system("clear; bundle exec ruby_app run")
    end

  end

  namespace :cache do

    desc 'List all cached files'
    task :list do
      system('find . | grep \'\\.cache\'')
    end

    desc 'Remove all cached files'
    task :destroy do
      puts 'Removing cached files ...'
      system('find . -name \'.cache\' | xargs rm -rv')
    end

  end

end
