felecs 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.byebug_history +20 -0
  3. data/.gitignore +17 -0
  4. data/.inch.yml +11 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +13 -0
  7. data/.ruby-version +1 -0
  8. data/CHANGELOG.mdown +80 -0
  9. data/Gemfile +10 -0
  10. data/Gemfile.lock +87 -0
  11. data/LICENSE +21 -0
  12. data/README.mdown +465 -0
  13. data/Rakefile +66 -0
  14. data/bin/console +15 -0
  15. data/bin/setup +8 -0
  16. data/docs/CNAME +1 -0
  17. data/docs/FelECS/ComponentManager.html +1239 -0
  18. data/docs/FelECS/Components.html +337 -0
  19. data/docs/FelECS/Entities.html +792 -0
  20. data/docs/FelECS/Order.html +251 -0
  21. data/docs/FelECS/Scenes.html +765 -0
  22. data/docs/FelECS/Stage.html +572 -0
  23. data/docs/FelECS/Systems.html +1505 -0
  24. data/docs/FelECS.html +335 -0
  25. data/docs/FelFlame/ComponentManager.html +1239 -0
  26. data/docs/FelFlame/Components.html +333 -0
  27. data/docs/FelFlame/Entities.html +792 -0
  28. data/docs/FelFlame/Helper/ComponentManager.html +1627 -0
  29. data/docs/FelFlame/Helper.html +142 -0
  30. data/docs/FelFlame/Order.html +251 -0
  31. data/docs/FelFlame/Scenes.html +765 -0
  32. data/docs/FelFlame/Stage.html +572 -0
  33. data/docs/FelFlame/Systems.html +1505 -0
  34. data/docs/FelFlame.html +319 -0
  35. data/docs/Felflame_.html +143 -0
  36. data/docs/_index.html +188 -0
  37. data/docs/class_list.html +51 -0
  38. data/docs/css/common.css +1 -0
  39. data/docs/css/full_list.css +58 -0
  40. data/docs/css/style.css +497 -0
  41. data/docs/file.README.html +560 -0
  42. data/docs/file.version.html +74 -0
  43. data/docs/file_list.html +56 -0
  44. data/docs/frames.html +17 -0
  45. data/docs/index.html +560 -0
  46. data/docs/js/app.js +314 -0
  47. data/docs/js/full_list.js +216 -0
  48. data/docs/js/jquery.js +4 -0
  49. data/docs/method_list.html +419 -0
  50. data/docs/top-level-namespace.html +137 -0
  51. data/felecs.gemspec +45 -0
  52. data/lib/felecs/component_manager.rb +279 -0
  53. data/lib/felecs/entity_manager.rb +160 -0
  54. data/lib/felecs/order.rb +24 -0
  55. data/lib/felecs/scene_manager.rb +69 -0
  56. data/lib/felecs/stage_manager.rb +47 -0
  57. data/lib/felecs/system_manager.rb +258 -0
  58. data/lib/felecs/version.rb +9 -0
  59. data/lib/felecs.rb +67 -0
  60. data/mrbgem/mrbgem.rake +4 -0
  61. data/mrbgem/mrblib/felecs.rb +913 -0
  62. metadata +229 -0
data/README.mdown ADDED
@@ -0,0 +1,465 @@
1
+ ![FelECS](https://raw.githubusercontent.com/realtradam/FelECS/master/logos/felecs-logo-text.png)
2
+ <!-- ![FelFlame](https://filestorage.catgirls.rodeo/images/felecs-logo-smaller-text.png) -->
3
+
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/maintainability)](https://codeclimate.com/github/realtradam/FelFlame/maintainability)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/test_coverage)](https://codeclimate.com/github/realtradam/FelFlame/test_coverage)
6
+ [![Inline docs](http://inch-ci.org/github/realtradam/FelECS.svg?branch=master)](http://inch-ci.org/github/realtradam/FelECS)
7
+ [![MIT License](https://img.shields.io/github/license/realtradam/FelECS)](https://github.com/realtradam/FelFlame/blob/master/LICENSE)
8
+ [![Ko-Fi](https://img.shields.io/static/v1?message=Buy%20me%20a%20coffee&logo=kofi&labelColor=ff5e5b&color=434B57&logoColor=white&label=%20)](https://ko-fi.com/tradam)
9
+
10
+ **[Check out the comprehensive documentation here!](https://felflame.tradam.fyi/)**
11
+
12
+ ---
13
+
14
+ <!-- vim-markdown-toc GFM -->
15
+
16
+ * [What is FelECS?](#what-is-felecs)
17
+ * [What is ECS?](#what-is-ecs)
18
+ * [Components](#components)
19
+ * [Entities](#entities)
20
+ * [Systems](#systems)
21
+ * [Scenes](#scenes)
22
+ * [Stage](#stage)
23
+ * [Order](#order)
24
+ * [Usage](#usage)
25
+ * [Entities](#entities-1)
26
+ * [Creation](#creation)
27
+ * [Accessing](#accessing)
28
+ * [Adding and Removing Components](#adding-and-removing-components)
29
+ * [Accessing Entities' Attached Components](#accessing-entities-attached-components)
30
+ * [Deletion](#deletion)
31
+ * [Components](#components-1)
32
+ * [Creating a Component Manager](#creating-a-component-manager)
33
+ * [Creating a Component from a Component Manager](#creating-a-component-from-a-component-manager)
34
+ * [Accessing](#accessing-1)
35
+ * [Accessing Attributes and Changing Them](#accessing-attributes-and-changing-them)
36
+ * [Deleting Components](#deleting-components)
37
+ * [Accessing Components' attached Entities](#accessing-components-attached-entities)
38
+ * [Systems](#systems-1)
39
+ * [Creation](#creation-1)
40
+ * [Execution](#execution)
41
+ * [Alternative Execution](#alternative-execution)
42
+ * [Clearing Alternative Executions](#clearing-alternative-executions)
43
+ * [Redefinition](#redefinition)
44
+ * [Scenes](#scenes-1)
45
+ * [Creation](#creation-2)
46
+ * [Accessing](#accessing-2)
47
+ * [Adding Systems](#adding-systems)
48
+ * [Removing Systems](#removing-systems)
49
+ * [Clearing](#clearing)
50
+ * [Execution](#execution-1)
51
+ * [Stage](#stage-1)
52
+ * [Adding Scenes](#adding-scenes)
53
+ * [Removing Scenes](#removing-scenes)
54
+ * [Executing](#executing)
55
+ * [Order](#order-1)
56
+ * [Setting the order](#setting-the-order)
57
+ * [Closing Notes](#closing-notes)
58
+ * [Contribution](#contribution)
59
+
60
+ <!-- vim-markdown-toc -->
61
+
62
+ # What is FelECS?
63
+
64
+ FelECS is an ECS framework for developing games in the Ruby language. FelECS has been designed from the ground up with these three ideas in mind:
65
+
66
+ 1. **Engine Agnostic:** FelECS has been designed to be rendering engine agnostic as long as the target rendering engine is written in Ruby. This means that this framework can be dropped into existing rendering engines such as [Ruby2D](http://www.ruby2d.com) or [DRGTK](https://dragonruby.org/toolkit/game) with little modifications.
67
+ 2. **Easily Extensible:** FelECS has been designed such that extensions to its capabilities can be easily added. Extensions such as rendering engine wrappers, premade systems, premade components, etcetera can be easily coded and then distributed as gems.
68
+ 3. **Principle of (My) Least Astonishment:** I want to develop games using a language and framework I love and makes sense to me, inspired by the [Philosophy of the creator of Ruby](https://en.wikipedia.org/wiki/Ruby_(programming_language)#Philosophy).
69
+
70
+ # What is ECS?
71
+ ECS is a software architectural pattern that is used in video game development. Traditionally games were programmed using an object oriented method, while ECS instead attempts to program games using a data oriented method instead.
72
+ ECS stands for Entity, Component, and System.
73
+
74
+ ---
75
+
76
+ ### Components
77
+ This is where the data or information of a given "object" is stored. There is no logic or code here.
78
+
79
+ ### Entities
80
+ Entities will contain one or more Components, but contains no logic or data otherwise
81
+
82
+ ### Systems
83
+ Systems are where all the logic or code is kept. There is no data stored in here.
84
+
85
+ ---
86
+
87
+ By using this pattern it allows programmers to easily control what an "object" or entity can do and how much data it needs to have. It avoids the issue of inhertance as no inhertance is ever required in this system. If you need a certain entity to have a certain functionality you just add the relevant component to it, and the systems that automatically go over specific components will give your entitiy the desired functionality.
88
+
89
+ **"But your framework also has `Scenes`, `Stage`, and `Order`, what is that about?"**
90
+
91
+ ---
92
+
93
+ ### Scenes
94
+ Scenes are simply a collection or subset of Systems. This allows for an easy way to activate and deactivate Systems.
95
+
96
+ ### Stage
97
+ The Stage is Scenes which are activated. This means any Scenes on the Stage are executed each frame, while the rest of the Systems are not.
98
+
99
+ ### Order
100
+ Order is a helper class which can set the priority of Scenes and Systems.
101
+
102
+ ---
103
+
104
+
105
+ # Usage
106
+
107
+ There are 2 ways of using FelECS. You can either `include` it as a gem in your project if your game engine supports this. The other option is to download the single file export of FelECS and then `require_relative` this file in your project. The single file export takes all the ruby code in the various files and concatenates them into a single file so it is more portable and easy to add.
108
+
109
+ To use the gem method you can do the following: install the gem using `gem install felecs` or using bundler `bundle add felecs` and then require it in your project like so: `require 'felecs'`.
110
+
111
+ To use the single file export method you simply download the felecs.rb file from the [releases page on Github](https://github.com/realtradam/FelECS/releases) and add it to your source folder and add a `require relative 'felecs.rb'` line or wherever you have placed the file to use it.
112
+
113
+ ## Entities
114
+
115
+ ### Creation
116
+ Entities are essentially "objects" in the game world. To create a new Entity we do the following:
117
+
118
+ ```ruby
119
+ @entity = FelECS::Entities.new
120
+ ```
121
+ or if we want to add (any number of)components to it when creating it:
122
+
123
+ ```ruby
124
+ @entity = FelECS::Entites.new(
125
+ FelECS::Components::Health.new,
126
+ @component,
127
+ FelECS::Components::EnemyTeam.first
128
+ )
129
+ ```
130
+
131
+ ### Accessing
132
+ Oftentimes you will not be accessing an Entity this way. Later we will shows you a more common way of accessing entities.
133
+ If you need to you can access Entities using the `Entities` module:
134
+
135
+ ```ruby
136
+ @entity = FelECS::Entities[2]
137
+ @entity = FelECS::Entities.first
138
+ @entity = FelECS::Entities.each # you can iterate over all entities this way. Any valid array method can be used
139
+ ```
140
+
141
+ ### Adding and Removing Components
142
+ We can still add or remove Components from an Entity after it has been created. Here is how:
143
+
144
+ ```ruby
145
+ @entity.add @component
146
+ @entity.remove @component
147
+ ```
148
+
149
+ ### Accessing Entities' Attached Components
150
+ This is the most common way of accessing an Entity
151
+
152
+ When Components are added to Entities, they can be accessed from the Entity. By using a Component Manager as a key we can access an array of all components created from that Component Manager that are attached to an entity:
153
+
154
+ ```ruby
155
+ @entity.components[@component_manager] # => [@component1, @component2, @component3]
156
+ ```
157
+
158
+ ### Deletion
159
+ To have all Components from an Entity **removed** and the Entity deleted we do the following:
160
+
161
+ NOTE: The components will **not be deleted**. They are simply **removed** from the entity and then the entity is destroyed. You must handle component deletion yourself as for example singleton components need to removed instead of deleted.
162
+
163
+ ```ruby
164
+ @entity.delete
165
+ ```
166
+
167
+ ## Components
168
+
169
+ ### Creating a Component Manager
170
+ Components are where all the data is stored. The data is stored in variables or accessors in each component.
171
+ These accessors and their defaults are configured when a component manager is created, like so:
172
+
173
+ ```ruby
174
+ @component_manager = FelECS::Components.new('Stats', :armour, hp: 100)
175
+ ```
176
+
177
+ In this example we created a component manager called "Stats".
178
+ The name given to component managers must follow the same rules for naming constants in ruby for a reason you will shortly see.
179
+ The parameters following are all creating the attributes we can set.
180
+ We can set any number of parameters we wish, in this example we define two.
181
+ The `:armour` parameter is being created without a default, it will equal to `nil` when a new component is created, while `hp` will be equal to 100 when a component is created.
182
+ When defining attributes symbols should be used.
183
+
184
+ ### Creating a Component from a Component Manager
185
+ Now that we have a component manager we can make components from it like so:
186
+
187
+ ```ruby
188
+ @component = FelECS::Components::Stats.new
189
+ ```
190
+
191
+ Or we can even override the defaults when creating the component:
192
+
193
+ ```ruby
194
+ @component = FelECS::Components::Stats.new(armour: 'steel')
195
+ ```
196
+
197
+ ### Accessing
198
+ You can access components using any array method.
199
+
200
+ ```ruby
201
+ @component = FelECS::Components::Stats[2]
202
+ @component = FelECS::Components::Stats.first
203
+ @component = FelECS::Components::Stats.each # you can use iterators this way
204
+ ```
205
+
206
+ ### Accessing Attributes and Changing Them
207
+ There are a few different ways we can read or change the attributes of a component depending on what our needs are.
208
+ Here are the ways to edit attrubutes, followed by the ways to read them.
209
+ ```ruby
210
+ @component.armour = 'Mythril'
211
+ @component.update_attrs(armour: 'Leather', hp: 95)
212
+ ```
213
+ ```ruby
214
+ @component.hp # => 95
215
+ @component.to_h # => {armour: 'Leather', hp: 95}
216
+ ```
217
+
218
+ ### Deleting Components
219
+ Deleting a Component is the same convention as deleting an Entity. When a Component is deleted referenced to it such as to entities are automatically cleared.
220
+
221
+ ```ruby
222
+ @component.delete
223
+ ```
224
+
225
+ ### Accessing Components' attached Entities
226
+ Components also keep track of what Entities are using it. To access this list we do the following:
227
+
228
+ ```ruby
229
+ @component.entities # => [@entity1, @entity2, @entity3]
230
+
231
+ # get the first entity attached.
232
+ # this will throw a warning if there is more or less then
233
+ # exactly one entity
234
+ @component.entity # => @entity
235
+ ```
236
+
237
+
238
+ ## Systems
239
+
240
+ ### Creation
241
+ We can create Systems like so:
242
+
243
+ ```ruby
244
+ FelECS::Systems.new('Render', priority: 2) do
245
+ # Code and Logic
246
+ end
247
+ ```
248
+
249
+ The name we assign is how we can access the System, like so:
250
+
251
+ ```ruby
252
+ FelECS::Systems::Render
253
+ ```
254
+ Priority determines the order Systems should be executed, this is used for `Scenes` and the `Stage`.
255
+ The lower the number, the earlier a given System will be executed.
256
+ E.g priority 1 will go first, priority 2 will go second, etcetera.
257
+
258
+ Both Scenes and Systems have a priority. System priority will decide the order it will be called inside of a Scene, which the Scene priority will decide the order it will be called inside of the Stage.
259
+
260
+ Often we will want to execute some logic on each Component in a given Component Manager so our code might look like this:
261
+
262
+ ```ruby
263
+ FelECS::Systems.new('Render', priority: 2) do
264
+ FelECS::Components::Sprites.each do |component|
265
+ # do something with these components
266
+ end
267
+ end
268
+ ```
269
+
270
+ ### Execution
271
+ After we create a System, it won't do anything on its own until we tell it to. Here is how:
272
+
273
+ ```ruby
274
+ FelECS::Systems::Render.call
275
+ ```
276
+
277
+ Sometimes you might want to manually activate a System, but the more common way to have Systems be triggered is to use Scenes and the Stage or the alternative ways of execution.
278
+
279
+ ### Alternative Execution
280
+ Sometimes you want a System to automatically trigger when a special even happens. FelECS can keep track of when a Component is added, removed, or when an attribute is changed and then execute Systems linked to these events. Here is how to create these links:
281
+
282
+ ```ruby
283
+ # When this Component is added to an Entity, this System will be called
284
+ FelECS::Systems::PassiveRegen.trigger_when_added(@component)
285
+
286
+ # When this Component is removed from an Entity, this System will be called
287
+ FelECS::Systems::PassiveRegen.trigger_when_removed(@component)
288
+
289
+ # When this Component's health attribute is changed, this System will be called
290
+ FelECS::Systems::PassiveRegen.trigger_when_is_changed(@component, :health)
291
+ ```
292
+
293
+ If we want these triggers to happen for all Components that belong to specific Component Manager then we can do that instead:
294
+
295
+ ```ruby
296
+ # When a Component from this Component Manager is added to an Entity, this System will be called
297
+ FelECS::Systems::PassiveRegen.trigger_when_added(@component_manager)
298
+
299
+ # When a Component from this Component Manager is removed from an Entity, this System will be called
300
+ FelECS::Systems::PassiveRegen.trigger_when_removed(@component_manager)
301
+
302
+ # When this Component's health attribute from this Component Manager is changed, this System will be called
303
+ FelECS::Systems::PassiveRegen.trigger_when_is_changed(@component_manager, :health)
304
+ ```
305
+
306
+ We can create any number of these links between Systems, Components, and Component Manangers as we like, simply call the method again with our other Components and Component Managers
307
+
308
+ ### Clearing Alternative Executions
309
+
310
+ If we wish to remove these links that we created, we can do that using the follwing function in any of the following ways:
311
+
312
+ ```ruby
313
+ # clears ALL triggers with this system
314
+ FelECS::Systems::PassiveRegen.clear_triggers
315
+
316
+ # clears ALL triggers with this Component Manager
317
+ FelECS::Systems::PassiveRegen.clear_triggers(@component)
318
+
319
+ # clear the 'trigger_when_added' for this Component
320
+ FelECS::Systems::PassiveRegen.clear_triggers(@component, :added)
321
+
322
+ # clear the 'trigger_when_removed' for this Component
323
+ FelECS::Systems::PassiveRegen.clear_triggers(@component, :removed)
324
+
325
+ # clear the 'trigger_when_is_changed' for this Component specifically for the health attribute
326
+ FelECS::Systems::PassiveRegen.clear_triggers(@component, :is_set, :health)
327
+ ```
328
+
329
+ Likewise we can do the same with Component Managers:
330
+
331
+ ```ruby
332
+ # clears ALL triggers with this Component
333
+ FelECS::Systems::PassiveRegen.clear_triggers(@component_manager)
334
+
335
+ # clear the 'trigger_when_added' for this Component Manager
336
+ FelECS::Systems::PassiveRegen.clear_triggers(@component_manager, :added)
337
+
338
+ # clear the 'trigger_when_removed' for this Component Manager
339
+ FelECS::Systems::PassiveRegen.clear_triggers(@component_manager, :removed)
340
+
341
+ # clear the 'trigger_when_is_changed' for this Component Manager specifically for the health attribute
342
+ FelECS::Systems::PassiveRegen.clear_triggers(@component_manager, :is_set, :health)
343
+ ```
344
+
345
+ ### Redefinition
346
+
347
+ If we wanted to change what code or logic a given System executes, we could do that with:
348
+
349
+ ```ruby
350
+ FelECS::Systems::PassiveRegen.redefine do
351
+ # Some new logic or code
352
+ end
353
+ ```
354
+
355
+ ## Scenes
356
+
357
+ ### Creation
358
+ Once we have all the core parts of ECS, we will want to organize our Systems. To do this we will use Scenes to group up Systems so they can quickly be enabled or disabled. Note that [Alternative Executions](#alternative-execution) will occur even if they are not part of a Scene. Here is how we make a new Scene:
359
+
360
+ ```ruby
361
+ @scene = FelECS::Scenes.new('ExampleScene', priority: 5)
362
+ ```
363
+
364
+ ### Accessing
365
+ Just like other classes in FelECS, the name we gave the Scene is how we access it:
366
+
367
+ ```ruby
368
+ @scene = FelECS::Scenes::ExampleScene
369
+ ```
370
+
371
+ ### Adding Systems
372
+ Adding Systems is simple. We can add as many as we want. In this example we add 3 different systems:
373
+
374
+ ```ruby
375
+ FelECS::Scenes::ExampleScene.add(
376
+ FelECS::Systems::Render,
377
+ @system2,
378
+ @system3
379
+ )
380
+ ```
381
+
382
+ ### Removing Systems
383
+ Removing Systems works similarly:
384
+
385
+ ```ruby
386
+ FelECS::Scenes::ExampleScene.remove(
387
+ FelECS::Systems::Render,
388
+ @system2,
389
+ @system3
390
+ )
391
+ ```
392
+
393
+ ### Clearing
394
+ If you want to remove all Systems from a Scene here is how we do it:
395
+
396
+ ```ruby
397
+ @scene.clear
398
+ ```
399
+
400
+ ### Execution
401
+ To execute all Systems within a scene once we can just do:
402
+
403
+ ```ruby
404
+ @scene.call
405
+ ```
406
+
407
+ The Scene will make sure that the systems are executed in the correct order based on their given priorities
408
+
409
+ ## Stage
410
+
411
+ ### Adding Scenes
412
+ Finally we have the Stage. There is only a single Stage and we do not have to create it as it exists by default. By adding a Scene to the Stage we are saying that the Scene is 'active'. To add a Scene we do the following:
413
+
414
+ ```ruby
415
+ FelECS::Stage.add FelECS::Scene::ExampleScene
416
+ ```
417
+
418
+ ### Removing Scenes
419
+ Likewise we can remove Scenes:
420
+
421
+ ```ruby
422
+ FelECS::Stage.remove FelECS::Scene::ExampleScene
423
+ ```
424
+
425
+ ### Executing
426
+ On each frame of the game generally we will want to execute the Stage once. When the Stage is executed it is progressing your game 1 frame forward. The Stage will call all Scenes you added to it in the order of their priority. Here is how we do it:
427
+
428
+ ```ruby
429
+ FelECS::Stage.call
430
+ ```
431
+
432
+ ## Order
433
+
434
+ ### Setting the order
435
+
436
+ To set the order you just need to call `FelECS::Order.sort` and pass Scenes or Systems in the parameters in the order you wish for them to execute
437
+
438
+ ```ruby
439
+ FelECS::Order.sort(
440
+ @system1,
441
+ @system2,
442
+ @system3
443
+ )
444
+ ```
445
+
446
+ If you want some Scenes or Systems to have the same priority then just pass them as an array:
447
+
448
+ ```ruby
449
+ FelECS::Order.sort(
450
+ @scene1,
451
+ [@scene2_1, @scene2_2],
452
+ @scene3
453
+ )
454
+ ```
455
+
456
+ ## Closing Notes
457
+
458
+ There are some methods I haven't gone over in the overview. If you want to see everything and read in more detail check out the [Documentation](https://felflame.tradam.fyi)!
459
+
460
+ # Contribution
461
+ Contributors are welcome! I am always looking to impove the capabilities of game development in Ruby. Feel free to open an issue to discuss a proposed changed or fix. To code a change or fix first fork the project. Next write your changes or fixes. Make sure all your changes and fixes are properly documented using Yard(I will not merge if it is not 100% documented) and make sure everything has tests written for it with Rspec(I will also not merge if it does not have 100% test coverage). Once you have your changes made then simply make a pull request.
462
+
463
+ If you need help writing documentation or tests feel free to ask!
464
+
465
+ If you want to contribute to development with a thanks you can always [buy me a coffee ;^)](https://ko-fi.com/tradam)
data/Rakefile ADDED
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'rspec/core/rake_task'
6
+ require 'yard'
7
+ require_relative './codeclimate/export-coverage'
8
+ require 'bundler/gem_tasks'
9
+ require 'rubocop/rake_task'
10
+
11
+ task default: [:spec, :yard, 'coverage:format']
12
+ # task default: :rubocop
13
+
14
+ desc 'Export to single file'
15
+ task :buildfile do
16
+ result = ''
17
+ main = File.read('lib/felecs.rb')
18
+ tmp = main.lines(chomp: true).select do |line|
19
+ line.include? 'require_relative '
20
+ end
21
+ tmp.each do |file|
22
+ file.delete_prefix!('require_relative ')
23
+ result += "#{File.read("lib/#{file[1, file.length - 2]}.rb")}\n"
24
+ end
25
+
26
+ result += main.lines.reject do |line|
27
+ line.include? 'require_relative '
28
+ end.join
29
+
30
+ `mkdir pkg`
31
+ File.write('pkg/felecs.rb', result)
32
+ File.write('mrbgem/mrblib/felecs.rb', result)
33
+ end
34
+
35
+ RuboCop::RakeTask.new
36
+
37
+ namespace :coverage do
38
+ desc 'format coverage so it can be exported to codeclimate'
39
+ task :format do
40
+ ReportCoverage.format
41
+ end
42
+
43
+ desc 'upload coverage using your key'
44
+ task :upload do
45
+ ReportCoverage.upload
46
+ end
47
+ end
48
+
49
+ YARD::Rake::YardocTask.new do |t|
50
+ t.files = ['lib/felecs.rb', 'lib/felecs/*'] # ['system_manager.rb', 'component_manager.rb', 'entity_manager.rb', 'scene_manager.rb', 'stage_manager.rb', 'felecs.rb']
51
+ t.options = ['--output-dir', './docs', 'yardoc --markup=markdown|textile|rdoc(default)']
52
+ t.stats_options = ['--list-undoc']
53
+ end
54
+
55
+ # Rake::TestTask.new do |t|
56
+ # t.pattern = "tests/**/*_test.rb"
57
+ # end
58
+
59
+ RSpec::Core::RakeTask.new :spec
60
+
61
+ # For installing FelPacks
62
+ # Gem::Specification.find_all.each do |a_gem|
63
+ # next unless a_gem.name.include? 'felpack-'
64
+ #
65
+ # Dir.glob("#{a_gem.gem_dir}/lib/#{a_gem.name.gsub('-', '/')}/tasks/*.rake").each { |r| load r }
66
+ # end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'felflame'
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
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/docs/CNAME ADDED
@@ -0,0 +1 @@
1
+ felflame.tradam.fyi