ppl 3.0.0 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +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::Application::Command do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -15,7 +14,7 @@ describe Ppl::Application::Command do
|
|
|
15
14
|
it "should accept a storage adapter" do
|
|
16
15
|
storage = double(Ppl::Adapter::Storage)
|
|
17
16
|
@command.storage = storage
|
|
18
|
-
@command.storage.
|
|
17
|
+
expect(@command.storage).to be storage
|
|
19
18
|
end
|
|
20
19
|
end
|
|
21
20
|
|
|
@@ -31,7 +30,7 @@ describe Ppl::Application::Command do
|
|
|
31
30
|
add_property :some_property
|
|
32
31
|
some_property "a value"
|
|
33
32
|
end
|
|
34
|
-
TestCommand456.some_property.
|
|
33
|
+
expect(TestCommand456.some_property).to eq "a value"
|
|
35
34
|
end
|
|
36
35
|
|
|
37
36
|
it "should expose properties as instance variables too" do
|
|
@@ -40,7 +39,7 @@ describe Ppl::Application::Command do
|
|
|
40
39
|
some_property "a value"
|
|
41
40
|
end
|
|
42
41
|
instance = TestCommand789.new
|
|
43
|
-
instance.some_property.
|
|
42
|
+
expect(instance.some_property).to eq "a value"
|
|
44
43
|
end
|
|
45
44
|
|
|
46
45
|
it "should allow properties to be overwritten by instance variables" do
|
|
@@ -50,21 +49,21 @@ describe Ppl::Application::Command do
|
|
|
50
49
|
end
|
|
51
50
|
instance = TestCommand901.new
|
|
52
51
|
instance.some_property = "different"
|
|
53
|
-
instance.some_property.
|
|
52
|
+
expect(instance.some_property).to eq "different"
|
|
54
53
|
end
|
|
55
54
|
end
|
|
56
55
|
|
|
57
56
|
describe "#name=" do
|
|
58
57
|
it "should allow the name to be set as an instance variable" do
|
|
59
58
|
@command.name = "testing"
|
|
60
|
-
@command.name.
|
|
59
|
+
expect(@command.name).to eq "testing"
|
|
61
60
|
end
|
|
62
61
|
end
|
|
63
62
|
|
|
64
63
|
describe "#description=" do
|
|
65
64
|
it "should allow the description to be set as an instance variable" do
|
|
66
65
|
@command.description = "testing"
|
|
67
|
-
@command.description.
|
|
66
|
+
expect(@command.description).to eq "testing"
|
|
68
67
|
end
|
|
69
68
|
end
|
|
70
69
|
|
|
@@ -74,7 +73,7 @@ describe Ppl::Application::Command do
|
|
|
74
73
|
name "new_for_test"
|
|
75
74
|
end
|
|
76
75
|
command = TestCommand123.new
|
|
77
|
-
command.name.
|
|
76
|
+
expect(command.name).to eq "new_for_test"
|
|
78
77
|
end
|
|
79
78
|
end
|
|
80
79
|
|
|
@@ -84,7 +83,7 @@ describe Ppl::Application::Command do
|
|
|
84
83
|
description "desc_for_test"
|
|
85
84
|
end
|
|
86
85
|
command = TestCommand123.new
|
|
87
|
-
command.description.
|
|
86
|
+
expect(command.description).to eq "desc_for_test"
|
|
88
87
|
end
|
|
89
88
|
end
|
|
90
89
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Application::CommandSuite do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -17,23 +16,23 @@ describe Ppl::Application::CommandSuite do
|
|
|
17
16
|
describe "#add_command" do
|
|
18
17
|
it "should accept a command" do
|
|
19
18
|
@command_suite.add_command(Ppl::Application::Command.new)
|
|
20
|
-
@command_suite.count.
|
|
19
|
+
expect(@command_suite.count).to be 3
|
|
21
20
|
end
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
describe "#find_command" do
|
|
25
24
|
it "should find a command matching the given name" do
|
|
26
|
-
@command_suite.find_command("foo").
|
|
25
|
+
expect(@command_suite.find_command("foo")).to be @foo_command
|
|
27
26
|
end
|
|
28
27
|
it "should return nil if no commands match the given name" do
|
|
29
|
-
@command_suite.find_command("baz").
|
|
28
|
+
expect(@command_suite.find_command("baz")).to be nil
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
|
|
33
32
|
describe "#each" do
|
|
34
33
|
it "should yield commands" do
|
|
35
|
-
@command_suite
|
|
36
|
-
.
|
|
34
|
+
expect(@command_suite)
|
|
35
|
+
.to receive(:each)
|
|
37
36
|
.and_yield(@foo_command)
|
|
38
37
|
.and_yield(@bar_command)
|
|
39
38
|
@command_suite.each do |c| end
|
|
@@ -43,8 +42,8 @@ describe Ppl::Application::CommandSuite do
|
|
|
43
42
|
describe "#sort_by_name" do
|
|
44
43
|
it "should sort the commands alphabetically by name" do
|
|
45
44
|
@command_suite.sort_by_name
|
|
46
|
-
@command_suite[0].name.
|
|
47
|
-
@command_suite[1].name.
|
|
45
|
+
expect(@command_suite[0].name).to eq "bar"
|
|
46
|
+
expect(@command_suite[1].name).to eq "foo"
|
|
48
47
|
end
|
|
49
48
|
end
|
|
50
49
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Application::Configuration do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -12,44 +11,44 @@ describe Ppl::Application::Configuration do
|
|
|
12
11
|
|
|
13
12
|
describe "#address_book_path" do
|
|
14
13
|
it "should default to the current working directory" do
|
|
15
|
-
@config.address_book_path.
|
|
14
|
+
expect(@config.address_book_path).to eq Dir.pwd
|
|
16
15
|
end
|
|
17
16
|
it "should be configurable by the user's config file" do
|
|
18
|
-
@config.
|
|
17
|
+
allow(@config).to receive(:user_configuration) do
|
|
19
18
|
{"address book" => {"path" => "/contacts"}}
|
|
20
19
|
end
|
|
21
|
-
@config.address_book_path.
|
|
20
|
+
expect(@config.address_book_path).to eq "/contacts"
|
|
22
21
|
end
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
describe "#aliases" do
|
|
26
25
|
it "should return a hash" do
|
|
27
|
-
@config.aliases.
|
|
26
|
+
expect(@config.aliases).to be_a(Hash)
|
|
28
27
|
end
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
describe "#color_enabled" do
|
|
32
31
|
|
|
33
32
|
it "should return true if color is explicitly enabled" do
|
|
34
|
-
@config.
|
|
33
|
+
allow(@config).to receive(:user_configuration).and_return({
|
|
35
34
|
"color" => {
|
|
36
35
|
"cmd" => "true",
|
|
37
36
|
},
|
|
38
37
|
})
|
|
39
|
-
@config.color_enabled("cmd").
|
|
38
|
+
expect(@config.color_enabled("cmd")).to eq true
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
it "should return false if color is not explicitly enabled" do
|
|
43
|
-
@config.color_enabled("cmd").
|
|
42
|
+
expect(@config.color_enabled("cmd")).to eq false
|
|
44
43
|
end
|
|
45
44
|
|
|
46
45
|
it "should return false if color is explicitly disabled" do
|
|
47
|
-
@config.
|
|
46
|
+
allow(@config).to receive(:user_configuration).and_return({
|
|
48
47
|
"color" => {
|
|
49
48
|
"cmd" => "false",
|
|
50
49
|
},
|
|
51
50
|
})
|
|
52
|
-
@config.color_enabled("cmd").
|
|
51
|
+
expect(@config.color_enabled("cmd")).to eq false
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
end
|
|
@@ -57,8 +56,8 @@ describe Ppl::Application::Configuration do
|
|
|
57
56
|
describe "#command_colors" do
|
|
58
57
|
|
|
59
58
|
before(:each) do
|
|
60
|
-
@config.
|
|
61
|
-
@config.
|
|
59
|
+
allow(@config).to receive(:color_enabled).and_return(true)
|
|
60
|
+
allow(@config).to receive(:user_configuration).and_return({
|
|
62
61
|
"color \"ls\"" => {
|
|
63
62
|
"id" => "blue",
|
|
64
63
|
},
|
|
@@ -66,19 +65,19 @@ describe Ppl::Application::Configuration do
|
|
|
66
65
|
end
|
|
67
66
|
|
|
68
67
|
it "should return the colors configured for the given command" do
|
|
69
|
-
@config.command_colors("ls").
|
|
68
|
+
expect(@config.command_colors("ls")).to eq({
|
|
70
69
|
"id" => "blue",
|
|
71
70
|
})
|
|
72
71
|
end
|
|
73
72
|
|
|
74
73
|
it "should return an empty hash if colors aren't enabled for the command" do
|
|
75
|
-
@config.
|
|
76
|
-
@config.command_colors("ls").
|
|
74
|
+
allow(@config).to receive(:color_enabled).and_return(false)
|
|
75
|
+
expect(@config.command_colors("ls")).to eq({})
|
|
77
76
|
end
|
|
78
77
|
|
|
79
78
|
it "should return nil if no colors are configured for the given command" do
|
|
80
|
-
@config.
|
|
81
|
-
@config.command_colors("show").
|
|
79
|
+
allow(@config).to receive(:user_configuration).and_return({})
|
|
80
|
+
expect(@config.command_colors("show")).to eq(nil)
|
|
82
81
|
end
|
|
83
82
|
|
|
84
83
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Application::Input do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -7,13 +6,13 @@ describe Ppl::Application::Input do
|
|
|
7
6
|
|
|
8
7
|
describe "#arguments" do
|
|
9
8
|
it "should be an array" do
|
|
10
|
-
@input.arguments.
|
|
9
|
+
expect(@input.arguments).to be_an(Array)
|
|
11
10
|
end
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
describe "#options" do
|
|
15
14
|
it "should be a hash" do
|
|
16
|
-
@input.options.
|
|
15
|
+
expect(@input.options).to be_a(Hash)
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Application::Router do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -21,35 +20,35 @@ describe Ppl::Application::Router do
|
|
|
21
20
|
describe "#default=" do
|
|
22
21
|
it "should accept the name of the default command" do
|
|
23
22
|
@router.default = "one"
|
|
24
|
-
@router.default.
|
|
23
|
+
expect(@router.default).to eq "one"
|
|
25
24
|
end
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
describe "#route" do
|
|
29
28
|
|
|
30
29
|
it "should return the command whose name matches the given argument" do
|
|
31
|
-
@router.route("two").
|
|
30
|
+
expect(@router.route("two")).to be @cmd_two
|
|
32
31
|
end
|
|
33
32
|
|
|
34
33
|
it "should return nil if no matching command can be found" do
|
|
35
|
-
@router.route("three").
|
|
34
|
+
expect(@router.route("three")).to be nil
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
it "should fall back to the default command if the given one isn't found" do
|
|
39
38
|
@router.default = "one"
|
|
40
|
-
@router.route("three").
|
|
39
|
+
expect(@router.route("three")).to be @cmd_one
|
|
41
40
|
end
|
|
42
41
|
|
|
43
42
|
it "should apply the aliases if the argument doesn't match a command" do
|
|
44
43
|
@router.aliases = {"t" => "two"}
|
|
45
|
-
@router.route("t").
|
|
44
|
+
expect(@router.route("t")).to be @cmd_two
|
|
46
45
|
end
|
|
47
46
|
|
|
48
47
|
it "should return a Ppl::Command::External if the input matches a bang alias" do
|
|
49
|
-
@external.
|
|
50
|
-
@external.
|
|
48
|
+
expect(@external).to receive(:name=).with("t")
|
|
49
|
+
expect(@external).to receive(:command=).with("two")
|
|
51
50
|
@router.aliases = {"t" => "!two"}
|
|
52
|
-
@router.route("t").
|
|
51
|
+
expect(@router.route("t")).to be @external
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
end
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Application::Shell do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -16,94 +15,94 @@ describe Ppl::Application::Shell do
|
|
|
16
15
|
|
|
17
16
|
it "should return false if the given command isn't found" do
|
|
18
17
|
@input.arguments = ["foo"]
|
|
19
|
-
@router
|
|
20
|
-
.
|
|
18
|
+
expect(@router)
|
|
19
|
+
.to receive(:route)
|
|
21
20
|
.with("foo")
|
|
22
21
|
.and_return(nil)
|
|
23
|
-
@shell.run(@input, @output).
|
|
22
|
+
expect(@shell.run(@input, @output)).to eq false
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
it "should execute the given command" do
|
|
27
26
|
@input.arguments = ["foo"]
|
|
28
|
-
@router
|
|
29
|
-
.
|
|
27
|
+
expect(@router)
|
|
28
|
+
.to receive(:route)
|
|
30
29
|
.with("foo")
|
|
31
30
|
.and_return(@command)
|
|
32
31
|
|
|
33
|
-
@command.
|
|
34
|
-
@command
|
|
35
|
-
.
|
|
32
|
+
expect(@command).to receive(:options)
|
|
33
|
+
expect(@command)
|
|
34
|
+
.to receive(:execute)
|
|
36
35
|
.and_return(true)
|
|
37
36
|
|
|
38
|
-
@shell.run(@input, @output).
|
|
37
|
+
expect(@shell.run(@input, @output)).to eq true
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
it "should not pass the command name in the input to the command itself" do
|
|
42
41
|
@input.arguments = ["mv", "foo", "bar"]
|
|
43
|
-
@router
|
|
44
|
-
.
|
|
42
|
+
expect(@router)
|
|
43
|
+
.to receive(:route)
|
|
45
44
|
.with("mv")
|
|
46
45
|
.and_return(@command)
|
|
47
46
|
|
|
48
|
-
@command.
|
|
49
|
-
@command.
|
|
50
|
-
input.arguments.
|
|
47
|
+
expect(@command).to receive(:options)
|
|
48
|
+
expect(@command).to receive(:execute) do |input, output|
|
|
49
|
+
expect(input.arguments).to eq ["foo", "bar"]
|
|
51
50
|
end
|
|
52
51
|
@shell.run(@input, @output)
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
it "should return false if the command throws an exception" do
|
|
56
|
-
@command.
|
|
57
|
-
@command
|
|
58
|
-
.
|
|
55
|
+
expect(@command).to receive(:options)
|
|
56
|
+
expect(@command)
|
|
57
|
+
.to receive(:execute)
|
|
59
58
|
.and_raise(StandardError)
|
|
60
59
|
|
|
61
|
-
@router
|
|
62
|
-
.
|
|
60
|
+
expect(@router)
|
|
61
|
+
.to receive(:route)
|
|
63
62
|
.and_return(@command)
|
|
64
63
|
|
|
65
|
-
@output.
|
|
64
|
+
expect(@output).to receive(:error)
|
|
66
65
|
|
|
67
66
|
@shell.run(@input, @output)
|
|
68
67
|
end
|
|
69
68
|
|
|
70
69
|
it "should not do any option parsing for Ppl::Command::External instances" do
|
|
71
70
|
external = Ppl::Command::External.new("ls", "ls", "List directory contents")
|
|
72
|
-
external.
|
|
73
|
-
@shell.
|
|
74
|
-
external.
|
|
71
|
+
allow(external).to receive(:execute).and_return(true)
|
|
72
|
+
expect(@shell).to receive(:select_command).and_return(external)
|
|
73
|
+
expect(external).not_to receive(:options)
|
|
75
74
|
@shell.run(@input, @output)
|
|
76
75
|
end
|
|
77
76
|
|
|
78
77
|
it "should send exception messages to stderr" do
|
|
79
|
-
@command.
|
|
80
|
-
@command.
|
|
81
|
-
@router.
|
|
82
|
-
@output.
|
|
78
|
+
expect(@command).to receive(:options)
|
|
79
|
+
expect(@command).to receive(:execute) { raise "Pool's Closed" }
|
|
80
|
+
expect(@router).to receive(:route).and_return(@command)
|
|
81
|
+
expect(@output).to receive(:error).with("ppl: Pool's Closed")
|
|
83
82
|
@shell.run(@input, @output)
|
|
84
83
|
end
|
|
85
84
|
|
|
86
85
|
it "should handle ContactNotFound errors nicely" do
|
|
87
|
-
@command.
|
|
88
|
-
@command.
|
|
89
|
-
@router.
|
|
90
|
-
@output.
|
|
86
|
+
allow(@command).to receive(:options)
|
|
87
|
+
expect(@command).to receive(:execute) { raise Ppl::Error::ContactNotFound, "example" }
|
|
88
|
+
expect(@router).to receive(:route).and_return(@command)
|
|
89
|
+
expect(@output).to receive(:error).with("ppl: Contact 'example' not found")
|
|
91
90
|
@shell.run(@input, @output)
|
|
92
91
|
end
|
|
93
92
|
|
|
94
93
|
it "should handle CompletionNotFound errors nicely" do
|
|
95
|
-
@command.
|
|
96
|
-
@command.
|
|
97
|
-
@router.
|
|
98
|
-
@output.
|
|
94
|
+
allow(@command).to receive(:options)
|
|
95
|
+
expect(@command).to receive(:execute) { raise Ppl::Error::CompletionNotFound, "example" }
|
|
96
|
+
expect(@router).to receive(:route).and_return(@command)
|
|
97
|
+
expect(@output).to receive(:error).with("ppl: No completion function available for 'example'")
|
|
99
98
|
@shell.run(@input, @output)
|
|
100
99
|
end
|
|
101
100
|
|
|
102
101
|
it "should handle PostalAddressNotFound errors nicely" do
|
|
103
|
-
@command.
|
|
104
|
-
@command.
|
|
105
|
-
@router.
|
|
106
|
-
@output.
|
|
102
|
+
allow(@command).to receive(:options)
|
|
103
|
+
expect(@command).to receive(:execute) { raise Ppl::Error::PostalAddressNotFound, "example" }
|
|
104
|
+
expect(@router).to receive(:route).and_return(@command)
|
|
105
|
+
expect(@output).to receive(:error).with("ppl: Postal address 'example' not found")
|
|
107
106
|
@shell.run(@input, @output)
|
|
108
107
|
end
|
|
109
108
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
describe Ppl::Command::Add do
|
|
3
2
|
|
|
4
3
|
before(:each) do
|
|
@@ -13,7 +12,7 @@ describe Ppl::Command::Add do
|
|
|
13
12
|
|
|
14
13
|
describe "#name" do
|
|
15
14
|
it "should be 'add'" do
|
|
16
|
-
@command.name.
|
|
15
|
+
expect(@command.name).to eq "add"
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
|
|
@@ -29,12 +28,12 @@ describe Ppl::Command::Add do
|
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
it "should save a new contact" do
|
|
32
|
-
@storage.
|
|
33
|
-
contact.id.
|
|
34
|
-
contact.name.
|
|
31
|
+
expect(@storage).to receive(:save_contact) do |contact|
|
|
32
|
+
expect(contact.id).to eq "john"
|
|
33
|
+
expect(contact.name).to be_a(Ppl::Entity::Name)
|
|
35
34
|
end
|
|
36
|
-
@name_service
|
|
37
|
-
.
|
|
35
|
+
expect(@name_service)
|
|
36
|
+
.to receive(:parse)
|
|
38
37
|
.with("John Doe")
|
|
39
38
|
.and_return(Ppl::Entity::Name.new)
|
|
40
39
|
@input.arguments = ["john", "John Doe"]
|