Skip to content

Commit

Permalink
Added option app_folder for update commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtadeulopes authored and dcrec1 committed Aug 24, 2010
1 parent b89ed32 commit a1f7d42
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 1 addition & 5 deletions lib/inploy/deploy.rb
Expand Up @@ -41,7 +41,7 @@ def remote_install(opts)
end

def remote_setup
remote_run "cd #{path} && #{@sudo}git clone --depth 1 #{repository} #{application} && cd #{directory} #{checkout}#{bundle} && #{@sudo}rake inploy:local:setup environment=#{environment}#{skip_steps_cmd}"
remote_run "cd #{path} && #{@sudo}git clone --depth 1 #{repository} #{application} && cd #{application_folder} #{checkout}#{bundle} && #{@sudo}rake inploy:local:setup environment=#{environment}#{skip_steps_cmd}"
end

def local_setup
Expand Down Expand Up @@ -72,10 +72,6 @@ def update_code

private

def directory
app_folder.nil? ? application : "#{application}/#{app_folder}"
end

def checkout
branch.eql?("master") ? "" : "&& $(git branch | grep -vq #{branch}) && git checkout -f -b #{branch} origin/#{branch}"
end
Expand Down
6 changes: 5 additions & 1 deletion lib/inploy/helper.rb
Expand Up @@ -33,7 +33,11 @@ def camelize(string)
end

def application_path
"#{path}/#{application}"
app_folder.nil? ? "#{path}/#{application}" : "#{path}/#{application}/#{app_folder}"
end

def application_folder
app_folder.nil? ? application : "#{application}/#{app_folder}"
end

def copy_sample_files
Expand Down
12 changes: 12 additions & 0 deletions spec/deploy_spec.rb
Expand Up @@ -141,6 +141,12 @@ def setup(subject)
subject.remote_update
end

it "should exec the commands in the app_folder" do
subject.app_folder = 'project'
expect_command "ssh #{@ssh_opts} #{@user}@#{@host} 'cd #{@path}/#{@application}/#{subject.app_folder} && rake inploy:local:update environment=#{@environment}'"
subject.remote_update
end

end

context "on local update" do
Expand All @@ -166,6 +172,12 @@ def setup(subject)
expect_command "ssh #{@ssh_opts} #{@user}@#{@host} 'cd #{@path}/#{@application} && rake #{task} RAILS_ENV=#{@environment}'"
subject.remote_rake task
end
it "should execute the rake task in app_folder" do
subject.app_folder = 'project'
task = 'build'
expect_command "ssh #{@ssh_opts} #{@user}@#{@host} 'cd #{@path}/#{@application}/#{subject.app_folder} && rake #{task} RAILS_ENV=#{@environment}'"
subject.remote_rake task
end
end
end

Expand Down

0 comments on commit a1f7d42

Please sign in to comment.