Bladeren bron

slight refactor to make things less hardcoded

Ruduki2 5 jaren geleden
bovenliggende
commit
f9a90a1430
3 gewijzigde bestanden met toevoegingen van 29 en 12 verwijderingen
  1. 3 1
      .gitignore
  2. 23 4
      Rakefile
  3. 3 7
      main.tw2

+ 3 - 1
.gitignore

@@ -2,4 +2,6 @@
 /watch.html
 /release.html
 /*_wrapper.tw2
-/Gemfile.lock
+/Gemfile.lock
+/story.tw2
+/story_title.tw2

+ 23 - 4
Rakefile

@@ -12,6 +12,8 @@ STORY_TITLE = 'Volleyball'
 STORY_FORMAT = 'SugarCube'
 STORY_FORMAT_PATH = "story_formats/sugarcube-2.28.2-for-twine-2.1-local/sugarcube-2"
 STORY_FORMAT_VERSION = '2.28.2'
+STORY_RELEASE_TITLE = 'Volleyball Chapter 1 v0.5'
+
 FILES = {
   '01_intro' => '01 Intro',
   '02_transform' => '02 Transform',
@@ -32,16 +34,16 @@ def files
   end
 end
 
-task develop: %w(bundle_install storyjs) do
+task develop: %w(bundle_install storyjs story.tw2 story_title.tw2) do
   sh "bundle exec twee2 build '--format=#{STORY_FORMAT_PATH}' main.tw2 develop.html"
 end
 
-task watch: %w(bundle_install storyjs) do
+task watch: %w(bundle_install storyjs story.tw2 story_title.tw2) do
   sh 'start watch.html'  # FIXME non-windows
   sh "bundle exec twee2 watch '--format=#{STORY_FORMAT_PATH}'  main.tw2 watch.html"
 end
 
-task release: %w(bundle_install storyjs) do
+task release: %w(bundle_install storyjs story.tw2 story_title.tw2) do
   sh "bundle exec twee2 build '--format=#{STORY_FORMAT_PATH}' main.tw2 release.html"
 end
 
@@ -53,8 +55,24 @@ task :storyjs do
   )
 end
 
+file 'story.tw2' do
+  File.open('story.tw2', 'w') do |f|
+    f.puts('::StoryIncludes')
+    files.each do |file|
+      f.puts(file.source_file)
+    end
+  end
+end
+
+file 'story_title.tw2' do
+  File.open('story_title.tw2', 'w') do |f|
+    f.puts('::StoryTitle')
+    f.puts("#{STORY_RELEASE_TITLE}")
+  end
+end
+
 desc 'export sub files to Twine 2'
-task export: %w(bundle_install storyjs) do
+task export: %w(bundle_install storyjs story.tw2) do
   files.each do |file|
     IO.write file.wrapper_file, <<~EOF
       ::StoryTitle
@@ -64,6 +82,7 @@ task export: %w(bundle_install storyjs) do
       @story_start_name = 'Start #{file.long_name}'
       Twee2::build_config.story_format = '#{STORY_FORMAT}'
       Twee2::build_config.story_format_version = '#{STORY_FORMAT_VERSION}'
+      Twee2::build_config.story_ifid = ''
       
       ::StoryIncludes
       images.tw2

+ 3 - 7
main.tw2

@@ -1,5 +1,5 @@
-::StoryTitle
-Volleyball Chapter 1 v0.5
+::StoryIncludes
+story_title.tw2
 
 ::landing <553,58>
 This interactive story contains adult content. Make sure it is lawful in your jurisdiction to consume such content.
@@ -154,11 +154,7 @@ Graphics Used
 images.tw2
 stylesheet.tw2
 storyjs.tw2
-story/01_intro.tw2
-story/02_transform.tw2
-story/03_custom_girl.tw2
-story/04_money_game.tw2
-story/05_beaches.tw2
+story.tw2
 after.tw2
 
 ::Twee2Settings [twee2]