Skip to content

Instantly share code, notes, and snippets.

@firecentaur
Created March 21, 2018 04:05
Show Gist options
  • Save firecentaur/3f4693630cc4d50b55fa39ba9f491483 to your computer and use it in GitHub Desktop.
Save firecentaur/3f4693630cc4d50b55fa39ba9f491483 to your computer and use it in GitHub Desktop.
cookbook_file '/srv/www/{application}/current/master/gulpfile.js' do
source 'gulpfile.js'
owner 'ubuntu'
group 'ubuntu'
mode '0755'
action :create
end
#delete node_modules folder first
directory "/srv/www/{application}/current/master/node_modules" do
recursive true
action :delete
end
#delete bower_components folder first
directory "/srv/www/{application}/current/master/bower_components" do
recursive true
action :delete
end
execute 'extract_node_modules' do
command 'tar xzvf node_modules.tar.gz -C /srv/www/{application}/current/master'
cwd '/srv/www/data/'
end
#copy to node_modules videoLibraryBackend
execute 'extract_videolibrary_node_modules videoLibrary demo' do
command 'tar xvf videoLibraryNodeModules.tar -C /srv/www/{application}/current/protected/vendor/movieenglish/videoLibraryBackend/src/htdocs/app'
cwd '/srv/www/data/'
end
execute 'extract_videolibrary_bower_components videoLibrary' do
command 'tar xvf videoLibaryBowerComponents.tar -C /srv/www/{application}/current/protected/vendor/movieenglish/videoLibraryBackend/src/htdocs/app'
cwd '/srv/www/data/'
end
execute 'extract_bower_components to /master' do
command 'tar xzvf bower_components.tar.gz -C /srv/www/{application}/current/master/'
cwd '/srv/www/data/'
end
execute "webpack" do
command "./node_modules/webpack/bin/webpack.js"
cwd "/srv/www/{application}/current/protected/vendor/movieenglish/videoLibraryBackend/src/htdocs/app"
end
execute "copy bundle files" do
command "rsync -arv dist/* /srv/www/{application}/current/master/bower_components/videoLibrary/"
cwd "/srv/www/{application}/current/protected/vendor/movieenglish/videoLibraryBackend/src/htdocs/app"
end
execute "gulp" do
command "node --stack-size=32000 ./node_modules/gulp/bin/gulp --use-cache build"
cwd "/srv/www/{application}/current/master/"
end
@hieunba
Copy link

hieunba commented Mar 21, 2018

Put all between these:

node[:deploy].each do |application, deploy|
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment