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
data/spec/ppl/command/rm_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Rm do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -14,7 +13,7 @@ describe Ppl::Command::Rm do
|
|
14
13
|
|
15
14
|
describe "#name" do
|
16
15
|
it "should be 'rm'" do
|
17
|
-
@command.name.
|
16
|
+
expect(@command.name).to eq "rm"
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
@@ -26,8 +25,8 @@ describe Ppl::Command::Rm do
|
|
26
25
|
end
|
27
26
|
|
28
27
|
it "should delete the given contact" do
|
29
|
-
@storage.
|
30
|
-
@storage.
|
28
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
29
|
+
expect(@storage).to receive(:delete_contact).with(@contact)
|
31
30
|
@command.execute(@input, @output)
|
32
31
|
end
|
33
32
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Scrape do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -16,68 +15,68 @@ describe Ppl::Command::Scrape do
|
|
16
15
|
|
17
16
|
describe "#name" do
|
18
17
|
it "should be 'scrape'" do
|
19
|
-
@command.name.
|
18
|
+
expect(@command.name).to eq "scrape"
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
22
|
describe "#execute" do
|
24
23
|
|
25
24
|
before(:each) do
|
26
|
-
@input.stdin.
|
27
|
-
@input.stdin.
|
28
|
-
@input.stdin.
|
29
|
-
@email_scraper.
|
30
|
-
Readline.
|
31
|
-
@storage.
|
25
|
+
allow(@input.stdin).to receive(:read)
|
26
|
+
allow(@input.stdin).to receive(:reopen)
|
27
|
+
allow(@input.stdin).to receive(:eof?)
|
28
|
+
allow(@email_scraper).to receive(:scrape_contacts).and_return([])
|
29
|
+
allow(Readline).to receive(:readline).and_return("")
|
30
|
+
allow(@storage).to receive(:save_contact)
|
32
31
|
end
|
33
32
|
|
34
33
|
it "should read input from stdin" do
|
35
34
|
@input.options[:sender] = true
|
36
|
-
@input.stdin.
|
35
|
+
expect(@input.stdin).to receive(:read)
|
37
36
|
@command.execute(@input, @output)
|
38
37
|
end
|
39
38
|
|
40
39
|
it "should pass input to the email scraper" do
|
41
40
|
@input.options[:sender] = true
|
42
|
-
@email_scraper.
|
41
|
+
expect(@email_scraper).to receive(:scrape_contacts)
|
43
42
|
@command.execute(@input, @output)
|
44
43
|
end
|
45
44
|
|
46
45
|
it "shouldn't do any scraping unless told which fields to scrape" do
|
47
|
-
@email_scraper.
|
46
|
+
expect(@email_scraper).not_to receive(:scrape_contacts)
|
48
47
|
@command.execute(@input, @output)
|
49
48
|
end
|
50
49
|
|
51
50
|
it "should always save contacts if in quiet mode" do
|
52
51
|
@input.options[:sender] = true
|
53
52
|
@input.options[:quiet] = true
|
54
|
-
@email_scraper.
|
55
|
-
Readline.
|
56
|
-
@storage.
|
53
|
+
allow(@email_scraper).to receive(:scrape_contacts).and_return([@contact])
|
54
|
+
expect(Readline).not_to receive(:readline)
|
55
|
+
expect(@storage).to receive(:save_contact)
|
57
56
|
@command.execute(@input, @output)
|
58
57
|
end
|
59
58
|
|
60
59
|
it "should reopen stdin to prompt the user" do
|
61
60
|
@input.options[:sender] = true
|
62
|
-
@input.stdin.
|
63
|
-
@input.stdin.
|
64
|
-
@email_scraper.
|
61
|
+
expect(@input.stdin).to receive(:eof?).and_return(true)
|
62
|
+
expect(@input.stdin).to receive(:reopen)
|
63
|
+
allow(@email_scraper).to receive(:scrape_contacts).and_return([@contact])
|
65
64
|
@command.execute(@input, @output)
|
66
65
|
end
|
67
66
|
|
68
67
|
it "should save the contact if the user approves" do
|
69
68
|
@input.options[:sender] = true
|
70
|
-
@email_scraper.
|
71
|
-
Readline.
|
72
|
-
@storage.
|
69
|
+
allow(@email_scraper).to receive(:scrape_contacts).and_return([@contact])
|
70
|
+
expect(Readline).to receive(:readline).and_return("y")
|
71
|
+
expect(@storage).to receive(:save_contact)
|
73
72
|
@command.execute(@input, @output)
|
74
73
|
end
|
75
74
|
|
76
75
|
it "should not save the contact if the user disapproves" do
|
77
76
|
@input.options[:sender] = true
|
78
|
-
@email_scraper.
|
79
|
-
Readline.
|
80
|
-
@storage.
|
77
|
+
allow(@email_scraper).to receive(:scrape_contacts).and_return([@contact])
|
78
|
+
expect(Readline).to receive(:readline).and_return("n")
|
79
|
+
expect(@storage).not_to receive(:save_contact)
|
81
80
|
@command.execute(@input, @output)
|
82
81
|
end
|
83
82
|
|
@@ -86,8 +85,8 @@ describe Ppl::Command::Scrape do
|
|
86
85
|
contact = Ppl::Entity::Contact.new
|
87
86
|
contact.name = "Test Person"
|
88
87
|
contact.email_addresses << "test@example.org"
|
89
|
-
@email_scraper.
|
90
|
-
Readline.
|
88
|
+
allow(@email_scraper).to receive(:scrape_contacts).and_return([contact])
|
89
|
+
expect(Readline).to receive(:readline).with("Add \"Test Person <test@example.org>\" to your address book [Y/n]? ")
|
91
90
|
@command.execute(@input, @output)
|
92
91
|
end
|
93
92
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Shell do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -9,16 +8,16 @@ describe Ppl::Command::Shell do
|
|
9
8
|
|
10
9
|
describe "#name" do
|
11
10
|
it "should be 'shell'" do
|
12
|
-
@command.name.
|
11
|
+
expect(@command.name).to eq "shell"
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
describe "#execute" do
|
17
16
|
it "should read a line of input from stdin" do
|
18
|
-
Readline.
|
19
|
-
@command.
|
20
|
-
@command.
|
21
|
-
@command.execute(@input, @output).
|
17
|
+
expect(Readline).to receive(:readline)
|
18
|
+
allow(@command).to receive(:welcome_user)
|
19
|
+
allow(@command).to receive(:terminate_gracefully)
|
20
|
+
expect(@command.execute(@input, @output)).to eq true
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -26,73 +25,73 @@ describe Ppl::Command::Shell do
|
|
26
25
|
|
27
26
|
before(:each) do
|
28
27
|
@input.stdin = double(IO)
|
29
|
-
@input.stdin.
|
28
|
+
allow(@input.stdin).to receive(:tty?) { true }
|
30
29
|
end
|
31
30
|
|
32
31
|
it "should not show a prompt if stdin isn't a tty" do
|
33
|
-
@input.stdin.
|
34
|
-
Readline.
|
35
|
-
@command.
|
32
|
+
allow(@input.stdin).to receive(:tty?) { false }
|
33
|
+
expect(Readline).to receive(:readline).with("", true)
|
34
|
+
allow(@command).to receive(:welcome_user)
|
36
35
|
@command.execute(@input, @output)
|
37
36
|
end
|
38
37
|
|
39
38
|
it "should show a prompt if stdin is a tty" do
|
40
|
-
@input.stdin.
|
41
|
-
Readline.
|
42
|
-
@command.
|
43
|
-
@command.
|
39
|
+
allow(@input.stdin).to receive(:tty?) { true }
|
40
|
+
expect(Readline).to receive(:readline).with("ppl> ", true)
|
41
|
+
allow(@command).to receive(:welcome_user)
|
42
|
+
allow(@command).to receive(:terminate_gracefully)
|
44
43
|
@command.execute(@input, @output)
|
45
44
|
end
|
46
45
|
|
47
46
|
it "should make a system call with the input from stdin" do
|
48
|
-
Readline.
|
49
|
-
Readline.
|
50
|
-
Kernel.
|
51
|
-
command.
|
47
|
+
expect(Readline).to receive(:readline).and_return("email fred")
|
48
|
+
expect(Readline).to receive(:readline).and_return(false)
|
49
|
+
expect(Kernel).to receive(:system) do |command|
|
50
|
+
expect(command).to include "email fred"
|
52
51
|
end
|
53
|
-
@command.
|
54
|
-
@command.
|
55
|
-
@command.execute(@input, @output).
|
52
|
+
allow(@command).to receive(:welcome_user)
|
53
|
+
allow(@command).to receive(:terminate_gracefully)
|
54
|
+
expect(@command.execute(@input, @output)).to eq true
|
56
55
|
end
|
57
56
|
|
58
57
|
it "should exit on ctrl+c" do
|
59
|
-
Readline.
|
60
|
-
@command.
|
61
|
-
@command.
|
62
|
-
@command.execute(@input, @output).
|
58
|
+
expect(Readline).to receive(:readline).and_raise(Interrupt)
|
59
|
+
allow(@command).to receive(:welcome_user)
|
60
|
+
allow(@command).to receive(:terminate_gracefully)
|
61
|
+
expect(@command.execute(@input, @output)).to eq false
|
63
62
|
end
|
64
63
|
|
65
64
|
it "should print a final newline on EOF so the user's prompt looks nice" do
|
66
|
-
@input.stdin.
|
67
|
-
@output.
|
68
|
-
Readline.
|
69
|
-
@command.
|
65
|
+
allow(@input.stdin).to receive(:tty?) { true }
|
66
|
+
expect(@output).to receive(:line).with("")
|
67
|
+
expect(Readline).to receive(:readline).and_return(false)
|
68
|
+
allow(@command).to receive(:welcome_user)
|
70
69
|
@command.execute(@input, @output)
|
71
70
|
end
|
72
71
|
|
73
72
|
it "should print a final newline on error so the user's prompt looks nice" do
|
74
|
-
@input.stdin.
|
75
|
-
@output.
|
76
|
-
@command.
|
73
|
+
allow(@input.stdin).to receive(:tty?) { true }
|
74
|
+
expect(@output).to receive(:line).with("")
|
75
|
+
allow(@command).to receive(:shell).and_raise(Interrupt)
|
77
76
|
@command.execute(@input, @output)
|
78
77
|
end
|
79
78
|
|
80
79
|
it "should not print a final newline on EOF if stdin isn't a tty" do
|
81
|
-
@input.stdin.
|
82
|
-
@output.
|
83
|
-
Readline.
|
84
|
-
@command.
|
80
|
+
allow(@input.stdin).to receive(:tty?) { false }
|
81
|
+
expect(@output).not_to receive(:line).with("")
|
82
|
+
expect(Readline).to receive(:readline).and_return(false)
|
83
|
+
allow(@command).to receive(:welcome_user)
|
85
84
|
@command.execute(@input, @output)
|
86
85
|
end
|
87
86
|
|
88
87
|
it "should print a welcome message on the tty" do
|
89
|
-
@input.stdin.
|
90
|
-
@output.
|
91
|
-
line.
|
92
|
-
line.
|
88
|
+
allow(@input.stdin).to receive(:tty?) { true }
|
89
|
+
expect(@output).to receive(:line) do |line|
|
90
|
+
expect(line).to include "ppl"
|
91
|
+
expect(line).to include Ppl::Version
|
93
92
|
end
|
94
|
-
Readline.
|
95
|
-
@command.
|
93
|
+
expect(Readline).to receive(:readline).and_return(false)
|
94
|
+
allow(@command).to receive(:terminate_gracefully)
|
96
95
|
@command.execute(@input, @output)
|
97
96
|
end
|
98
97
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Show do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -15,7 +14,7 @@ describe Ppl::Command::Show do
|
|
15
14
|
|
16
15
|
describe "#name" do
|
17
16
|
it "should be 'show'" do
|
18
|
-
@command.name.
|
17
|
+
expect(@command.name).to eq "show"
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -27,12 +26,12 @@ describe Ppl::Command::Show do
|
|
27
26
|
end
|
28
27
|
|
29
28
|
it "should show the contact's name" do
|
30
|
-
@storage.
|
31
|
-
@format.
|
29
|
+
expect(@storage).to receive(:require_contact).and_return(@contact)
|
30
|
+
expect(@format).to receive(:process).and_return("John Doe")
|
32
31
|
|
33
32
|
@input.arguments = ["john"]
|
34
33
|
|
35
|
-
@output.
|
34
|
+
expect(@output).to receive(:line).with("John Doe")
|
36
35
|
@command.execute(@input, @output)
|
37
36
|
end
|
38
37
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Command::Version do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -9,16 +8,16 @@ describe Ppl::Command::Version do
|
|
9
8
|
|
10
9
|
describe "#name" do
|
11
10
|
it "should be 'version'" do
|
12
|
-
@command.name.
|
11
|
+
expect(@command.name).to eq "version"
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
describe "#execute" do
|
17
16
|
it "should show the version number" do
|
18
|
-
@output.
|
19
|
-
line.
|
17
|
+
expect(@output).to receive(:line) do |line|
|
18
|
+
expect(line).to include Ppl::Version
|
20
19
|
end
|
21
|
-
@command.execute(@input, @output).
|
20
|
+
expect(@command.execute(@input, @output)).to eq true
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Entity::AddressBook do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -7,7 +6,7 @@ describe Ppl::Entity::AddressBook do
|
|
7
6
|
|
8
7
|
describe "#contacts" do
|
9
8
|
it "should be an array" do
|
10
|
-
@address_book.contacts.
|
9
|
+
expect(@address_book.contacts).to be_an(Array)
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
describe Ppl::Entity::Contact do
|
3
2
|
|
4
3
|
before(:each) do
|
@@ -7,72 +6,72 @@ describe Ppl::Entity::Contact do
|
|
7
6
|
|
8
7
|
describe "#id" do
|
9
8
|
it "should return a value" do
|
10
|
-
@contact.id.
|
9
|
+
expect(@contact.id).to be nil
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
14
13
|
describe "#id=" do
|
15
14
|
it "should accept a value" do
|
16
15
|
@contact.id = "john"
|
17
|
-
@contact.id.
|
16
|
+
expect(@contact.id).to eq "john"
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
20
|
describe "#email_addresses" do
|
22
21
|
it "should return an array" do
|
23
|
-
@contact.email_addresses.
|
22
|
+
expect(@contact.email_addresses).to be_a(Array)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
26
|
describe "#postal_addresses" do
|
28
27
|
it "should return an array" do
|
29
|
-
@contact.postal_addresses.
|
28
|
+
expect(@contact.postal_addresses).to be_a(Array)
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
32
|
describe "#birthday" do
|
34
33
|
it "should return a value" do
|
35
|
-
@contact.birthday.
|
34
|
+
expect(@contact.birthday).to eq nil
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|
39
38
|
describe "#postal_address" do
|
40
39
|
it "should return a value" do
|
41
|
-
@contact.postal_address.
|
40
|
+
expect(@contact.postal_address).to eq nil
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
44
|
describe "#urls" do
|
46
45
|
it "should return an array" do
|
47
|
-
@contact.urls.
|
46
|
+
expect(@contact.urls).to be_a(Array)
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
50
|
describe "#nicknames" do
|
52
51
|
it "should return an array" do
|
53
|
-
@contact.nicknames.
|
52
|
+
expect(@contact.nicknames).to be_a(Array)
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
56
|
describe "#organizations" do
|
58
57
|
it "should return an array" do
|
59
|
-
@contact.organizations.
|
58
|
+
expect(@contact.organizations).to be_a(Array)
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
62
|
describe "#phone_numbers" do
|
64
63
|
it "should return an array" do
|
65
|
-
@contact.phone_numbers.
|
64
|
+
expect(@contact.phone_numbers).to be_a(Array)
|
66
65
|
end
|
67
66
|
end
|
68
67
|
|
69
68
|
describe "#age" do
|
70
69
|
it "should return nil if the date of birth is unknown" do
|
71
|
-
@contact.age(Date.today).
|
70
|
+
expect(@contact.age(Date.today)).to eq nil
|
72
71
|
end
|
73
72
|
it "should return the contact's age" do
|
74
73
|
@contact.birthday = Date.parse("1970-01-01")
|
75
|
-
@contact.age(Date.parse("1980-01-02")).
|
74
|
+
expect(@contact.age(Date.parse("1980-01-02"))).to eq 10
|
76
75
|
end
|
77
76
|
end
|
78
77
|
|
@@ -83,12 +82,12 @@ describe Ppl::Entity::Contact do
|
|
83
82
|
end
|
84
83
|
|
85
84
|
it "returns nil if there's no preferred address" do
|
86
|
-
@contact.preferred_email_address.
|
85
|
+
expect(@contact.preferred_email_address).to eq nil
|
87
86
|
end
|
88
87
|
|
89
88
|
it "returns the preferred email address" do
|
90
89
|
@contact.email_addresses[0].preferred = true
|
91
|
-
@contact.preferred_email_address.
|
90
|
+
expect(@contact.preferred_email_address).to be_a(Ppl::Entity::EmailAddress)
|
92
91
|
end
|
93
92
|
|
94
93
|
end
|
@@ -100,12 +99,12 @@ describe Ppl::Entity::Contact do
|
|
100
99
|
end
|
101
100
|
|
102
101
|
it "returns nil if there's no preferred number" do
|
103
|
-
@contact.preferred_phone_number.
|
102
|
+
expect(@contact.preferred_phone_number).to eq nil
|
104
103
|
end
|
105
104
|
|
106
105
|
it "returns the preferred phone number" do
|
107
106
|
@contact.phone_numbers[0].preferred = true
|
108
|
-
@contact.preferred_phone_number.
|
107
|
+
expect(@contact.preferred_phone_number).to be_a(Ppl::Entity::PhoneNumber)
|
109
108
|
end
|
110
109
|
|
111
110
|
end
|