-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtasks.rb
44 lines (40 loc) · 1.64 KB
/
tasks.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
set :npm_bin, 'npm'
set :bower_bin, 'bower'
set :grunt_bin, 'grunt'
set :npm_options, '--production'
set :bower_options, '--allow-root'
set :grunt_options, ''
set :grunt_task, 'build'
namespace :npm do
desc 'Install node modules using Npm.'
task install: :environment do
command %{
echo "-----> Installing node modules using Npm"
sub_directory=$(pwd | sed -r "s/.*?$(basename $build_path)//g")
#{echo_cmd %[mkdir -p "#{fetch(:deploy_to)}/#{fetch(:shared_path)}/$sub_directory/node_modules"]}
#{echo_cmd %[ln -s "#{fetch(:deploy_to)}/#{fetch(:shared_path)}/$sub_directory/node_modules" "node_modules"]}
#{echo_cmd %[#{fetch(:npm_bin)} install #{fetch(:npm_options)}]}
}
end
end
namespace :bower do
desc "Install bower modules."
task install: :environment do
command %{
echo "-----> Installing bower modules"
sub_directory=$(pwd | sed -r "s/.*?$(basename $build_path)//g")
#{echo_cmd %[mkdir -p "#{fetch(:deploy_to)}/#{fetch(:shared_path)}/$sub_directory/bower_components"]}
#{echo_cmd %[ln -s "#{fetch(:deploy_to)}/#{fetch(:shared_path)}/$sub_directory/bower_components" "bower_components"]}
#{echo_cmd %[[ -f bower.json ] && (#{fetch(:bower_bin)} install #{fetch(:bower_options)}) || ! [ -f bower.json ]]}
}
end
end
namespace :grunt do
desc "Launch a task with grunt. Set the grunt_task (defaults to \"build\") variable before calling this."
task task: :environment do
command %{
echo "-----> Launch a build with Grunt"
#{echo_cmd %[[ -f Gruntfile.js ] && (#{fetch(:grunt_bin)} #{fetch(:grunt_task)} #{fetch(:grunt_options)}) || ! [ -f Gruntfile.js ]]}
}
end
end