Skip to content

Instantly share code, notes, and snippets.

@firecentaur
Created March 21, 2018 08:04
Show Gist options
  • Save firecentaur/2a69d2918051246922834260f069283c to your computer and use it in GitHub Desktop.
Save firecentaur/2a69d2918051246922834260f069283c to your computer and use it in GitHub Desktop.
node[:deploy].each do |application, deploy|
backendLocation = application.sub('frontend','backend');
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/#{backendLocation}/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/#{backendLocation}/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/#{backendLocation}/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/#{backendLocation}/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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment