Skip to content

Commit

Permalink
[WIP] Add front integration
Browse files Browse the repository at this point in the history
  • Loading branch information
rubyconvict committed Jul 18, 2017
1 parent ff83c76 commit 8147aeb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
13 changes: 6 additions & 7 deletions lib/capistrano/new_artrails_capistrano/front_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ def front_branch
fetch(:front_branch) || 'master'
end

def new_artrails_capistrano_front_remote_cache
"shared/front-cached-copy-#{fetch(:local_user) || 'deploy'}"
def front_rsync_remote_cache
fetch(:front_remote_cache) || "shared/front-cached-copy-#{fetch(:local_user) || 'deploy'}"
end

def front_local_cache
front_application = fetch(:front_application)
fetch(:front_local_cache) || "/tmp/.#{front_application}_rsync_cache" # ".front_rsync_cache-#{fetch(:stage)}"
# "-#{fetch(:stage)}"
fetch(:front_local_cache) || "/tmp/.#{front_application}_rsync_cache"
end

def front_rsync_credentials
Expand All @@ -25,7 +26,6 @@ def front_dist_dir_name
fetch(:front_dist_dir_name) || 'dist'
end


def front_rsync_options
fetch(:front_rsync_options) || fetch(:rsync_options)
end
Expand All @@ -49,15 +49,14 @@ def front_copy_command
end
"rsync -a --no-p --no-g --delete#{keep_string}"
end
#????

def front_revision
@front_revision ||= `git ls-remote #{fetch(:front_repo_url)} #{front_branch}`.split("\t").first
end

def front_release_path
File.join(release_path, 'public')
end
# ????

def front_install_command
fetch(:front_install_command) ||
Expand Down Expand Up @@ -106,7 +105,7 @@ def front_command

def front_remote_cache
lambda do
cache = new_artrails_capistrano_front_remote_cache
cache = front_rsync_remote_cache
cache = deploy_to + '/' + cache if cache && cache !~ /^\//
cache
end
Expand Down
12 changes: 3 additions & 9 deletions lib/capistrano/new_artrails_capistrano/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ def dir_exists?(path)
end

def copy_command
"rsync -a --no-p --no-g --delete" # "rsync --archive --acls --xattrs"
"rsync -a --no-p --no-g --delete"
end

# Path to the remote cache. We use a variable name and default that are compatible with
# the stock remote_cache strategy, for easy migration.
def repository_cache
fetch(:remote_cache) || 'shared/cached-copy-deploy'
def rsync_remote_cache
fetch(:remote_cache) || "shared/cached-copy-#{fetch(:local_user) || 'deploy'}"
end

def new_artrails_capistrano_detect_manifest_path
Expand Down Expand Up @@ -53,7 +51,6 @@ def new_artrails_capistrano_run_with_rvm_in_release_path(cmd, options={}, &block
end

def new_artrails_capistrano_run(cmd, options={}, &block)
# BEGIN: hack, invoke almost *all* commands as mongrel user
if cmd.include?('db:migrate')
c = cmd.split(';')

Expand All @@ -69,7 +66,6 @@ def new_artrails_capistrano_run(cmd, options={}, &block)
cmd = "sudo -u #{new_artrails_capistrano_sudo_as} " + cmd
end

#if cmd.strip[0..2] != 'cd ' &&
if cmd.strip[0..3] != 'pwd ' &&
!cmd.include?( 'sudo' ) &&
!cmd.include?( 'chmod +r+w+x' ) &&
Expand All @@ -85,9 +81,7 @@ def new_artrails_capistrano_run(cmd, options={}, &block)

cmd = "sudo -i -u #{new_artrails_capistrano_sudo_as} " + cmd
end
# END: hack

# run_without_sudo(cmd, options, &block)
execute(cmd, options, &block)
end
end
Expand Down

0 comments on commit 8147aeb

Please sign in to comment.