camerata 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: af96a719ccb22da2f7cfa9911a9fb000bb6e2f35026507f878817e1abaa0df4f
4
+ data.tar.gz: 8d8ee0950b7eaa29931f5d2f457f1df4593211a30451f9d387e9a305d7f95b16
5
+ SHA512:
6
+ metadata.gz: '05289ef39b5e1e6987b3cb9f997977f52f77e3870d12995018c6319df7b91e1bd989ffcc97587e4bfefd1b52edbda90703caf60ae3e1020858ae4d2b694c6f74'
7
+ data.tar.gz: d0f365f1a1ac6b9daa081921d6948255d059085e0becc738e31acf40060d5aa1955f6e239eab6a0abfc36fbc542d8931770ed5fa90b6313efcf8d2a762cdd0e4
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.3
@@ -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 henry@heycanvas.com. 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
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in camerata.gemspec
6
+ gemspec
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ camerata (0.0.1)
5
+ activerecord (>= 4.1)
6
+ sorbet-runtime
7
+ yajl-ruby
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activemodel (6.0.1)
13
+ activesupport (= 6.0.1)
14
+ activerecord (6.0.1)
15
+ activemodel (= 6.0.1)
16
+ activesupport (= 6.0.1)
17
+ activesupport (6.0.1)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 0.7, < 2)
20
+ minitest (~> 5.1)
21
+ tzinfo (~> 1.1)
22
+ zeitwerk (~> 2.2)
23
+ coderay (1.1.2)
24
+ concurrent-ruby (1.1.5)
25
+ diff-lcs (1.3)
26
+ docile (1.3.2)
27
+ i18n (1.7.0)
28
+ concurrent-ruby (~> 1.0)
29
+ json (2.2.0)
30
+ method_source (0.9.2)
31
+ minitest (5.13.0)
32
+ pry (0.12.2)
33
+ coderay (~> 1.1.0)
34
+ method_source (~> 0.9.0)
35
+ rake (10.5.0)
36
+ rspec (3.9.0)
37
+ rspec-core (~> 3.9.0)
38
+ rspec-expectations (~> 3.9.0)
39
+ rspec-mocks (~> 3.9.0)
40
+ rspec-core (3.9.0)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-expectations (3.9.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.9.0)
45
+ rspec-mocks (3.9.0)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.9.0)
48
+ rspec-support (3.9.0)
49
+ simplecov (0.17.1)
50
+ docile (~> 1.1)
51
+ json (>= 1.8, < 3)
52
+ simplecov-html (~> 0.10.0)
53
+ simplecov-html (0.10.2)
54
+ sorbet (0.4.5049)
55
+ sorbet-static (= 0.4.5049)
56
+ sorbet-runtime (0.4.5049)
57
+ sorbet-static (0.4.5049-universal-darwin-14)
58
+ thread_safe (0.3.6)
59
+ tzinfo (1.2.5)
60
+ thread_safe (~> 0.1)
61
+ yajl-ruby (1.4.1)
62
+ zeitwerk (2.2.1)
63
+
64
+ PLATFORMS
65
+ ruby
66
+
67
+ DEPENDENCIES
68
+ bundler (~> 1.17)
69
+ camerata!
70
+ pry
71
+ rake (~> 10.0)
72
+ rspec (~> 3.0)
73
+ simplecov
74
+ sorbet
75
+
76
+ BUNDLED WITH
77
+ 1.17.3
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Henry Tseng
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.
@@ -0,0 +1,83 @@
1
+ # Camerata
2
+
3
+ A serializer for JSONAPI included with a host of decoupled tools for fast and flexible responses.
4
+
5
+ Camerata aims to be opinionated but is designed to be used piece-meal decoupled from existing tools.
6
+
7
+
8
+ ## Upcoming
9
+
10
+ - DSL
11
+ - Write directly to socket
12
+ - Build out network timeout handler
13
+ - Add support for yajl-ruby
14
+ - Direct socket connection
15
+ - Rack Request
16
+ - Rack Response
17
+ - Metadata
18
+ - Fields
19
+ - Pagination
20
+ - Query management; aggregated query
21
+ - Count
22
+ - Group
23
+ - Sorting
24
+ - Eager loading support
25
+ - Cache loaded relationships
26
+ - Includes
27
+ - Middleware support
28
+ - Command design pattern service integration
29
+
30
+ - Tests:
31
+ - Large number of properties
32
+ - Large property value
33
+ - Large number or relationships
34
+ - Relationship-of-relationships
35
+
36
+
37
+ ## Installation
38
+
39
+ Add this line to your application's Gemfile:
40
+
41
+ ```ruby
42
+ gem 'camerata'
43
+ ```
44
+
45
+ And then execute:
46
+
47
+ $ bundle
48
+
49
+ Or install it yourself as:
50
+
51
+ $ gem install camerata
52
+
53
+ ## Usage
54
+
55
+ TODO: Write usage instructions here
56
+
57
+ ## Development
58
+
59
+ 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.
60
+
61
+ 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).
62
+
63
+ ## Contributing
64
+
65
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/camerata. 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.
66
+
67
+ ## License
68
+
69
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
70
+
71
+ ## Code of Conduct
72
+
73
+ Everyone interacting in the Camerata project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/camerata/blob/master/CODE_OF_CONDUCT.md).
74
+
75
+
76
+ ## What does Camerata mean?
77
+
78
+ What does the word camerata mean? Why camerata?
79
+
80
+ Camerata is a shout out to an analogy coined by Jessica Kerr at RubyConf 2019. Rubyists are akin to the Florentine Camerata coming together as a community from varying disciplines.
81
+
82
+ The modern term camerata refers to a small chamber orchestra or choir. An API is likewise in many projects the collaboration of several different hands in a harmonizing composition of services.
83
+
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "camerata"
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
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -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
@@ -0,0 +1,44 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "camerata/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "camerata"
8
+ spec.version = Camerata::VERSION
9
+ spec.authors = ["Henry Tseng"]
10
+ spec.email = ["info@heycanvas.com"]
11
+
12
+ spec.summary = "A serializer for JSONAPI"
13
+ spec.description = "A serializer for JSONAPI included with a host of decoupled tools for fast and flexible responses"
14
+ spec.homepage = "https://github.com/henrytseng/camerata"
15
+ spec.license = "MIT"
16
+
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/henrytseng/camerata"
20
+ spec.metadata["changelog_uri"] = "https://github.com/henrytseng/camerata/CHANGELOG.md"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_development_dependency "bundler", "~> 1.17"
36
+ spec.add_development_dependency "pry"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency "simplecov"
40
+ spec.add_development_dependency "sorbet"
41
+ spec.add_dependency "activerecord", ">= 4.1"
42
+ spec.add_dependency "yajl-ruby"
43
+ spec.add_dependency "sorbet-runtime"
44
+ end
@@ -0,0 +1,6 @@
1
+ # typed: false
2
+
3
+ module Camerata
4
+ require "camerata/version"
5
+ require "camerata/serializer"
6
+ end
@@ -0,0 +1,4 @@
1
+ module Camerata
2
+ class SerializableIdentifier
3
+ end
4
+ end
@@ -0,0 +1,27 @@
1
+ # typed: false
2
+
3
+ require 'yajl'
4
+
5
+ module Camerata
6
+ class Serializer
7
+
8
+ def initialize(encoder: nil)
9
+ @encoder = encoder || Yajl::Encoder.new
10
+ @middleware_list = []
11
+ end
12
+
13
+ def register(&middleware)
14
+ @middleware_list << middleware
15
+ end
16
+
17
+ def marshall(enumerable)
18
+ enumerable.map do |record|
19
+ payload = {}
20
+ @middleware_list.each do |middleware|
21
+ payload = middleware.call(record, payload)
22
+ end
23
+ payload
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ # typed: strong
2
+ module Camerata
3
+ VERSION = "0.0.1"
4
+ end
@@ -0,0 +1,2 @@
1
+ --dir
2
+ .
@@ -0,0 +1,91 @@
1
+ # This file is autogenerated. Do not edit it by hand. Regenerate it with:
2
+ # srb rbi gems
3
+
4
+ # typed: strong
5
+ #
6
+ # If you would like to make changes to this file, great! Please create the gem's shim here:
7
+ #
8
+ # https://github.com/sorbet/sorbet-typed/new/master?filename=lib/coderay/all/coderay.rbi
9
+ #
10
+ # coderay-1.1.2
11
+ module CodeRay
12
+ def self.coderay_path(*path); end
13
+ def self.encode(code, lang, format, options = nil); end
14
+ def self.encode_file(filename, format, options = nil); end
15
+ def self.encode_tokens(tokens, format, options = nil); end
16
+ def self.encoder(format, options = nil); end
17
+ def self.get_scanner_options(options); end
18
+ def self.highlight(code, lang, options = nil, format = nil); end
19
+ def self.highlight_file(filename, options = nil, format = nil); end
20
+ def self.scan(code, lang, options = nil, &block); end
21
+ def self.scan_file(filename, lang = nil, options = nil, &block); end
22
+ def self.scanner(lang, options = nil, &block); end
23
+ end
24
+ module CodeRay::PluginHost
25
+ def [](id, *args, &blk); end
26
+ def all_plugins; end
27
+ def const_missing(const); end
28
+ def default(id = nil); end
29
+ def list; end
30
+ def load(id, *args, &blk); end
31
+ def load_all; end
32
+ def load_plugin_map; end
33
+ def make_plugin_hash; end
34
+ def map(hash); end
35
+ def path_to(plugin_id); end
36
+ def plugin_hash; end
37
+ def plugin_path(*args); end
38
+ def register(plugin, id); end
39
+ def self.extended(mod); end
40
+ def validate_id(id); end
41
+ end
42
+ class CodeRay::PluginHost::PluginNotFound < LoadError
43
+ end
44
+ class CodeRay::PluginHost::HostNotFound < LoadError
45
+ end
46
+ module CodeRay::Encoders
47
+ extend CodeRay::PluginHost
48
+ end
49
+ module CodeRay::Plugin
50
+ def aliases; end
51
+ def plugin_host(host = nil); end
52
+ def plugin_id; end
53
+ def register_for(id); end
54
+ def title(title = nil); end
55
+ end
56
+ class CodeRay::Encoders::Encoder
57
+ def <<(token); end
58
+ def begin_group(kind); end
59
+ def begin_line(kind); end
60
+ def compile(tokens, options = nil); end
61
+ def encode(code, lang, options = nil); end
62
+ def encode_tokens(tokens, options = nil); end
63
+ def end_group(kind); end
64
+ def end_line(kind); end
65
+ def file_extension; end
66
+ def finish(options); end
67
+ def get_output(options); end
68
+ def highlight(code, lang, options = nil); end
69
+ def initialize(options = nil); end
70
+ def options; end
71
+ def options=(arg0); end
72
+ def output(data); end
73
+ def scanner; end
74
+ def scanner=(arg0); end
75
+ def self.const_missing(sym); end
76
+ def self.file_extension; end
77
+ def setup(options); end
78
+ def text_token(text, kind); end
79
+ def token(content, kind); end
80
+ def tokens(tokens, options = nil); end
81
+ extend CodeRay::Plugin
82
+ end
83
+ class CodeRay::Encoders::Terminal < CodeRay::Encoders::Encoder
84
+ def begin_group(kind); end
85
+ def begin_line(kind); end
86
+ def end_group(kind); end
87
+ def end_line(kind); end
88
+ def open_token(kind); end
89
+ def setup(options); end
90
+ def text_token(text, kind); end
91
+ end