On Fri, 2 May 2025 at 10:36, Niall Pemberton <niall.pember...@gmail.com> wrote:
>
> On Fri, 2 May 2025 at 09:57, sebb <seb...@gmail.com> wrote:
>
> > On Fri, 2 May 2025 at 09:12, Niall Pemberton <niall.pember...@gmail.com>
> > wrote:
> > >
> > > On Thu, 1 May 2025 at 13:53, sebb <seb...@gmail.com> wrote:
> > >
> > > > On Thu, 1 May 2025 at 10:20, sebb <seb...@gmail.com> wrote:
> > > > >
> > > > > On Thu, 1 May 2025 at 09:55, Niall Pemberton <
> > niall.pember...@gmail.com>
> > > > wrote:
> > > > > >
> > > > > > On Thu, 1 May 2025 at 09:29, sebb <seb...@gmail.com> wrote:
> > > > > >
> > > > > > > retire.py currently uses Python, but Jekyll is based on Ruby, so
> > I
> > > > > > > have so far been working on a replacement in Ruby. Does it matter
> > > > what
> > > > > > > language is used?
> > > > > >
> > > > > >
> > > > > > Can this be incorporated into the Jekyll site? I believe you can
> > create
> > > > > > custom “commands” - so maybe possible, like running the Jekyll
> > build
> > > > > > locally, also be able to execute command(s) that replicate the
> > puthon
> > > > > > functionality.
> > > > >
> > > > > It would be possible to create an on-demand workflow that prompts for
> > > > > the project id.
> > > > > That can then run the script and generate a new/updated project.yaml
> > > > > file in a new branch.
> > > > > The workflow can then create a PR from the branch.
> > > > >
> > > > > I have tested all the parts separately, but have yet to put them
> > > > together.
> > > >
> > > > I've added a sample workflow
> > > > It's still a work in progress ...
> > > >
> > >
> > > This is what I was talking about Commands:
> > >     https://jekyllrb.com/docs/plugins/commands/
> > >     https://maxchadwick.xyz/blog/building-a-custom-jekyll-command-plugin
> >
> > Looks a bit tedious to set up; cannot just add the code to _plugins.
> >
> > > I haven't really had a chance to look at what you've been committing yet,
> > > but I suspect you're going in a different direction. Anyway, thought I
> > > would mention it in case it could be useful:
> > >
> > > So to build and run the site locally, I use:
> > >     bundle exec jekyll build
> > >     bundle exec jekyll serve
> > >
> > > And it looks like, with a custom command, we could have our own custom
> > > command like "create-project" and then you would run something like the
> > > following (e.g., to create the gora project YAML):
> > >    bundle exec jekyll create-project gora
> >
> > The script can be run as follows:
> >
> > build exec ruby retire.rb projectId  ...
> >
> > > It seems neat to be able to run custom scripts in the same environment as
> > > building/running the site locally
> >
> > Not sure it's worth the overhead of creating a Jekyll command just to
> > replace 'ruby' with 'jekyll' in the command-line...
> >
>
> You're probably right, but I think there could be a few advantages:
>   - you can use the Jekyll.logger
>       Jekyll.logger.error "You forgot the project_id you idiot!"
>   - it has built in support for configuring & getting options
>   - "bundle exec jekyll help" would show it in the list of commands
>   - "bundle exec jekyll help retire" would show help for the retire command
> & its options
>   - you can get access/create the whole Jekyll configuration with
> "configuration_from_options(options)"
>   - I believe you can easily get it to build the  site (so perhaps generate
> the YAML & site with the custom command)
>
> https://github.com/jekyll/jekyll/blob/ce67da0f80058f579630e0adcec538facd8418a8/lib/jekyll/command.rb

Whilst useful, those don't seem like must-haves, so I don't personally
think it's worth the effort.
The script already checks its parameters and reports errors.

> Niall
>
>
>
>
> >
> > > Niall
> > >
> > >
> > > >
> > > > > > From my PoV this would be better since I have Jekyll & Ruby
> > installed
> > > > - but
> > > > > > I’ve never used Python.
> > > > > >
> > > > > > Having said that, I run Jekyll in WSL (windows Linux) which I only
> > > > recently
> > > > > > started using - so could probably also work out python
> > > > >
> > > > > Unless the script needs modification, the language is largely
> > > > > irrelevant so long as it is installed.
> > > > > Sounds like staying with Ruby would involve less work.
> > > > >
> > > > > > Niall
> > > > > >
> > > > > >
> > > > > >
> > > > > > >
> > > > > > > Sebb
> > > > > > >
> > > >
> >

Reply via email to