diff --git a/bin/ring.ml b/bin/ring.ml index 1017674..7aeabe7 100644 --- a/bin/ring.ml +++ b/bin/ring.ml @@ -5,22 +5,4 @@ module Resolver = Gem.Resolver.Make (struct let target = Path.rel [ "_www" ] end) -let final_message _cache = Eff.log ~level:`Debug "ring.muhokama done" - -let generate_opml chain = - Action.write_static_file Resolver.Target.ring_opml - (let open Task in - Pipeline.track_files - (Resolver.Source.members :: Resolver.Source.common_deps) - >>> const chain - >>> Gem.Chain.to_opml) - -let process_all () = - let open Eff in - let* cache, chain = Gem.Action.init_chain (module Resolver) in - return cache - >>= generate_opml chain - >>= Action.store_cache Resolver.Target.cache - >>= final_message - -let () = Yocaml_eio.run ~level:`Debug process_all +let () = Yocaml_eio.run ~level:`Debug (Gem.Action.process_all (module Resolver)) diff --git a/lib/action.ml b/lib/action.ml index 0d17fe1..74be0fa 100644 --- a/lib/action.ml +++ b/lib/action.ml @@ -20,3 +20,20 @@ let init_chain (module R : Sigs.RESOLVER) = cache in (cache, Chain.init ~chain ~members) + +let final_message _cache = Yocaml.Eff.log ~level:`Debug "ring.muhokama done" + +let generate_opml (module R : Sigs.RESOLVER) chain = + Yocaml.Action.write_static_file R.Target.ring_opml + (let open Yocaml.Task in + Yocaml.Pipeline.track_files (R.Source.members :: R.Source.common_deps) + >>> const chain + >>> Chain.to_opml) + +let process_all (module R : Sigs.RESOLVER) () = + let open Yocaml.Eff in + let* cache, chain = init_chain (module R) in + return cache + >>= generate_opml (module R) chain + >>= Yocaml.Action.store_cache R.Target.cache + >>= final_message diff --git a/lib/action.mli b/lib/action.mli new file mode 100644 index 0000000..d36b3ba --- /dev/null +++ b/lib/action.mli @@ -0,0 +1,4 @@ +(** All the actions used to build the ring. *) + +val process_all : (module Sigs.RESOLVER) -> unit -> unit Yocaml.Eff.t +(** Process all action in order to produce [ring.muhokama]. *)