Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to reinstall the same theme each startup #40

Closed
Argish42 opened this issue Jun 13, 2014 · 17 comments
Closed

Need to reinstall the same theme each startup #40

Argish42 opened this issue Jun 13, 2014 · 17 comments

Comments

@Argish42
Copy link

This is going to drive me crazy.

pry-theme list

It throws me a blank space. If I try to install a theme, let's say ocean with:

pry-theme install ocean

I get the expected output:

Installing "ocean" from Pry Theme Collection...
Successfully installed "ocean"!

Then, I'm able to use it with pry-theme try ocean.

The problem is whenever I exit from pry, and I enter again, the theme installed is not available:

Cannot find "ocean" amongst themes in /home/argish/.pry/themes

I checked the .pry/themes folder and the ocean file is just there...

Your help is really appreciated.

@kyrylo
Copy link
Owner

kyrylo commented Jun 13, 2014

Hello! :)

What are your Pry and Pry Theme versions? Please, make sure that you have Pry v0.10.0 and Pry Theme v1.1.0.

@Argish42
Copy link
Author

I just updated pry-theme to v1.1.0 but I'm still getting the same problem here.

Thanks.

@kyrylo
Copy link
Owner

kyrylo commented Jun 14, 2014

Please, show your .pryrc.

@Argish42
Copy link
Author

My .pryrc is blank at the moment. Anyway, I tried using pry -f just in case, but no luck again.

@kyrylo
Copy link
Owner

kyrylo commented Jun 14, 2014

Okay... Could you try to delete the entire ~/.pryrc/themes directory and reinstall the ocean theme (don't worry, the default themes will be restored automatically).

@Argish42
Copy link
Author

Yeah, I tried that too. It throws an error like this one:

Errno::ENOENT: No such file or directory from pry-theme-1.1.0/lib/pry-theme/commands.rb:245:in 'initialize'

So whenever I deleted the themes folder I have to create it manually. I also tried reinstalling both gems and using another shell. I'm starting to be short of more ideas.

Also noticed that there were no default themes on this folder before I removed it.

@kyrylo
Copy link
Owner

kyrylo commented Jun 14, 2014

So you are using Ruby 2.1.1 and Pry v0.10.0. Correct?

Do you have any other Pry plugins installed?

@Argish42
Copy link
Author

I'm using Ruby 2.1.2 and no, no more plugins installed. I tested with rvm ruby 2.1.1 and 2.0.0 and the same happens.

@kyrylo
Copy link
Owner

kyrylo commented Jun 14, 2014

Could you, please, copy-paste everything you tried in order to trigger this error? I just need to collect some more information about this quirk.

I cannot reproduce it whatever I try.

@Argish42
Copy link
Author

Well, not too much. I just installed ruby with rvm and then I installed both gems, pry and pry-theme.

I have been trying to isolate the problem and this is what I found:

I'm not loading the default themes, so lots of methods are not working, for example pry-theme current throws an error because it's NIL. I installed 2 custom themes and then everything works, and I mean everything.

But for some reason and this is something I don't understand, when I close the pry session and I start it again, it's not loading the custom installed themes. I have to call the install method each time even If they are already in the local folder, and then it works. So I guess something happens with that method that then allows me to do pry-theme try successfully.

@kyrylo
Copy link
Owner

kyrylo commented Jun 15, 2014

The try subcommand changes themes only for the current session. If you want to use a theme, you must set it inside your .pryrc like so: Pry.config.theme = 'ocean'.

Pry Theme has had a similar issue recently, but it should be fixed: #39

@Argish42
Copy link
Author

Yeah, I know that. The problem is the only way pry-theme is loading themes to try is installing them first in the current session. That's why I think there's something in the install method that then allows me to try theme.

Otherwise I get this error Cannot find "ocean" amongst themes in /home/argish/.pry/themes so even If I put Pry.config.theme = 'ocean' It doesn't load the theme.

@kyrylo kyrylo closed this as completed in d4b8158 Jun 15, 2014
@kyrylo
Copy link
Owner

kyrylo commented Jun 15, 2014

Could you, please, try Pry Theme from master? I think I fixed the issue.

@Argish42
Copy link
Author

Yes, it works. It works with pry-rescue installed as you mentioned in the commit. But without pry-rescue installed, it doesn't.

@kyrylo
Copy link
Owner

kyrylo commented Jun 16, 2014

I just released v1.1.2. Thanks for the collaboration! :)

@Argish42
Copy link
Author

No problem. Thank you too for your time.

Cheers

@JoshCheek
Copy link
Contributor

Until this gets fixed in Pry, you can get around it by adding the following to your ~/.pryrc

# ensure hooks have been initialized prior to use (https://github.com/pry/pry/issues/1271)
Pry.config.hooks

# ensure pry-theme hook is added since it might have gotten "lost"
Pry.config.hooks.add_hook(
  :when_started,
  :pry_theme,
  PryTheme::WhenStartedHook.new
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants