cistern 2.8.0 → 2.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +1 -0
- data/CHANGELOG.md +18 -0
- data/lib/cistern/associations.rb +1 -0
- data/lib/cistern/attributes.rb +2 -0
- data/lib/cistern/client.rb +2 -0
- data/lib/cistern/collection.rb +2 -0
- data/lib/cistern/coverage.rb +2 -0
- data/lib/cistern/data/hash.rb +2 -0
- data/lib/cistern/data/redis.rb +2 -0
- data/lib/cistern/data.rb +2 -0
- data/lib/cistern/formatter/awesome_print.rb +7 -3
- data/lib/cistern/formatter/default.rb +2 -0
- data/lib/cistern/formatter/formatador.rb +8 -6
- data/lib/cistern/formatter.rb +2 -0
- data/lib/cistern/hash.rb +2 -0
- data/lib/cistern/hash_support.rb +2 -0
- data/lib/cistern/mock.rb +2 -0
- data/lib/cistern/model.rb +2 -0
- data/lib/cistern/request.rb +2 -0
- data/lib/cistern/service.rb +2 -0
- data/lib/cistern/singular.rb +2 -0
- data/lib/cistern/string.rb +2 -0
- data/lib/cistern/timeout.rb +2 -0
- data/lib/cistern/version.rb +3 -1
- data/lib/cistern/wait_for.rb +2 -0
- data/lib/cistern.rb +2 -0
- data/spec/associations_spec.rb +2 -0
- data/spec/attributes_spec.rb +2 -0
- data/spec/client_spec.rb +2 -0
- data/spec/collection_spec.rb +2 -0
- data/spec/coverage_spec.rb +2 -0
- data/spec/dirty_spec.rb +2 -0
- data/spec/formatter_spec.rb +24 -4
- data/spec/hash_spec.rb +2 -0
- data/spec/mock_data_spec.rb +2 -0
- data/spec/model_spec.rb +2 -0
- data/spec/request_spec.rb +2 -0
- data/spec/singular_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/service.rb +2 -0
- data/spec/wait_for_spec.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6949d6bf767316892c02a7ae3ae1f14afc2cff8331b4fc0a72bf93295e126e7a
|
4
|
+
data.tar.gz: d2a27bae1d717ec47ed4f6135cc7fa4e635423a1f81e7facd2b616cf33eed3ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '02565729c04cff5108f5b3b7547e635b3c3a56dd239d00bb3108b8106a05ad7a50d79b03992dddea1a136bf66552d97a3c140d282a1218c73c5b0e4df1116b2a'
|
7
|
+
data.tar.gz: aa96a0b7dd8ad8e985e4ee8c9f1d22f8c8ca673b9ef9346d7771a4b853440791a7acef4a9f95fb6cb2c86b69f0d969bc8c8cc8f62f9a92c793798781601631cc
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [Unreleased](https://github.com/lanej/cistern/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/lanej/cistern/compare/v2.7.2...HEAD)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- fix codeclimate reporting [\#80](https://github.com/lanej/cistern/pull/80) ([lanej](https://github.com/lanej))
|
10
|
+
- Add support for a Date type. [\#78](https://github.com/lanej/cistern/pull/78) ([leklund](https://github.com/leklund))
|
11
|
+
- fix 0.12 branch for ruby 2.4 [\#77](https://github.com/lanej/cistern/pull/77) ([ehowe](https://github.com/ehowe))
|
12
|
+
|
13
|
+
## [v2.7.2](https://github.com/lanej/cistern/tree/v2.7.2) (2016-10-21)
|
14
|
+
[Full Changelog](https://github.com/lanej/cistern/compare/v2.7.1...v2.7.2)
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- feature: add \#clone\_attributes [\#75](https://github.com/lanej/cistern/pull/75) ([lanej](https://github.com/lanej))
|
19
|
+
- fix: alias attributes= to merge\_attributes [\#74](https://github.com/lanej/cistern/pull/74) ([lanej](https://github.com/lanej))
|
20
|
+
|
3
21
|
## [v2.7.1](https://github.com/lanej/cistern/tree/v2.7.1) (2016-08-26)
|
4
22
|
[Full Changelog](https://github.com/lanej/cistern/compare/v2.7.0...v2.7.1)
|
5
23
|
|
data/lib/cistern/associations.rb
CHANGED
data/lib/cistern/attributes.rb
CHANGED
data/lib/cistern/client.rb
CHANGED
data/lib/cistern/collection.rb
CHANGED
data/lib/cistern/coverage.rb
CHANGED
data/lib/cistern/data/hash.rb
CHANGED
data/lib/cistern/data/redis.rb
CHANGED
data/lib/cistern/data.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'awesome_print'
|
2
4
|
|
3
5
|
module Cistern::Formatter::AwesomePrint
|
@@ -27,14 +29,16 @@ module AwesomePrint::Cistern
|
|
27
29
|
# Format Cistern::Model
|
28
30
|
#------------------------------------------------------------------------------
|
29
31
|
def awesome_cistern_model(object)
|
30
|
-
data = object.attributes.keys.sort.each_with_object({})
|
31
|
-
|
32
|
+
data = object.attributes.keys.sort.each_with_object({}) do |e, a|
|
33
|
+
a[e] = object.read_attribute(e)
|
34
|
+
end
|
35
|
+
"#{object} #{awesome_hash(data)}"
|
32
36
|
end
|
33
37
|
|
34
38
|
# Format Cistern::Model
|
35
39
|
#------------------------------------------------------------------------------
|
36
40
|
def awesome_cistern_collection(object)
|
37
|
-
"#{object.class.name}
|
41
|
+
"#{object.class.name} #{awesome_hash(attributes: object.attributes, records: object.to_a)}"
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'formatador'
|
2
4
|
|
3
5
|
module Cistern::Formatter::Formatador
|
@@ -12,24 +14,24 @@ module Cistern::Formatter::Formatador
|
|
12
14
|
|
13
15
|
def self.model_inspect(model)
|
14
16
|
Thread.current[:formatador] ||= Formatador.new
|
15
|
-
data = "#{Thread.current[:formatador].indentation}<#{model.class.name}"
|
17
|
+
data = ["#{Thread.current[:formatador].indentation}<#{model.class.name}"]
|
16
18
|
Thread.current[:formatador].indent do
|
17
19
|
unless model.class.attributes.empty?
|
18
20
|
data << "\n#{Thread.current[:formatador].indentation}"
|
19
|
-
data << model.class.attributes.map { |attribute, _| "#{attribute}=#{model.
|
21
|
+
data << model.class.attributes.map { |attribute, _| "#{attribute}=#{model.read_attribute(attribute).inspect}" }.join(",\n#{Thread.current[:formatador].indentation}")
|
20
22
|
end
|
21
23
|
end
|
22
24
|
data << "\n#{Thread.current[:formatador].indentation}>"
|
23
|
-
data
|
25
|
+
data.join
|
24
26
|
end
|
25
27
|
|
26
28
|
def self.collection_inspect(collection)
|
27
29
|
Thread.current[:formatador] ||= Formatador.new
|
28
|
-
data = "#{Thread.current[:formatador].indentation}<#{collection.class.name}\n"
|
30
|
+
data = ["#{Thread.current[:formatador].indentation}<#{collection.class.name}\n"]
|
29
31
|
Thread.current[:formatador].indent do
|
30
32
|
unless collection.class.attributes.empty?
|
31
33
|
data << "#{Thread.current[:formatador].indentation}"
|
32
|
-
data << collection.class.attributes.map { |attribute| "#{attribute}=#{
|
34
|
+
data << collection.class.attributes.map { |attribute, _| "#{attribute}=#{collection.read_attribute(attribute).inspect}" }.join(",\n#{Thread.current[:formatador].indentation}")
|
33
35
|
data << "\n"
|
34
36
|
end
|
35
37
|
data << "#{Thread.current[:formatador].indentation}["
|
@@ -44,7 +46,7 @@ module Cistern::Formatter::Formatador
|
|
44
46
|
data << "]\n"
|
45
47
|
end
|
46
48
|
data << "#{Thread.current[:formatador].indentation}>"
|
47
|
-
data
|
49
|
+
data.join
|
48
50
|
end
|
49
51
|
|
50
52
|
def table(attributes = nil)
|
data/lib/cistern/formatter.rb
CHANGED
data/lib/cistern/hash.rb
CHANGED
data/lib/cistern/hash_support.rb
CHANGED
data/lib/cistern/mock.rb
CHANGED
data/lib/cistern/model.rb
CHANGED
data/lib/cistern/request.rb
CHANGED
data/lib/cistern/service.rb
CHANGED
data/lib/cistern/singular.rb
CHANGED
data/lib/cistern/string.rb
CHANGED
data/lib/cistern/timeout.rb
CHANGED
data/lib/cistern/version.rb
CHANGED
data/lib/cistern/wait_for.rb
CHANGED
data/lib/cistern.rb
CHANGED
data/spec/associations_spec.rb
CHANGED
data/spec/attributes_spec.rb
CHANGED
data/spec/client_spec.rb
CHANGED
data/spec/collection_spec.rb
CHANGED
data/spec/coverage_spec.rb
CHANGED
data/spec/dirty_spec.rb
CHANGED
data/spec/formatter_spec.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
class Inspector < Sample::Model
|
4
6
|
identity :id
|
5
7
|
attribute :name
|
8
|
+
|
9
|
+
has_many :employees, -> { Inspectors.new(associate_id: id).all }
|
10
|
+
has_many :managers, -> { Inspectors.new(associate_id: nil).all }
|
6
11
|
end
|
7
12
|
|
8
13
|
class Anon < Sample::Model
|
@@ -10,11 +15,13 @@ class Anon < Sample::Model
|
|
10
15
|
end
|
11
16
|
|
12
17
|
class Inspectors < Sample::Collection
|
18
|
+
attribute :associate_id
|
19
|
+
|
13
20
|
model Inspector
|
14
21
|
|
15
22
|
def all(options = {})
|
16
23
|
merge_attributes(options)
|
17
|
-
load([{ id: 1, name: '2' }, { id: 3, name: '4' }])
|
24
|
+
load([{ id: 1, name: '2', managers: [{ id: 5, name: '5'}]}, { id: 3, name: '4' }, employees: [{ id: 9, name: '8'}]])
|
18
25
|
end
|
19
26
|
end
|
20
27
|
|
@@ -64,20 +71,33 @@ describe Cistern::Formatter::Formatador do
|
|
64
71
|
|
65
72
|
expect(Inspector.new(id: 1, name: 'name').inspect).to eq(' <Inspector
|
66
73
|
id=1,
|
67
|
-
name="name"
|
74
|
+
name="name",
|
75
|
+
employees=nil,
|
76
|
+
managers=nil
|
68
77
|
>')
|
69
78
|
end
|
70
79
|
|
71
80
|
it 'formats a collection' do
|
72
81
|
expect(Inspectors.new.all.inspect).to eq(' <Inspectors
|
82
|
+
associate_id=nil
|
73
83
|
[
|
74
84
|
<Inspector
|
75
85
|
id=1,
|
76
|
-
name="2"
|
86
|
+
name="2",
|
87
|
+
employees=nil,
|
88
|
+
managers=[{"id"=>5, "name"=>"5"}]
|
77
89
|
>,
|
78
90
|
<Inspector
|
79
91
|
id=3,
|
80
|
-
name="4"
|
92
|
+
name="4",
|
93
|
+
employees=nil,
|
94
|
+
managers=nil
|
95
|
+
>,
|
96
|
+
<Inspector
|
97
|
+
id=nil,
|
98
|
+
name=nil,
|
99
|
+
employees=[{"id"=>9, "name"=>"8"}],
|
100
|
+
managers=nil
|
81
101
|
>
|
82
102
|
]
|
83
103
|
>')
|
data/spec/hash_spec.rb
CHANGED
data/spec/mock_data_spec.rb
CHANGED
data/spec/model_spec.rb
CHANGED
data/spec/request_spec.rb
CHANGED
data/spec/singular_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/support/service.rb
CHANGED
data/spec/wait_for_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cistern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Lane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: API client framework extracted from Fog
|
14
14
|
email:
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.6
|
94
|
+
rubygems_version: 2.7.6
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: API client framework
|