Class: RailsPwnerer::App::Assets

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/rails_pwnerer/app/assets.rb

Overview

manages the precompiled assets in the Rails 3.1+ asset pipeline

Instance Method Summary collapse

Methods included from Base

_setup_unix, _setup_windows, all_packages, all_packages_without_caching, #atomic_erase, #atomic_read, #atomic_write, #best_package_matching, #check_rails_root, #control_boot_script, #cpu_cores, #current_user, #gem_exists?, #gid_for_username, #group_for_username, #hook_boot_script, #install_gem, #install_gems, #install_package, #install_package_impl, #install_package_matching, #install_packages, #kill_tree, #os_distro, package_info_hash, #path_to_boot_script, #path_to_boot_script_defaults, #path_to_gemdir, #process_info, #prompt_user_for_password, #remove_package, #remove_packages, #search_packages, #uid_for_username, #unroll_collection, #update_all_packages, #update_all_packages_impl, #update_gems, #update_package_metadata, #upgrade_gem, #upgrade_gems, #upgrade_package, #upgrade_package_impl, #upgrade_packages, #with_package_source, #with_temp_dir

Instance Method Details

#build_app_caches(app_name, instance_name) ⇒ Object

builds up the asset caches



30
31
32
33
34
35
36
37
38
# File 'lib/rails_pwnerer/app/assets.rb', line 30

def build_app_caches(app_name, instance_name)
  Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do
    if File.exist?('Gemfile')
      Kernel.system 'bundle exec rake assets:precompile RAILS_ENV=production'
    else
      Kernel.system 'rake assets:precompile RAILS_ENV=production'
    end
  end
end

#cleanup_app_caches(app_name, instance_name) ⇒ Object

removes asset caches from the application directory



19
20
21
22
23
24
25
26
27
# File 'lib/rails_pwnerer/app/assets.rb', line 19

def cleanup_app_caches(app_name, instance_name)
  Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do
    if File.exist?('Gemfile')
      Kernel.system 'bundle exec rake assets:clean RAILS_ENV=production'
    else
      Kernel.system 'rake assets:clean RAILS_ENV=production'
    end
  end
end

#setup(app_name, instance_name) ⇒ Object



6
7
8
# File 'lib/rails_pwnerer/app/assets.rb', line 6

def setup(app_name, instance_name)
  build_app_caches app_name, instance_name
end

#update(app_name, instance_name) ⇒ Object



14
15
16
# File 'lib/rails_pwnerer/app/assets.rb', line 14

def update(app_name, instance_name)
  build_app_caches app_name, instance_name
end

#update_prefetch(app_name, instance_name) ⇒ Object



10
11
12
# File 'lib/rails_pwnerer/app/assets.rb', line 10

def update_prefetch(app_name, instance_name)
  cleanup_app_caches app_name, instance_name
end