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

Path to Hugo binary #41

Closed
max-arnold opened this issue May 30, 2018 · 11 comments
Closed

Path to Hugo binary #41

max-arnold opened this issue May 30, 2018 · 11 comments

Comments

@max-arnold
Copy link

How to specify different Hugo binaries for different blogs (for example if I they require different versions or I do not want to place hugo in PATH)?

@masasam
Copy link
Owner

masasam commented May 31, 2018

Hi @max-arnold .
Thank you for comment.

if I they require different versions

I think that if your site don't work on the latest stable version of hugo you should correct the cause of your source.
If absolutely require different version, you can do this by changing the binary of hugo when you move the current directory.
You can do it by writing elisp in your init.el to change the symbolic link.
I think that it is not a easy-hugo problem but your problem.

I do not want to place hugo in PATH

I don't want to support a method that doesn't conform to UNIX standards.

Hope that helps!

@max-arnold
Copy link
Author

max-arnold commented May 31, 2018

Ok, more details about my use case:

  1. I use separate python virtualenvs for each blog
  2. I need python in order to deploy my blog (I use Fabric tool for this) and perform other blog-related tasks
  3. I put Hugo binary to virtualenv bin (~/.virtualenvs/blog1/bin/hugo)

The binary is actually in the PATH, but only after I activate virtualenv by doing workon blog1. It allows me to freeze and isolate blog dependencies. Upgrading hugo everywhere is too risky, I prefer to do this separately for each blog.

So, because supporting virtualenvs is out of scope of this project, what I'm asking is to allow me to customize hugo path on per-blog basis.

@max-arnold
Copy link
Author

I found multiple (call-process "hugo") calls in the code. Does it make sense to apply the DRY principle and extract them into a function or macros, along with the ability to customize the binary path?

@masasam
Copy link
Owner

masasam commented May 31, 2018

I found multiple (call-process "hugo") calls in the code. Does it make sense to apply the DRY principle and extract them into a function or macros, along with the ability to customize the binary path?

If customizing the binary path permit you to solve the problem, I can respond.

@masasam
Copy link
Owner

masasam commented May 31, 2018

The following runs the Rakefile.
Does this method solve your problem?

You can do it in the following way.
put deploy.sh and Rakefile at easy-hugo-basedir

deploy.sh

#!/bin/sh
rake hello
rake pen
rake apple
chmod a+x deploy.sh

Rakefile

task :hello do
File.open("hello.txt", "w") do |f|
f.puts("Hello, World!")
end
end
task :pen do
File.open("pen.txt", "w") do |f|
f.puts("I have a pen!")
end
end
task :apple do
File.open("apple.txt", "w") do |f|
f.puts("I have an apple!")
end
end

M-x easy-hugo-github-deploy
or
Press G on easy-hugo-mode

@max-arnold
Copy link
Author

If customizing the binary path permit you to solve the problem, I can respond.

Yes, this would solve my case.

@max-arnold
Copy link
Author

And sorry, but I do not understand your Rakefile example. If it is about deployment tasks, then I do not plan to change my deployment method or switch to Rake.

@masasam
Copy link
Owner

masasam commented May 31, 2018

Hi @max-arnold .

Make hugo's binary changeable for each blog at 3b0516c

It will be reflected in melpa in around 6 hours.

sample setting

(setq easy-hugo-url "https://yourdomain")
(setq easy-hugo-bin "/.virtualenvs/blog1/bin/hugo")
(setq easy-hugo-basedir "~/yoursource/")
(setq easy-hugo-sshdomain "blogdomain")
(setq easy-hugo-root "/home/yourblog/")

(setq easy-hugo-bloglist '(((easy-hugo-basedir . "~/yoursource2/")
(easy-hugo-bin . "/.virtualenvs/blog2/bin/hugo")
(easy-hugo-url . "https://yourdomain2")
(easy-hugo-sshdomain . "blogdomain")
(easy-hugo-root . "/home/yourblog2/"))))

@max-arnold
Copy link
Author

Thanks a lot! Will try it tomorrow and report here if it works.

@masasam masasam closed this as completed Jun 3, 2018
@max-arnold
Copy link
Author

Sorry, I forgot to inform you that my use case is solved and everything works just fine. You are great!

@masasam
Copy link
Owner

masasam commented Jun 3, 2018

Hi @max-arnold .
Thank you for test.
Thanks for the report.

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

No branches or pull requests

2 participants