supa 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
  [![Build Status](https://travis-ci.org/dasnotme/supa.svg?branch=master)](https://travis-ci.org/dasnotme/supa)
6
+ [![Code Climate](https://codeclimate.com/github/dasnotme/supa/badges/gpa.svg)](https://codeclimate.com/github/dasnotme/supa)
7
+ [![Test Coverage](https://codeclimate.com/github/dasnotme/supa/badges/coverage.svg)](https://codeclimate.com/github/dasnotme/supa/coverage)
8
+ [![Issue Count](https://codeclimate.com/github/dasnotme/supa/badges/issue_count.svg)](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
@@ -8,7 +8,7 @@ end
8
8
 
9
9
  Rake::TestTask.new(:bench) do |t|
10
10
  t.libs << %w(spec lib)
11
- t.test_files = FileList['spec/**/*_bench.rb']
11
+ t.test_files = FileList['spec/benchmarks/**/*_bench.rb']
12
12
  end
13
13
 
14
14
  task :default => :test
@@ -15,12 +15,8 @@ module Supa
15
15
  private
16
16
  attr_reader :context, :tree, :name, :options, :block
17
17
 
18
- def with_getter?
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,9 +4,7 @@ module Supa
4
4
  module Commands
5
5
  class Attribute < Supa::Command
6
6
  def represent
7
- value = with_getter? ? context.instance_exec(&getter) : context.send(name)
8
-
9
- tree[name] = value
7
+ tree[name] = get_value
10
8
  end
11
9
  end
12
10
  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(values).each do |value|
9
+ Array(get_value).each do |element|
12
10
  tree[name] << {}
13
11
 
14
- Supa::Builder.new(context: value, tree: tree[name][-1]).instance_exec(&block)
12
+ Supa::Builder.new(context: element, tree: tree[name][-1]).instance_exec(&block)
15
13
  end
16
14
  end
17
15
  end
@@ -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: value, tree: tree[name]).instance_exec(&block)
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(values).each do |value|
9
+ Array(get_value).each do |element|
12
10
  tree[name] << {}
13
11
 
14
- Supa::Builder.new(context: value, tree: tree[name][-1]).instance_exec(&block)
12
+ Supa::Builder.new(context: element, tree: tree[name][-1]).instance_exec(&block)
15
13
  end
16
14
  end
17
15
  end
@@ -1,3 +1,3 @@
1
1
  module Supa
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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.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-23 00:00:00.000000000 Z
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:
Binary file