lib/hem/tasks/magento.rb in hem-1.0.1.beta1 vs lib/hem/tasks/magento.rb in hem-1.0.1.beta2
- old
+ new
@@ -1,10 +1,10 @@
namespace :tools do
desc "Fetches the n98-magerun utility"
task :n98magerun do
FileUtils.mkdir_p "bin"
- vm_shell '"wget" --no-check-certificate "https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar" -O bin/n98-magerun.phar'
+ run_command '"wget" --no-check-certificate "https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar" -O bin/n98-magerun.phar'
FileUtils.chmod 0755, "bin/n98-magerun.phar"
end
end
desc "Magento related tasks"
@@ -44,11 +44,11 @@
if Hem.project_config[:magento_edition].nil?
magento_edition = nil
if magento_version_file
args = [ "php -r \"require '#{magento_version_file}'; echo Mage::getEdition();\""]
- magento_edition = vm_shell(*args, :capture => true).to_s.downcase
+ magento_edition = run_command(*args, :capture => true).to_s.downcase
end
edition_options = ['community', 'enterprise', 'professional', 'go']
unless edition_options.include? magento_edition
@@ -62,11 +62,11 @@
if Hem.project_config[:magento_version].nil?
magento_version = nil
if magento_version_file
args = [ "php -r \"require '#{magento_version_file}'; echo Mage::getVersion();\""]
- magento_version = vm_shell(*args, :capture => true)
+ magento_version = run_command(*args, :capture => true)
end
version_regex = /^\d+(\.\d+){3}$/
unless version_regex.match(magento_version)
@@ -93,11 +93,11 @@
status = shell(tools_command, :exit_status => true)
use_vm = status != 0
end
if use_vm
- status = vm_shell(tools_command, :exit_status => true)
+ status = run_command(tools_command, :exit_status => true)
end
if status != 0
raise Hem::UserError.new "Please make sure '#{tools.join(',')}' is installed on your host or VM before continuing"
end
@@ -181,11 +181,11 @@
if /\.sh$/.match(file)
File.rename file, "#{magento_path}/#{filename}"
file = "#{magento_path}/#{filename}"
if use_vm
- vm_shell "cd #{magento_path} && sh #{filename}", :realtime => true, :indent => 2
+ run_command "cd #{magento_path} && sh #{filename}", :realtime => true, :indent => 2
else
shell "cd #{magento_path} && sh #{filename}", :realtime => true, :indent => 2
end
else
shell "git apply --directory #{magento_path} #{file}"
@@ -211,34 +211,34 @@
desc "Setup script tasks"
namespace :'setup-scripts' do
desc "Run magento setup scripts"
task :run => ['tools:n98magerun'] do
Hem.ui.success "Running setup scripts"
- vm_shell("bin/n98-magerun.phar cache:clean config", :realtime => true, :indent => 2)
- vm_shell("bin/n98-magerun.phar sys:setup:incremental -n", :realtime => true, :indent => 2)
+ run_command("bin/n98-magerun.phar cache:clean config", :realtime => true, :indent => 2)
+ run_command("bin/n98-magerun.phar sys:setup:incremental -n", :realtime => true, :indent => 2)
Hem.ui.separator
end
end
desc "Cache tasks"
namespace :cache do
desc "Clear cache"
task :clear => ['tools:n98magerun'] do
Hem.ui.success "Clearing magento cache"
- vm_shell("bin/n98-magerun.phar cache:flush", :realtime => true, :indent => 2)
+ run_command("bin/n98-magerun.phar cache:flush", :realtime => true, :indent => 2)
Hem.ui.separator
end
end
desc "Configuration related tasks"
namespace :config do
desc "Configure magento base URLs"
task :'configure-urls' => ['tools:n98magerun'] do
Hem.ui.success "Configuring magento base urls"
domain = Hem.project_config.hostname
- vm_shell("bin/n98-magerun.phar config:set web/unsecure/base_url 'http://#{domain}/'", :realtime => true, :indent => 2)
- vm_shell("bin/n98-magerun.phar config:set web/secure/base_url 'https://#{domain}/'", :realtime => true, :indent => 2)
+ run_command("bin/n98-magerun.phar config:set web/unsecure/base_url 'http://#{domain}/'", :realtime => true, :indent => 2)
+ run_command("bin/n98-magerun.phar config:set web/secure/base_url 'https://#{domain}/'", :realtime => true, :indent => 2)
Hem.ui.separator
end
desc "Enable magento errors"
task :'enable-errors' do
@@ -250,21 +250,21 @@
) unless File.exists? error_config
end
desc "Create admin user"
task :'create-admin-user' do
- initialized = vm_shell("bin/n98-magerun.phar admin:user:list | grep admin", :exit_status => true) == 0
+ initialized = run_command("bin/n98-magerun.phar admin:user:list | grep admin", :exit_status => true) == 0
unless initialized
Hem.ui.success "Creating admin user"
- vm_shell("bin/n98-magerun.phar admin:user:create admin '' admin admin admin", :realtime => true, :indent => 2)
+ run_command("bin/n98-magerun.phar admin:user:create admin '' admin admin admin", :realtime => true, :indent => 2)
Hem.ui.separator
end
end
desc "Enable rewrites"
task :'enable-rewrites' do
Hem.ui.success "Enabling rewrites"
- vm_shell("bin/n98-magerun.phar config:set web/seo/use_rewrites 1", :realtime => true, :indent => 2)
+ run_command("bin/n98-magerun.phar config:set web/seo/use_rewrites 1", :realtime => true, :indent => 2)
Hem.ui.separator
end
end
desc "Initializes magento specifics on the virtual machine after a fresh build"