diff --git a/.travis.yml b/.travis.yml index ea9f20e..8920d68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false bundler_args: "--without development" script: bundle exec rspec rvm: diff --git a/lib/git_deploy/configuration.rb b/lib/git_deploy/configuration.rb index 25940bc..e9f653d 100644 --- a/lib/git_deploy/configuration.rb +++ b/lib/git_deploy/configuration.rb @@ -9,7 +9,16 @@ module Configuration extend Forwardable def_delegator :remote_url, :host def_delegator :remote_url, :port, :remote_port - def_delegator :remote_url, :path, :deploy_to + + def deploy_to + @deploy_to ||= begin + if remote_url.path.start_with? '/~/' + remote_url.path[1..-1] + else + remote_url.path + end + end + end def remote_user @user ||= begin diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 5e46594..301609c 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -44,6 +44,15 @@ def stub_remote_url(url, remote = options[:remote]) its(:deploy_to) { should eq('/path/to/app') } end + context "scp-style with home" do + before { stub_remote_url 'git@example.com:~/path/to/app' } + + its(:host) { should eq('example.com') } + its(:remote_port) { should be_nil } + its(:remote_user) { should eq('git') } + its(:deploy_to) { should eq('~/path/to/app') } + end + context "pushurl only" do before { remote = options.fetch(:remote)