gamefic-ideas 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a6a85bbe24df7b150d4370b087501deae84ece6a592db730b50e54e5a984a355
4
+ data.tar.gz: 287ff150610eaa46772a775c2cbf554104e3dfa5fac1a1f2e63afe63c1cd1881
5
+ SHA512:
6
+ metadata.gz: 4e91cba001a74e75afffef28dda793e063c5c1438621650223a10eeeb596cf106a682a83b319c76ee1ddc74fd19b7ad050fcb8318024969384ebf2809533d121
7
+ data.tar.gz: ee61073fbb4d969c8222d2f63c9dfeda61a56bed1efe382d36522ad4195f9f7c81411a51373c1fb265b4f8a1f19145a283772daf9fe90562e53dc541a2913498
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # Gamefic::Ideas
2
+
3
+ A Gamefic extension for queryable abstract ideas.
4
+
5
+ An `Idea` is a pseudo-entity that can be queried by the command parser but does not have a physical presence in the game world.
6
+ It has `name`, `synonyms`, and `description` attributes, but it does not have a `parent` or `children`.
7
+
8
+ ## Installation
9
+
10
+ Add the library to your Gamefic project's Gemfile:
11
+
12
+ ```
13
+ gem 'gamefic-ideas'
14
+ ```
15
+
16
+ Run `bundle install`.
17
+
18
+ Add the requirement to your project's code (typically in `main.rb`):
19
+
20
+ ```
21
+ require 'gamefic-ideas'
22
+ ```
23
+
24
+ If you want to include the library's actions, include `Gamefic::Ideas` in your project's Plot:
25
+
26
+ ```ruby
27
+ module Example
28
+ class Plot < Gamefic::Plot
29
+ include Gamefic::Ideas
30
+ end
31
+ end
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ The process to `make` new ideas is similar to making standard entities:
37
+
38
+ ```ruby
39
+ module Example
40
+ class Plot < Gamefic::Plot
41
+ include Gamefic::Ideas # Default commands for ideas like `think`
42
+
43
+ attr_seed :food_idea, Idea,
44
+ name: 'food',
45
+ synonyms: 'eating meals',
46
+ description: "A meal would hit the spot right now."
47
+ end
48
+ end
49
+ ```
50
+
51
+ If you included `Gamefic::Ideas`, players can access the idea's description with the `think` command:
52
+
53
+ > think about food
54
+
55
+ A meal would hit the spot right now.
56
+
57
+ You can also implement your own commands by accessing the idea with the `anywhere` query:
58
+
59
+ ```ruby
60
+ module Example
61
+ class Plot < Gamefic::Plot
62
+ attr_seed :food_idea, Idea,
63
+ name: 'food',
64
+ synonyms: 'eating meals',
65
+ description: "A meal would hit the spot right now."
66
+
67
+ respond :contemplate, anywhere(Idea) do |actor, idea|
68
+ actor.tell idea.description
69
+ end
70
+ end
71
+ end
72
+ ```
73
+
74
+ ## Development
75
+
76
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
77
+
78
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
79
+
80
+ ## Contributing
81
+
82
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gamefic-ideas.
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require 'opal/rspec/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task default: :spec
10
+
11
+ Opal::RSpec::RakeTask.new(:opal) do |_, config|
12
+ Opal.append_path File.join(__dir__, 'lib')
13
+ Opal.use_gem 'gamefic'
14
+ config.default_path = 'spec'
15
+ config.pattern = 'spec/**/*_spec.rb'
16
+ config.requires = ['opal_helper']
17
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/gamefic/ideas/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'gamefic-ideas'
7
+ spec.version = Gamefic::Ideas::VERSION
8
+ spec.authors = ['Fred Snyder']
9
+ spec.email = ['fsnyder@castwide.com']
10
+
11
+ spec.summary = 'A Gamefic extension for queryable abstract ideas.'
12
+ # spec.description = 'TODO: Write a longer description or delete this line.'
13
+ # spec.homepage = "TODO: Put your gem's website or public repo URL here."
14
+ spec.required_ruby_version = '>= 2.6.0'
15
+
16
+ # spec.metadata['allowed_push_host'] = "TODO: Set to your gem server 'https://example.com'"
17
+
18
+ # spec.metadata['homepage_uri'] = spec.homepage
19
+ # spec.metadata['source_code_uri'] = "TODO: Put your gem's public repo URL here."
20
+ # spec.metadata['changelog_uri'] = "TODO: Put your gem's CHANGELOG.md URL here."
21
+
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
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (File.expand_path(f) == __FILE__) ||
27
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
28
+ end
29
+ end
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency "example-gem", "~> 1.0"
36
+ spec.add_dependency 'gamefic', '~> 3.5'
37
+
38
+ spec.add_development_dependency 'opal-rspec', '~> 1.0'
39
+ spec.add_development_dependency 'opal-sprockets', '~> 1.0'
40
+ spec.add_development_dependency 'rake', '~> 13.0'
41
+ spec.add_development_dependency 'rspec', '~> 3.0'
42
+ spec.add_development_dependency 'simplecov', '~> 0.22'
43
+
44
+ # For more information and examples about making a new gem, check out our
45
+ # guide at: https://bundler.io/guides/creating_gem.html
46
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Ideas
5
+ # A pseudo-entity for queryable abstract ideas.
6
+ #
7
+ # An Idea can have a name, description, and synonyms, but it does not have
8
+ # a parent or children.
9
+ #
10
+ class Idea
11
+ include Gamefic::Describable
12
+
13
+ def initialize **args
14
+ args.each_pair { |k, v| send "#{k}=", v }
15
+ end
16
+
17
+ def parent
18
+ nil
19
+ end
20
+
21
+ def children
22
+ []
23
+ end
24
+
25
+ def flatten
26
+ []
27
+ end
28
+
29
+ def parent=
30
+ raise RuntimeError, 'Ideas cannot have parents'
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ Idea = Gamefic::Ideas::Idea
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Ideas
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gamefic'
4
+ require 'gamefic/ideas/version'
5
+ require 'gamefic/ideas/idea'
6
+
7
+ module Gamefic
8
+ # A Gamefic extension for queryable abstract ideas.
9
+ #
10
+ module Ideas
11
+ extend Gamefic::Scriptable
12
+
13
+ respond :think, anywhere(Idea) do |actor, idea|
14
+ actor.tell idea.description
15
+ end
16
+ interpret 'consider :idea', 'think :idea'
17
+ interpret 'ponder :idea', 'think :idea'
18
+ interpret 'remember :idea', 'think :idea'
19
+ interpret 'think about :idea', 'think :idea'
20
+ interpret 'think of :idea', 'think :idea'
21
+ interpret 'think on :idea', 'think :idea'
22
+ interpret 'wonder :idea', 'think :idea'
23
+ interpret 'wonder about :idea', 'think :idea'
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gamefic/ideas'
@@ -0,0 +1,6 @@
1
+ module Gamefic
2
+ module Ideas
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gamefic-ideas
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Fred Snyder
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-10-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gamefic
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: opal-rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: opal-sprockets
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.22'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.22'
97
+ description:
98
+ email:
99
+ - fsnyder@castwide.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".rspec"
105
+ - README.md
106
+ - Rakefile
107
+ - gamefic-ideas.gemspec
108
+ - lib/gamefic-ideas.rb
109
+ - lib/gamefic/ideas.rb
110
+ - lib/gamefic/ideas/idea.rb
111
+ - lib/gamefic/ideas/version.rb
112
+ - sig/gamefic/ideas.rbs
113
+ homepage:
114
+ licenses: []
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 2.6.0
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubygems_version: 3.3.7
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: A Gamefic extension for queryable abstract ideas.
135
+ test_files: []