ppl 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/ppl.rb +2 -1
- data/lib/ppl/adapter/storage/git.rb +20 -12
- data/lib/ppl/error/invalid_vcard.rb +2 -0
- data/lib/ppl/format/table.rb +3 -1
- data/ppl.gemspec +3 -2
- data/spec/ppl/adapter/storage/git_spec.rb +10 -0
- data/spec/ppl/format/table_spec.rb +10 -0
- data/spec/spec_helper.rb +5 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de5c3bfa9ec90c3aad5dace9f52e3ac33a24d53c
|
4
|
+
data.tar.gz: 0c3ecacd962b11facb97e41d8ec59b3b64350554
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40fc44570b1d55fcd8fe915798ed6913cdfa932a00bf785288b5bbae76b5afcb85d39eb81d0b69c2b7e6d81983f7ef4edab9a0058f15b5c37b845cc4e548f763
|
7
|
+
data.tar.gz: 5eb285ac6574d192cb79f9a873c621b5f66ace980c6248703644d10ccb1d9d30df26d4cfa81f3e00870da9368355a07340390919fecdd8e714ec7bfa7ddb11ca
|
data/README.md
CHANGED
@@ -14,6 +14,7 @@ ppl if:
|
|
14
14
|
|
15
15
|
[![Build Status](https://secure.travis-ci.org/h2s/ppl.png)](http://travis-ci.org/h2s/ppl)
|
16
16
|
[![Code Climate](https://codeclimate.com/github/h2s/ppl.png)](https://codeclimate.com/github/h2s/ppl)
|
17
|
+
[![Coverage Status](https://coveralls.io/repos/h2s/ppl/badge.png?branch=master)](https://coveralls.io/r/h2s/ppl?branch=master)
|
17
18
|
|
18
19
|
Installation
|
19
20
|
------------
|
data/lib/ppl.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module Ppl
|
3
3
|
|
4
|
-
Version = "2.
|
4
|
+
Version = "2.3.1"
|
5
5
|
|
6
6
|
module Adapter
|
7
7
|
end
|
@@ -81,6 +81,7 @@ require "ppl/entity/postal_address"
|
|
81
81
|
require "ppl/error/completion_not_found"
|
82
82
|
require "ppl/error/contact_not_found"
|
83
83
|
require "ppl/error/incorrect_usage"
|
84
|
+
require "ppl/error/invalid_vcard"
|
84
85
|
require "ppl/error/postal_address_not_found"
|
85
86
|
|
86
87
|
require "ppl/format/address_book"
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require "rugged"
|
3
2
|
require "socket"
|
4
3
|
|
@@ -40,17 +39,11 @@ class Ppl::Adapter::Storage::Git < Ppl::Adapter::Storage
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def load_contact(id)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
if !vcard.nil?
|
49
|
-
contact = @vcard_adapter.decode(vcard)
|
50
|
-
contact.id = id
|
42
|
+
begin
|
43
|
+
read_contact_from_disk id
|
44
|
+
rescue GreenCard::InvalidEncodingError
|
45
|
+
raise Ppl::Error::InvalidVcard, "#{id}.vcf contains invalid data"
|
51
46
|
end
|
52
|
-
|
53
|
-
return contact
|
54
47
|
end
|
55
48
|
|
56
49
|
def save_contact(contact)
|
@@ -117,5 +110,20 @@ class Ppl::Adapter::Storage::Git < Ppl::Adapter::Storage
|
|
117
110
|
@disk.path
|
118
111
|
end
|
119
112
|
|
120
|
-
|
113
|
+
private
|
121
114
|
|
115
|
+
def read_contact_from_disk(id)
|
116
|
+
filename = id + ".vcf"
|
117
|
+
target = @repository.head.target
|
118
|
+
vcard = @repository.file_at(target, filename)
|
119
|
+
contact = nil
|
120
|
+
|
121
|
+
if !vcard.nil?
|
122
|
+
contact = @vcard_adapter.decode(vcard)
|
123
|
+
contact.id = id
|
124
|
+
end
|
125
|
+
|
126
|
+
return contact
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
data/lib/ppl/format/table.rb
CHANGED
data/ppl.gemspec
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
Gem::Specification.new do |spec|
|
3
3
|
|
4
4
|
spec.name = "ppl"
|
5
|
-
spec.version = "2.3.
|
6
|
-
spec.date = "
|
5
|
+
spec.version = "2.3.1"
|
6
|
+
spec.date = "2014-03-30"
|
7
7
|
|
8
8
|
spec.required_ruby_version = ">= 1.9.3"
|
9
9
|
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.add_dependency("rugged", "0.17.0.b6")
|
19
19
|
spec.add_dependency("greencard", "0.0.5")
|
20
20
|
|
21
|
+
spec.add_development_dependency("coveralls")
|
21
22
|
spec.add_development_dependency("cucumber")
|
22
23
|
spec.add_development_dependency("rspec")
|
23
24
|
spec.add_development_dependency("rake")
|
@@ -93,6 +93,16 @@ describe Ppl::Adapter::Storage::Git do
|
|
93
93
|
contact = @git.load_contact("test")
|
94
94
|
end
|
95
95
|
|
96
|
+
it "handles encoding errors gracefully" do
|
97
|
+
head = OpenStruct.new
|
98
|
+
head.target = "asdfg"
|
99
|
+
|
100
|
+
@repo.should_receive(:head).and_return(head)
|
101
|
+
@repo.should_receive(:file_at).and_return("vcard contents")
|
102
|
+
@vcard.should_receive(:decode).and_raise(GreenCard::InvalidEncodingError)
|
103
|
+
expect{ @git.load_contact("test") }.to raise_error(Ppl::Error::InvalidVcard)
|
104
|
+
end
|
105
|
+
|
96
106
|
end
|
97
107
|
|
98
108
|
describe "#save_contact" do
|
@@ -96,6 +96,16 @@ describe Ppl::Format::Table do
|
|
96
96
|
@table.to_s.should include "123 Luis Ignacio Lula da Silva lula@planalto.biz"
|
97
97
|
end
|
98
98
|
|
99
|
+
it "copes with mixed encodings" do
|
100
|
+
@table.add_row({
|
101
|
+
:id => "franz_viehböck".force_encoding("ASCII-8BIT"),
|
102
|
+
:name => "Franz Viehböck",
|
103
|
+
:email => "fv@example.org",
|
104
|
+
})
|
105
|
+
expect{ @table.to_s }.not_to raise_error()
|
106
|
+
@table.to_s.should include "franz_viehböck Franz Viehböck fv@example.org"
|
107
|
+
end
|
108
|
+
|
99
109
|
end
|
100
110
|
|
101
111
|
describe "#disable_colors!" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ppl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.0.5
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: cucumber
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,6 +250,7 @@ files:
|
|
236
250
|
- lib/ppl/error/completion_not_found.rb
|
237
251
|
- lib/ppl/error/contact_not_found.rb
|
238
252
|
- lib/ppl/error/incorrect_usage.rb
|
253
|
+
- lib/ppl/error/invalid_vcard.rb
|
239
254
|
- lib/ppl/error/postal_address_not_found.rb
|
240
255
|
- lib/ppl/format/address_book.rb
|
241
256
|
- lib/ppl/format/address_book/ages.rb
|