ppl 1.17.0 → 1.17.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 534e964077775b5213a6a424cbd7e7fafdd3bdc1
4
- data.tar.gz: 591219daa582fb9f4f0ce4513407a11aca5c340e
3
+ metadata.gz: ecd0486206406d56c76fb117e670366c7a9397d6
4
+ data.tar.gz: 28772223134972c6b129ad759dcfbcf02d030d7f
5
5
  SHA512:
6
- metadata.gz: a163c7310507391c86a9605dec4c07154ad9b7e91304948d09ba77dc72a4f92488ef7a679da6fc0b31d95e18260e98783ade8492491fa9f273018d05658cad6c
7
- data.tar.gz: 5c23014db12338370ab46ee21098bbcb15ee9e2ef6cb3b4917ed8dcef59a7df6e58ac28b1611862ce8b1a0f4bdbaa2429b06657a1f18277a82a8d4f9d455ac03
6
+ metadata.gz: 1887503ef58bbcd1df760d0fc07e61ae2799e83e29994f7097b690b3a043bf65b1abc5be315a4bbceb84cffd616769f01e16c861bb231f533af53d69a61e736e
7
+ data.tar.gz: 45268a4da3b16be35c6cb572f48427a7c9d9f5dd07a820c7d317469e080554f6d2f077e4fcab932f13df863b0cf2e5d02f801b2a412139d4cb3690fd82f2e044
data/completions/bash CHANGED
@@ -15,7 +15,7 @@ _ppl()
15
15
  # Complete nicknames
16
16
  nick_cmds=([age]="" [bday]="" [email]="" [mv]="" [name]="" [nick]="" [org]="" [phone]="" [post]="" [rm]="" [show]="" [url]="")
17
17
  if [[ $nick_cmds[${prev}] ]]; then
18
- local nicknames=$(for x in `ppl nick | cut -d ':' -f 1`; do echo ${x} ; done )
18
+ local nicknames=$(for x in `ppl nick | cut -d ':' -f 1 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`; do echo ${x} ; done )
19
19
  COMPREPLY=( $(compgen -W "${nicknames}" -- ${cur}) )
20
20
  return 0
21
21
  fi
data/completions/zsh CHANGED
@@ -2,7 +2,7 @@
2
2
  #autoload
3
3
 
4
4
  _ppl_contacts() {
5
- contacts=(`ppl nick | cut -d ':' -f 1`)
5
+ contacts=(`ppl nick | cut -d ':' -f 1 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"`)
6
6
  }
7
7
 
8
8
  local -a _1st_arguments
data/lib/ppl.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Ppl
3
3
 
4
- Version = "1.17.0"
4
+ Version = "1.17.1"
5
5
 
6
6
  module Adapter
7
7
  end
@@ -10,13 +10,19 @@ class Ppl::Application::Output
10
10
  end
11
11
 
12
12
  def error(string)
13
- @stderr.puts string
13
+ @stderr.puts sanitise(string)
14
14
  end
15
15
 
16
16
  def line(string)
17
- @stdout.puts string
17
+ @stdout.puts sanitise(string)
18
18
  true
19
19
  end
20
20
 
21
+ private
22
+
23
+ def sanitise(string)
24
+ string.delete "\r"
25
+ end
26
+
21
27
  end
22
28
 
@@ -7,9 +7,19 @@ class Ppl::Application::Shell
7
7
 
8
8
  def run(input, output)
9
9
  outcome = false
10
+ begin
10
11
  command = select_command(input)
11
12
  prepare_command(command, input)
12
13
  outcome = execute_command(command, input, output)
14
+ rescue Ppl::Error::ContactNotFound
15
+ output.error("ppl: Contact '#{$!}' not found")
16
+ rescue OptionParser::InvalidOption, OptionParser::MissingArgument, Ppl::Error::IncorrectUsage
17
+ output.error($!)
18
+ output.error(@optparse.to_s)
19
+ rescue
20
+ output.error("ppl: " + $!.message)
21
+ outcome = false
22
+ end
13
23
  return outcome
14
24
  end
15
25
 
@@ -39,6 +39,7 @@ class Ppl::Command::Mutt < Ppl::Application::Command
39
39
  def select_matching_contacts(address_book, query)
40
40
  matches = Ppl::Entity::AddressBook.new
41
41
  address_book.contacts.each do |contact|
42
+ contact = contact.dup
42
43
  if contact.email_addresses.empty?
43
44
  next
44
45
  elsif match_by_name(contact, query)
@@ -82,9 +83,9 @@ class Ppl::Command::Mutt < Ppl::Application::Command
82
83
 
83
84
  def describe_matches(matches)
84
85
  summary = sprintf(
85
- "Searching address book... %d entries... %d matching:",
86
- @address_book.contacts.length,
87
- matches.contacts.length
86
+ "Searching address book... %d email addresses... %d matching:",
87
+ @address_book.contacts.inject(0) { |total, c| total += c.email_addresses.length },
88
+ matches.contacts.inject(0) { |total, c| total += c.email_addresses.length }
88
89
  )
89
90
  results = @format.process(matches)
90
91
  [summary, results].join("\n").strip
data/ppl.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  spec.name = "ppl"
5
- spec.version = "1.17.0"
5
+ spec.version = "1.17.1"
6
6
  spec.date = "2013-04-14"
7
7
 
8
8
  spec.required_ruby_version = ">= 1.9.3"
@@ -37,6 +37,18 @@ describe Ppl::Application::Output do
37
37
  @stdout.should_receive(:puts).with(string)
38
38
  @output.line(string)
39
39
  end
40
+
41
+ it "should not send carriage returns to stdout" do
42
+ string = "The quick brown fox
43
+ @stdout.should_receive(:puts).with("The quick brown fox")
44
+ @output.line(string)
45
+ end
46
+
47
+ it "should not send carriage returns to stderr" do
48
+ string = "The quick brown fox
49
+ @stderr.should_receive(:puts).with("The quick brown fox")
50
+ @output.error(string)
51
+ end
40
52
  end
41
53
 
42
54
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
 
2
3
  describe Ppl::Adapter::Vcard::GreenCard, "#encode" do
3
4
 
@@ -45,7 +45,7 @@ describe Ppl::Command::Mutt do
45
45
  @storage.should_receive(:load_address_book).and_return(@address_book)
46
46
  @format.should_receive(:process).and_return("test@example.org\tTest User")
47
47
  @output.should_receive(:line) do |line|
48
- line.should include "Searching address book... 1 entries... 1 matching:"
48
+ line.should include "Searching address book... 1 email addresses... 1 matching:"
49
49
  line.should include "test@example.org\tTest User"
50
50
  end
51
51
  @command.execute(@input, @output).should eq true
@@ -78,12 +78,30 @@ describe Ppl::Command::Mutt do
78
78
  @storage.should_receive(:load_address_book).and_return(@address_book)
79
79
  @format.should_receive(:process).and_return("test@example.org\tTest User")
80
80
  @output.should_receive(:line) do |line|
81
- line.should include "Searching address book... 1 entries... 1 matching:"
81
+ line.should include "Searching address book... 1 email addresses... 1 matching:"
82
82
  line.should include "test@example.org\tTest User"
83
83
  end
84
84
  @command.execute(@input, @output).should eq true
85
85
  end
86
86
 
87
+
88
+ it "should count up email addresses in the status line" do
89
+ @input.arguments.push "org"
90
+
91
+ @contact.name = "Test User"
92
+ @contact.email_addresses.push "test@test.org"
93
+ @contact.email_addresses.push "prova@prova.org"
94
+ @address_book.contacts << @contact
95
+
96
+ @storage.stub(:load_address_book).and_return(@address_book)
97
+ @format.stub(:process)
98
+ @output.stub(:line)
99
+ @output.should_receive(:line) do |line|
100
+ line.should include "Searching address book... 2 email addresses... 2 matching:"
101
+ end
102
+ @command.execute(@input, @output)
103
+ end
104
+
87
105
  end
88
106
 
89
107
  describe "#execute (case-insensitive)" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.0
4
+ version: 1.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Smith