ppl 1.14.1 → 1.15.0
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.
- data/Gemfile +2 -1
- data/Gemfile.lock +3 -1
- data/lib/ppl/adapter/color/colored.rb +15 -0
- data/lib/ppl/adapter/color.rb +9 -0
- data/lib/ppl/application/bootstrap.rb +309 -61
- data/lib/ppl/application/configuration.rb +15 -0
- data/lib/ppl/command/age.rb +0 -5
- data/lib/ppl/command/bday.rb +0 -5
- data/lib/ppl/command/email.rb +1 -3
- data/lib/ppl/command/ls.rb +0 -5
- data/lib/ppl/command/mutt.rb +0 -4
- data/lib/ppl/command/name.rb +0 -5
- data/lib/ppl/command/nick.rb +1 -3
- data/lib/ppl/command/org.rb +1 -3
- data/lib/ppl/command/phone.rb +1 -3
- data/lib/ppl/command/post.rb +0 -5
- data/lib/ppl/command/url.rb +1 -3
- data/lib/ppl/format/address_book/ages.rb +2 -4
- data/lib/ppl/format/address_book/birthdays.rb +2 -2
- data/lib/ppl/format/address_book/email_addresses.rb +3 -3
- data/lib/ppl/format/address_book/names.rb +2 -2
- data/lib/ppl/format/address_book/nicknames.rb +2 -2
- data/lib/ppl/format/address_book/one_line.rb +2 -2
- data/lib/ppl/format/address_book/organizations.rb +2 -2
- data/lib/ppl/format/address_book/phone_numbers.rb +2 -2
- data/lib/ppl/format/address_book/postal_addresses.rb +2 -2
- data/lib/ppl/format/address_book/urls.rb +2 -2
- data/lib/ppl/format/contact/age.rb +13 -1
- data/lib/ppl/format/contact/birthday.rb +11 -0
- data/lib/ppl/format/contact/email_addresses.rb +19 -1
- data/lib/ppl/format/contact/name.rb +18 -2
- data/lib/ppl/format/contact/nicknames.rb +19 -1
- data/lib/ppl/format/contact/organization.rb +19 -1
- data/lib/ppl/format/contact/phone_number.rb +19 -1
- data/lib/ppl/format/contact/urls.rb +19 -1
- data/lib/ppl/format/table.rb +15 -6
- data/lib/ppl.rb +3 -1
- data/ppl.gemspec +4 -2
- data/spec/ppl/adapter/color/colored_spec.rb +24 -0
- data/spec/ppl/adapter/color_spec.rb +15 -0
- data/spec/ppl/application/bootstrap_spec.rb +403 -25
- data/spec/ppl/application/configuration_spec.rb +46 -0
- data/spec/ppl/command/mutt_spec.rb +4 -0
- data/spec/ppl/format/address_book/ages_spec.rb +10 -0
- data/spec/ppl/format/address_book/birthdays_spec.rb +10 -0
- data/spec/ppl/format/address_book/email_addresses_spec.rb +12 -2
- data/spec/ppl/format/address_book/names_spec.rb +10 -0
- data/spec/ppl/format/address_book/nicknames_spec.rb +10 -0
- data/spec/ppl/format/address_book/one_line_spec.rb +10 -0
- data/spec/ppl/format/address_book/organizations_spec.rb +10 -0
- data/spec/ppl/format/address_book/phone_numbers_spec.rb +10 -0
- data/spec/ppl/format/address_book/postal_addresses_spec.rb +10 -0
- data/spec/ppl/format/address_book/urls_spec.rb +10 -0
- data/spec/ppl/format/contact/age_spec.rb +10 -0
- data/spec/ppl/format/contact/birthday_spec.rb +8 -0
- data/spec/ppl/format/contact/email_addresses_spec.rb +8 -0
- data/spec/ppl/format/contact/name_spec.rb +8 -0
- data/spec/ppl/format/contact/nicknames_spec.rb +8 -0
- data/spec/ppl/format/contact/organization_spec.rb +8 -0
- data/spec/ppl/format/contact/phone_number_spec.rb +8 -0
- data/spec/ppl/format/contact/urls_spec.rb +8 -0
- data/spec/ppl/format/table_spec.rb +20 -0
- metadata +38 -2
@@ -5,22 +5,403 @@ describe Ppl::Application::Bootstrap do
|
|
5
5
|
@bootstrap = Ppl::Application::Bootstrap.new
|
6
6
|
end
|
7
7
|
|
8
|
-
describe "#
|
9
|
-
|
10
|
-
@bootstrap.
|
8
|
+
describe "#command_add" do
|
9
|
+
it "should return a Ppl::Command::Add" do
|
10
|
+
@bootstrap.command_add.should be_a(Ppl::Command::Add)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#command_age" do
|
15
|
+
it "should return a Ppl::Command::Age" do
|
16
|
+
@bootstrap.command_age.should be_a(Ppl::Command::Age)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#command_bday" do
|
21
|
+
it "should return a Ppl::Command::Bday" do
|
22
|
+
@bootstrap.command_bday.should be_a(Ppl::Command::Bday)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#command_email" do
|
27
|
+
it "should return a Ppl::Command::Email" do
|
28
|
+
@bootstrap.command_email.should be_a(Ppl::Command::Email)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#command_help" do
|
33
|
+
it "should return a Ppl::Command::Help" do
|
34
|
+
@bootstrap.command_help.should be_a(Ppl::Command::Help)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#command_init" do
|
39
|
+
it "should return a Ppl::Command::Init" do
|
40
|
+
@bootstrap.command_init.should be_a(Ppl::Command::Init)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#command_ls" do
|
45
|
+
it "should return a Ppl::Command::Ls" do
|
46
|
+
@bootstrap.command_ls.should be_a(Ppl::Command::Ls)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#command_mutt" do
|
51
|
+
it "should return a Ppl::Command::Mutt" do
|
52
|
+
@bootstrap.command_mutt.should be_a(Ppl::Command::Mutt)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#command_mv" do
|
57
|
+
it "should return a Ppl::Command::Mv" do
|
58
|
+
@bootstrap.command_mv.should be_a(Ppl::Command::Mv)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "#command_name" do
|
63
|
+
it "should return a Ppl::Command::Name" do
|
64
|
+
@bootstrap.command_name.should be_a(Ppl::Command::Name)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "#command_nick" do
|
69
|
+
it "should return a Ppl::Command::Nick" do
|
70
|
+
@bootstrap.command_nick.should be_a(Ppl::Command::Nick)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "#command_org" do
|
75
|
+
it "should return a Ppl::Command::Org" do
|
76
|
+
@bootstrap.command_org.should be_a(Ppl::Command::Org)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe "#command_phone" do
|
81
|
+
it "should return a Ppl::Command::Phone" do
|
82
|
+
@bootstrap.command_phone.should be_a(Ppl::Command::Phone)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "#command_post" do
|
87
|
+
it "should return a Ppl::Command::Post" do
|
88
|
+
@bootstrap.command_post.should be_a(Ppl::Command::Post)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "#command_pull" do
|
93
|
+
it "should return a command" do
|
94
|
+
@bootstrap.command_pull.should be_a(Ppl::Application::Command)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "#command_push" do
|
99
|
+
it "should return a command" do
|
100
|
+
@bootstrap.command_push.should be_a(Ppl::Application::Command)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "#command_remote" do
|
105
|
+
it "should return a command" do
|
106
|
+
@bootstrap.command_remote.should be_a(Ppl::Application::Command)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "#command_rm" do
|
111
|
+
it "should return a Ppl::Command::Rm" do
|
112
|
+
@bootstrap.command_rm.should be_a(Ppl::Command::Rm)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "#command_shell" do
|
117
|
+
it "should return a Ppl::Command::Shell" do
|
118
|
+
@bootstrap.command_shell.should be_a(Ppl::Command::Shell)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "#command_show" do
|
123
|
+
it "should return a Ppl::Command::Show" do
|
124
|
+
@bootstrap.command_show.should be_a(Ppl::Command::Show)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe "#command_url" do
|
129
|
+
it "should return a Ppl::Command::Url" do
|
130
|
+
@bootstrap.command_url.should be_a(Ppl::Command::Url)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe "#command_version" do
|
135
|
+
it "should return a Ppl::Command::Version" do
|
136
|
+
@bootstrap.command_version.should be_a(Ppl::Command::Version)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe "#format_address_book_ages" do
|
141
|
+
|
142
|
+
it "should return a Ppl::Format::AddressBook::Ages" do
|
143
|
+
@bootstrap.format_address_book_ages.should be_a(Ppl::Format::AddressBook::Ages)
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should set up colored output if configured to do so" do
|
147
|
+
@colors = {}
|
148
|
+
@config = double(Ppl::Application::Configuration)
|
149
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
150
|
+
@config.should_receive(:color_enabled).with("age").and_return(true)
|
151
|
+
@config.should_receive(:command_colors).with("age").and_return(@colors)
|
152
|
+
@bootstrap.format_address_book_ages
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
describe "#format_address_book_birthdays" do
|
158
|
+
it "should return a Ppl::Format::AddressBook::Birthdays" do
|
159
|
+
@bootstrap.format_address_book_birthdays.should be_a(Ppl::Format::AddressBook::Birthdays)
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should set up colored output if configured to do so" do
|
163
|
+
@colors = {}
|
164
|
+
@config = double(Ppl::Application::Configuration)
|
165
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
166
|
+
@config.should_receive(:color_enabled).with("bday").and_return(true)
|
167
|
+
@config.should_receive(:command_colors).with("bday").and_return(@colors)
|
168
|
+
@bootstrap.format_address_book_birthdays
|
11
169
|
end
|
12
|
-
|
13
|
-
|
170
|
+
end
|
171
|
+
|
172
|
+
describe "#format_address_book_email_addresses" do
|
173
|
+
it "should return a Ppl::Format::AddressBook::EmailAddresses" do
|
174
|
+
@bootstrap.format_address_book_email_addresses.should be_a(Ppl::Format::AddressBook::EmailAddresses)
|
14
175
|
end
|
15
|
-
it "should
|
16
|
-
@
|
17
|
-
|
18
|
-
|
176
|
+
it "should set up colored output if configured to do so" do
|
177
|
+
@colors = {}
|
178
|
+
@config = double(Ppl::Application::Configuration)
|
179
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
180
|
+
@config.should_receive(:color_enabled).with("email").and_return(true)
|
181
|
+
@config.should_receive(:command_colors).with("email").and_return(@colors)
|
182
|
+
@bootstrap.format_address_book_email_addresses
|
19
183
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "#format_address_book_mutt_query" do
|
187
|
+
it "should return a Ppl::Format::AddressBook::MuttQuery" do
|
188
|
+
@bootstrap.format_address_book_mutt_query.should be_a(Ppl::Format::AddressBook::MuttQuery)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe "#format_address_book_organizations" do
|
193
|
+
it "should return a Ppl::Format::AddressBook::Organizations" do
|
194
|
+
@bootstrap.format_address_book_organizations.should be_a(Ppl::Format::AddressBook::Organizations)
|
195
|
+
end
|
196
|
+
it "should set up colored output if configured to do so" do
|
197
|
+
@colors = {}
|
198
|
+
@config = double(Ppl::Application::Configuration)
|
199
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
200
|
+
@config.should_receive(:color_enabled).with("org").and_return(true)
|
201
|
+
@config.should_receive(:command_colors).with("org").and_return(@colors)
|
202
|
+
@bootstrap.format_address_book_organizations
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe "#format_address_book_names" do
|
207
|
+
it "should return a Ppl::Format::AddressBook::Names" do
|
208
|
+
@bootstrap.format_address_book_names.should be_a(Ppl::Format::AddressBook::Names)
|
209
|
+
end
|
210
|
+
it "should set up colored output if configured to do so" do
|
211
|
+
@colors = {}
|
212
|
+
@config = double(Ppl::Application::Configuration)
|
213
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
214
|
+
@config.should_receive(:color_enabled).with("name").and_return(true)
|
215
|
+
@config.should_receive(:command_colors).with("name").and_return(@colors)
|
216
|
+
@bootstrap.format_address_book_names
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
describe "#format_address_book_nicknames" do
|
221
|
+
it "should return a Ppl::Format::AddressBook::Nicknames" do
|
222
|
+
@bootstrap.format_address_book_nicknames.should be_a(Ppl::Format::AddressBook::Nicknames)
|
223
|
+
end
|
224
|
+
it "should set up colored output if configured to do so" do
|
225
|
+
@colors = {}
|
226
|
+
@config = double(Ppl::Application::Configuration)
|
227
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
228
|
+
@config.should_receive(:color_enabled).with("nick").and_return(true)
|
229
|
+
@config.should_receive(:command_colors).with("nick").and_return(@colors)
|
230
|
+
@bootstrap.format_address_book_nicknames
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
describe "#format_address_book_one_line" do
|
235
|
+
it "should return a Ppl::Format::AddressBook::OneLine" do
|
236
|
+
@bootstrap.format_address_book_one_line.should be_a(Ppl::Format::AddressBook::OneLine)
|
237
|
+
end
|
238
|
+
it "should set up colored output if configured to do so" do
|
239
|
+
@colors = {}
|
240
|
+
@config = double(Ppl::Application::Configuration)
|
241
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
242
|
+
@config.should_receive(:color_enabled).with("ls").and_return(true)
|
243
|
+
@config.should_receive(:command_colors).with("ls").and_return(@colors)
|
244
|
+
@bootstrap.format_address_book_one_line
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
describe "#format_address_book_phone_numbers" do
|
249
|
+
it "should return a Ppl::Format::Address_book::PhoneNumbers" do
|
250
|
+
@bootstrap.format_address_book_phone_numbers.should be_a(Ppl::Format::AddressBook::PhoneNumbers)
|
251
|
+
end
|
252
|
+
it "should set up colored output if configured to do so" do
|
253
|
+
@colors = {}
|
254
|
+
@config = double(Ppl::Application::Configuration)
|
255
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
256
|
+
@config.should_receive(:color_enabled).with("phone").and_return(true)
|
257
|
+
@config.should_receive(:command_colors).with("phone").and_return(@colors)
|
258
|
+
@bootstrap.format_address_book_phone_numbers
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe "#format_address_book_postal_addresses" do
|
263
|
+
it "should return a Ppl::Format::AddressBook::PostalAddresses" do
|
264
|
+
@bootstrap.format_address_book_postal_addresses.should be_a(Ppl::Format::AddressBook::PostalAddresses)
|
265
|
+
end
|
266
|
+
it "should set up colored output if configured to do so" do
|
267
|
+
@colors = {}
|
268
|
+
@config = double(Ppl::Application::Configuration)
|
269
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
270
|
+
@config.should_receive(:color_enabled).with("post").and_return(true)
|
271
|
+
@config.should_receive(:command_colors).with("post").and_return(@colors)
|
272
|
+
@bootstrap.format_address_book_postal_addresses
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
describe "#format_address_book_urls" do
|
277
|
+
it "should return a Ppl::Format::AddressBook::Urls" do
|
278
|
+
@bootstrap.format_address_book_urls.should be_a(Ppl::Format::AddressBook::Urls)
|
279
|
+
end
|
280
|
+
it "should set up colored output if configured to do so" do
|
281
|
+
@colors = {}
|
282
|
+
@config = double(Ppl::Application::Configuration)
|
283
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
284
|
+
@config.should_receive(:color_enabled).with("url").and_return(true)
|
285
|
+
@config.should_receive(:command_colors).with("url").and_return(@colors)
|
286
|
+
@bootstrap.format_address_book_urls
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
describe "#format_contact_age" do
|
291
|
+
it "should return a Ppl::Format::Contact::Age" do
|
292
|
+
@bootstrap.format_contact_age.should be_a(Ppl::Format::Contact::Age)
|
293
|
+
end
|
294
|
+
it "should set up colored output if configured to do so" do
|
295
|
+
@colors = {}
|
296
|
+
@config = double(Ppl::Application::Configuration)
|
297
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
298
|
+
@config.should_receive(:color_enabled).with("age").and_return(true)
|
299
|
+
@config.should_receive(:command_colors).with("age").and_return(@colors)
|
300
|
+
@bootstrap.format_contact_age
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
describe "#format_contact_birthday" do
|
305
|
+
it "should return a Ppl::Format::Contact::Birthday" do
|
306
|
+
@bootstrap.format_contact_birthday.should be_a(Ppl::Format::Contact::Birthday)
|
307
|
+
end
|
308
|
+
it "should set up colored output if configured to do so" do
|
309
|
+
@colors = {}
|
310
|
+
@config = double(Ppl::Application::Configuration)
|
311
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
312
|
+
@config.should_receive(:color_enabled).with("bday").and_return(true)
|
313
|
+
@config.should_receive(:command_colors).with("bday").and_return(@colors)
|
314
|
+
@bootstrap.format_contact_birthday
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
describe "#format_contact_email_addresses" do
|
319
|
+
it "should return a Ppl::Format::Contact::EmailAddresses" do
|
320
|
+
@bootstrap.format_contact_email_addresses.should be_a(Ppl::Format::Contact::EmailAddresses)
|
321
|
+
end
|
322
|
+
it "should set up colored output if configured to do so" do
|
323
|
+
@colors = {}
|
324
|
+
@config = double(Ppl::Application::Configuration)
|
325
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
326
|
+
@config.should_receive(:color_enabled).with("email").and_return(true)
|
327
|
+
@config.should_receive(:command_colors).with("email").and_return(@colors)
|
328
|
+
@bootstrap.format_contact_email_addresses
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
describe "#format_contact_name" do
|
333
|
+
it "should return a Ppl::Format::Contact::Name" do
|
334
|
+
@bootstrap.format_contact_name.should be_a(Ppl::Format::Contact::Name)
|
335
|
+
end
|
336
|
+
it "should set up colored output if configured to do so" do
|
337
|
+
@colors = {}
|
338
|
+
@config = double(Ppl::Application::Configuration)
|
339
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
340
|
+
@config.should_receive(:color_enabled).with("name").and_return(true)
|
341
|
+
@config.should_receive(:command_colors).with("name").and_return(@colors)
|
342
|
+
@bootstrap.format_contact_name
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
describe "#format_contact_nicknames" do
|
347
|
+
it "should return a Ppl::Format::Contact::Nicknames" do
|
348
|
+
@bootstrap.format_contact_nicknames.should be_a(Ppl::Format::Contact::Nicknames)
|
349
|
+
end
|
350
|
+
it "should set up colored output if configured to do so" do
|
351
|
+
@colors = {}
|
352
|
+
@config = double(Ppl::Application::Configuration)
|
353
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
354
|
+
@config.should_receive(:color_enabled).with("nick").and_return(true)
|
355
|
+
@config.should_receive(:command_colors).with("nick").and_return(@colors)
|
356
|
+
@bootstrap.format_contact_nicknames
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
describe "#format_contact_organizations" do
|
361
|
+
it "should return a Ppl::Format::Contact::Organizations" do
|
362
|
+
@bootstrap.format_contact_organizations.should be_a(Ppl::Format::Contact::Organization)
|
363
|
+
end
|
364
|
+
it "should set up colored output if configured to do so" do
|
365
|
+
@colors = {}
|
366
|
+
@config = double(Ppl::Application::Configuration)
|
367
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
368
|
+
@config.should_receive(:color_enabled).with("org").and_return(true)
|
369
|
+
@config.should_receive(:command_colors).with("org").and_return(@colors)
|
370
|
+
@bootstrap.format_contact_organizations
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
describe "#format_contact_phone_numbers" do
|
375
|
+
it "should return a Ppl::Format::Contact::PhoneNumber" do
|
376
|
+
@bootstrap.format_contact_phone_numbers.should be_a(Ppl::Format::Contact::PhoneNumber)
|
377
|
+
end
|
378
|
+
it "should set up colored output if configured to do so" do
|
379
|
+
@colors = {}
|
380
|
+
@config = double(Ppl::Application::Configuration)
|
381
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
382
|
+
@config.should_receive(:color_enabled).with("phone").and_return(true)
|
383
|
+
@config.should_receive(:command_colors).with("phone").and_return(@colors)
|
384
|
+
@bootstrap.format_contact_phone_numbers
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
describe "#format_contact_postal_addresses" do
|
389
|
+
it "should return a Ppl::Format::Contact::PostalAddress" do
|
390
|
+
@bootstrap.format_contact_postal_addresses.should be_a(Ppl::Format::Contact::PostalAddress)
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
describe "#format_contact_urls" do
|
395
|
+
it "should return a Ppl::Format::Contact::Urls" do
|
396
|
+
@bootstrap.format_contact_urls.should be_a(Ppl::Format::Contact::Urls)
|
397
|
+
end
|
398
|
+
it "should set up colored output if configured to do so" do
|
399
|
+
@colors = {}
|
400
|
+
@config = double(Ppl::Application::Configuration)
|
401
|
+
@bootstrap.stub(:configuration).and_return(@config)
|
402
|
+
@config.should_receive(:color_enabled).with("url").and_return(true)
|
403
|
+
@config.should_receive(:command_colors).with("url").and_return(@colors)
|
404
|
+
@bootstrap.format_contact_urls
|
24
405
|
end
|
25
406
|
end
|
26
407
|
|
@@ -72,6 +453,15 @@ describe Ppl::Application::Bootstrap do
|
|
72
453
|
it "should contain the 'post' command" do
|
73
454
|
@bootstrap.command_suite.find_command("post").should_not be nil
|
74
455
|
end
|
456
|
+
it "should contain the 'pull' command" do
|
457
|
+
@bootstrap.command_suite.find_command("pull").should_not be nil
|
458
|
+
end
|
459
|
+
it "should contain the 'push' command" do
|
460
|
+
@bootstrap.command_suite.find_command("push").should_not be nil
|
461
|
+
end
|
462
|
+
it "should contain the 'remote' command" do
|
463
|
+
@bootstrap.command_suite.find_command("remote").should_not be nil
|
464
|
+
end
|
75
465
|
it "should contain the 'rm' command" do
|
76
466
|
@bootstrap.command_suite.find_command("rm").should_not be nil
|
77
467
|
end
|
@@ -92,18 +482,6 @@ describe Ppl::Application::Bootstrap do
|
|
92
482
|
end
|
93
483
|
end
|
94
484
|
|
95
|
-
describe "#git_commands" do
|
96
|
-
it "should contain the 'pull' command" do
|
97
|
-
@bootstrap.git_commands[0].name.should eq "pull"
|
98
|
-
end
|
99
|
-
it "should contain the 'push' command" do
|
100
|
-
@bootstrap.git_commands[1].name.should eq "push"
|
101
|
-
end
|
102
|
-
it "should contain the 'remote' command" do
|
103
|
-
@bootstrap.git_commands[2].name.should eq "remote"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
485
|
describe "#configuration" do
|
108
486
|
it "should return a Ppl::Application::Configuration" do
|
109
487
|
@bootstrap.configuration.should be_a(Ppl::Application::Configuration)
|
@@ -28,5 +28,51 @@ describe Ppl::Application::Configuration do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
describe "#color_enabled" do
|
32
|
+
|
33
|
+
it "should return true if color is explicitly enabled" do
|
34
|
+
@config.stub(:user_configuration).and_return({
|
35
|
+
"color" => {
|
36
|
+
"cmd" => "true",
|
37
|
+
},
|
38
|
+
})
|
39
|
+
@config.color_enabled("cmd").should eq true
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return false if color is not explicitly enabled" do
|
43
|
+
@config.color_enabled("cmd").should eq false
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return false if color is explicitly disabled" do
|
47
|
+
@config.stub(:user_configuration).and_return({
|
48
|
+
"color" => {
|
49
|
+
"cmd" => "false",
|
50
|
+
},
|
51
|
+
})
|
52
|
+
@config.color_enabled("cmd").should eq false
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#command_colors" do
|
58
|
+
|
59
|
+
it "should return the colors configured for the given command" do
|
60
|
+
@config.stub(:user_configuration).and_return({
|
61
|
+
"color \"ls\"" => {
|
62
|
+
"id" => "blue",
|
63
|
+
},
|
64
|
+
})
|
65
|
+
@config.command_colors("ls").should eq({
|
66
|
+
"id" => "blue",
|
67
|
+
})
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should return nil if no colors are configured for the given command" do
|
71
|
+
@config.stub(:user_configuration).and_return({})
|
72
|
+
@config.command_colors("ls").should eq(nil)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
31
77
|
end
|
32
78
|
|
@@ -6,11 +6,13 @@ describe Ppl::Command::Mutt do
|
|
6
6
|
@input = Ppl::Application::Input.new
|
7
7
|
@output = double(Ppl::Application::Output)
|
8
8
|
@storage = double(Ppl::Adapter::Storage)
|
9
|
+
@format = double(Ppl::Format::AddressBook)
|
9
10
|
|
10
11
|
@address_book = Ppl::Entity::AddressBook.new
|
11
12
|
@contact = Ppl::Entity::Contact.new
|
12
13
|
|
13
14
|
@command.storage = @storage
|
15
|
+
@command.format = @format
|
14
16
|
end
|
15
17
|
|
16
18
|
describe "#name" do
|
@@ -41,6 +43,7 @@ describe Ppl::Command::Mutt do
|
|
41
43
|
@input.arguments.push "example"
|
42
44
|
|
43
45
|
@storage.should_receive(:load_address_book).and_return(@address_book)
|
46
|
+
@format.should_receive(:process).and_return("test@example.org\tTest User")
|
44
47
|
@output.should_receive(:line) do |line|
|
45
48
|
line.should include "Searching address book... 1 entries... 1 matching:"
|
46
49
|
line.should include "test@example.org\tTest User"
|
@@ -57,6 +60,7 @@ describe Ppl::Command::Mutt do
|
|
57
60
|
@input.arguments.push "User"
|
58
61
|
|
59
62
|
@storage.should_receive(:load_address_book).and_return(@address_book)
|
63
|
+
@format.should_receive(:process).and_return("test@example.org\tTest User")
|
60
64
|
@output.should_receive(:line) do |line|
|
61
65
|
line.should include "Searching address book... 1 entries... 1 matching:"
|
62
66
|
line.should include "test@example.org\tTest User"
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::Ages do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :age], colors)
|
7
|
+
format = Ppl::Format::AddressBook::Ages.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::Ages do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::Birthdays do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :birthday], colors)
|
7
|
+
format = Ppl::Format::AddressBook::Birthdays.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::Birthdays do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::EmailAddresses do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :email_addresses], colors)
|
7
|
+
format = Ppl::Format::AddressBook::EmailAddresses.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::EmailAddresses do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -17,7 +27,7 @@ describe Ppl::Format::AddressBook::EmailAddresses do
|
|
17
27
|
|
18
28
|
it "should at least show the contact's id" do
|
19
29
|
@table.should_receive(:add_row).with({
|
20
|
-
:
|
30
|
+
:id => "test:",
|
21
31
|
:email_addresses => "",
|
22
32
|
})
|
23
33
|
@format.process(@address_book)
|
@@ -26,7 +36,7 @@ describe Ppl::Format::AddressBook::EmailAddresses do
|
|
26
36
|
it "should show an email address if it's available" do
|
27
37
|
@contact.email_addresses.push "jdoe@example.org"
|
28
38
|
@table.should_receive(:add_row).with({
|
29
|
-
:
|
39
|
+
:id => "test:",
|
30
40
|
:email_addresses => "jdoe@example.org",
|
31
41
|
})
|
32
42
|
@format.process(@address_book)
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::Names do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :name], colors)
|
7
|
+
format = Ppl::Format::AddressBook::Names.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::Names do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::Nicknames do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :nicknames], colors)
|
7
|
+
format = Ppl::Format::AddressBook::Nicknames.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::Nicknames do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::OneLine do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :name, :email], colors)
|
7
|
+
format = Ppl::Format::AddressBook::OneLine.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::OneLine do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::Organizations do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :organizations], colors)
|
7
|
+
format = Ppl::Format::AddressBook::Organizations.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::Organizations do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::PhoneNumbers do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :phone_numbers], colors)
|
7
|
+
format = Ppl::Format::AddressBook::PhoneNumbers.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::PhoneNumbers do
|
3
13
|
|
4
14
|
before(:each) do
|
@@ -1,4 +1,14 @@
|
|
1
1
|
|
2
|
+
describe Ppl::Format::AddressBook::PostalAddresses do
|
3
|
+
describe "#initialize" do
|
4
|
+
it "should pass the colors through to the table" do
|
5
|
+
colors = {"id" => "blue"}
|
6
|
+
Ppl::Format::Table.should_receive(:new).with([:id, :postal_address], colors)
|
7
|
+
format = Ppl::Format::AddressBook::PostalAddresses.new(colors)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
2
12
|
describe Ppl::Format::AddressBook::PostalAddresses do
|
3
13
|
|
4
14
|
before(:each) do
|