ppl 3.0.0 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.editorconfig +16 -0
- data/.eleventy.js +86 -0
- data/.eleventyignore +1 -0
- data/.github/workflows/build.yml +61 -0
- data/.gitignore +3 -1
- data/Rakefile +1 -18
- data/{CODE_OF_CONDUCT.md → code_of_conduct.md} +1 -1
- data/features/step_definitions/ppl_steps.rb +27 -27
- data/gh-pages/Gemfile +2 -0
- data/gh-pages/_config.yml +5 -0
- data/gh-pages/_includes/changelog.html +23 -0
- data/gh-pages/_includes/development-sidebar.html +25 -0
- data/gh-pages/_includes/footer.html +22 -0
- data/gh-pages/_includes/header.html +43 -0
- data/gh-pages/_includes/news.html +36 -0
- data/gh-pages/_includes/tip.html +54 -0
- data/gh-pages/_layouts/changelog.html +1 -0
- data/gh-pages/_layouts/command.html +104 -0
- data/gh-pages/_layouts/configuration.html +71 -0
- data/gh-pages/_layouts/development.html +20 -0
- data/gh-pages/_layouts/frontpage.html +6 -0
- data/gh-pages/_layouts/integration.html +44 -0
- data/gh-pages/_layouts/news.html +2 -0
- data/gh-pages/_layouts/page.html +6 -0
- data/gh-pages/_layouts/tip.html +2 -0
- data/gh-pages/_posts/2012-01-15-first-post.md +16 -0
- data/gh-pages/_posts/2012-12-20-1.0.0.md +19 -0
- data/gh-pages/_posts/2012-12-20-1.1.0.md +28 -0
- data/gh-pages/_posts/2012-12-20-1.2.0.md +18 -0
- data/gh-pages/_posts/2012-12-21-1.3.0.md +20 -0
- data/gh-pages/_posts/2012-12-21-thank-you-for-your-all-your-feedback.md +26 -0
- data/gh-pages/_posts/2012-12-22-1.4.1.md +21 -0
- data/gh-pages/_posts/2012-12-22-1.5.0.md +17 -0
- data/gh-pages/_posts/2012-12-23-1.5.1.md +13 -0
- data/gh-pages/_posts/2012-12-23-1.5.2.md +15 -0
- data/gh-pages/_posts/2012-12-26-1.5.3.md +19 -0
- data/gh-pages/_posts/2012-12-27-1.6.0.md +18 -0
- data/gh-pages/_posts/2012-12-29-1.7.0.md +18 -0
- data/gh-pages/_posts/2013-01-05-1.8.0.md +18 -0
- data/gh-pages/_posts/2013-01-06-1.9.0.md +20 -0
- data/gh-pages/_posts/2013-01-10-1.10.0.md +18 -0
- data/gh-pages/_posts/2013-01-20-1.11.0.md +14 -0
- data/gh-pages/_posts/2013-02-16-1.12.0.md +14 -0
- data/gh-pages/_posts/2013-02-17-1.13.0.md +29 -0
- data/gh-pages/_posts/2013-02-17-1.14.0.md +15 -0
- data/gh-pages/_posts/2013-02-17-1.14.1.md +18 -0
- data/gh-pages/_posts/2013-02-17-two-months-in.md +27 -0
- data/gh-pages/_posts/2013-03-16-1.15.0.md +28 -0
- data/gh-pages/_posts/2013-03-16-coloured-output-released.md +27 -0
- data/gh-pages/_posts/2013-04-10-ruby-2.0-compatibility.md +28 -0
- data/gh-pages/_posts/2013-04-11-1.15.1.md +13 -0
- data/gh-pages/_posts/2013-04-12-1.16.0.md +22 -0
- data/gh-pages/_posts/2013-04-14-1.17.0.md +15 -0
- data/gh-pages/_posts/2013-04-14-1.17.1.md +20 -0
- data/gh-pages/_posts/2013-04-14-1.17.2.md +13 -0
- data/gh-pages/_posts/2013-04-15-sync-alias.md +31 -0
- data/gh-pages/_posts/2013-04-15-utf8-fixed-and-more.md +37 -0
- data/gh-pages/_posts/2013-04-16-1.18.0.md +15 -0
- data/gh-pages/_posts/2013-04-16-set-up-color-output.md +47 -0
- data/gh-pages/_posts/2013-04-19-1.19.0.md +13 -0
- data/gh-pages/_posts/2013-04-19-1.20.0.md +15 -0
- data/gh-pages/_posts/2013-04-20-1.21.0.md +16 -0
- data/gh-pages/_posts/2013-04-20-1.22.0.md +14 -0
- data/gh-pages/_posts/2013-04-20-1.22.1.md +13 -0
- data/gh-pages/_posts/2013-04-21-1.22.2.md +15 -0
- data/gh-pages/_posts/2013-04-21-1.23.0.md +35 -0
- data/gh-pages/_posts/2013-04-23-1.24.0.md +16 -0
- data/gh-pages/_posts/2013-04-24-1.25.0.md +21 -0
- data/gh-pages/_posts/2013-05-09-2.0.0.md +33 -0
- data/gh-pages/_posts/2013-05-09-version-2.0.0-released.md +32 -0
- data/gh-pages/_posts/2013-07-20-2.1.0.md +36 -0
- data/gh-pages/_posts/2013-07-20-2.2.0.md +20 -0
- data/gh-pages/_posts/2013-10-12-2.3.0.md +19 -0
- data/gh-pages/_posts/2014-03-30-2.3.1.md +25 -0
- data/gh-pages/_posts/2015-01-05-2.3.2.md +18 -0
- data/gh-pages/_posts/2015-12-03-get-involved.md +29 -0
- data/gh-pages/_posts/2015-12-05-2.3.3.md +16 -0
- data/gh-pages/_posts/2016-01-02-2.4.0.md +19 -0
- data/gh-pages/_posts/2017-05-01-2.4.1.md +12 -0
- data/gh-pages/_posts/2017-10-23-sleep-mode.md +18 -0
- data/gh-pages/_posts/2018-01-03-3.0.1.md +12 -0
- data/gh-pages/_stylesheets/ppl/color.less +119 -0
- data/gh-pages/_stylesheets/ppl/layout.less +54 -0
- data/gh-pages/_stylesheets/ppl/style.less +185 -0
- data/gh-pages/_stylesheets/ppl/typography.less +59 -0
- data/gh-pages/development/changelog/index.md +18 -0
- data/gh-pages/development/changelog/split.rb +51 -0
- data/gh-pages/development/index.html +32 -0
- data/gh-pages/development/roadmap/index.md +15 -0
- data/gh-pages/documentation/about/index.html +63 -0
- data/gh-pages/documentation/commands/add/index.md +43 -0
- data/gh-pages/documentation/commands/age/add/index.md +40 -0
- data/gh-pages/documentation/commands/age/index.md +38 -0
- data/gh-pages/documentation/commands/bday/index.md +44 -0
- data/gh-pages/documentation/commands/completion/index.md +38 -0
- data/gh-pages/documentation/commands/email/index.md +64 -0
- data/gh-pages/documentation/commands/grep/index.md +32 -0
- data/gh-pages/documentation/commands/init/index.md +28 -0
- data/gh-pages/documentation/commands/ls/index.md +55 -0
- data/gh-pages/documentation/commands/mutt/index.md +36 -0
- data/gh-pages/documentation/commands/mv/index.md +26 -0
- data/gh-pages/documentation/commands/name/index.md +45 -0
- data/gh-pages/documentation/commands/nick/index.md +44 -0
- data/gh-pages/documentation/commands/org/index.md +45 -0
- data/gh-pages/documentation/commands/phone/index.md +56 -0
- data/gh-pages/documentation/commands/post/index.md +61 -0
- data/gh-pages/documentation/commands/pull/index.md +39 -0
- data/gh-pages/documentation/commands/push/index.md +36 -0
- data/gh-pages/documentation/commands/remote/index.md +40 -0
- data/gh-pages/documentation/commands/rm/index.md +23 -0
- data/gh-pages/documentation/commands/scrape/index.md +38 -0
- data/gh-pages/documentation/commands/shell/index.md +39 -0
- data/gh-pages/documentation/commands/show/index.md +33 -0
- data/gh-pages/documentation/commands/url/index.md +44 -0
- data/gh-pages/documentation/commands/version/index.md +27 -0
- data/gh-pages/documentation/configuration/address_book/index.md +22 -0
- data/gh-pages/documentation/configuration/alias/index.md +45 -0
- data/gh-pages/documentation/configuration/color/index.md +47 -0
- data/gh-pages/documentation/configuration/color_age/index.md +20 -0
- data/gh-pages/documentation/configuration/color_bday/index.md +20 -0
- data/gh-pages/documentation/configuration/color_email/index.md +21 -0
- data/gh-pages/documentation/configuration/color_ls/index.md +21 -0
- data/gh-pages/documentation/configuration/color_name/index.md +20 -0
- data/gh-pages/documentation/configuration/color_nick/index.md +20 -0
- data/gh-pages/documentation/configuration/color_org/index.md +20 -0
- data/gh-pages/documentation/configuration/color_phone/index.md +22 -0
- data/gh-pages/documentation/configuration/color_post/index.md +20 -0
- data/gh-pages/documentation/configuration/color_url/index.md +20 -0
- data/gh-pages/documentation/configuration/index.html +8 -0
- data/gh-pages/documentation/index.html +183 -0
- data/gh-pages/documentation/integration/bash/index.md +23 -0
- data/gh-pages/documentation/integration/google/index.md +26 -0
- data/gh-pages/documentation/integration/index.html +8 -0
- data/gh-pages/documentation/integration/mutt/index.md +35 -0
- data/gh-pages/documentation/integration/zsh/index.md +19 -0
- data/gh-pages/documentation/quick-start/index.html +88 -0
- data/gh-pages/documentation/tips/index.html +9 -0
- data/gh-pages/index.html +108 -0
- data/gh-pages/news/index.html +9 -0
- data/gh-pages/robots.txt +3 -0
- data/gh-pages/stylesheets/flatstrap.css +10 -0
- data/gh-pages/stylesheets/ppl.scss +235 -0
- data/gh-pages/wiki.png +0 -0
- data/lib/ppl.rb +4 -1
- data/lib/ppl/adapter/color.rb +0 -1
- data/lib/ppl/adapter/color/colored.rb +0 -1
- data/lib/ppl/adapter/email_scraper.rb +0 -1
- data/lib/ppl/adapter/email_scraper/mail.rb +4 -5
- data/lib/ppl/adapter/storage.rb +0 -1
- data/lib/ppl/adapter/storage/disk.rb +0 -1
- data/lib/ppl/adapter/storage/factory.rb +0 -1
- data/lib/ppl/adapter/vcard.rb +0 -1
- data/lib/ppl/adapter/vcard/vpim.rb +5 -1
- data/lib/ppl/application/bootstrap.rb +0 -1
- data/lib/ppl/application/command.rb +0 -1
- data/lib/ppl/application/command_suite.rb +0 -1
- data/lib/ppl/application/configuration.rb +0 -1
- data/lib/ppl/application/input.rb +0 -1
- data/lib/ppl/application/output.rb +0 -1
- data/lib/ppl/application/router.rb +0 -1
- data/lib/ppl/application/shell.rb +0 -1
- data/lib/ppl/command/add.rb +0 -1
- data/lib/ppl/command/age.rb +0 -1
- data/lib/ppl/command/attribute.rb +0 -1
- data/lib/ppl/command/bday.rb +0 -1
- data/lib/ppl/command/completion.rb +0 -1
- data/lib/ppl/command/email.rb +0 -1
- data/lib/ppl/command/external.rb +0 -1
- data/lib/ppl/command/help.rb +0 -1
- data/lib/ppl/command/init.rb +0 -1
- data/lib/ppl/command/ls.rb +0 -1
- data/lib/ppl/command/mutt.rb +0 -1
- data/lib/ppl/command/mv.rb +0 -1
- data/lib/ppl/command/name.rb +0 -1
- data/lib/ppl/command/nick.rb +0 -1
- data/lib/ppl/command/org.rb +0 -1
- data/lib/ppl/command/phone.rb +0 -1
- data/lib/ppl/command/post.rb +0 -1
- data/lib/ppl/command/rm.rb +0 -1
- data/lib/ppl/command/scrape.rb +0 -1
- data/lib/ppl/command/shell.rb +0 -1
- data/lib/ppl/command/show.rb +0 -1
- data/lib/ppl/command/url.rb +0 -1
- data/lib/ppl/command/version.rb +0 -1
- data/lib/ppl/entity/address_book.rb +0 -1
- data/lib/ppl/entity/contact.rb +0 -1
- data/lib/ppl/entity/email_address.rb +0 -1
- data/lib/ppl/entity/name.rb +0 -1
- data/lib/ppl/entity/phone_number.rb +0 -1
- data/lib/ppl/entity/postal_address.rb +0 -1
- data/lib/ppl/error/completion_not_found.rb +0 -1
- data/lib/ppl/error/contact_not_found.rb +0 -1
- data/lib/ppl/error/incorrect_usage.rb +0 -1
- data/lib/ppl/error/invalid_vcard.rb +1 -0
- data/lib/ppl/error/postal_address_not_found.rb +0 -1
- data/lib/ppl/format/address_book.rb +0 -1
- data/lib/ppl/format/address_book/ages.rb +0 -1
- data/lib/ppl/format/address_book/birthdays.rb +0 -1
- data/lib/ppl/format/address_book/email_addresses.rb +0 -1
- data/lib/ppl/format/address_book/mutt_query.rb +0 -1
- data/lib/ppl/format/address_book/names.rb +0 -1
- data/lib/ppl/format/address_book/nicknames.rb +0 -1
- data/lib/ppl/format/address_book/one_line.rb +0 -1
- data/lib/ppl/format/address_book/organizations.rb +0 -1
- data/lib/ppl/format/address_book/phone_numbers.rb +0 -1
- data/lib/ppl/format/address_book/postal_addresses.rb +0 -1
- data/lib/ppl/format/address_book/urls.rb +0 -1
- data/lib/ppl/format/contact.rb +0 -1
- data/lib/ppl/format/contact/age.rb +0 -1
- data/lib/ppl/format/contact/birthday.rb +0 -1
- data/lib/ppl/format/contact/email_addresses.rb +0 -1
- data/lib/ppl/format/contact/full.rb +0 -1
- data/lib/ppl/format/contact/nicknames.rb +0 -1
- data/lib/ppl/format/contact/organization.rb +0 -1
- data/lib/ppl/format/contact/phone_number.rb +0 -1
- data/lib/ppl/format/contact/postal_address.rb +0 -1
- data/lib/ppl/format/contact/postal_addresses.rb +0 -1
- data/lib/ppl/format/contact/urls.rb +0 -1
- data/lib/ppl/format/custom.rb +0 -1
- data/lib/ppl/format/custom/contact.rb +0 -1
- data/lib/ppl/format/custom/email_address.rb +0 -1
- data/lib/ppl/format/custom/phone_number.rb +0 -1
- data/lib/ppl/format/name.rb +0 -1
- data/lib/ppl/format/name/full_only.rb +0 -1
- data/lib/ppl/format/postal_address.rb +0 -1
- data/lib/ppl/format/postal_address/multi_line.rb +0 -1
- data/lib/ppl/format/postal_address/one_line.rb +0 -1
- data/lib/ppl/format/table.rb +0 -1
- data/lib/ppl/service/email_address.rb +0 -1
- data/lib/ppl/service/name.rb +0 -1
- data/lib/ppl/service/phone_number.rb +0 -1
- data/lib/ppl/service/postal_address.rb +0 -1
- data/{LICENSE → license} +0 -0
- data/makefile +18 -0
- data/package.json +23 -0
- data/ppl.gemspec +15 -13
- data/{README.md → readme.md} +12 -9
- data/site/_data/url.js +4 -0
- data/site/casts/hero.cast +189 -0
- data/site/development.njk +6 -0
- data/site/documentation.njk +6 -0
- data/site/index.njk +75 -0
- data/site/news.njk +6 -0
- data/site/style.scss +140 -0
- data/spec/ppl/adapter/color/colored_spec.rb +3 -4
- data/spec/ppl/adapter/color_spec.rb +0 -1
- data/spec/ppl/adapter/email_scraper/mail_spec.rb +13 -13
- data/spec/ppl/adapter/email_scraper_spec.rb +0 -1
- data/spec/ppl/adapter/output_spec.rb +7 -8
- data/spec/ppl/adapter/storage/disk_spec.rb +18 -19
- data/spec/ppl/adapter/storage/factory_spec.rb +3 -4
- data/spec/ppl/adapter/storage/git_spec.rb +31 -32
- data/spec/ppl/adapter/storage_spec.rb +3 -4
- data/spec/ppl/adapter/vcard/greencard_spec.rb +45 -45
- data/spec/ppl/adapter/vcard_spec.rb +0 -1
- data/spec/ppl/application/bootstrap_spec.rb +128 -129
- data/spec/ppl/application/command_spec.rb +8 -9
- data/spec/ppl/application/command_suite_spec.rb +7 -8
- data/spec/ppl/application/configuration_spec.rb +16 -17
- data/spec/ppl/application/input_spec.rb +2 -3
- data/spec/ppl/application/router_spec.rb +8 -9
- data/spec/ppl/application/shell_spec.rb +39 -40
- data/spec/ppl/command/add_spec.rb +6 -7
- data/spec/ppl/command/age_spec.rb +7 -8
- data/spec/ppl/command/attribute_spec.rb +22 -23
- data/spec/ppl/command/bday_spec.rb +11 -12
- data/spec/ppl/command/completion_spec.rb +7 -8
- data/spec/ppl/command/email_spec.rb +19 -20
- data/spec/ppl/command/external_spec.rb +7 -8
- data/spec/ppl/command/help_spec.rb +15 -16
- data/spec/ppl/command/init_spec.rb +5 -6
- data/spec/ppl/command/ls_spec.rb +12 -13
- data/spec/ppl/command/mutt_spec.rb +33 -34
- data/spec/ppl/command/mv_spec.rb +11 -12
- data/spec/ppl/command/name_spec.rb +17 -18
- data/spec/ppl/command/nick_spec.rb +1 -2
- data/spec/ppl/command/org_spec.rb +1 -2
- data/spec/ppl/command/phone_spec.rb +15 -16
- data/spec/ppl/command/post_spec.rb +29 -30
- data/spec/ppl/command/rm_spec.rb +3 -4
- data/spec/ppl/command/scrape_spec.rb +24 -25
- data/spec/ppl/command/shell_spec.rb +41 -42
- data/spec/ppl/command/show_spec.rb +4 -5
- data/spec/ppl/command/url_spec.rb +1 -2
- data/spec/ppl/command/version_spec.rb +4 -5
- data/spec/ppl/entity/address_book_spec.rb +1 -2
- data/spec/ppl/entity/contact_spec.rb +16 -17
- data/spec/ppl/entity/email_address_spec.rb +3 -4
- data/spec/ppl/entity/name_spec.rb +1 -2
- data/spec/ppl/entity/phone_number_spec.rb +5 -6
- data/spec/ppl/entity/postal_address_spec.rb +2 -3
- data/spec/ppl/format/address_book/ages_spec.rb +3 -4
- data/spec/ppl/format/address_book/birthdays_spec.rb +3 -4
- data/spec/ppl/format/address_book/email_addresses_spec.rb +3 -4
- data/spec/ppl/format/address_book/mutt_query_spec.rb +3 -4
- data/spec/ppl/format/address_book/names_spec.rb +3 -4
- data/spec/ppl/format/address_book/nicknames_spec.rb +4 -5
- data/spec/ppl/format/address_book/one_line_spec.rb +5 -6
- data/spec/ppl/format/address_book/organizations_spec.rb +3 -4
- data/spec/ppl/format/address_book/phone_numbers_spec.rb +3 -4
- data/spec/ppl/format/address_book/postal_addresses_spec.rb +2 -3
- data/spec/ppl/format/address_book/urls_spec.rb +3 -4
- data/spec/ppl/format/address_book_spec.rb +0 -1
- data/spec/ppl/format/contact/age_spec.rb +8 -9
- data/spec/ppl/format/contact/birthday_spec.rb +4 -5
- data/spec/ppl/format/contact/email_addresses_spec.rb +3 -4
- data/spec/ppl/format/contact/full_spec.rb +11 -12
- data/spec/ppl/format/contact/nicknames_spec.rb +4 -5
- data/spec/ppl/format/contact/organization_spec.rb +4 -5
- data/spec/ppl/format/contact/phone_number_spec.rb +4 -5
- data/spec/ppl/format/contact/postal_address_spec.rb +1 -2
- data/spec/ppl/format/contact/postal_addresses_spec.rb +3 -4
- data/spec/ppl/format/contact/urls_spec.rb +4 -5
- data/spec/ppl/format/contact_spec.rb +0 -1
- data/spec/ppl/format/custom/contact_spec.rb +13 -14
- data/spec/ppl/format/custom/email_address_spec.rb +3 -4
- data/spec/ppl/format/custom/phone_number_spec.rb +4 -5
- data/spec/ppl/format/custom_spec.rb +6 -7
- data/spec/ppl/format/name/full_only_spec.rb +4 -5
- data/spec/ppl/format/name_spec.rb +0 -1
- data/spec/ppl/format/postal_address/multi_line_spec.rb +10 -11
- data/spec/ppl/format/postal_address/one_line_spec.rb +9 -10
- data/spec/ppl/format/postal_address_spec.rb +0 -1
- data/spec/ppl/format/table_spec.rb +11 -11
- data/spec/ppl/service/email_address_spec.rb +13 -14
- data/spec/ppl/service/name_spec.rb +9 -10
- data/spec/ppl/service/phone_number_spec.rb +11 -12
- data/spec/ppl/service/postal_address_spec.rb +20 -21
- data/spec/spec_helper.rb +4 -0
- data/yarn.lock +3605 -0
- metadata +183 -22
- data/.travis.yml +0 -11
- data/COPYING +0 -339
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Age do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -16,24 +15,24 @@ describe Ppl::Command::Age do
|
|
16
15
|
|
17
16
|
describe "#name" do
|
18
17
|
it "should be 'age'" do
|
19
|
-
@command.name.
|
18
|
+
expect(@command.name).to eq "age"
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
22
|
describe "#execute" do
|
24
23
|
|
25
24
|
it "should list contacts' ages if no arguments are given" do
|
26
|
-
@storage.
|
27
|
-
@list_format.
|
28
|
-
@output.
|
25
|
+
expect(@storage).to receive(:load_address_book)
|
26
|
+
expect(@list_format).to receive(:process)
|
27
|
+
expect(@output).to receive(:line)
|
29
28
|
@command.execute(@input, @output)
|
30
29
|
end
|
31
30
|
|
32
31
|
it "should show a single contact's ages if one is specified" do
|
33
32
|
@input.arguments = ["jdoe"]
|
34
|
-
@storage.
|
35
|
-
@show_format.
|
36
|
-
@output.
|
33
|
+
expect(@storage).to receive(:require_contact)
|
34
|
+
expect(@show_format).to receive(:process)
|
35
|
+
expect(@output).to receive(:line)
|
37
36
|
@command.execute(@input, @output)
|
38
37
|
end
|
39
38
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Attribute do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -22,47 +21,47 @@ describe Ppl::Command::Attribute do
|
|
22
21
|
describe "#execute" do
|
23
22
|
|
24
23
|
it "should list all the contacts and the value of the attribute for each" do
|
25
|
-
@storage.
|
26
|
-
@list_format.
|
27
|
-
@output.
|
28
|
-
@command.execute(@input, @output).
|
24
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
25
|
+
expect(@list_format).to receive(:process).and_return("imagine this is a list")
|
26
|
+
expect(@output).to receive(:line).with("imagine this is a list")
|
27
|
+
expect(@command.execute(@input, @output)).to eq true
|
29
28
|
end
|
30
29
|
|
31
30
|
it "should disable color output if :no_color is set" do
|
32
31
|
@input.options[:no_color] = true
|
33
|
-
@storage.
|
34
|
-
@list_format.
|
35
|
-
@list_format.
|
36
|
-
@output.
|
37
|
-
@command.execute(@input, @output).
|
32
|
+
allow(@storage).to receive(:load_address_book).and_return(@address_book)
|
33
|
+
expect(@list_format).to receive(:disable_colors!)
|
34
|
+
allow(@list_format).to receive(:process)
|
35
|
+
expect(@output).to receive(:line)
|
36
|
+
expect(@command.execute(@input, @output)).to eq true
|
38
37
|
end
|
39
38
|
|
40
39
|
it "should show the full list of attributes for the given contact" do
|
41
40
|
@input.arguments.push("jdoe")
|
42
|
-
@storage.
|
43
|
-
@show_format.
|
44
|
-
@output.
|
45
|
-
@command.execute(@input, @output).
|
41
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
42
|
+
expect(@show_format).to receive(:process).and_return("all the info")
|
43
|
+
expect(@output).to receive(:line).with("all the info")
|
44
|
+
expect(@command.execute(@input, @output)).to eq true
|
46
45
|
end
|
47
46
|
|
48
47
|
it "should add the given value to the contact's attributes" do
|
49
48
|
@input.arguments.push("jdoe", "anyvalue")
|
50
|
-
@storage.
|
51
|
-
@contact.
|
52
|
-
@storage.
|
53
|
-
@command.execute(@input, @output).
|
49
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
50
|
+
expect(@contact).to receive(:phone_numbers).and_return([])
|
51
|
+
expect(@storage).to receive(:save_contact)
|
52
|
+
expect(@command.execute(@input, @output)).to eq true
|
54
53
|
end
|
55
54
|
|
56
55
|
it "should delete the given value from the contact's attributes" do
|
57
56
|
phone_numbers = double(Array)
|
58
|
-
phone_numbers.
|
57
|
+
expect(phone_numbers).to receive(:delete)
|
59
58
|
|
60
|
-
@storage.
|
61
|
-
@contact.
|
62
|
-
@storage.
|
59
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
60
|
+
expect(@contact).to receive(:phone_numbers).and_return(phone_numbers)
|
61
|
+
expect(@storage).to receive(:save_contact).and_return(true)
|
63
62
|
@input.arguments = ["jdoe", "somevalue"]
|
64
63
|
@input.options = { :delete => true }
|
65
|
-
@command.execute(@input, @output).
|
64
|
+
expect(@command.execute(@input, @output)).to eq true
|
66
65
|
end
|
67
66
|
|
68
67
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Bday do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -16,31 +15,31 @@ describe Ppl::Command::Bday do
|
|
16
15
|
|
17
16
|
describe "#name" do
|
18
17
|
it "should be 'bday'" do
|
19
|
-
@command.name.
|
18
|
+
expect(@command.name).to eq "bday"
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
22
|
describe "#execute" do
|
24
23
|
|
25
24
|
it "should show the contact's birthday if no date is given" do
|
26
|
-
@storage.
|
27
|
-
@show_format.
|
28
|
-
@output.
|
25
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
26
|
+
expect(@show_format).to receive(:process).and_return("1970-01-01")
|
27
|
+
expect(@output).to receive(:line).with("1970-01-01")
|
29
28
|
@input.arguments = ["jim"]
|
30
|
-
@command.execute(@input, @output).
|
29
|
+
expect(@command.execute(@input, @output)).to eq true
|
31
30
|
end
|
32
31
|
|
33
32
|
it "should not output anything if there's no birthday to show" do
|
34
|
-
@storage.
|
35
|
-
@show_format.
|
33
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
34
|
+
expect(@show_format).to receive(:process).and_return("")
|
36
35
|
@input.arguments = ["jim"]
|
37
|
-
@command.execute(@input, @output).
|
36
|
+
expect(@command.execute(@input, @output)).to eq false
|
38
37
|
end
|
39
38
|
|
40
39
|
it "should change the contact's birthday if a date is given" do
|
41
|
-
@storage.
|
42
|
-
@storage.
|
43
|
-
contact.birthday.strftime.
|
40
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
41
|
+
expect(@storage).to receive(:save_contact) do |contact|
|
42
|
+
expect(contact.birthday.strftime).to eq "1980-01-01"
|
44
43
|
end
|
45
44
|
@input.arguments = ["jim", "1980-01-01"]
|
46
45
|
@command.execute(@input, @output)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Completion do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -11,16 +10,16 @@ describe Ppl::Command::Completion do
|
|
11
10
|
|
12
11
|
describe "#name" do
|
13
12
|
it "should be 'completion'" do
|
14
|
-
@command.name.
|
13
|
+
expect(@command.name).to eq "completion"
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
describe "#execute" do
|
19
18
|
|
20
19
|
before(:each) do
|
21
|
-
@directory.
|
22
|
-
File.
|
23
|
-
File.
|
20
|
+
allow(@directory).to receive(:path).and_return("")
|
21
|
+
allow(File).to receive(:exists?).and_return(true)
|
22
|
+
allow(File).to receive(:read)
|
24
23
|
end
|
25
24
|
|
26
25
|
it "should raise an error if no shell is specified" do
|
@@ -30,14 +29,14 @@ describe Ppl::Command::Completion do
|
|
30
29
|
|
31
30
|
it "should raise an error if the shell is not recognised" do
|
32
31
|
@input.arguments = ["invalidshell"]
|
33
|
-
File.
|
32
|
+
expect(File).to receive(:exists?).with("/invalidshell").and_return(false)
|
34
33
|
expect{@command.execute(@input, @output)}.to raise_error(Ppl::Error::CompletionNotFound)
|
35
34
|
end
|
36
35
|
|
37
36
|
it "should read the function from disk and print it to stdout" do
|
38
37
|
@input.arguments = ["zsh"]
|
39
|
-
File.
|
40
|
-
@output.
|
38
|
+
expect(File).to receive(:read).and_return("completion function")
|
39
|
+
expect(@output).to receive(:line).with("completion function")
|
41
40
|
@command.execute(@input, @output)
|
42
41
|
end
|
43
42
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Email do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -7,7 +6,7 @@ describe Ppl::Command::Email do
|
|
7
6
|
|
8
7
|
describe "#name" do
|
9
8
|
it "should be 'email'" do
|
10
|
-
@command.name.
|
9
|
+
expect(@command.name).to eq "email"
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
@@ -22,8 +21,8 @@ describe Ppl::Command::Email do
|
|
22
21
|
@list_format = double(Ppl::Format::AddressBook)
|
23
22
|
@show_format = double(Ppl::Format::Contact)
|
24
23
|
@custom_format = double(Ppl::Format::Custom)
|
25
|
-
@storage.
|
26
|
-
@storage.
|
24
|
+
allow(@storage).to receive(:require_contact).and_return(@contact)
|
25
|
+
allow(@storage).to receive(:save_contact)
|
27
26
|
@command.storage = @storage
|
28
27
|
@command.email_service = @service
|
29
28
|
@command.list_format = @list_format
|
@@ -32,17 +31,17 @@ describe Ppl::Command::Email do
|
|
32
31
|
end
|
33
32
|
|
34
33
|
it "should list all email addresses by default" do
|
35
|
-
@storage.
|
36
|
-
@list_format.
|
37
|
-
@output.
|
34
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
35
|
+
expect(@list_format).to receive(:process).and_return("imagine this is a list")
|
36
|
+
expect(@output).to receive(:line).with("imagine this is a list")
|
38
37
|
@command.execute(@input, @output)
|
39
38
|
end
|
40
39
|
|
41
40
|
it "should show a single contact's addresses if one is specified" do
|
42
41
|
@input.arguments << "jdoe"
|
43
|
-
@storage.
|
44
|
-
@show_format.
|
45
|
-
@output.
|
42
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
43
|
+
expect(@show_format).to receive(:process).and_return("imagine this is a list")
|
44
|
+
expect(@output).to receive(:line).with("imagine this is a list")
|
46
45
|
@command.execute(@input, @output)
|
47
46
|
end
|
48
47
|
|
@@ -50,33 +49,33 @@ describe Ppl::Command::Email do
|
|
50
49
|
@input.arguments << "jdoe"
|
51
50
|
@input.options[:format] = "%e"
|
52
51
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("jdoe@example.org")
|
53
|
-
@storage.
|
54
|
-
@custom_format.
|
55
|
-
@custom_format.
|
56
|
-
@output.
|
52
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
53
|
+
expect(@custom_format).to receive(:format=).with("%e")
|
54
|
+
expect(@custom_format).to receive(:process).and_return("")
|
55
|
+
expect(@output).to receive(:line).with("")
|
57
56
|
@command.execute(@input, @output)
|
58
57
|
end
|
59
58
|
|
60
59
|
it "should delegate to the service layer to add a new email address" do
|
61
60
|
@input.arguments = ["jdoe", "jdoe@example.org"]
|
62
|
-
@storage.
|
63
|
-
@service.
|
61
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
62
|
+
expect(@service).to receive(:add).with(@contact, "jdoe@example.org", @input.options)
|
64
63
|
@command.execute(@input, @output)
|
65
64
|
end
|
66
65
|
|
67
66
|
it "should delegate to the service layer to update an existing address" do
|
68
67
|
@contact.email_addresses << Ppl::Entity::EmailAddress.new("jdoe@example.org")
|
69
68
|
@input.arguments = ["jdoe", "jdoe@example.org"]
|
70
|
-
@storage.
|
71
|
-
@service.
|
69
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
70
|
+
expect(@service).to receive(:update).with(@contact, "jdoe@example.org", {})
|
72
71
|
@command.execute(@input, @output)
|
73
72
|
end
|
74
73
|
|
75
74
|
it "should delegate to the service layer to remove an email address" do
|
76
75
|
@input.arguments = ["jdoe", "jdoe@example.org"]
|
77
76
|
@input.options[:delete] = true
|
78
|
-
@storage.
|
79
|
-
@service.
|
77
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
78
|
+
expect(@service).to receive(:remove).with(@contact, "jdoe@example.org")
|
80
79
|
@command.execute(@input, @output)
|
81
80
|
end
|
82
81
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::External do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -7,28 +6,28 @@ describe Ppl::Command::External do
|
|
7
6
|
@output = double(Ppl::Application::Output)
|
8
7
|
@storage = double(Ppl::Adapter::Storage)
|
9
8
|
|
10
|
-
@storage.
|
9
|
+
allow(@storage).to receive(:path).and_return("/contacts")
|
11
10
|
@command.storage = @storage
|
12
11
|
end
|
13
12
|
|
14
13
|
describe "#execute" do
|
15
14
|
|
16
15
|
it "should chdir to the location of the address book on disk" do
|
17
|
-
Dir.
|
18
|
-
Kernel.
|
16
|
+
expect(Dir).to receive(:chdir).with("/contacts")
|
17
|
+
allow(Kernel).to receive(:exec)
|
19
18
|
@command.execute(@input, @output)
|
20
19
|
end
|
21
20
|
|
22
21
|
it "should run the specified command" do
|
23
|
-
Dir.
|
24
|
-
Kernel.
|
22
|
+
allow(Dir).to receive(:chdir)
|
23
|
+
expect(Kernel).to receive(:exec).with("git remote")
|
25
24
|
@command.execute(@input, @output)
|
26
25
|
end
|
27
26
|
|
28
27
|
it "should pass arguments through to the command" do
|
29
28
|
@input.arguments = ["--help"]
|
30
|
-
Dir.
|
31
|
-
Kernel.
|
29
|
+
allow(Dir).to receive(:chdir)
|
30
|
+
expect(Kernel).to receive(:exec).with("git remote --help")
|
32
31
|
@command.execute(@input, @output)
|
33
32
|
end
|
34
33
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Help do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -12,13 +11,13 @@ describe Ppl::Command::Help do
|
|
12
11
|
it "should accept a value" do
|
13
12
|
suite = Object.new
|
14
13
|
@command.command_suite = suite
|
15
|
-
@command.command_suite.
|
14
|
+
expect(@command.command_suite).to be suite
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
18
|
describe "#name" do
|
20
19
|
it "should be 'help'" do
|
21
|
-
@command.name.
|
20
|
+
expect(@command.name).to eq "help"
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -27,23 +26,23 @@ describe Ppl::Command::Help do
|
|
27
26
|
it "should not list itself" do
|
28
27
|
@command.command_suite.add_command(@command)
|
29
28
|
|
30
|
-
@output.
|
31
|
-
@output.
|
32
|
-
@output.
|
29
|
+
expect(@output).to receive(:line).with("usage: ppl <command>")
|
30
|
+
expect(@output).to receive(:line).with(nil)
|
31
|
+
expect(@output).to receive(:line).with(nil)
|
33
32
|
|
34
33
|
@command.execute(nil, @output)
|
35
34
|
end
|
36
35
|
|
37
36
|
it "should list available commands" do
|
38
37
|
command = double(Ppl::Application::Command)
|
39
|
-
command.
|
40
|
-
command.
|
38
|
+
expect(command).to receive(:name).twice.and_return("one")
|
39
|
+
expect(command).to receive(:description).and_return("The first command")
|
41
40
|
@command.command_suite.add_command(command)
|
42
41
|
|
43
|
-
@output.
|
44
|
-
@output.
|
45
|
-
@output.
|
46
|
-
@output.
|
42
|
+
expect(@output).to receive(:line).with("usage: ppl <command>")
|
43
|
+
expect(@output).to receive(:line).with(nil)
|
44
|
+
expect(@output).to receive(:line).with(" one The first command")
|
45
|
+
expect(@output).to receive(:line).with(nil)
|
47
46
|
|
48
47
|
@command.execute(nil, @output)
|
49
48
|
end
|
@@ -60,15 +59,15 @@ describe Ppl::Command::Help do
|
|
60
59
|
@command.command_suite.add_command(command_foo)
|
61
60
|
@command.command_suite.add_command(command_bar)
|
62
61
|
|
63
|
-
@output.
|
64
|
-
@output.
|
62
|
+
expect(@output).to receive(:line).with("usage: ppl <command>")
|
63
|
+
expect(@output).to receive(:line).with(nil)
|
65
64
|
[
|
66
65
|
" shortname This is a command with a short name",
|
67
66
|
" veryverylongname This is a command with a longer name",
|
68
67
|
].each do |line|
|
69
|
-
@output.
|
68
|
+
expect(@output).to receive(:line).with(line)
|
70
69
|
end
|
71
|
-
@output.
|
70
|
+
expect(@output).to receive(:line).with(nil)
|
72
71
|
|
73
72
|
@command.execute(nil, @output)
|
74
73
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Init do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -9,15 +8,15 @@ describe Ppl::Command::Init do
|
|
9
8
|
|
10
9
|
describe "#name" do
|
11
10
|
it "should be 'init'" do
|
12
|
-
@command.name.
|
11
|
+
expect(@command.name).to eq "init"
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
describe "#execute" do
|
17
16
|
|
18
17
|
it "should pass the given path through to the storage adapter" do
|
19
|
-
Ppl::Adapter::Storage::Git.
|
20
|
-
path.
|
18
|
+
allow(Ppl::Adapter::Storage::Git).to receive(:create_address_book) do |path|
|
19
|
+
expect(path).to eq "/contacts"
|
21
20
|
end
|
22
21
|
@input.arguments.push "/contacts"
|
23
22
|
@command.execute(@input, @output)
|
@@ -27,8 +26,8 @@ describe Ppl::Command::Init do
|
|
27
26
|
FakeFS.activate!
|
28
27
|
Dir.mkdir "/current"
|
29
28
|
Dir.chdir "/current"
|
30
|
-
Ppl::Adapter::Storage::Git.
|
31
|
-
path.
|
29
|
+
allow(Ppl::Adapter::Storage::Git).to receive(:create_address_book) do |path|
|
30
|
+
expect(path).to eq "/current"
|
32
31
|
end
|
33
32
|
@command.execute(@input, @output)
|
34
33
|
FakeFS.deactivate!
|
data/spec/ppl/command/ls_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Ls do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -17,14 +16,14 @@ describe Ppl::Command::Ls do
|
|
17
16
|
|
18
17
|
describe "#name" do
|
19
18
|
it "should be 'ls'" do
|
20
|
-
@command.name.
|
19
|
+
expect(@command.name).to eq "ls"
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
24
23
|
describe "#execute" do
|
25
24
|
|
26
25
|
before(:each) do
|
27
|
-
@storage.
|
26
|
+
expect(@storage).to receive(:load_address_book).and_return(@address_book)
|
28
27
|
end
|
29
28
|
|
30
29
|
after(:each) do
|
@@ -32,24 +31,24 @@ describe Ppl::Command::Ls do
|
|
32
31
|
end
|
33
32
|
|
34
33
|
it "should show the list of contacts in the address book" do
|
35
|
-
@format.
|
36
|
-
@output.
|
34
|
+
expect(@format).to receive(:process).and_return("list of contacts")
|
35
|
+
expect(@output).to receive(:line).with("list of contacts")
|
37
36
|
end
|
38
37
|
|
39
38
|
it "should let the user specify a preset pretty format" do
|
40
39
|
@input.options[:pretty] = "test"
|
41
|
-
@address_book.
|
42
|
-
@custom.
|
43
|
-
@custom.
|
44
|
-
@output.
|
40
|
+
expect(@address_book).to receive(:contacts).and_return([1])
|
41
|
+
expect(@custom).to receive(:use_preset).with("test")
|
42
|
+
expect(@custom).to receive(:process).and_return("list of contacts")
|
43
|
+
expect(@output).to receive(:line).with("list of contacts")
|
45
44
|
end
|
46
45
|
|
47
46
|
it "should let the user specify a custom format" do
|
48
47
|
@input.options[:format] = "%n"
|
49
|
-
@address_book.
|
50
|
-
@custom.
|
51
|
-
@custom.
|
52
|
-
@output.
|
48
|
+
expect(@address_book).to receive(:contacts).and_return([1])
|
49
|
+
expect(@custom).to receive(:format=).with("%n")
|
50
|
+
expect(@custom).to receive(:process).and_return("list of contacts")
|
51
|
+
expect(@output).to receive(:line).with("list of contacts")
|
53
52
|
end
|
54
53
|
|
55
54
|
end
|