-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize Action (into qualified subdir)
- Loading branch information
Showing
23 changed files
with
144 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
let init_message (module R : Sigs.RESOLVER) = | ||
Yocaml.Eff.logf ~level:`Debug "ring.muhokama [source: `%a`, target: `%a`]" | ||
Yocaml.Path.pp R.source Yocaml.Path.pp R.target | ||
|
||
let final_message _cache = Yocaml.Eff.log ~level:`Debug "ring.muhokama done" | ||
|
||
let run (module R : Sigs.RESOLVER) () = | ||
let open Yocaml.Eff in | ||
let* () = init_message (module R) in | ||
let* cache, chain = Init.run (module R) in | ||
return cache | ||
>>= Cname.run (module R) | ||
>>= Fonts.run (module R) | ||
>>= Css.run (module R) | ||
>>= Images.run (module R) | ||
>>= Opml.run (module R) chain | ||
>>= Chain.run (module R) chain | ||
>>= Index.run (module R) chain | ||
>>= Yocaml.Action.store_cache R.Target.cache | ||
>>= final_message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** The global process that executes all actions sequentially. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> unit -> unit Yocaml.Eff.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let has_extension ext_list path = | ||
List.exists (fun ext -> Yocaml.Path.has_extension ext path) ext_list | ||
|
||
let run ?extension ~source ~target cache = | ||
let where = Option.map (fun ext -> has_extension ext) extension in | ||
Yocaml.Action.batch ~only:`Files ?where source | ||
(Yocaml.Action.copy_file ~into:target) | ||
cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(** An action that initiates the copying of files from a source directory to a | ||
target directory. *) | ||
|
||
val run : | ||
?extension:string list -> | ||
source:Yocaml.Path.t -> | ||
target:Yocaml.Path.t -> | ||
Yocaml.Action.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
let member (module R : Sigs.RESOLVER) pred_or_succ current_member target_member | ||
= | ||
let target = | ||
R.Target.member_redirection | ||
~id:(Model.Member.id current_member) | ||
pred_or_succ | ||
in | ||
Yocaml.Action.write_static_file target | ||
(let open Yocaml.Task in | ||
R.track_common_dependencies | ||
>>> const target_member | ||
>>> empty_body () | ||
>>> Yocaml_jingoo.Pipeline.as_template | ||
(module Model.Member) | ||
(R.Source.template "redirect.html") | ||
>>> drop_first ()) | ||
|
||
let run (module R : Sigs.RESOLVER) chain = | ||
let member = member (module R) in | ||
Yocaml.Action.batch_list (Model.Chain.to_list chain) | ||
(fun (curr, (pred, succ)) cache -> | ||
let open Yocaml.Eff in | ||
cache |> member `Pred curr pred >>= member `Succ curr succ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that builds the chain of links for each member. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Model.Chain.t -> Yocaml.Action.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let run (module R : Sigs.RESOLVER) = | ||
Yocaml.Action.copy_file ~into:R.Target.root R.Source.cname |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that copies the CNAME of the existing webring. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Yocaml.Action.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let run (module R : Sigs.RESOLVER) = | ||
Batch_copy.run ~extension:[ "css" ] ~source:R.Source.css ~target:R.Target.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that copies all the CSS files from the source to the target. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Yocaml.Action.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let run (module R : Sigs.RESOLVER) = | ||
Batch_copy.run ~extension:[ "woff2" ] ~source:R.Source.fonts | ||
~target:R.Target.fonts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that copies all the font files from the source to the target. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Yocaml.Action.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let run (module R : Sigs.RESOLVER) cache = | ||
(* We pass [cache] in order to add more rules. *) | ||
cache | ||
|> Batch_copy.run ~extension:[ "svg"; "png" ] ~source:R.Source.static_images | ||
~target:R.Target.images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that copies all the images files from the source to the target. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Yocaml.Action.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
let run (module R : Sigs.RESOLVER) _chain = | ||
Yocaml.Action.write_static_file R.Target.index | ||
(let open Yocaml.Task in | ||
R.track_common_dependencies | ||
>>> Yocaml.Pipeline.track_file R.Source.members | ||
>>> Yocaml_yaml.Pipeline.read_file_with_metadata | ||
(module Model.Page) | ||
R.Source.index | ||
>>> Yocaml_omd.content_to_html () | ||
>>> Yocaml_jingoo.Pipeline.as_template | ||
(module Model.Page) | ||
(R.Source.template "layout.html") | ||
>>> drop_first ()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that builds the webring index. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Model.Chain.t -> Yocaml.Action.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
let run (module R : Sigs.RESOLVER) = | ||
let open Yocaml.Eff in | ||
let* cache = Yocaml.Action.restore_cache ~on:`Target R.Target.cache in | ||
let* chain = | ||
Yocaml_yaml.Eff.read_file_as_metadata | ||
(module Model.Chain.Metadata) | ||
~on:`Source R.Source.chain | ||
in | ||
let+ cache, members = | ||
Yocaml.Action.fold ~only:`Files | ||
~where:(Yocaml.Path.has_extension "yml") | ||
~state:[] R.Source.members | ||
(fun path state cache -> | ||
let+ member = | ||
Yocaml_yaml.Eff.read_file_as_metadata | ||
(module Model.Member) | ||
~on:`Source path | ||
in | ||
(cache, member :: state)) | ||
cache | ||
in | ||
(cache, Model.Chain.init ~chain ~members) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(** An action (not in the Yocaml sense) which initializes the cache and builds | ||
the chain. *) | ||
|
||
val run : | ||
(module Sigs.RESOLVER) -> (Yocaml.Cache.t * Model.Chain.t) Yocaml.Eff.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let run (module R : Sigs.RESOLVER) chain = | ||
Yocaml.Action.write_static_file R.Target.ring_opml | ||
(let open Yocaml.Task in | ||
R.track_common_dependencies | ||
>>> Yocaml.Pipeline.track_file R.Source.members | ||
>>> const chain | ||
>>> Model.Chain.to_opml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that builds the OPML file for the rss/atom feeds of ring members. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Model.Chain.t -> Yocaml.Action.t |