Explorar el Código

export/import actually completely works as expected now

what wasn't working was that a story format wasn't being set because you
need a name and a version.

so now we set a name and a version on export that is explicit. (exported
files would work before if you set the format in the GUI each time, but
that wouldn't solve the problem I'm trying to solve)
Ruduki2 hace 6 años
padre
commit
893afab9d1
Se han modificado 1 ficheros con 14 adiciones y 3 borrados
  1. 14 3
      Rakefile

+ 14 - 3
Rakefile

@@ -1,6 +1,8 @@
 task default: %w(develop)
 STORY_DIR=File.join(ENV['USERPROFILE'], 'Documents\\Twine\\Stories')
 STORY_TITLE = 'Volleyball'
+STORY_FORMAT = 'SugarCube'
+STORY_FORMAT_VERSION = '2.25.0'
 FILES = {
   '01_intro' => '01 Intro',
   '02_transform' => '02 Transform',
@@ -43,7 +45,8 @@ task export: %w(bundle_install) do
 
       ::Twee2Settings [twee2]
       @story_start_name = 'Start #{file.long_name}'
-      Twee2::build_config.story_format = 'SugarCube2'
+      Twee2::build_config.story_format = 'SugarCube'
+      Twee2::build_config.story_format_version = 'SugarCube2'
 
       ::StoryIncludes
       images.tw2
@@ -52,9 +55,17 @@ task export: %w(bundle_install) do
       #{file.source_file}
     EOF
 
-    sh 'bundle', 'exec', 'twee2', 'export', file.wrapper_file, file.dest_file
+    sh(
+      'bundle', 'exec', 'twee2', 'export',
+      "--format=#{STORY_FORMAT}", "--format-version=#{STORY_FORMAT_VERSION}",
+      file.wrapper_file, file.dest_file,
+    )
   end
-  sh 'bundle', 'exec', 'twee2', 'export', 'main.tw2', STORY_DIR
+  sh(
+    'bundle', 'exec', 'twee2', 'export',
+    "--format=#{STORY_FORMAT}", "--format-version=#{STORY_FORMAT_VERSION}",
+    'main.tw2', STORY_DIR,
+  )
 end
 
 desc 'import sub files from Twine 2'