Interpret the app from the CWD

This commit is contained in:
Seth Vargo 2014-11-13 18:00:43 -05:00
parent 7e3de3951e
commit 9d1a43c766
2 changed files with 17 additions and 1 deletions

View File

@ -19,9 +19,12 @@ module VagrantPlugins
# Get the current branch
branch = git_branch(dir)
# Get the name of the app
app = config.app || interpret_app(dir)
# Check if we need to add the git remote
if !has_git_remote?(config.remote, dir)
add_heroku_git_remote(config.remote, config.app, dir)
add_heroku_git_remote(config.remote, app, dir)
end
# Push to Heroku
@ -45,6 +48,13 @@ module VagrantPlugins
end
end
# Interpret the name of the Heroku application from the given path.
# @param [String] path
# @return [String]
def interpret_app(path)
File.basename(path)
end
# The git directory for the given path.
# @param [String] path
# @return [String]

View File

@ -222,6 +222,12 @@ describe VagrantPlugins::HerokuPush::Push do
end
end
describe "#interpret_app" do
it "returns the basename of the directory" do
expect(subject.interpret_app("/foo/bar/blitz")).to eq("blitz")
end
end
describe "#heroku_git_url" do
it "returns the proper string" do
expect(subject.heroku_git_url("bacon"))