Skip to content

Commit

Permalink
Clarify the usage of Shell::Helpers.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Apr 28, 2012
1 parent 905f0b3 commit 4fba900
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
12 changes: 6 additions & 6 deletions lib/engineyard-serverside/deploy.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def check_for_ey_config
if gemfile? && lockfile if gemfile? && lockfile
configured_services = parse_configured_services configured_services = parse_configured_services
if !configured_services.empty? && !lockfile.has_ey_config? if !configured_services.empty? && !lockfile.has_ey_config?
warning "Gemfile.lock does not contain ey_config. Add it to get EY::Config access to: #{configured_services.keys.join(', ')}." shell.warning "Gemfile.lock does not contain ey_config. Add it to get EY::Config access to: #{configured_services.keys.join(', ')}."
end end
end end
end end
Expand All @@ -89,7 +89,7 @@ def check_repository
if lockfile if lockfile
shell.status "Gemfile.lock found." shell.status "Gemfile.lock found."
unless lockfile.any_database_adapter? unless lockfile.any_database_adapter?
warning <<-WARN shell.warning <<-WARN
Gemfile.lock does not contain a recognized database adapter. Gemfile.lock does not contain a recognized database adapter.
A database-adapter gem such as mysql2, mysql, or do_mysql was expected. A database-adapter gem such as mysql2, mysql, or do_mysql was expected.
This can prevent applications that use MySQL or PostreSQL from booting. This can prevent applications that use MySQL or PostreSQL from booting.
Expand All @@ -99,7 +99,7 @@ def check_repository
WARN WARN
end end
else else
warning <<-WARN shell.warning <<-WARN
Gemfile.lock is missing! Gemfile.lock is missing!
You can get different versions of gems in production than what you tested with. You can get different versions of gems in production than what you tested with.
You can get different versions of gems on every deployment even if your Gemfile hasn't changed. You can get different versions of gems on every deployment even if your Gemfile hasn't changed.
Expand Down Expand Up @@ -319,13 +319,13 @@ def setup_services
begin begin
sudo(services_command_check) sudo(services_command_check)
rescue StandardError => e rescue StandardError => e
info "Could not setup services. Upgrade your environment to get services configuration." shell.info "Could not setup services. Upgrade your environment to get services configuration."
return return
end end
sudo(services_setup_command) sudo(services_setup_command)
rescue StandardError => e rescue StandardError => e
unless previously_configured_services.empty? unless previously_configured_services.empty?
warning <<-WARNING shell.warning <<-WARNING
External services configuration not updated. Using previous version. External services configuration not updated. Using previous version.
Deploy again if your services configuration appears incomplete or out of date. Deploy again if your services configuration appears incomplete or out of date.
#{e} #{e}
Expand Down Expand Up @@ -549,7 +549,7 @@ def write_system_version


def check_node_npm def check_node_npm
if File.exist?("#{c.release_path}/package.json") if File.exist?("#{c.release_path}/package.json")
info "~> package.json detected, installing npm packages" shell.info "~> package.json detected, installing npm packages"
run "cd #{c.release_path} && npm install" run "cd #{c.release_path} && npm install"
end end
end end
Expand Down
2 changes: 1 addition & 1 deletion lib/engineyard-serverside/rails_asset_support.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def compile_assets
if rails_version if rails_version
shell.status "Precompiling assets for rails v#{rails_version}" shell.status "Precompiling assets for rails v#{rails_version}"
else else
warning "Precompiling assets even though Rails was not bundled." shell.warning "Precompiling assets even though Rails was not bundled."
end end
run(cmd) run(cmd)
end end
Expand Down
2 changes: 0 additions & 2 deletions lib/engineyard-serverside/task.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
module EY module EY
module Serverside module Serverside
class Task class Task
include EY::Serverside::Shell::Helpers

attr_reader :config, :shell attr_reader :config, :shell
alias :c :config alias :c :config


Expand Down
8 changes: 8 additions & 0 deletions spec/deploy_hook_spec.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ def where_code_runs_with(code)
it "#current_role returns the first role" do it "#current_role returns the first role" do
deploy_hook(:current_roles => %w(a b)).eval_hook('current_role').should == 'a' deploy_hook(:current_roles => %w(a b)).eval_hook('current_role').should == 'a'
end end

it "has info, warning, debug, logged_system, and access to shell" do
deploy_hook.eval_hook('respond_to?(:info) ').should be_true
deploy_hook.eval_hook('respond_to?(:warning) ').should be_true
deploy_hook.eval_hook('respond_to?(:debug) ').should be_true
deploy_hook.eval_hook('respond_to?(:logged_system)').should be_true
deploy_hook.eval_hook('respond_to?(:shell) ').should be_true
end
end end
end end
end end

0 comments on commit 4fba900

Please sign in to comment.