community_theatre 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +64 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/modules/gem.iml +19 -0
- data/.idea/modules/reference.iml +17 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +10 -0
- data/bin/console +11 -0
- data/bin/degenerate_fizzbuzz +14 -0
- data/bin/generate_fizzbuzz +29 -0
- data/bin/project_fizzbuzz +31 -0
- data/bin/setup +8 -0
- data/community_theatre.gemspec +43 -0
- data/community_theatre.iml +16 -0
- data/lib/community_theatre/disposable_spooler.rb +55 -0
- data/lib/community_theatre/projector.rb +30 -0
- data/lib/community_theatre/splicing_spooler.rb +46 -0
- data/lib/community_theatre/version.rb +3 -0
- data/lib/community_theatre.rb +7 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a5d32f4bb88edd6740c771dea231dde55c58987effa066876504fba93bae25ff
|
4
|
+
data.tar.gz: d442e54ee7553950258d2b9fd268b33527b69bff079d7d7a5b76c824369ba6fa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1aa49f9fb8cfc59ed8ed73b5b5df0d3e4583607ea301a8bc3a5e8d5719ba1a42add972ee533463900f19c489ddd0b4a54d4f8f93d3fd2a8764bb0bb69beea448
|
7
|
+
data.tar.gz: 3f4a60c92e4ce4e28127c629455c9a15ff7a53c41f7c0671fee300489f3a906d4875e0ecd6b134b930dcacb469758a88048715ce3cf44d8ff2b3d72fb306e3e4
|
data/.gitignore
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
Gemfile.lock
|
10
|
+
|
11
|
+
### JetBrains template
|
12
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
13
|
+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
14
|
+
|
15
|
+
# User-specific stuff
|
16
|
+
.idea/**/workspace.xml
|
17
|
+
.idea/**/misc.xml
|
18
|
+
.idea/**/tasks.xml
|
19
|
+
.idea/**/dictionaries
|
20
|
+
.idea/**/shelf
|
21
|
+
|
22
|
+
# Sensitive or high-churn files
|
23
|
+
.idea/**/dataSources/
|
24
|
+
.idea/**/dataSources.ids
|
25
|
+
.idea/**/dataSources.local.xml
|
26
|
+
.idea/**/sqlDataSources.xml
|
27
|
+
.idea/**/dynamic.xml
|
28
|
+
.idea/**/uiDesigner.xml
|
29
|
+
.idea/**/dbnavigator.xml
|
30
|
+
|
31
|
+
# Gradle
|
32
|
+
.idea/**/gradle.xml
|
33
|
+
.idea/**/libraries
|
34
|
+
|
35
|
+
# CMake
|
36
|
+
cmake-build-debug/
|
37
|
+
cmake-build-release/
|
38
|
+
|
39
|
+
# Mongo Explorer plugin
|
40
|
+
.idea/**/mongoSettings.xml
|
41
|
+
|
42
|
+
# File-based project format
|
43
|
+
*.iws
|
44
|
+
|
45
|
+
# IntelliJ
|
46
|
+
out/
|
47
|
+
|
48
|
+
# mpeltonen/sbt-idea plugin
|
49
|
+
.idea_modules/
|
50
|
+
|
51
|
+
# JIRA plugin
|
52
|
+
atlassian-ide-plugin.xml
|
53
|
+
|
54
|
+
# Cursive Clojure plugin
|
55
|
+
.idea/replstate.xml
|
56
|
+
|
57
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
58
|
+
com_crashlytics_export_strings.xml
|
59
|
+
crashlytics.properties
|
60
|
+
crashlytics-build.properties
|
61
|
+
fabric.properties
|
62
|
+
|
63
|
+
# Editor-based Rest Client
|
64
|
+
.idea/httpRequests
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$/../../community_theatre" />
|
6
|
+
<orderEntry type="jdk" jdkName="rbenv: 2.6.1" jdkType="RUBY_SDK" />
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
8
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, rbenv: 2.6.1) [gem]" level="application" />
|
9
|
+
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.2, rbenv: 2.6.1) [gem]" level="application" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.2, rbenv: 2.6.1) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, rbenv: 2.6.1) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="msgpack (v1.2.6, rbenv: 2.6.1) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="pry (v0.12.2, rbenv: 2.6.1) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, rbenv: 2.6.1) [gem]" level="application" />
|
15
|
+
</component>
|
16
|
+
<component name="RubyModuleProperties">
|
17
|
+
<option name="autoCreated" value="true" />
|
18
|
+
</component>
|
19
|
+
</module>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$/../../reference" />
|
6
|
+
<orderEntry type="jdk" jdkName="rbenv: 2.6.1" jdkType="RUBY_SDK" />
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
8
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, rbenv: 2.6.1) [gem]" level="application" />
|
9
|
+
<orderEntry type="library" scope="PROVIDED" name="mustermann (v1.0.3, rbenv: 2.6.1) [gem]" level="application" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-protection (v2.0.5, rbenv: 2.6.1) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="sinatra (v2.0.5, rbenv: 2.6.1) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.9, rbenv: 2.6.1) [gem]" level="application" />
|
13
|
+
</component>
|
14
|
+
<component name="RubyModuleProperties">
|
15
|
+
<option name="autoCreated" value="true" />
|
16
|
+
</component>
|
17
|
+
</module>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/community_theatre.iml" filepath="$PROJECT_DIR$/community_theatre.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at TODO: Write your email address. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Liam Dawson
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# CommunityTheatre
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/community_theatre`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'community_theatre'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install community_theatre
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/community_theatre. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
+
|
41
|
+
## Code of Conduct
|
42
|
+
|
43
|
+
Everyone interacting in the CommunityTheatre project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/community_theatre/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "community_theatre"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
require "pry"
|
10
|
+
pry.start
|
11
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "community_theatre"
|
5
|
+
|
6
|
+
spooler = CommunityTheatre::DisposableSpooler.new(ARGV[0])
|
7
|
+
spooler.unspool.each do |i|
|
8
|
+
print "#{i['val']}: "
|
9
|
+
if i['fizz'] && i['buzz']
|
10
|
+
puts "fizzbuzz"
|
11
|
+
else
|
12
|
+
puts ""
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "community_theatre"
|
5
|
+
|
6
|
+
class FizzBuzzSource
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
def initialize(source)
|
10
|
+
@source = source
|
11
|
+
|
12
|
+
x = []
|
13
|
+
end
|
14
|
+
|
15
|
+
def seek_to!(item_count, _)
|
16
|
+
@source = @source.drop(item_count)
|
17
|
+
end
|
18
|
+
|
19
|
+
def each(&block)
|
20
|
+
until @source.empty?
|
21
|
+
yield @source.shift
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
data = (1..5500).map {|i| {val: i, fizz: (i % 3).zero?, buzz: (i % 5).zero?}}
|
27
|
+
|
28
|
+
spooler = CommunityTheatre::SplicingSpooler.new(ARGV[0], page_size: (ARGV[1] || 500).to_i)
|
29
|
+
spooler.spool!(FizzBuzzSource.new(data))
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "community_theatre"
|
5
|
+
require 'csv'
|
6
|
+
|
7
|
+
spooler = CommunityTheatre::DisposableSpooler.new(ARGV[0])
|
8
|
+
class FizzBuzzProjector < CommunityTheatre::Projector
|
9
|
+
def pre_project
|
10
|
+
@fizzbuzzes = Set.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def process_item(item)
|
14
|
+
value = item['val']
|
15
|
+
|
16
|
+
if item['fizz'] && item['buzz']
|
17
|
+
@fizzbuzzes.add(value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def post_project
|
22
|
+
CSV.open(projector_dir_path("fizzbuzzes.csv"), 'w') do |csv|
|
23
|
+
csv << ["number"]
|
24
|
+
|
25
|
+
@fizzbuzzes.each {|n| csv << [n]}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
projector = FizzBuzzProjector.new(spooler, File.join(__dir__, "../"))
|
31
|
+
projector.project
|
data/bin/setup
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "community_theatre/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "community_theatre"
|
8
|
+
spec.version = CommunityTheatre::VERSION
|
9
|
+
spec.authors = ["Liam Dawson"]
|
10
|
+
spec.email = ["liam@ldaws.com"]
|
11
|
+
|
12
|
+
spec.summary = "Prepare a changelog or event source for local projection."
|
13
|
+
spec.homepage = "https://github.com/liamdawson/community_theatre.git"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = "https://github.com/liamdawson/community_theatre.git"
|
23
|
+
spec.metadata["changelog_uri"] = "https://github.com/liamdawson/community_theatre/blob/master/CHANGELOG.md"
|
24
|
+
else
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
+
"public gem pushes."
|
27
|
+
end
|
28
|
+
|
29
|
+
# Specify which files should be added to the gem when it is released.
|
30
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
|
+
end
|
34
|
+
spec.bindir = "exe"
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
|
38
|
+
spec.add_runtime_dependency "msgpack", "~> 1.2"
|
39
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
42
|
+
spec.add_development_dependency "pry", "~> 0.12"
|
43
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
6
|
+
<orderEntry type="jdk" jdkName="rbenv: 2.6.1" jdkType="RUBY_SDK" />
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
8
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, rbenv: 2.6.1) [gem]" level="application" />
|
9
|
+
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.2, rbenv: 2.6.1) [gem]" level="application" />
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.2, rbenv: 2.6.1) [gem]" level="application" />
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, rbenv: 2.6.1) [gem]" level="application" />
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="msgpack (v1.2.6, rbenv: 2.6.1) [gem]" level="application" />
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="pry (v0.12.2, rbenv: 2.6.1) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, rbenv: 2.6.1) [gem]" level="application" />
|
15
|
+
</component>
|
16
|
+
</module>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'msgpack'
|
4
|
+
|
5
|
+
module CommunityTheatre
|
6
|
+
class DisposableSpooler
|
7
|
+
def initialize(dest, page_size: 100)
|
8
|
+
@page_size = page_size
|
9
|
+
@destination = dest
|
10
|
+
end
|
11
|
+
|
12
|
+
def spool!(enumerable)
|
13
|
+
enumerable.each_slice(@page_size).each_with_index do |page, index|
|
14
|
+
file_for_page(index) do |file|
|
15
|
+
packer = MessagePack::Packer.new(file)
|
16
|
+
packer.write_array_header(page.size)
|
17
|
+
|
18
|
+
page.each {|item| packer.write(item)}
|
19
|
+
|
20
|
+
packer.flush
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def unspool
|
26
|
+
Enumerator.new do |yielder|
|
27
|
+
existing_pages.each do |page_no|
|
28
|
+
file_for_page(page_no, 'r') do |file|
|
29
|
+
page = MessagePack::Unpacker.new(file).unpack
|
30
|
+
page.each {|item| yielder << item}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def existing_pages
|
39
|
+
Dir.entries(@destination)
|
40
|
+
.map{|n| File.join(@destination, n)}
|
41
|
+
.filter {|n| File.file?(n)}
|
42
|
+
.filter {|n| n =~ /\/\d+$/}
|
43
|
+
.map {|n| /\/(\d+)$/.match(n)[1].to_i }
|
44
|
+
.sort
|
45
|
+
end
|
46
|
+
|
47
|
+
def path_for_page(n)
|
48
|
+
File.join(@destination, n.to_s)
|
49
|
+
end
|
50
|
+
|
51
|
+
def file_for_page(n, mode='w', &block)
|
52
|
+
File.open(path_for_page(n), mode, &block)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module CommunityTheatre
|
2
|
+
class Projector
|
3
|
+
def initialize(spooler, path_base)
|
4
|
+
@spooler = spooler
|
5
|
+
@path_base = path_base
|
6
|
+
end
|
7
|
+
|
8
|
+
def projector_dir_path(*args)
|
9
|
+
File.join(@path_base, *args)
|
10
|
+
end
|
11
|
+
|
12
|
+
def pre_project;
|
13
|
+
end
|
14
|
+
|
15
|
+
def post_project;
|
16
|
+
end
|
17
|
+
|
18
|
+
def process_item(item)
|
19
|
+
;
|
20
|
+
end
|
21
|
+
|
22
|
+
def project
|
23
|
+
pre_project
|
24
|
+
|
25
|
+
@spooler.unspool.each(&method(:process_item))
|
26
|
+
|
27
|
+
post_project
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'msgpack'
|
4
|
+
|
5
|
+
module CommunityTheatre
|
6
|
+
class SplicingSpooler < DisposableSpooler
|
7
|
+
def initialize(dest, page_size: 100)
|
8
|
+
super(dest, page_size: page_size)
|
9
|
+
end
|
10
|
+
|
11
|
+
def spool!(enumerable)
|
12
|
+
pages = existing_pages
|
13
|
+
# for convenience's sake, rebuild the last page now
|
14
|
+
starting_page = [pages.size - 1, 0].max
|
15
|
+
skip_number = starting_page * @page_size
|
16
|
+
|
17
|
+
enumerable.seek_to!(skip_number, last_entry_of_second_last_page)
|
18
|
+
|
19
|
+
enumerable.each_slice(@page_size).each_with_index do |page, index|
|
20
|
+
file_for_page(index + starting_page) do |file|
|
21
|
+
packer = MessagePack::Packer.new(file)
|
22
|
+
packer.write_array_header(page.size)
|
23
|
+
|
24
|
+
page.each {|item| packer.write(item)}
|
25
|
+
|
26
|
+
packer.flush
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def last_entry_of_second_last_page
|
34
|
+
pages = existing_pages
|
35
|
+
|
36
|
+
return if pages.size < 2
|
37
|
+
|
38
|
+
file_for_page(pages[-2], 'r') do |f|
|
39
|
+
page = MessagePack::Unpacker.new(f).unpack
|
40
|
+
|
41
|
+
page.last
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: community_theatre
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Liam Dawson
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: msgpack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.12'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.12'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- liam@ldaws.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
92
|
+
- ".idea/modules.xml"
|
93
|
+
- ".idea/modules/gem.iml"
|
94
|
+
- ".idea/modules/reference.iml"
|
95
|
+
- ".idea/vcs.xml"
|
96
|
+
- ".travis.yml"
|
97
|
+
- CODE_OF_CONDUCT.md
|
98
|
+
- Gemfile
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- bin/console
|
103
|
+
- bin/degenerate_fizzbuzz
|
104
|
+
- bin/generate_fizzbuzz
|
105
|
+
- bin/project_fizzbuzz
|
106
|
+
- bin/setup
|
107
|
+
- community_theatre.gemspec
|
108
|
+
- community_theatre.iml
|
109
|
+
- lib/community_theatre.rb
|
110
|
+
- lib/community_theatre/disposable_spooler.rb
|
111
|
+
- lib/community_theatre/projector.rb
|
112
|
+
- lib/community_theatre/splicing_spooler.rb
|
113
|
+
- lib/community_theatre/version.rb
|
114
|
+
homepage: https://github.com/liamdawson/community_theatre.git
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata:
|
118
|
+
homepage_uri: https://github.com/liamdawson/community_theatre.git
|
119
|
+
source_code_uri: https://github.com/liamdawson/community_theatre.git
|
120
|
+
changelog_uri: https://github.com/liamdawson/community_theatre/blob/master/CHANGELOG.md
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubygems_version: 3.0.3
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: Prepare a changelog or event source for local projection.
|
140
|
+
test_files: []
|