Sfoglia il codice sorgente

Ensure resume is regenerated on recompilation

theenglishway (time) 2 anni fa
parent
commit
efa70350fa

+ 9 - 0
lib/regenerate_on_compilation.ex

@@ -0,0 +1,9 @@
+defmodule CvGen.RegenerateOnCompilation do
+  defmacro __using__([]) do
+    quote do
+      @after_compile __MODULE__
+
+      def __after_compile__(_env, _bytecode), do: CvGen.generate()
+    end
+  end
+end

+ 1 - 0
lib/views/basics.ex

@@ -1,5 +1,6 @@
 defmodule CvGenView.Basics do
   use Phoenix.Component
+  use CvGen.RegenerateOnCompilation
   alias CvGenView.Text
 
   attr(:name, :string, required: true)

+ 1 - 0
lib/views/date.ex

@@ -1,5 +1,6 @@
 defmodule CvGenView.Date do
   use Phoenix.Component
+  use CvGen.RegenerateOnCompilation
 
   attr(:start_date, :string, required: true)
   attr(:end_date, :string, default: nil)

+ 2 - 1
lib/views/education.ex

@@ -1,5 +1,6 @@
 defmodule CvGenView.Education do
   use Phoenix.Component
+  use CvGen.RegenerateOnCompilation
   alias CvGenView.{Text, Date}
 
   attr(:institution, :string, required: true)
@@ -15,7 +16,7 @@ defmodule CvGenView.Education do
       <div class="box">
         <h1><%= @institution %></h1>
         <h2><%= @area %></h2>
-        <Text.text text={@summary}/>
+        <Text.text text={@summary} />
       </div>
     </div>
     """

+ 1 - 0
lib/views/language.ex

@@ -1,5 +1,6 @@
 defmodule CvGenView.Language do
   use Phoenix.Component
+  use CvGen.RegenerateOnCompilation
 
   attr(:lang, :map)
 

+ 2 - 0
lib/views/layout.ex

@@ -1,4 +1,6 @@
 defmodule CvGenView.Layout do
+  use CvGen.RegenerateOnCompilation
+
   def resets(),
     do: """
     @charset "utf-8";

+ 1 - 0
lib/views/skill.ex

@@ -1,5 +1,6 @@
 defmodule CvGenView.Skill do
   use Phoenix.Component
+  use CvGen.RegenerateOnCompilation
 
   attr(:skill, :map)
 

+ 1 - 0
lib/views/text.ex

@@ -1,5 +1,6 @@
 defmodule CvGenView.Text do
   use Phoenix.Component
+  use CvGen.RegenerateOnCompilation
 
   attr(:text, :any, required: true)
   attr(:rest, :global)

+ 1 - 0
lib/views/work.ex

@@ -1,5 +1,6 @@
 defmodule CvGenView.Work do
   use Phoenix.Component
+  use CvGen.RegenerateOnCompilation
   alias CvGenView.{Date, Text}
 
   attr(:name, :string, required: true)