inkcpp_rb 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6df4171fdae3fb72109490becde82a3c0ddfb844313aba4dae1d4fc992047d9d
4
- data.tar.gz: 31444bad672062c2517af2d36306eb120e6fa0a19eaf6ea52a7df7426f8e6bea
3
+ metadata.gz: fc9836fdbf53db4e97756a16f1da5b5aaf2ceb687b5b0106625ef46dec583ee3
4
+ data.tar.gz: c31f75154ffb5e06f157954eeb84cadd52fa1455029a08aa3bdd3120134f583b
5
5
  SHA512:
6
- metadata.gz: 79b518042aa460fdd5d421491d0382f74f23ac16c4cddf947166428fffcd2013346b664275dfb1b356bf097aa157ac2580d7907eb846c13311d8198faef0f5c6
7
- data.tar.gz: 423a32aa6d86fcb5941e3e5ba29b80e85b3664b816a479c28f66c69ea0c0c96ccb4a94bbe8ca8b5f5dcfbd19df19e4437167b2819138ed5c361611d2996aaf1b
6
+ metadata.gz: c4000451548a7be40123e6be1f3293c62cb0575c78edef98842a6a62107798853b6cce24dbf849432ea771f8bd8e66a375c2cd37982fb224c0da576ade8abf49
7
+ data.tar.gz: 9cd7ce509dba7793eafc39e28503a93e9e8cdd31bf93de0be2eca35b334ffd405c543f95ee23c36297f0b97d25e580a0fb43e99203c46ecaa75a83f2c38c9013
data/CHANGELOG.md CHANGED
@@ -1,3 +1,4 @@
1
1
  0.1.0: Initial commit
2
2
  0.1.1: Adjust directory structure to fit Ruby norms
3
3
  0.1.2: Ensure Rice included as a dependency
4
+ 0.1.3: Fix typings for Ink::Story
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- inkcpp_rb (0.1.2)
4
+ inkcpp_rb (0.1.3)
5
5
  rice (~> 4.3.3)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -10,6 +10,10 @@ bundle add inkcpp_rb
10
10
 
11
11
  Sorbet typings are included.
12
12
 
13
+ ## REQUIREMENTS
14
+
15
+ In order to install this gem your destination must have `cmake` installed as well as have a functioning C++ compilation toolchain.
16
+
13
17
  ## WARNING
14
18
 
15
19
  This gem has largely been developed for my own purposes. I am not yet confident enough in the memory semantics between Rice and InkCPP to say that this is leak free or safe to use in any important environment. If you do use this gem, I strongly suggest you use it in situations where you are not parsing untrusted user input or anything like that.
data/bin/console CHANGED
@@ -4,12 +4,6 @@
4
4
  require "bundler/setup"
5
5
  require "inkcpp_rb"
6
6
 
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
7
 
14
8
  require "irb"
15
9
  IRB.start(__FILE__)
data/bin/inkplay.rb ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ # typed: true
4
+ require "bundler/setup"
5
+ require "inkcpp_rb"
6
+ require "tempfile"
7
+ require "sorbet-runtime"
8
+
9
+ inklecate_path = %x{which inklecate}.chomp
10
+ raise "inklecate binary must be in your PATH - see https://github.com/inkle/ink/releases" if inklecate_path.empty?
11
+
12
+ story_path = ARGV[0]
13
+ raise "Must specify a story path" if story_path.nil? || story_path.empty?
14
+
15
+ file = Tempfile.new("inkplay.ink")
16
+ path = file.path
17
+ output = %x{inklecate -o #{path} #{story_path}}
18
+ raise "Could not compile ink json: #{output.inspect}" unless $?.success?
19
+ json_contents = File.read(T.must(path))
20
+ compiled = Ink.compile_json(json_contents)
21
+ story = T.must(Ink::Story.from_binary(compiled))
22
+ runner = T.must(story.new_runner(nil).get)
23
+ while true
24
+ puts runner.getline
25
+ if runner.num_choices > 0
26
+ all_choices = runner.each_choice.to_a
27
+ all_choices.each do |choice|
28
+ puts "#{choice.index}. #{choice.text}"
29
+ end
30
+ puts "Which choice?"
31
+ choice_num = STDIN.readline.chomp.to_i
32
+ chosen = all_choices.detect { |choice| choice.index == choice_num }
33
+ if chosen
34
+ runner.choose(choice_num - 1)
35
+ break if !runner.can_continue
36
+ end
37
+ end
38
+ end
39
+ puts "END"
data/bin/setup CHANGED
@@ -7,4 +7,3 @@ bundle install
7
7
  git submodule init
8
8
  git submodule update
9
9
 
10
- # Do any other automated setup that you need to do here
data/inkcpp_rb.gemspec CHANGED
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = "inkcpp bindings in Ruby"
13
13
  spec.homepage = "https://git.sr.ht/~netshade/inkcpp_rb"
14
14
  spec.required_ruby_version = ">= 2.6.0"
15
+ spec.requirements << "cmake"
15
16
 
16
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org/"
17
18
 
@@ -19,8 +20,6 @@ Gem::Specification.new do |spec|
19
20
  spec.metadata["source_code_uri"] = "https://git.sr.ht/~netshade/inkcpp_rb"
20
21
  spec.metadata["changelog_uri"] = "https://git.sr.ht/~netshade/inkcpp_rb/tree/main/item/CHANGELOG.md"
21
22
 
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
23
  submodules = %w{inkcpp}
25
24
  submodule_files = submodules.flat_map do |module_name|
26
25
  base_submodule_path = File.join("ext", "inkcpp_rb", module_name)
@@ -41,15 +40,10 @@ Gem::Specification.new do |spec|
41
40
  spec.require_paths = ["lib"]
42
41
  spec.extensions = ["ext/inkcpp_rb/extconf.rb"]
43
42
 
44
- # Uncomment to register a new dependency of your gem
45
- # spec.add_dependency "example-gem", "~> 1.0"
46
43
  spec.add_dependency "rice", "~> 4.3.3"
47
44
  spec.add_development_dependency "rake-compiler", "~> 1.2.8"
48
45
  spec.add_development_dependency "sorbet", "~> 0.5.0"
49
46
  spec.add_development_dependency "sorbet-runtime", "~> 0.5.0"
50
47
  spec.add_development_dependency "tapioca", "~> 0.16.0"
51
48
  spec.add_development_dependency "debug", "~> 1.1.0"
52
-
53
- # For more information and examples about making a new gem, check out our
54
- # guide at: https://bundler.io/guides/creating_gem.html
55
49
  end
@@ -1,3 +1,3 @@
1
1
  module InkcppRb
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/rbi/inkcpp_rb.rbi CHANGED
@@ -201,15 +201,15 @@ module Ink
201
201
  def self.from_binary(data); end
202
202
 
203
203
  sig { returns(T.nilable(Ink::StoryImpl)) }
204
- def self.new_globals(); end
204
+ def new_globals(); end
205
205
 
206
206
  sig { params(globals: T.nilable(Ink::StoryImpl)).returns(Ink::RunnerImpl) }
207
- def self.new_runner(globals); end
207
+ def new_runner(globals); end
208
208
 
209
209
  sig { params(snapshot: Ink::Snapshot).returns(Ink::StoryImpl) }
210
- def self.new_globals_from_snapshot(snapshot); end
210
+ def new_globals_from_snapshot(snapshot); end
211
211
 
212
212
  sig { params(snapshot: Ink::Snapshot, globals: T.nilable(Ink::StoryImpl), index: Integer).returns(Ink::StoryImpl) }
213
- def self.new_runner_from_snapshot(snapshot, globals, index); end
213
+ def new_runner_from_snapshot(snapshot, globals, index); end
214
214
  end
215
215
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inkcpp_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Zelenak
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-10 00:00:00.000000000 Z
10
+ date: 2025-01-12 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rice
@@ -109,6 +109,7 @@ files:
109
109
  - README.md
110
110
  - Rakefile
111
111
  - bin/console
112
+ - bin/inkplay.rb
112
113
  - bin/setup
113
114
  - bin/tapioca
114
115
  - ext/inkcpp_rb/extconf.rb
@@ -395,7 +396,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
395
396
  - - ">="
396
397
  - !ruby/object:Gem::Version
397
398
  version: '0'
398
- requirements: []
399
+ requirements:
400
+ - cmake
399
401
  rubygems_version: 3.6.2
400
402
  specification_version: 4
401
403
  summary: inkcpp bindings in Ruby