Sha256: 1f064939849a6d9a650f3bb432aedf2bbfe201958f492861320dc7c3c6390a15

Contents?: true

Size: 1.13 KB

Versions: 23

Compression:

Stored size: 1.13 KB

Contents

require 'rake'
require 'rake/tasklib'
require 'fileutils'

module Uploader
  class Tasks < ::Rake::TaskLib
    def initialize
      define
    end
  
    private
    def define
      namespace :uploader do
        
        task :app_env do
          Rake::Task[:environment].invoke if defined?(RAILS_ROOT)
        end
        
        desc 'Send all uploads to S3.  (Will only send uploads from a model named Upload)'
        task :upload_to_s3 do
          uploads = Upload.pending_s3_migration
          uploads.each do |upload|
            upload.remote = upload.local
            upload.save!
          end
        end

        desc "Sync required files from uploader."
        task :sync do
          path = File.join(File.dirname(__FILE__), *%w[.. ..])
          daemons_path = "#{RAILS_ROOT}/lib/daemons"
          system "rsync -ruv #{path}/public ."
          system "rsync -ruv #{path}/db ."
          FileUtils.mkdir_p(daemons_path) unless File.directory?(daemons_path)          
          FileUtils.cp_r("#{path}/lib/daemons/amazonaws.rb", "#{RAILS_ROOT}/lib/daemons/amazonaws.rb")
        end
        
      end
    end
  end
end
Uploader::Tasks.new

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
jbasdf-uploader-0.1.8 lib/uploader/tasks.rb
uploader-0.2.8 lib/uploader/tasks.rb
uploader-0.2.7 lib/uploader/tasks.rb
uploader-0.2.6 lib/uploader/tasks.rb
uploader-0.2.5 lib/uploader/tasks.rb
uploader-0.2.4 lib/uploader/tasks.rb
uploader-0.2.3 lib/uploader/tasks.rb
uploader-0.2.2 lib/uploader/tasks.rb
uploader-0.2.1 lib/uploader/tasks.rb
uploader-0.2.0 lib/uploader/tasks.rb
uploader-0.1.19 lib/uploader/tasks.rb
uploader-0.1.20 lib/uploader/tasks.rb
uploader-0.1.16 lib/uploader/tasks.rb
uploader-0.1.17 lib/uploader/tasks.rb
uploader-0.1.18 lib/uploader/tasks.rb
uploader-0.1.15 lib/uploader/tasks.rb
uploader-0.1.14 lib/uploader/tasks.rb
uploader-0.1.12 lib/uploader/tasks.rb
uploader-0.1.13 lib/uploader/tasks.rb
uploader-0.1.10 lib/uploader/tasks.rb