Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kudrykv committed Nov 8, 2024
1 parent 31aabe9 commit f112d8d
Show file tree
Hide file tree
Showing 25 changed files with 226 additions and 206 deletions.
2 changes: 1 addition & 1 deletion lib/latex_yearly_planner/cli/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.exit_on_failure?
default: './out'

def generate(path_to_yaml_file)
HighLevel::Planner::Generate.call(path_to_yaml_file:, **options)
HighLevel::Generate.call(path_to_yaml_file:, **options)

puts 'Generated'
end
Expand Down
13 changes: 0 additions & 13 deletions lib/latex_yearly_planner/high_level/create_planner.rb

This file was deleted.

17 changes: 17 additions & 0 deletions lib/latex_yearly_planner/high_level/generate.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
class Generate < Actor
play Plays::InitializePlannerConfig,
Plays::InitializeI18n,
Plays::InitializeSectioner,
Plays::InitializeIndexer,
Plays::InitializeGenerator,
Plays::InitializeTextDocumentsWriter,
Plays::InitializeCompiler,
Plays::InitializePlanner,
Plays::CreatePlanner
end
end
end
15 changes: 0 additions & 15 deletions lib/latex_yearly_planner/high_level/initialize_compiler.rb

This file was deleted.

15 changes: 0 additions & 15 deletions lib/latex_yearly_planner/high_level/initialize_generator.rb

This file was deleted.

27 changes: 0 additions & 27 deletions lib/latex_yearly_planner/high_level/initialize_html_compiler.rb

This file was deleted.

21 changes: 0 additions & 21 deletions lib/latex_yearly_planner/high_level/initialize_html_indexer.rb

This file was deleted.

15 changes: 0 additions & 15 deletions lib/latex_yearly_planner/high_level/initialize_i18n.rb

This file was deleted.

14 changes: 0 additions & 14 deletions lib/latex_yearly_planner/high_level/initialize_indexer.rb

This file was deleted.

18 changes: 0 additions & 18 deletions lib/latex_yearly_planner/high_level/initialize_planner.rb

This file was deleted.

20 changes: 0 additions & 20 deletions lib/latex_yearly_planner/high_level/initialize_planner_config.rb

This file was deleted.

14 changes: 0 additions & 14 deletions lib/latex_yearly_planner/high_level/initialize_sectioner.rb

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions lib/latex_yearly_planner/high_level/planner/generate.rb

This file was deleted.

15 changes: 15 additions & 0 deletions lib/latex_yearly_planner/high_level/plays/create_planner.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
module Plays
class CreatePlanner < Actor
input :planner, allow_nil: false

def call
planner.create
end
end
end
end
end
17 changes: 17 additions & 0 deletions lib/latex_yearly_planner/high_level/plays/initialize_compiler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
module Plays
class InitializeCompiler < Actor
input :workdir, allow_nil: false
input :planner_config, allow_nil: false
output :compiler

def call
self.compiler = Adapters::TypstCompiler.new(workdir:, planner_config:)
end
end
end
end
end
17 changes: 17 additions & 0 deletions lib/latex_yearly_planner/high_level/plays/initialize_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
module Plays
class InitializeGenerator < Actor
input :indexer, allow_nil: false
input :sectioner, allow_nil: false
output :generator

def call
self.generator = Core::Generator.new(indexer:, sectioner:)
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
module Plays
class InitializeHtmlCompiler
include Interactor

def call
context.html_compiler = Adapters::HtmlCompiler.new(workdir:, planner_config:)
end

private

def workdir
raise DevelopmentError, 'workdir is not defined' unless context.workdir

context.workdir
end

def planner_config
raise DevelopmentError, 'planner_config is not defined' unless context.planner_config

context.planner_config
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
module Plays
class InitializeHtmlIndexer
include Interactor

def call
context.html_indexer = Adapters::HtmlIndexer.new(planner_config:)
end

private

def planner_config
raise DevelopmentError, '`planner_config` is not defined' unless context.planner_config

context.planner_config
end
end
end
end
end
17 changes: 17 additions & 0 deletions lib/latex_yearly_planner/high_level/plays/initialize_i18n.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
module Plays
class InitializeI18n < Actor
input :planner_config, allow_nil: false
input :locales_file_pattern, allow_nil: false

def call
I18n.load_path = Dir[locales_file_pattern]
I18n.locale = planner_config.locale
end
end
end
end
end
16 changes: 16 additions & 0 deletions lib/latex_yearly_planner/high_level/plays/initialize_indexer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

module LatexYearlyPlanner
module HighLevel
module Plays
class InitializeIndexer < Actor
input :planner_config, allow_nil: false
output :indexer

def call
self.indexer = Adapters::TypstIndexer.new(planner_config:)
end
end
end
end
end
Loading

0 comments on commit f112d8d

Please sign in to comment.