add $name.vcf to a new book? #12

Closed
storge-xx opened this Issue Dec 27, 2012 · 9 comments

Comments

Projects
None yet
3 participants
@storge-xx

first question: is there a way i can move contacts made in the wrong dir to the address book?
i made a mistake and entered about 50 contacts outside of my address book. i tried to move all the $name.vcf into ~/contacts and tried 'ppl ls' but it listed only the two contacts i had in there previously.

second question: what goes in this [bracket] below?

$ echo "[address book]" > ~/.pplconfig
$ echo path = "`pwd`" >> ~/.pplconfig

i tried to do this:

$ echo "~/contacts" > ~/.pplconfig

but at my next attempt to create a contact, this happened:

[crunchbang5010:storge] ~/contacts $ ppl add test2 "testy mctest"
[crunchbang5010:storge] ~/contacts $ echo "~/contacts" > ~/.pplconfig
[crunchbang5010:storge] ~/contacts $ echo path = "`pwd`" >> ~/.pplconfig
[crunchbang5010:storge] ~/contacts $ ppl add test3 "testy mctest"
/var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:506:in `parse_error': Could not parse line: "~/contacts" (IniFile::Error)
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:482:in `process_property'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:434:in `parse!'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:148:in `read'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:91:in `initialize'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:35:in `new'
from /var/lib/gems/1.9.1/gems/inifile-2.0.2/lib/inifile.rb:35:in `load'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/configuration.rb:40:in `user_configuration'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/configuration.rb:11:in `address_book_path'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:67:in `storage_adapter'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:23:in `block in commands'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:22:in `each'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:22:in `commands'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:30:in `command_suite'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:53:in `router'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/lib/ppl/application/bootstrap.rb:60:in `shell'
from /var/lib/gems/1.9.1/gems/ppl-1.5.3/bin/ppl:13:in `'
from /usr/local/bin/ppl:23:in `load'
from /usr/local/bin/ppl:23:in `'
[crunchbang5010:storge] ~/contacts

...on balance, the first question matters more to me, since it was a lesson learned to be in the right directory the first time. but knowing the second question will save me in the future.
thanks again.
~storge

EDIT

@tsroten

This comment has been minimized.

Show comment Hide comment
@tsroten

tsroten Dec 27, 2012

For the first question, let me first say that I am just guessing, but I believe you actually have to commit the .vcf file to the git repository. When the code saves a contact, it appears the following happens:

def save_contact(contact)
    @disk.save_contact(contact)

    add("#{contact.id}.vcf")
    commit("save_contact(#{contact.id})")
  end

So, for your case, I'd move the files into ~/contacts and then try:

$ git add .
$ git commit -m "Imported contacts"

EDIT: I tested the above and it seemed to work fine.

For your second question, you need to run the commands verbatim. No need to replace the [address book] with anything.
From your ~/contacts, run:

$ echo "[address book]" > ~/.pplconfig
$ echo path = "`pwd`" >> ~/.pplconfig

tsroten commented Dec 27, 2012

For the first question, let me first say that I am just guessing, but I believe you actually have to commit the .vcf file to the git repository. When the code saves a contact, it appears the following happens:

def save_contact(contact)
    @disk.save_contact(contact)

    add("#{contact.id}.vcf")
    commit("save_contact(#{contact.id})")
  end

So, for your case, I'd move the files into ~/contacts and then try:

$ git add .
$ git commit -m "Imported contacts"

EDIT: I tested the above and it seemed to work fine.

For your second question, you need to run the commands verbatim. No need to replace the [address book] with anything.
From your ~/contacts, run:

$ echo "[address book]" > ~/.pplconfig
$ echo path = "`pwd`" >> ~/.pplconfig
@storge-xx

This comment has been minimized.

Show comment Hide comment
@storge-xx

storge-xx Dec 27, 2012

i'm not sure what i'm doing wrong...

[crunchbang5010:storge] ~ $ rm -fr contacts/
[crunchbang5010:storge] ~ $ ppl init ~/contacts
[crunchbang5010:storge] ~ $ cp .contacts-bkp/*.vcf ~/contacts
[crunchbang5010:storge] ~ $ cd contacts/
[crunchbang5010:storge] ~/contacts $ git add .
[crunchbang5010:storge] ~/contacts $ git commit -m "Imported contacts"
[master b79daca] Imported contacts
34 files changed, 308 insertions(+)
create mode 100644 alex.vcf
create mode 100644 audrey.vcf
create mode 100644 brandy.vcf
create mode 100644 colleen.vcf
create mode 100644 conner.vcf
create mode 100644 craig.vcf
create mode 100644 denise.vcf
create mode 100644 epiphyte.vcf
create mode 100644 erica.vcf
create mode 100644 furphy.vcf
create mode 100644 ginger.vcf
create mode 100644 jannik.vcf
create mode 100644 jasmyne.vcf
create mode 100644 jesus.vcf
create mode 100644 jobin.vcf
create mode 100644 jonathan.vcf
create mode 100644 josh.vcf
create mode 100644 kbone.vcf
create mode 100644 kerensa.vcf
create mode 100644 kori.vcf
create mode 100644 linda.vcf
create mode 100644 lisa.vcf
create mode 100644 mcmanus.vcf
create mode 100644 molly.vcf
create mode 100644 morris.vcf
create mode 100644 mrk.vcf
create mode 100644 sam.vcf
create mode 100644 sarah.vcf
create mode 100644 serena.vcf
create mode 100644 sharr.vcf
create mode 100644 tom.vcf
create mode 100644 tria.vcf
create mode 100644 tuan.vcf
create mode 100644 tyson.vcf
[crunchbang5010:storge] ~/contacts $ ppl ls
test: testy mctest
[crunchbang5010:storge] ~/contacts $

I executed the other commands from the second question as well, thanks.

i'm not sure what i'm doing wrong...

[crunchbang5010:storge] ~ $ rm -fr contacts/
[crunchbang5010:storge] ~ $ ppl init ~/contacts
[crunchbang5010:storge] ~ $ cp .contacts-bkp/*.vcf ~/contacts
[crunchbang5010:storge] ~ $ cd contacts/
[crunchbang5010:storge] ~/contacts $ git add .
[crunchbang5010:storge] ~/contacts $ git commit -m "Imported contacts"
[master b79daca] Imported contacts
34 files changed, 308 insertions(+)
create mode 100644 alex.vcf
create mode 100644 audrey.vcf
create mode 100644 brandy.vcf
create mode 100644 colleen.vcf
create mode 100644 conner.vcf
create mode 100644 craig.vcf
create mode 100644 denise.vcf
create mode 100644 epiphyte.vcf
create mode 100644 erica.vcf
create mode 100644 furphy.vcf
create mode 100644 ginger.vcf
create mode 100644 jannik.vcf
create mode 100644 jasmyne.vcf
create mode 100644 jesus.vcf
create mode 100644 jobin.vcf
create mode 100644 jonathan.vcf
create mode 100644 josh.vcf
create mode 100644 kbone.vcf
create mode 100644 kerensa.vcf
create mode 100644 kori.vcf
create mode 100644 linda.vcf
create mode 100644 lisa.vcf
create mode 100644 mcmanus.vcf
create mode 100644 molly.vcf
create mode 100644 morris.vcf
create mode 100644 mrk.vcf
create mode 100644 sam.vcf
create mode 100644 sarah.vcf
create mode 100644 serena.vcf
create mode 100644 sharr.vcf
create mode 100644 tom.vcf
create mode 100644 tria.vcf
create mode 100644 tuan.vcf
create mode 100644 tyson.vcf
[crunchbang5010:storge] ~/contacts $ ppl ls
test: testy mctest
[crunchbang5010:storge] ~/contacts $

I executed the other commands from the second question as well, thanks.

@tsroten

This comment has been minimized.

Show comment Hide comment
@tsroten

tsroten Dec 27, 2012

The only thing I can think of is that you need to make sure that the configuration in ~/.pplconfig is pointed to the correct directory.

$ cat ~/.pplconfig

Mine outputs:

[address book]
path = /Users/tsr/Documents/contacts

Make sure that your's points to your desired contacts folder.

Hope that helps!

tsroten commented Dec 27, 2012

The only thing I can think of is that you need to make sure that the configuration in ~/.pplconfig is pointed to the correct directory.

$ cat ~/.pplconfig

Mine outputs:

[address book]
path = /Users/tsr/Documents/contacts

Make sure that your's points to your desired contacts folder.

Hope that helps!

@storge-xx

This comment has been minimized.

Show comment Hide comment
@storge-xx

storge-xx Dec 27, 2012

[crunchbang5010:storge] ~ $ cat ~/.pplconfig
[address book]
path = /home/storge/contacts

...yep, it points to there. maybe those contacts are doomed and i have to start over. that would make me sad.

...wait, does this have to be run in contacts/ or ~/?

echo "[address book]" > ~/.pplconfig
echo path = "`pwd`" >> ~/.pplconfig

...i thought as a .config file, those would be run in ~/$user. maybe that would confuse it if run in the wrong place?
i ask because i don't have a default .pplconfig anywhere. i do have a ~/contacts/.ppl/config but it's an empty file.

[crunchbang5010:storge] ~ $ cat ~/.pplconfig
[address book]
path = /home/storge/contacts

...yep, it points to there. maybe those contacts are doomed and i have to start over. that would make me sad.

...wait, does this have to be run in contacts/ or ~/?

echo "[address book]" > ~/.pplconfig
echo path = "`pwd`" >> ~/.pplconfig

...i thought as a .config file, those would be run in ~/$user. maybe that would confuse it if run in the wrong place?
i ask because i don't have a default .pplconfig anywhere. i do have a ~/contacts/.ppl/config but it's an empty file.

@hnrysmth

This comment has been minimized.

Show comment Hide comment
@hnrysmth

hnrysmth Dec 27, 2012

Owner

...wait, does this have to be run in contacts/ or ~/?

You have to run this in your ~/contacts directory or wherever you put that directory. If you run echo path = "'pwd'" >> ~/.pplconfig in ~/, then it'll write the following to your ~/.pplconfig:

path = /home/storge

This is because that pwd in the command is replaced with your current working directory at the time of running the command. In the quick start guide, this works because if you've followed along with the commands then your current working directory will be ~/contacts.

When I tried to imitate the steps you described - ppl init ~/contacts, copy *.vcf files, commit manually - I actually made this exact mistake. As a result, The output of ppl ls was empty even though the contacts were in place and committed.

i do have a ~/contacts/.ppl/config but it's an empty file.

You might as well delete this, it doesn't do anything. I'll delete the unused constant referring to it for now: there's currently no repository-level configuration in place. It's something we'll probably want one day but for now there is none.

Owner

hnrysmth commented Dec 27, 2012

...wait, does this have to be run in contacts/ or ~/?

You have to run this in your ~/contacts directory or wherever you put that directory. If you run echo path = "'pwd'" >> ~/.pplconfig in ~/, then it'll write the following to your ~/.pplconfig:

path = /home/storge

This is because that pwd in the command is replaced with your current working directory at the time of running the command. In the quick start guide, this works because if you've followed along with the commands then your current working directory will be ~/contacts.

When I tried to imitate the steps you described - ppl init ~/contacts, copy *.vcf files, commit manually - I actually made this exact mistake. As a result, The output of ppl ls was empty even though the contacts were in place and committed.

i do have a ~/contacts/.ppl/config but it's an empty file.

You might as well delete this, it doesn't do anything. I'll delete the unused constant referring to it for now: there's currently no repository-level configuration in place. It's something we'll probably want one day but for now there is none.

@storge-xx

This comment has been minimized.

Show comment Hide comment
@storge-xx

storge-xx Dec 27, 2012

thank you very much. that worked! all the contacts are integrated now.

thank you very much. that worked! all the contacts are integrated now.

@hnrysmth

This comment has been minimized.

Show comment Hide comment
@hnrysmth

hnrysmth Dec 27, 2012

Owner

It's working? So glad to hear that!

Owner

hnrysmth commented Dec 27, 2012

It's working? So glad to hear that!

@hnrysmth

This comment has been minimized.

Show comment Hide comment
@hnrysmth

hnrysmth Dec 27, 2012

Owner

Okay, I'm gonna close this now.

This isn't the first time that this whole ~/.pplconfig address book path thing has caused confusion. I'm gonna have a think about ways of making this more clear and I'm open to suggestions.

For starters, I think it's time to start a "configuration section" in the documentation. With a page each for things like the address book path, there ought to be enough space to explain things in proper detail.

Owner

hnrysmth commented Dec 27, 2012

Okay, I'm gonna close this now.

This isn't the first time that this whole ~/.pplconfig address book path thing has caused confusion. I'm gonna have a think about ways of making this more clear and I'm open to suggestions.

For starters, I think it's time to start a "configuration section" in the documentation. With a page each for things like the address book path, there ought to be enough space to explain things in proper detail.

@hnrysmth hnrysmth closed this Dec 27, 2012

@storge-xx

This comment has been minimized.

Show comment Hide comment
@storge-xx

storge-xx Dec 27, 2012

...maybe just direct as hell.

$ echo "[address book]" > ~/.pplconfig type exactly this while in your contacts directory
$ echo path = "`pwd`" >> ~/.pplconfig type exactly this while in your contacts directory

it's what my thick skull needed ;)

...maybe just direct as hell.

$ echo "[address book]" > ~/.pplconfig type exactly this while in your contacts directory
$ echo path = "`pwd`" >> ~/.pplconfig type exactly this while in your contacts directory

it's what my thick skull needed ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment