Skip to content

Commit

Permalink
Rough draft of sync_assets feature
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Oct 9, 2014
1 parent a7a00db commit e64572b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/engineyard-serverside/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def fetch_deprecated(attr, replacement, default)
def_option :services_check_command, "which /usr/local/ey_resin/ruby/bin/ey-services-setup >/dev/null 2>&1"
def_option(:services_setup_command) { "/usr/local/ey_resin/ruby/bin/ey-services-setup #{app}" }

# experimental, need feedback from people using it, feature implementation subject to change or removal
def_option :restart_groups, 1
def_boolean_option :sync_assets, false

DEFAULT_KEEP_RELEASES = 3

Expand Down
2 changes: 1 addition & 1 deletion lib/engineyard-serverside/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def cached_deploy
setup_services
symlink_configs
setup_sqlite3_if_necessary
run_with_callbacks(:compile_assets) # defined in RailsAssetSupport
run_with_callbacks(:compile_assets)
enable_maintenance_page
run_with_callbacks(:migrate)
callback(:before_symlink)
Expand Down
14 changes: 13 additions & 1 deletion lib/engineyard-serverside/rails_assets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,19 @@ def run_precompile_assets_task
asset_strategy.prepare do
cd = "cd #{paths.active_release}"
task = "PATH=#{paths.binstubs}:$PATH #{framework_envs} #{precompile_assets_command}"
runner.run "#{cd} && #{task}"

# This is a hack right now, but I haven't iterated over it enough for a good solution yet.
if config.sync_assets?
shell.status "Compiling assets once on localhost (sync_assets: true)"
shell.logged_system("sh -l -c '#{cd} && #{task}'")

shell.status "Syncing assets to other remote servers (sync_assets: true)"
runner.servers.remote.run_for_each do |server|
server.sync_directory_command(paths.public_assets)
end
else
runner.run "#{cd} && #{task}"
end
end
end

Expand Down

0 comments on commit e64572b

Please sign in to comment.