ppl 1.22.1 → 1.22.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc9a9a697a887b27f8b6861bd558f92d14d0e7db
4
+ data.tar.gz: 76354097c49287e8c92a804bfbc9cf397eafa5fe
5
+ SHA512:
6
+ metadata.gz: bd847a67287e56e12ea07d0b1cf1d0b902dcddd585bb4e7b5b09a8cb3168de0c10916651dd7f7ec126249a64f4b58b8fc5ff106936564c7d7f9cdd570ae42e74
7
+ data.tar.gz: 23c4c152e84c421afb380bc687c45db332c326f5c96ec4c91723de998aa299eda024ce773bcfbe5b11c8a1f3483222c53458091b1fcfdc37bcedcbcabecd8632
data/.travis.yml CHANGED
@@ -3,5 +3,7 @@ language: ruby
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
- script: bundle exec rspec spec
6
+ script:
7
+ - bundle exec rspec spec
8
+ - bundle exec cucumber
7
9
 
@@ -0,0 +1,9 @@
1
+
2
+ Feature: ppl add
3
+
4
+ Scenario: Add a new contact
5
+ Given I am in an empty address book
6
+ And I run "ppl add alice 'Alice Adams'"
7
+ Then there should be 1 contact
8
+ And its name should be "Alice Adams"
9
+
@@ -0,0 +1,9 @@
1
+
2
+ Feature: ppl email
3
+
4
+ Scenario: Add an email address to a contact
5
+ Given I am in an address book with a blank contact called bob
6
+ And I run "ppl email bob bob@example.org"
7
+ Then bob should have 1 email address
8
+ And the 1st email address should be "bob@example.org"
9
+
@@ -0,0 +1,13 @@
1
+
2
+ Feature: ppl init
3
+
4
+ Scenario: Create a new address book
5
+ Given I am in an empty directory
6
+ When I run "ppl init ./contacts"
7
+ Then "./contacts" should be a ppl address book
8
+
9
+ Scenario: Incorrect usage
10
+ Given I am in an empty directory
11
+ When I run "ppl init --invalid-option 2> /dev/null"
12
+ Then it should fail
13
+
@@ -0,0 +1,9 @@
1
+
2
+ Feature: ppl org
3
+
4
+ Scenario: Add an organization to a contact
5
+ Given I am in an address book with a blank contact called bob
6
+ And I run "ppl org bob 'Red Hat'"
7
+ Then bob should have 1 organization
8
+ And the 1st organization should be "Red Hat"
9
+
@@ -0,0 +1,14 @@
1
+
2
+ Feature: ppl phone
3
+
4
+ Scenario: Add a phone number to a contact
5
+ Given I am in an address book with a blank contact called bob
6
+ And I run "ppl phone bob 01234567890"
7
+ Then bob should have 1 phone number
8
+ And the 1st phone number should be "01234567890"
9
+
10
+ Scenario: Remove a phone number from a contact
11
+ Given I am in the same address book as before
12
+ And I run "ppl phone bob --delete 01234567890"
13
+ Then bob should have 0 phone numbers
14
+
@@ -9,3 +9,25 @@ Given /^I am in an empty directory$/ do
9
9
  end
10
10
  end
11
11
 
12
+ Given /^I am in an empty address book$/ do
13
+ @directory = Dir.mktmpdir
14
+ Dir.chdir @directory
15
+ ppl "init"
16
+ at_exit do
17
+ FileUtils.rm_rf @directory
18
+ end
19
+ end
20
+
21
+ Given /^I am in an address book with a blank contact called bob$/ do
22
+ @directory = Dir.mktmpdir
23
+ Dir.chdir @directory
24
+ ppl "init"
25
+ ppl "add bob Bob"
26
+ at_exit do
27
+ FileUtils.rm_rf @directory
28
+ end
29
+ end
30
+
31
+ Given /^I am in the same address book as before$/ do
32
+ end
33
+
@@ -1,5 +1,54 @@
1
1
 
2
- When /^I run "(ppl [^"]+)"$/ do |command|
3
- Kernel.system command
2
+ def ppl(command)
3
+ project_root = File.dirname(File.dirname(File.dirname(__FILE__)))
4
+ ppl_location = File.join(project_root, "bin", "ppl")
5
+ real_command = "#{ppl_location} #{command}"
6
+ `#{real_command}`.strip
4
7
  end
5
8
 
9
+ When /^I run "ppl ([^"]+)"$/ do |command|
10
+ ppl command
11
+ end
12
+
13
+ Then /^it should fail$/ do
14
+ $?.exitstatus.should_not eq 0
15
+ end
16
+
17
+ Then /^there should be 1 contact$/ do
18
+ contact_list = ppl("ls").strip.split("\n")
19
+ contact_list.length.should eq 1
20
+ @contact_id = contact_list[0].split(":").first
21
+ end
22
+
23
+ Then /^(bob) should have (\d+) email addresse?s?$/ do |name, number|
24
+ @email_addresses = ppl("email #{name}").split("\n")
25
+ @email_addresses.length.should eq number.to_i
26
+ end
27
+
28
+ Then /^(bob) should have (\d+) organizations?$/ do |name, number|
29
+ @organizations = ppl("org #{name}").split("\n")
30
+ @organizations.length.should eq number.to_i
31
+ end
32
+
33
+ Then /^(bob) should have (\d+) phone numbers?$/ do |name, number|
34
+ @phone_numbers = ppl("phone #{name}").split("\n")
35
+ @phone_numbers.length.should eq number.to_i
36
+ end
37
+
38
+ And /^its name should be "([^"]+)"$/ do |name|
39
+ ppl("name #{@contact_id}").should eq name
40
+ end
41
+
42
+ Then(/^the (\d+).. email address should be "([^"]+)"$/) do |nth, address|
43
+ @email_addresses[nth.to_i - 1].should eq address
44
+ end
45
+
46
+ Then(/^the (\d+).. organization should be "([^"]+)"$/) do |nth, organization|
47
+ @organizations[nth.to_i - 1].should eq organization
48
+ end
49
+
50
+ Then(/^the (\d+).. phone number should be "([^"]+)"$/) do |nth, phone_number|
51
+ @phone_numbers[nth.to_i - 1].should eq phone_number
52
+ end
53
+
54
+
data/lib/ppl.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Ppl
3
3
 
4
- Version = "1.22.1"
4
+ Version = "1.22.2"
5
5
 
6
6
  module Adapter
7
7
  end
@@ -29,6 +29,12 @@ class Ppl::Command::Phone < Ppl::Command::Attribute
29
29
  true
30
30
  end
31
31
 
32
+ def remove_attribute(input, output)
33
+ contact = @storage.require_contact(input.arguments[0])
34
+ contact.phone_numbers.select! { |pn| pn.number != input.arguments[1] }
35
+ @storage.save_contact(contact)
36
+ end
37
+
32
38
  def new_number?(contact, input_number)
33
39
  matching_numbers = contact.phone_numbers.select do |pn|
34
40
  pn.number == input_number
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 = "1.22.1"
6
- spec.date = "2013-04-20"
5
+ spec.version = "1.22.2"
6
+ spec.date = "2013-04-21"
7
7
 
8
8
  spec.required_ruby_version = ">= 1.9.3"
9
9
 
@@ -53,6 +53,16 @@ describe Ppl::Command::Phone do
53
53
  @command.execute(@input, @output)
54
54
  end
55
55
 
56
+ it "should delete the given number from the contact" do
57
+ @input.arguments = ["jdoe", "01234567"]
58
+ @input.options[:delete] = "true"
59
+ @contact.phone_numbers << Ppl::Entity::PhoneNumber.new("01234567")
60
+ @storage.should_receive(:save_contact) do |c|
61
+ c.phone_numbers.length.should eq 0
62
+ end
63
+ @command.execute(@input, @output)
64
+ end
65
+
56
66
  end
57
67
 
58
68
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.22.1
5
- prerelease:
4
+ version: 1.22.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Henry Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-20 00:00:00.000000000 Z
11
+ date: 2013-04-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: colored
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: inifile
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - '='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - '='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mail
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - '='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - '='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: morphine
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - '='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - '='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rugged
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - '='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - '='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: greencard
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - '='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - '='
108
95
  - !ruby/object:Gem::Version
@@ -110,65 +97,57 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: cucumber
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: rspec
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: rake
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: '0'
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
156
137
  - !ruby/object:Gem::Version
157
138
  version: '0'
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: fakefs
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - '>='
164
144
  - !ruby/object:Gem::Version
165
145
  version: '0'
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - '>='
172
151
  - !ruby/object:Gem::Version
173
152
  version: '0'
174
153
  description: CLI Address Book
@@ -187,7 +166,11 @@ files:
187
166
  - bin/ppl
188
167
  - completions/bash
189
168
  - completions/zsh
190
- - features/init/create_repository.feature
169
+ - features/add.feature
170
+ - features/email.feature
171
+ - features/init.feature
172
+ - features/org.feature
173
+ - features/phone.feature
191
174
  - features/step_definitions/address_book_steps.rb
192
175
  - features/step_definitions/cwd_steps.rb
193
176
  - features/step_definitions/ppl_steps.rb
@@ -342,26 +325,25 @@ files:
342
325
  homepage: http://ppladdressbook.org
343
326
  licenses:
344
327
  - GPL-2
328
+ metadata: {}
345
329
  post_install_message:
346
330
  rdoc_options: []
347
331
  require_paths:
348
332
  - lib
349
333
  required_ruby_version: !ruby/object:Gem::Requirement
350
- none: false
351
334
  requirements:
352
- - - ! '>='
335
+ - - '>='
353
336
  - !ruby/object:Gem::Version
354
337
  version: 1.9.3
355
338
  required_rubygems_version: !ruby/object:Gem::Requirement
356
- none: false
357
339
  requirements:
358
- - - ! '>='
340
+ - - '>='
359
341
  - !ruby/object:Gem::Version
360
342
  version: '0'
361
343
  requirements: []
362
344
  rubyforge_project:
363
- rubygems_version: 1.8.23
345
+ rubygems_version: 2.0.3
364
346
  signing_key:
365
- specification_version: 3
347
+ specification_version: 4
366
348
  summary: CLI Address Book
367
349
  test_files: []
@@ -1,8 +0,0 @@
1
-
2
- Feature: create address book
3
-
4
- Scenario: success
5
- Given I am in an empty directory
6
- When I run "ppl init ./contacts"
7
- Then "./contacts" should be a ppl address book
8
-