|
@@ -1,5 +1,6 @@
|
|
task default: %w(develop)
|
|
task default: %w(develop)
|
|
STORY_DIR=File.join(ENV['USERPROFILE'], 'Documents\\Twine\\Stories')
|
|
STORY_DIR=File.join(ENV['USERPROFILE'], 'Documents\\Twine\\Stories')
|
|
|
|
+STORY_TITLE = 'Volleyball'
|
|
FILES = {
|
|
FILES = {
|
|
'intro' => 'Intro',
|
|
'intro' => 'Intro',
|
|
'transform' => 'Transform',
|
|
'transform' => 'Transform',
|
|
@@ -8,6 +9,18 @@ FILES = {
|
|
'money_game' => 'Money Games',
|
|
'money_game' => 'Money Games',
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+def files
|
|
|
|
+ FILES.map do |short_name, long_name|
|
|
|
|
+ OpenStruct.new({
|
|
|
|
+ short_name: short_name,
|
|
|
|
+ long_name: long_name,
|
|
|
|
+ source_file: "#{short_name}.tw2",
|
|
|
|
+ dest_file: File.join(STORY_DIR, "#{STORY_TITLE} - #{long_name}.html"),
|
|
|
|
+ wrapper_file: "#{short_name}_wrapper.tw2",
|
|
|
|
+ })
|
|
|
|
+ end
|
|
|
|
+end
|
|
|
|
+
|
|
task develop: %w(bundle_install) do
|
|
task develop: %w(bundle_install) do
|
|
sh "bundle exec twee2 build main.tw2 develop.html"
|
|
sh "bundle exec twee2 build main.tw2 develop.html"
|
|
end
|
|
end
|
|
@@ -23,31 +36,36 @@ end
|
|
|
|
|
|
desc 'export sub files to Twine 2'
|
|
desc 'export sub files to Twine 2'
|
|
task export: %w(bundle_install) do
|
|
task export: %w(bundle_install) do
|
|
- FILES.each do |short_name, long_name|
|
|
|
|
- IO.write "#{short_name}_wrapper.tw2", <<~EOF
|
|
|
|
|
|
+ files.each do |file|
|
|
|
|
+ IO.write file.wrapper_file, <<~EOF
|
|
::StoryTitle
|
|
::StoryTitle
|
|
- Volleyball - #{long_name}
|
|
|
|
|
|
+ Volleyball - #{file.long_name}
|
|
|
|
|
|
::Twee2Settings [twee2]
|
|
::Twee2Settings [twee2]
|
|
- @story_start_name = 'Start #{long_name}'
|
|
|
|
|
|
+ @story_start_name = 'Start #{file.long_name}'
|
|
Twee2::build_config.story_format = 'SugarCube2'
|
|
Twee2::build_config.story_format = 'SugarCube2'
|
|
|
|
|
|
::StoryIncludes
|
|
::StoryIncludes
|
|
images.tw2
|
|
images.tw2
|
|
stylesheet.tw2
|
|
stylesheet.tw2
|
|
storyjs.tw2
|
|
storyjs.tw2
|
|
- #{short_name}.tw2
|
|
|
|
|
|
+ #{file.source_file}
|
|
EOF
|
|
EOF
|
|
|
|
|
|
- sh "bundle exec twee2 export #{short_name}_wrapper.tw2 '#{File.join(STORY_DIR, "Volleyball - #{long_name}.html")}'"
|
|
|
|
|
|
+ sh 'bundle', 'exec', 'twee2', 'export', file.wrapper_file, file.dest_file
|
|
end
|
|
end
|
|
- sh "bundle exec twee2 export main.tw2 '#{File.join(STORY_DIR, "Volleyball - Full Game.html")}'"
|
|
|
|
|
|
+ sh 'bundle', 'exec', 'twee2', 'export', 'main.tw2', STORY_DIR
|
|
end
|
|
end
|
|
|
|
|
|
desc 'import sub files from Twine 2'
|
|
desc 'import sub files from Twine 2'
|
|
task import: %w(bundle_install) do
|
|
task import: %w(bundle_install) do
|
|
- FILES.each do |short_name, long_name|
|
|
|
|
- sh "bundle exec twee2 decompile '#{File.join(STORY_DIR, "Volleyball - #{long_name}.html")}' '#{short_name}.tw2' --exclude=StoryJS,StoryCSS,StoryTitle,Twee2Settings --exclude-from=storyjs.tw2,stylesheet.tw2,images.tw2"
|
|
|
|
|
|
+ files.each do |file|
|
|
|
|
+ sh(
|
|
|
|
+ 'bundle', 'exec', 'twee2', 'decompile',
|
|
|
|
+ file.dest_file, file.source_file,
|
|
|
|
+ '--exclude=StoryJS,StoryCSS,StoryTitle,Twee2Settings',
|
|
|
|
+ '--exclude-from=storyjs.tw2,stylesheet.tw2,images.tw2"',
|
|
|
|
+ )
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
|