Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
rename heroku-direct to heroku-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrainard committed Apr 12, 2012
1 parent 90e27c7 commit 2ad1ae6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion init.rb
@@ -1 +1 @@
require "heroku/command/direct"
require "heroku/command/deploy"
10 changes: 5 additions & 5 deletions lib/heroku/command/direct.rb → lib/heroku/command/deploy.rb
Expand Up @@ -4,7 +4,7 @@

# deploy to an app
#
class Heroku::Command::Direct < Heroku::Command::BaseWithApp
class Heroku::Command::Deploy < Heroku::Command::BaseWithApp
VERSION = "0.1"
DEFAULT_HOST = "direct-to.herokuapp.com"
MAX_UPLOAD_SIZE_MB = 100
Expand All @@ -17,19 +17,19 @@ class Heroku::Command::Direct < Heroku::Command::BaseWithApp
RESPONSE_KEY_MESSAGE = 'message'
RESPONSE_KEY_RELEASE = 'release'

# direct
# deploy
#
# deploy to an app
#
def index
display "Usage: heroku direct:war"
display "Usage: heroku deploy:war"
end

# direct:war
# deploy:war
#
# deploy a war file to an app
#
# -w, --war WARFILE # war to push
# -w, --war WARFILE # war to deploy
#
def war
war = extract_option("--war")
Expand Down
@@ -1,6 +1,6 @@
require "spec_helper"

describe Heroku::Command::Direct do
describe Heroku::Command::Deploy do

before(:all) do
@app_name = ENV['HEROKU_TEST_APP_NAME']
Expand All @@ -18,18 +18,18 @@
context "when command options are are initialized" do
#noinspection RubyArgCount
#noinspection RubyWrongHash
let (:options) { Heroku::Command.commands['direct:war'][:options] }
let (:options) { Heroku::Command.commands['deploy:war'][:options] }

it { options.has_key?("war").should be_true }
end

context "when a war file and valid app is specified" do
#noinspection RubyArgCount
let(:direct) { Heroku::Command::Direct.new [], :app => @app_name, :war => @real_war.path }
let(:deploy) { Heroku::Command::Deploy.new [], :app => @app_name, :war => @real_war.path }

context "and everything is peachy" do
it "the war should be deployed" do
direct.war.should eql "success"
deploy.war.should eql "success"
end

it "the result should be visible in browser" do
Expand All @@ -39,66 +39,66 @@

context "when heroku credentials are invalid" do
before do
direct.stub(:api_key).and_return "something_invalid"
deploy.stub(:api_key).and_return "something_invalid"
end

it "an error should be raised" do
lambda { direct.war }.should raise_error(Heroku::Command::CommandFailed, /Unable to get user info/)
lambda { deploy.war }.should raise_error(Heroku::Command::CommandFailed, /Unable to get user info/)
end
end
end

context "when a war file is huge" do
#noinspection RubyArgCount
let(:direct) { Heroku::Command::Direct.new [], :app => @app_name, :war => @huge_war.path }
let(:deploy) { Heroku::Command::Deploy.new [], :app => @app_name, :war => @huge_war.path }

it "the war should be deployed" do
direct.war.should eql "success"
deploy.war.should eql "success"
end
end

context "when a war file is too huge" do
#noinspection RubyArgCount
let(:direct) { Heroku::Command::Direct.new [], :app => @app_name, :war => @too_huge_war.path }
let(:deploy) { Heroku::Command::Deploy.new [], :app => @app_name, :war => @too_huge_war.path }

it "an error should be raised" do
lambda { direct.war }.should raise_error(Heroku::Command::CommandFailed, "War file must not exceed 100 MB")
lambda { deploy.war }.should raise_error(Heroku::Command::CommandFailed, "War file must not exceed 100 MB")
end
end

context "when a war file and app without access is specified" do
#noinspection RubyArgCount
let(:direct) { Heroku::Command::Direct.new [], :app => "an-app-i-do-not-own", :war => @real_war.path }
let(:deploy) { Heroku::Command::Deploy.new [], :app => "an-app-i-do-not-own", :war => @real_war.path }

it "an error should be raised" do
lambda { direct.war }.should raise_error(Heroku::Command::CommandFailed, "No access to this app")
lambda { deploy.war }.should raise_error(Heroku::Command::CommandFailed, "No access to this app")
end
end

context "when no war file is specified" do
#noinspection RubyArgCount
let(:direct) { Heroku::Command::Direct.new [], :app => @app_name }
let(:deploy) { Heroku::Command::Deploy.new [], :app => @app_name }

it "an error should be raised" do
lambda { direct.war }.should raise_error(Heroku::Command::CommandFailed, "No .war specified.\nSpecify which war to use with --war <war file name>")
lambda { deploy.war }.should raise_error(Heroku::Command::CommandFailed, "No .war specified.\nSpecify which war to use with --war <war file name>")
end
end

context "when a war file without a .war extension is specified" do
#noinspection RubyArgCount
let(:direct) { Heroku::Command::Direct.new [], :app => @app_name, :war => "something.notwar" }
let(:deploy) { Heroku::Command::Deploy.new [], :app => @app_name, :war => "something.notwar" }

it "an error should be raised" do
lambda { direct.war }.should raise_error(Heroku::Command::CommandFailed, "War file must have a .war extension")
lambda { deploy.war }.should raise_error(Heroku::Command::CommandFailed, "War file must have a .war extension")
end
end

context "when a war file is specified but can't be found'" do
#noinspection RubyArgCount
let(:direct) { Heroku::Command::Direct.new [], :app => @app_name, :war => "not_there.war" }
let(:deploy) { Heroku::Command::Deploy.new [], :app => @app_name, :war => "not_there.war" }

it "an error should be raised" do
lambda { direct.war }.should raise_error(Heroku::Command::CommandFailed, "War file not found")
lambda { deploy.war }.should raise_error(Heroku::Command::CommandFailed, "War file not found")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
@@ -1,4 +1,4 @@
require "heroku/cli"
require "heroku/command/direct"
require "heroku/command/deploy"
require "rspec"
require "tempfile"

0 comments on commit 2ad1ae6

Please sign in to comment.