supa 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +23 -0
- data/.rubocop.yml +1156 -0
- data/.travis.yml +7 -0
- data/README.md +6 -3
- data/Rakefile +1 -1
- data/lib/supa/command.rb +2 -6
- data/lib/supa/commands/attribute.rb +1 -3
- data/lib/supa/commands/collection.rb +2 -4
- data/lib/supa/commands/object.rb +1 -3
- data/lib/supa/commands/polymorphic.rb +2 -4
- data/lib/supa/version.rb +1 -1
- data/supa.gemspec +3 -9
- metadata +33 -5
- data/supa-0.1.0.gem +0 -0
data/.travis.yml
CHANGED
@@ -3,3 +3,10 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- 2.3.1
|
5
5
|
before_install: gem install bundler -v 1.13.1
|
6
|
+
addons:
|
7
|
+
code_climate:
|
8
|
+
repo_token: eb758a7a8b04369f929aa1b962bc9764b6517539971b785600065cf5ad93e282
|
9
|
+
after_success:
|
10
|
+
- bundle exec codeclimate-test-reporter
|
11
|
+
notifications:
|
12
|
+
email: false
|
data/README.md
CHANGED
@@ -3,24 +3,27 @@
|
|
3
3
|
Ruby object → JSON serialization.
|
4
4
|
|
5
5
|
[](https://travis-ci.org/dasnotme/supa)
|
6
|
+
[](https://codeclimate.com/github/dasnotme/supa)
|
7
|
+
[](https://codeclimate.com/github/dasnotme/supa/coverage)
|
8
|
+
[](https://codeclimate.com/github/dasnotme/supa)
|
6
9
|
|
7
10
|
## Introduction
|
8
11
|
|
9
12
|
|
10
13
|
## Installation
|
11
14
|
|
12
|
-
Add this line to your application's Gemfile
|
15
|
+
Add this line to your application's Gemfile
|
13
16
|
|
14
17
|
```ruby
|
15
18
|
gem 'supa'
|
16
19
|
```
|
17
20
|
|
18
|
-
And then execute
|
21
|
+
And then execute
|
19
22
|
```shell
|
20
23
|
bundle install
|
21
24
|
```
|
22
25
|
|
23
|
-
Or install it yourself as
|
26
|
+
Or install it yourself as
|
24
27
|
```
|
25
28
|
gem install supa
|
26
29
|
```
|
data/Rakefile
CHANGED
data/lib/supa/command.rb
CHANGED
@@ -15,12 +15,8 @@ module Supa
|
|
15
15
|
private
|
16
16
|
attr_reader :context, :tree, :name, :options, :block
|
17
17
|
|
18
|
-
def
|
19
|
-
options[:getter].is_a?(Proc)
|
20
|
-
end
|
21
|
-
|
22
|
-
def getter
|
23
|
-
options[:getter]
|
18
|
+
def get_value
|
19
|
+
options[:getter].is_a?(Proc) ? context.instance_exec(&options[:getter]) : context.send(name)
|
24
20
|
end
|
25
21
|
end
|
26
22
|
end
|
@@ -4,14 +4,12 @@ module Supa
|
|
4
4
|
module Commands
|
5
5
|
class Collection < Supa::Command
|
6
6
|
def represent
|
7
|
-
values = with_getter? ? context.instance_exec(&getter) : context.send(name)
|
8
|
-
|
9
7
|
tree[name] = []
|
10
8
|
|
11
|
-
Array(
|
9
|
+
Array(get_value).each do |element|
|
12
10
|
tree[name] << {}
|
13
11
|
|
14
|
-
Supa::Builder.new(context:
|
12
|
+
Supa::Builder.new(context: element, tree: tree[name][-1]).instance_exec(&block)
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
data/lib/supa/commands/object.rb
CHANGED
@@ -4,11 +4,9 @@ module Supa
|
|
4
4
|
module Commands
|
5
5
|
class Object < Supa::Command
|
6
6
|
def represent
|
7
|
-
value = with_getter? ? context.instance_exec(&getter) : context.send(name)
|
8
|
-
|
9
7
|
tree[name] = {}
|
10
8
|
|
11
|
-
Supa::Builder.new(context:
|
9
|
+
Supa::Builder.new(context: get_value, tree: tree[name]).instance_exec(&block)
|
12
10
|
end
|
13
11
|
end
|
14
12
|
end
|
@@ -4,14 +4,12 @@ module Supa
|
|
4
4
|
module Commands
|
5
5
|
class Polymorphic < Supa::Command
|
6
6
|
def represent
|
7
|
-
values = with_getter? ? context.instance_exec(&getter) : context.send(name)
|
8
|
-
|
9
7
|
tree[name] ||= []
|
10
8
|
|
11
|
-
Array(
|
9
|
+
Array(get_value).each do |element|
|
12
10
|
tree[name] << {}
|
13
11
|
|
14
|
-
Supa::Builder.new(context:
|
12
|
+
Supa::Builder.new(context: element, tree: tree[name][-1]).instance_exec(&block)
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
data/lib/supa/version.rb
CHANGED
data/supa.gemspec
CHANGED
@@ -6,6 +6,7 @@ require 'supa/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "supa"
|
8
8
|
spec.version = Supa::VERSION
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
9
10
|
spec.authors = ["Das"]
|
10
11
|
spec.email = [""]
|
11
12
|
|
@@ -14,15 +15,6 @@ Gem::Specification.new do |spec|
|
|
14
15
|
spec.homepage = "https://github.com/dasnotme/supa"
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
-
else
|
22
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
-
"public gem pushes."
|
24
|
-
end
|
25
|
-
|
26
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
19
|
f.match(%r{^(test|spec|features)/})
|
28
20
|
end
|
@@ -33,4 +25,6 @@ Gem::Specification.new do |spec|
|
|
33
25
|
spec.add_development_dependency "bundler", "~> 1.13"
|
34
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
27
|
spec.add_development_dependency "minitest", "~> 5.0"
|
28
|
+
spec.add_development_dependency "simplecov", "~> 0.12"
|
29
|
+
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
36
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Das
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: codeclimate-test-reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.0
|
55
83
|
description: Ruby object → JSON serialization.
|
56
84
|
email:
|
57
85
|
- ''
|
@@ -59,7 +87,9 @@ executables: []
|
|
59
87
|
extensions: []
|
60
88
|
extra_rdoc_files: []
|
61
89
|
files:
|
90
|
+
- .codeclimate.yml
|
62
91
|
- .gitignore
|
92
|
+
- .rubocop.yml
|
63
93
|
- .travis.yml
|
64
94
|
- CODE_OF_CONDUCT.md
|
65
95
|
- Gemfile
|
@@ -78,13 +108,11 @@ files:
|
|
78
108
|
- lib/supa/commands/polymorphic.rb
|
79
109
|
- lib/supa/representable.rb
|
80
110
|
- lib/supa/version.rb
|
81
|
-
- supa-0.1.0.gem
|
82
111
|
- supa.gemspec
|
83
112
|
homepage: https://github.com/dasnotme/supa
|
84
113
|
licenses:
|
85
114
|
- MIT
|
86
|
-
metadata:
|
87
|
-
allowed_push_host: 'TODO: Set to ''http://mygemserver.com'''
|
115
|
+
metadata: {}
|
88
116
|
post_install_message:
|
89
117
|
rdoc_options: []
|
90
118
|
require_paths:
|
data/supa-0.1.0.gem
DELETED
Binary file
|