Skip to content

Commit 6d4d48e

Browse files
committed
Spider - fix paths
The utility functions were previously moved to a dedicated Paths module. This caused a conflict with the documentation rebuild code, but it has now been resolved.
1 parent 4393c08 commit 6d4d48e

File tree

4 files changed

+86
-18
lines changed

4 files changed

+86
-18
lines changed

app/server/ruby/bin/qt-doc2.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
require_relative "../lib/sonicpi/lang/sound"
2626
require_relative "../lib/sonicpi/lang/minecraftpi"
2727
require_relative "../lib/sonicpi/lang/midi"
28+
require_relative '../paths'
2829
require 'active_support/inflector'
2930
require 'erb'
3031
require 'gettext'
3132
require "gettext/tools/xgettext"
3233

33-
3434
class QtDocs
3535
include SonicPi::Lang::Support::DocSystem
3636
include SonicPi::Util
@@ -72,9 +72,9 @@ def generate_docs
7272

7373
def generate_pot_file(interpolated_file_paths)
7474
puts 'Extracting the translatable text into pot file...'
75-
FileUtils.mkdir_p(interpolated_template_path) unless File.exist?(interpolated_template_path)
75+
FileUtils.mkdir_p(::SonicPi::Paths.interpolated_template_path) unless File.exist?(::SonicPi::Paths.interpolated_template_path)
7676
cwd = Dir.pwd
77-
Dir.chdir(generated_path)
77+
Dir.chdir(::SonicPi::Paths.generated_path)
7878
GetText::Tools::XGetText.run(
7979
*interpolated_file_paths,
8080
'-otest.pot'
@@ -98,7 +98,7 @@ def generate_toml_files
9898

9999
def sync_to_documentation_app
100100
puts 'Syncing the TOML files to the documentation web app...'
101-
FileUtils.cp_r(doc_toml_path, documentation_app_priv_path, remove_destination: true)
101+
FileUtils.cp_r(::SonicPi::Paths.doc_toml_path, ::SonicPi::Paths.documentation_app_priv_path, remove_destination: true)
102102
end
103103

104104
def synths
@@ -107,9 +107,9 @@ def synths
107107
end
108108
{
109109
items: items,
110-
template_path: synth_and_fx_template_path,
111-
interpolated_path: synths_interpolated_path,
112-
output_path: synths_toml_path,
110+
template_path: ::SonicPi::Paths.synth_and_fx_template_path,
111+
interpolated_path: ::SonicPi::Paths.synths_interpolated_path,
112+
output_path: ::SonicPi::Paths.synths_toml_path,
113113
klass: SonicPi::Synths::SynthInfo
114114
}
115115
end
@@ -120,29 +120,29 @@ def fx
120120
end
121121
{
122122
items: items,
123-
template_path: synth_and_fx_template_path,
124-
interpolated_path: fx_interpolated_path,
125-
output_path: fx_toml_path,
123+
template_path: ::SonicPi::Paths.synth_and_fx_template_path,
124+
interpolated_path: ::SonicPi::Paths.fx_interpolated_path,
125+
output_path: ::SonicPi::Paths.fx_toml_path,
126126
klass: SonicPi::Synths::FXInfo
127127
}
128128
end
129129

130130
def samples
131131
{
132132
items: SonicPi::Synths::SynthInfo.grouped_samples,
133-
template_path: samples_template_path,
134-
interpolated_path: samples_interpolated_path,
135-
output_path: samples_toml_path,
133+
template_path: ::SonicPi::Paths.samples_template_path,
134+
interpolated_path: ::SonicPi::Paths.samples_interpolated_path,
135+
output_path: ::SonicPi::Paths.samples_toml_path,
136136
data_object: SonicPi::Synths::StereoPlayer.new
137137
}
138138
end
139139

140140
def lang
141141
{
142142
items: @@docs,
143-
template_path: lang_template_path,
144-
interpolated_path: lang_interpolated_path,
145-
output_path: lang_toml_path
143+
template_path: ::SonicPi::Paths.lang_template_path,
144+
interpolated_path: ::SonicPi::Paths.lang_interpolated_path,
145+
output_path: ::SonicPi::Paths.lang_toml_path
146146
}
147147
end
148148
end

app/server/ruby/paths.rb

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ def self.doc_path
6161
File.absolute_path("#{etc_path}/doc")
6262
end
6363

64+
def self.generated_path
65+
File.absolute_path("#{doc_path}/generated")
66+
end
67+
6468
def self.cheatsheets_path
6569
File.absolute_path("#{doc_path}/cheatsheets")
6670
end
@@ -69,6 +73,70 @@ def self.tutorial_path
6973
File.absolute_path("#{doc_path}/tutorial")
7074
end
7175

76+
def self.doc_templates_path
77+
File.absolute_path("#{doc_path}/templates")
78+
end
79+
80+
def self.lang_template_path
81+
File.absolute_path("#{doc_templates_path}/lang.toml.erb")
82+
end
83+
84+
def self.synth_and_fx_template_path
85+
File.absolute_path("#{doc_templates_path}/synth_and_fx.toml.erb")
86+
end
87+
88+
def self.slides_template_path
89+
File.absolute_path("#{doc_templates_path}/slides.toml.erb")
90+
end
91+
92+
def self.samples_template_path
93+
File.absolute_path("#{doc_templates_path}/samples.toml.erb")
94+
end
95+
96+
def self.interpolated_template_path
97+
File.absolute_path("#{generated_path}/interpolated_templates")
98+
end
99+
100+
def self.lang_interpolated_path
101+
File.absolute_path("#{interpolated_template_path}/lang")
102+
end
103+
104+
def self.synths_interpolated_path
105+
File.absolute_path("#{interpolated_template_path}/synths")
106+
end
107+
108+
def self.fx_interpolated_path
109+
File.absolute_path("#{interpolated_template_path}/fx")
110+
end
111+
112+
def self.samples_interpolated_path
113+
File.absolute_path("#{interpolated_template_path}/samples")
114+
end
115+
116+
def self.doc_toml_path
117+
File.absolute_path("#{doc_path}/generated/toml")
118+
end
119+
120+
def self.lang_toml_path
121+
File.absolute_path("#{doc_toml_path}/lang")
122+
end
123+
124+
def self.synths_toml_path
125+
File.absolute_path("#{doc_toml_path}/synths")
126+
end
127+
128+
def self.fx_toml_path
129+
File.absolute_path("#{doc_toml_path}/fx")
130+
end
131+
132+
def self.samples_toml_path
133+
File.absolute_path("#{doc_toml_path}/samples")
134+
end
135+
136+
def self.documentation_app_priv_path
137+
File.absolute_path("#{etc_path}/docs/priv/")
138+
end
139+
72140
def self.tmp_path
73141
File.absolute_path("#{root_path}/tmp")
74142
end

etc/doc/templates/samples.toml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ t_(
7474

7575
<%=
7676
if data_object.arg_info.any? { |name, arg| arg[:slidable] }
77-
ERB.new(File.read(slides_template_path), nil, '-', eoutvar: '_slide01').result(binding)
77+
ERB.new(File.read(::SonicPi::Paths.slides_template_path), nil, '-', eoutvar: '_slide01').result(binding)
7878
end
7979
%>

etc/doc/templates/synth_and_fx.toml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ t_(
9292
<% end %>
9393
<%=
9494
if item.arg_info.any? { |name, arg| arg[:slidable] }
95-
ERB.new(File.read(slides_template_path), nil, '-', eoutvar: '_slide01').result(binding)
95+
ERB.new(File.read(::SonicPi::Paths.slides_template_path), nil, '-', eoutvar: '_slide01').result(binding)
9696
end
9797
%>

0 commit comments

Comments
 (0)