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

Publish to rubygems.org #3

Closed
lewisnyman opened this issue Jul 13, 2015 · 21 comments
Closed

Publish to rubygems.org #3

lewisnyman opened this issue Jul 13, 2015 · 21 comments

Comments

@lewisnyman
Copy link

If we publish this then it becomes a lot simpler to find, install, and contribute back to. The only way to use it right now is to copy it into the plugins directory which tends to encourage the behaviour of copying and editing instead of posting PRs.

What do you think?

@aarongustafson
Copy link
Owner

Good idea. I have not published anything to RubyGems before, but I will look into the process.

@aarongustafson
Copy link
Owner

I’m not clear: how would I bundle the JS and rakefile with this as a Gem? The JS I could always expose via a Jekyll tag, so that isn’t as big of a deal, but I’m not sure the convention for supplementary stuff like this, especially the Rake task.

@lewisnyman
Copy link
Author

I'm no expert in this either, maybe we could it a go with just the liquid tag and then add to it? I've published a compass extension as a gem before, but that was using this yeoman setup https://github.com/at-import/generator-compass-extension

@lewisnyman
Copy link
Author

@0xdevalias
Copy link
Contributor

+1, definitely interested in this as a gem.

Just made a similar PR for indirect/jekyll-postfiles#7 which was mostly generated using bundler gem jekyll-postfiles with a few tweaks afterwards.

One thing that I had to do was change the jekyll/postfiles folder structure to just jekyll-postfiles, otherwise loading through the config file doesn't match other plugins like jekyll/jekyll-feed

@0xdevalias
Copy link
Contributor

This is still definitely a thing i'd be keen on! Any chance you'll have the time to do it? Or if not, got some pointers how you'd want it done, open to PR's?

@aarongustafson
Copy link
Owner

I started working on it and got frustrated when trying to figure out how to
bundle the JavaScript for live updating and the rake tasks. I did port the
Crosspost to Medium one :-)

On Tue, Apr 12, 2016 at 12:58 AM, alias1 notifications@github.com wrote:

This is still definitely a thing i'd be keen on! Any chance you'll have
the time to do it? Or if not, got some pointers how you'd want it done,
open to PR's?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#3 (comment)

@0xdevalias
Copy link
Contributor

I saw that :) (just installed it)
Hrmm, that's annoying. What aspect of the JS was tripping you up?

@aarongustafson
Copy link
Owner

How to properly bundle it in the Gem and the best way to expose it back to
Jekyll.

On Tuesday, April 12, 2016, alias1 notifications@github.com wrote:

I saw that :) (just installed it)
Hrmm, that's annoying. What aspect of the JS was tripping you up?

Sent from Outlook Mobile

On Tue, Apr 12, 2016 at 7:28 AM -0700, "Aaron Gustafson" <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

I started working on it and got frustrated when trying to figure out how to

bundle the JavaScript for live updating and the rake tasks. I did port the

Crosspost to Medium one :-)

On Tue, Apr 12, 2016 at 12:58 AM, alias1 <notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

This is still definitely a thing i'd be keen on! Any chance you'll have

the time to do it? Or if not, got some pointers how you'd want it done,

open to PR's?

You are receiving this because you commented.

Reply to this email directly or view it on GitHub

<
#3 (comment)


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#3 (comment)

Cheers,

Aaron

@0xdevalias
Copy link
Contributor

So reading over the type of plugins, the 2 that sound potentially useful for exposing the JS to me would be generators (most likely) or hooks.

If we had a generator that reads the contents of the JS file from the gem and makes a new Jekyll::StaticFile, outputting it to a location controlled from the site config, that could probably work?

Then a tag for loading the JS file from the same path that we output it to.

What do you think?

I haven't worked much with gems before, so if it's not easy to just read a file stored in it, I found this workaround for determining the path:


Also, I started hacking together (haven't touched ruby in ages) a tag for the webmention/pingback header tags (and looking to do one for redirected_from as well once I figure out how it works)

  class WebmentionHeaderTag < Liquid::Tag
    @@warned = {}

    def initialize(tag_name, text, tokens)
      super
      # @text = text
    end

    def render(context)
      site = context.registers[:site]

      if site.config['jekyll-webmention-io']
        @config = site.config['jekyll-webmention-io']
      else
        if !@@warned.has_key?('config')
          Jekyll.logger.warn "jekyll-webmention-io:", "_config.yml key not defined: jekyll-webmention-io"
          @@warned['config'] = true
        end

        return ""
      end

      if @config.has_key?('domain')
        @domain = @config['domain']
      else
        if !@@warned.has_key?('domain')
          Jekyll.logger.warn "jekyll-webmention-io:", "_config.yml key not defined: jekyll-webmention-io.domain"
          @@warned['domain'] = true
        end

        return ""
      end

      out = ""

      if @domain
        out += "<link rel=\"webmention\" href=\"https://webmention.io/#{@domain}/webmention\" />\n"
        out += "<link rel=\"pingback\" href=\"https://webmention.io/#{@domain}/xmlrpc\" />\n"
      end

      return out
    end
  end

Not sure of a nicer/less verbose way of doing those config key checks, but if there is one, would simplify this down a lot.

@0xdevalias
Copy link
Contributor

Started working on the conversion to gem on my fork. Will see if I can get the above JS loading idea working.

Ref for local loading: https://stackoverflow.com/questions/4487948/how-can-i-specify-a-local-gem-in-my-gemfile

Edit: Hrmm, seems jekyll doesn't like loading the gem that way.. Any ideas?

Dependency Error: Yikes! It looks like you don't have jekyll-webmention_io or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-webmention_io' If you run into trouble, you can find helpful resources at http://jekyllrb.com/help/!

Edit2: Ok, my bad, had some files named wrong..

@0xdevalias
Copy link
Contributor

0xdevalias commented Apr 14, 2016

Got the JS file from gem -> built site working with a generator.
Fixed up the cache path stuff to work from the gem.
Created JS liquid tag: webmention_js_tag
Created liquid tag: webmention_redirected_from
Converted the rake task to a jekyll command: jekyll webmention

Pushed all I have currently to my fork

@0xdevalias
Copy link
Contributor

Just created a PR for this @aarongustafson @lewisnyman

Mostly tested with Jekyll 3.x

Let me know what you think.

@0xdevalias
Copy link
Contributor

Heya, Just wondering if you'd had a chance to check the PR out yet?

@aarongustafson
Copy link
Owner

I’m sorry I have not had much of a chance to tuck into it yet. I’m prepping
to give a talk at SpeechTek next week and am also solo-parenting my
5-month-old right now while my wife is at another conference :-/

I should have some time toward the end of next week. I sincerely apologize
for the delay.

On Thu, May 12, 2016 at 9:36 PM, alias1 notifications@github.com wrote:

Heya, Just wondering if you'd had a chance to check the PR out yet?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#3 (comment)

@0xdevalias
Copy link
Contributor

0xdevalias commented May 18, 2016

Eep, business! No stress, just wanted to make sure it didn't get forgotten about :)

@aarongustafson
Copy link
Owner

Still tracking this, I‘m sorry I have been so quiet. I will review soon, I promise!

@0xdevalias
Copy link
Contributor

That's alright. I know the feels when life gets crazy. Let me know if there's anything I can do to help get it merged.

@aarongustafson
Copy link
Owner

Just an update: The move to a gem is in progress.

@0xdevalias
Copy link
Contributor

Woohoo!!

@aarongustafson
Copy link
Owner

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

3 participants