Run i18n:js:export rake task on web site updates
authorTom Hughes <tom@compton.nu>
Tue, 28 Aug 2018 17:12:34 +0000 (18:12 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 28 Aug 2018 17:12:34 +0000 (18:12 +0100)
cookbooks/web/resources/rails_port.rb

index 778d24f..17dfe64 100644 (file)
@@ -125,7 +125,7 @@ action :create do
     user new_resource.user
     group new_resource.group
     notifies :run, "execute[#{rails_directory}/Gemfile]"
-    notifies :run, "execute[#{rails_directory}/public/assets]"
+    notifies :run, "execute[#{rails_directory}/app/assets/javascripts/i18n]"
     notifies :delete, "file[#{rails_directory}/public/export/embed.html]"
     notifies :restart, "passenger_application[#{rails_directory}]"
   end
@@ -320,6 +320,16 @@ action :create do
     only_if { new_resource.run_migrations }
   end
 
+  execute "#{rails_directory}/app/assets/javascripts/i18n" do
+    action :nothing
+    command "bundle#{new_resource.ruby} exec rake i18n:js:export"
+    environment "RAILS_ENV" => "production"
+    cwd rails_directory
+    user new_resource.user
+    group new_resource.group
+    notifies :run, "execute[#{rails_directory}/public/assets]"
+  end
+
   execute "#{rails_directory}/public/assets" do
     action :nothing
     command "bundle#{new_resource.ruby} exec rake assets:precompile"