25
25
require_relative "../lib/sonicpi/lang/sound"
26
26
require_relative "../lib/sonicpi/lang/minecraftpi"
27
27
require_relative "../lib/sonicpi/lang/midi"
28
+ require_relative '../paths'
28
29
require 'active_support/inflector'
29
30
require 'erb'
30
31
require 'gettext'
31
32
require "gettext/tools/xgettext"
32
33
33
-
34
34
class QtDocs
35
35
include SonicPi ::Lang ::Support ::DocSystem
36
36
include SonicPi ::Util
@@ -72,9 +72,10 @@ def generate_docs
72
72
73
73
def generate_pot_file ( interpolated_file_paths )
74
74
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 )
76
76
cwd = Dir . pwd
77
- Dir . chdir ( generated_path )
77
+ FileUtils . mkdir_p ( ::SonicPi ::Paths . generated_path ) unless File . exist? ( ::SonicPi ::Paths . generated_path )
78
+ Dir . chdir ( ::SonicPi ::Paths . generated_path )
78
79
GetText ::Tools ::XGetText . run (
79
80
*interpolated_file_paths ,
80
81
'-otest.pot'
@@ -89,6 +90,7 @@ def generate_toml_files
89
90
key = key . to_s [ 3 ..-1 ] if collection [ :klass ] == SonicPi ::Synths ::FXInfo
90
91
interpolated_file = File . read ( "#{ collection [ :interpolated_path ] } /#{ key } .toml.erb" )
91
92
output = ERB . new ( interpolated_file , nil , '-' ) . result ( binding )
93
+ FileUtils . mkdir_p ( collection [ :output_path ] ) unless File . exist? ( collection [ :output_path ] )
92
94
File . open ( "#{ collection [ :output_path ] } /#{ key } .toml" , 'w' ) do |f |
93
95
f . write output
94
96
end
@@ -98,7 +100,7 @@ def generate_toml_files
98
100
99
101
def sync_to_documentation_app
100
102
puts 'Syncing the TOML files to the documentation web app...'
101
- FileUtils . cp_r ( doc_toml_path , documentation_app_priv_path , remove_destination : true )
103
+ FileUtils . cp_r ( :: SonicPi :: Paths . doc_toml_path , :: SonicPi :: Paths . documentation_app_priv_path , remove_destination : true )
102
104
end
103
105
104
106
def synths
@@ -107,9 +109,9 @@ def synths
107
109
end
108
110
{
109
111
items : items ,
110
- template_path : synth_and_fx_template_path ,
111
- interpolated_path : synths_interpolated_path ,
112
- output_path : synths_toml_path ,
112
+ template_path : :: SonicPi :: Paths . synth_and_fx_template_path ,
113
+ interpolated_path : :: SonicPi :: Paths . synths_interpolated_path ,
114
+ output_path : :: SonicPi :: Paths . synths_toml_path ,
113
115
klass : SonicPi ::Synths ::SynthInfo
114
116
}
115
117
end
@@ -120,29 +122,29 @@ def fx
120
122
end
121
123
{
122
124
items : items ,
123
- template_path : synth_and_fx_template_path ,
124
- interpolated_path : fx_interpolated_path ,
125
- output_path : fx_toml_path ,
125
+ template_path : :: SonicPi :: Paths . synth_and_fx_template_path ,
126
+ interpolated_path : :: SonicPi :: Paths . fx_interpolated_path ,
127
+ output_path : :: SonicPi :: Paths . fx_toml_path ,
126
128
klass : SonicPi ::Synths ::FXInfo
127
129
}
128
130
end
129
131
130
132
def samples
131
133
{
132
134
items : SonicPi ::Synths ::SynthInfo . grouped_samples ,
133
- template_path : samples_template_path ,
134
- interpolated_path : samples_interpolated_path ,
135
- output_path : samples_toml_path ,
135
+ template_path : :: SonicPi :: Paths . samples_template_path ,
136
+ interpolated_path : :: SonicPi :: Paths . samples_interpolated_path ,
137
+ output_path : :: SonicPi :: Paths . samples_toml_path ,
136
138
data_object : SonicPi ::Synths ::StereoPlayer . new
137
139
}
138
140
end
139
141
140
142
def lang
141
143
{
142
144
items : @@docs ,
143
- template_path : lang_template_path ,
144
- interpolated_path : lang_interpolated_path ,
145
- output_path : lang_toml_path
145
+ template_path : :: SonicPi :: Paths . lang_template_path ,
146
+ interpolated_path : :: SonicPi :: Paths . lang_interpolated_path ,
147
+ output_path : :: SonicPi :: Paths . lang_toml_path
146
148
}
147
149
end
148
150
end
0 commit comments