Giter Club home page Giter Club logo

jekyll-compose's Introduction

Jekyll::Compose

Streamline your writing in Jekyll with some commands.

Linux Build Status Windows Build status

Installation

Add this line to your application's Gemfile:

gem 'jekyll-compose', group: [:jekyll_plugins]

And then execute:

$ bundle

Usage

After you have installed (see above), run bundle exec jekyll help and you should see:

Listed in help you will see new commands available to you:

  draft      # Creates a new draft post with the given NAME
  post       # Creates a new post with the given NAME
  publish    # Moves a draft into the _posts directory and sets the date
  unpublish  # Moves a post back into the _drafts directory
  page       # Creates a new page with the given NAME
  rename     # Moves a draft to a given NAME and sets the title
  compose    # Creates a new file with the given NAME

Create your new page using:

    $ bundle exec jekyll page "My New Page"

Create your new post using:

    $ bundle exec jekyll post "My New Post"
    # or specify a custom format for the date attribute in the yaml front matter
    $ bundle exec jekyll post "My New Post" --timestamp-format "%Y-%m-%d %H:%M:%S %z"
    # or by using the compose command
    $ bundle exec jekyll compose "My New Post"
    # or by using the compose command with post specified
    $ bundle exec jekyll compose "My New Post" --post
    # or by using the compose command with the posts collection specified
    $ bundle exec jekyll compose "My New Post" --collection "posts"

Create your new draft using:

    $ bundle exec jekyll draft "My new draft"
    # or by using the compose command with draft specified
    $ bundle exec jekyll compose "My new draft" --draft
    # or by using the compose command with the drafts collection specified
    $ bundle exec jekyll compose "My new draft" --collection "drafts"

Rename your draft using:

$ bundle exec jekyll rename _drafts/my-new-draft.md "My Renamed Draft"
# or rename it back
$ bundle exec jekyll rename _drafts/my-renamed-draft.md "My new draft"

Publish your draft using:

    $ bundle exec jekyll publish _drafts/my-new-draft.md
    # or specify a specific date on which to publish it
    $ bundle exec jekyll publish _drafts/my-new-draft.md --date 2014-01-24
    # or specify a custom format for the date attribute in the yaml front matter
    $ bundle exec jekyll publish _drafts/my-new-draft.md --timestamp-format "%Y-%m-%d %H:%M:%S %z"

Rename your post using:

$ bundle exec jekyll rename _posts/2014-01-24-my-new-draft.md "My New Post"
# or specify a specific date
$ bundle exec jekyll rename _posts/2014-01-24-my-new-post.md "My Old Post" --date "2012-03-04"
# or specify the current date
$ bundle exec jekyll rename _posts/2012-03-04-my-old-post.md "My New Post" --now

Unpublish your post using:

    $ bundle exec jekyll unpublish _posts/2014-01-24-my-new-draft.md

Create your new file in a collection using:

    $ bundle exec jekyll compose "My New Thing" --collection "things"

Configuration

To customize the default plugin configuration edit the jekyll_compose section within your jekyll config file.

auto-open new drafts or posts in your editor

  jekyll_compose:
    auto_open: true

and make sure that you have EDITOR, VISUAL or JEKYLL_EDITOR environment variable set. For instance if you wish to open newly created Jekyll posts and drafts in Atom editor you can add the following line in your shell configuration:

export JEKYLL_EDITOR=atom

JEKYLL_EDITOR will override default EDITOR or VISUAL value. VISUAL will override default EDITOR value.

Set default front matter for drafts and posts

If you wish to add default front matter to newly created posts or drafts, you can specify as many as you want under default_front_matter config keys, for instance:

jekyll_compose:
  default_front_matter:
    drafts:
      description:
      image:
      category:
      tags:
    posts:
      description:
      image:
      category:
      tags:
      published: false
      sitemap: false

This will also auto add:

  • The creation timestamp under the date attribute.
  • The title attribute under the title attribute

For collections, you can add default front matter to newly created collection files using default_front_matter and the collection name as a config key, for instance for the collection things:

jekyll_compose:
  default_front_matter:
    things:
      description:
      image:
      category:
      tags:

Contributing

  1. Fork it ( http://github.com/jekyll/jekyll-compose/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run the specs and our linter (script/cibuild)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

Submitting a Pull Request based on an existing proposal

When submitting a pull request that uses code from an unmerged pull request, please be aware of the following:

  • Changes proposed in the older pull request is still the original author's property. Moving forward from where they left it means that you're a co-author.
  • GitHub allows attributing credit to multiple authors However, pull requests in this project are automatically squashed and then merged onto the base branch. So, only authors and co-authors of the opening commit gets credit once the pull request gets merged.
  • If the original pull request contained multiple commits, you may squash them into a single commit but ensure that you list any additional authors (and yourselves) as co-authors of that commit.
  • Use appropriate keywords in your pull request post to link to the existing pull request or issue-ticket so that they're automatically closed when your pull request gets merged.

jekyll-compose's People

Contributors

alzeih avatar anxolerd avatar ashmaroli avatar bennyhallett avatar blackjid avatar buo avatar campo avatar courajs avatar dirtyf avatar djds23 avatar envygeeks avatar exalted avatar gittoby avatar jandudulski avatar jekyllbot avatar mehonoshin avatar mloberg avatar nmenag avatar parkr avatar patrickclery avatar toshimaru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jekyll-compose's Issues

Time for a new release

Hello, maintainers! ๐Ÿ‘‹

By my calculations, it's time for a new release of jekyll-compose. It's been over 2 months since the last release, v0.8.0.

What else is left to be done before a new release can be made? Please make sure to update History.markdown too if it's not already updated.

Thanks! ๐Ÿ’ž โœจ

Invalid Command

I am unable to get Jekyll compose to work. At first, I got it to work after placing the Ruby installation directory in my $PATH variable, as discussed here. But then, regretfully, I did bundle install and it stopped working. I don't really know how to get it to work now.

This is my gemfile:

source 'https://rubygems.org'

gem 'jekyll'
gem 'github-pages'

group :jekyll_plugins do
  gem 'jekyll-compose'
  gem 'jekyll-paginate'
end

This is my gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.0.0 (2014-05-08 patchlevel 481) [universal.x86_64-darwin14]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - USER INSTALLATION DIRECTORY: /Users/acastano/.gem/ruby/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /Users/acastano/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-14
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/acastano/.gem/ruby/2.0.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Library/Frameworks/Python.framework/Versions/2.7/bin
     - /Library/Frameworks/Python.framework/Versions/Current/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /usr/local/git/bin
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
     - /Library/Ruby/Gems/2.0.0/gems/
     - /Users/acastano/.gem/ruby/2.0.0

Are my $PATH configurations correct? Could there be a conflict between my gemfile and my gemfile.lock now?

I'm unsure of how to proceed. The basic jekyll commands still work, but I would really like to install this plugin as well. Thanks in advance for the help

Titles should be quoted/escaped

Certain characters, such as the colon (:) are not allowed in an unquoted title. This command:

jekyll draft "Jekyll: How to use"

Generates a file with this front-matter:


---
layout: post
title: Jekyll: How to use

---

Which causes this error:

Error: could not read file jekyll-how-to-use.md: (): mapping values are not allowed in this context at line 3 column 14

Instead, the title in the front-matter should be quoted:


---
layout: post
title: "Jekyll: How to use"

---

Publish - must specify a draft path

When I run:

bundle exec jekyll publish

it returns:
jekyll 3.7.3 | Error: You must specify a draft path.

However, running:

bundle exec jekyll draft "Test Post"

works find and creates the file in _drafts

Time for a new release

Hello, maintainers! ๐Ÿ‘‹

By my calculations, it's time for a new release of jekyll-compose. It's been over 2 months since the last release, v0.6.0.

What else is left to be done before a new release can be made? Please make sure to update History.markdown too if it's not already updated.

Thanks! ๐Ÿ’ž โœจ

Publishing a draft with a date in the front-matter should use that date instead

Let's say I have a draft, with a date field in the front matter:


---
layout: post
title: Test!
date: 2015-01-01 00:01
categories:

---

Test body.

When I publish this draft, I expected it to get the name 2015-01-01-test.md, but it gets the current date instead. However, Jekyll displays the date field everywhere, and also uses it for the permalink. The published post should match that date, if specified.

Avoid unecessary configuration logs

Given I use jekyll-compose plugin
When I create a new post
Then I get the following output:

bundle exec jekyll post a-new-post
Configuration file: /Users/frank/code/jekyll/tests/default/_config.yml
Configuration file: /Users/frank/code/jekyll/tests/default/_config.yml
New post created at src/_posts/2018-10-07-a-new-post.md.
Configuration file: /Users/frank/code/jekyll/tests/default/_config.yml

I should simply get:

bundle exec jekyll post a-new-post
New post created at src/_posts/2018-10-07-a-new-post.md.

We should mirror jekyll's build and serve command and use configuration_from_options here.

0.3.0 release

@parkr Would you create a new release with the new page generation functionality?

Generated filename should not have accents

Hi,

Not a big problem as it could easily be fixed manually but it may be problematic for some language with accents (like french :/ )

When I create a draft like this :


bundle exec jekyll draft "Gรฉnรฉrer un brouillon"

The filename contains accents which is a bad idea I think because unless you change the filename manually (what I do atm) or edit the slug in the front matter manually, you'll end up with messy url with encoded characters.

Don't know if that possible but adding a slugify to the process of filenaming might be a solution.

Status of compose commands

Seems like the discussion around incorporating drafts, post, pages command cooled off recently. I was wondering if there was still interest in this. Looking at jekyll/jekyll#2378, I think it's just a matter of opening a new PR against this repo with the same code. @BennyHallett were you still planning on making a PR? If not, I would be more than happy to help (of course, I would still label those commits as you being the author).

Time for a new release

Hello, maintainers! ๐Ÿ‘‹

By my calculations, it's time for a new release of jekyll-compose. It's been over 2 months since the last release, v0.11.0.

What else is left to be done before a new release can be made? Please make sure to update History.markdown too if it's not already updated.

Thanks! ๐Ÿ’ž โœจ

fatal: 'jekyll draft' could not be found.

Using jekyll 3.7.0 and jekyll-compose 0.6.0

Created a new test directory with following Gemfile

source "https://rubygems.org"

gem 'jekyll-compose'

After running the command

bundler install
bundler exec jekyll draft 

Gives me error:
fatal: 'jekyll draft' could not be found. You may need to install the jekyll-draft gem or a related gem to be able to use this subcommand.

Below are the output of my bundler exec jekyll help

jekyll 3.7.0 -- Jekyll is a blog-aware, static site generator in Ruby

Usage:

  jekyll <subcommand> [options]

Options:
        -s, --source [DIR]  Source directory (defaults to ./)
        -d, --destination [DIR]  Destination directory (defaults to ./_site)
            --safe         Safe mode (defaults to false)
        -p, --plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]  Plugins directory (defaults to ./_plugins)
            --layouts DIR  Layouts directory (defaults to ./_layouts)
            --profile      Generate a Liquid rendering profile
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs

Subcommands:
  docs                  
  import                
  build, b              Build your site
  clean                 Clean the site (removes site output and metadata file) without building.
  doctor, hyde          Search site and print specific deprecation warnings
  help                  Show the help message, optionally for a given subcommand.
  new                   Creates a new Jekyll site scaffold in PATH
  new-theme             Creates a new Jekyll theme scaffold
  serve, server, s      Serve your site locally

Am I doing it wrong?

Drop leading ./ from messages & errors?

I personally think the message
New post created at _posts/2015-06-19-thingy.md.
would be a bit nicer than
New post created at ./_posts/2015-06-19-thingy.md.

The command is only valid from one directory anyway (the root of the jekyll project)

Thoughts?

Open new draft in editor

auto_open only works for posts at the moment, it should also work for drafts.

Given that I set `auto_open: true` in config
When I run `bundle exec jekyll draft a-new-draft`
Then new created draft opens in editor

Command not available; unresolved specs

$ bundle exec jekyll post
Invalid command. Use --help for more information 

$ jekyll post
WARN: Unresolved specs during Gem::Specification.reset:
      pygments.rb (~> 0.6.0)
      redcarpet (~> 3.1)
      listen (~> 2.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/ndarville/.rbenv/versions/2.2.0-dev/lib/ruby/gems/2.3.0/gems/jekyll-2.5.3/bin/jekyll:21:in `block in <top (required)>': cannot load such file -- jekyll/version (LoadError)
    from /Users/ndarville/.rbenv/versions/2.2.0-dev/lib/ruby/gems/2.3.0/gems/mercenary-0.3.5/lib/mercenary.rb:18:in `program'
    from /Users/ndarville/.rbenv/versions/2.2.0-dev/lib/ruby/gems/2.3.0/gems/jekyll-2.5.3/bin/jekyll:20:in `<top (required)>'
    from /Users/ndarville/.rbenv/versions/2.2.0-dev/bin/jekyll:23:in `load'
    from /Users/ndarville/.rbenv/versions/2.2.0-dev/bin/jekyll:23:in `<main>โ€™

Iโ€™ve tried both using jekyll-compose in my Gemfile as well as a gem in _config.yml with the same result.

Rename command

At least for me, writing a title is the last step of the writing process. I start by having some idea of what I want to write but it always evolves over the course of actual writing. If I start by writing a title first, more often than not, I need to amend that title. In jekyll that means I need to change front matter and rename a file. Not the nicest IMO.

I'd like to be able to do something like jekyll rename _drafts/untitled.md 'My Actual Title'

When looking through the source code to see how this might be accomplished, I noticed that Jekyll::Compose::ArgParser#validate! returns a hard-coded error message if the argument list is empty, which complains that a name must be specified. Which is, of course, wouldn't work with a command that requires two arguments like a rename command.

Do you think a rename command is worthwhile? If so, how would you handle the hard-coded error message?

Thanks.

Time for a new release

Hello, maintainers! ๐Ÿ‘‹

By my calculations, it's time for a new release of jekyll-compose. It's been over 2 months since the last release, v0.11.0.

What else is left to be done before a new release can be made? Please make sure to update History.markdown too if it's not already updated.

Thanks! ๐Ÿ’ž โœจ

Incompatible with Jekyll3 ?

For some reason this seems incompatible with Jekyll 3. Can anyone verify this ?

or I am doing it wrong

edit : sorry my bad.

No collection_dir in Jekyll config causes TypeError

I don't have a collections_dir key in my Jekyll config; I think #74 is throwing a TypeError:

Error:  no implicit conversion of nil into String

I think the arg parser needs to gracefully handle the lack of a key, but I don't know enough Ruby to do this myself ๐Ÿ˜…

Full traceback from running $ bundle exec jekyll post "Hi" --trace

Configuration file: /Users/mitchellbusby/repos/mitchell-busby/_config.yml
/Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/jekyll-compose-0.9.0/lib/jekyll-compose/arg_parser.rb:36:in `join': no implicit conversion of nil into String (TypeError)
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/jekyll-compose-0.9.0/lib/jekyll-compose/arg_parser.rb:36:in `source'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/jekyll-compose-0.9.0/lib/jekyll/commands/post.rb:35:in `process'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/jekyll-compose-0.9.0/lib/jekyll/commands/post.rb:13:in `block (2 levels) in init_with_program'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/gems/jekyll-3.3.0/exe/jekyll:13:in `<top (required)>'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/bin/jekyll:23:in `load'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/bin/jekyll:23:in `<main>'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
        from /Users/mitchellbusby/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'

Commands fail with opaque error when _posts does not exist

Running a jekyll publish, or jekyll post when _posts does not exist results in errors looking like this:
jekyll 2.5.3 | Error: No such file or directory @ sys_fail2 - (_drafts/my-site.md, _posts/2015-06-07-my-site.md)
I think it should create the folder, or at least display an informative error instead.

Support the source configuration setting

I'm using Jekyll in it's own directory from the project root using the source: dir/ setting in _config.yml, however jekyll-compose doesn't respect that and always creates a _posts in the project root instead of in dir/_posts.

Does it work with `github-pages` gem?

I can't get this working with the github-pages gem, which is just a gem that pins jekyll and some extra dependencies to match the versions running on GitHub Pages.

My Gemfile looks like this:

source 'https://rubygems.org'

gem 'jekyll-compose'
gem 'github-pages'

Using bundler but the new commands from compose are not being installed. What am I missing?

Can see commands in help but they do not work

I followed instruction commands and bundled so I have the jekyll-compose gem installed in my Gemfile

source "https://rubygems.org"
ruby RUBY_VERSION

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "3.6.3"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
   gem "jekyll-feed", "~> 0.6"
   gem "jekyll-paginate-v2", "~> 1.9"
   gem 'jekyll-compose', "~> 0.9"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

and I see the commands when I run bundle exec Jekyll help

However when I try to create a file for example bundle exec jekyll post "My New Post" or bundle exec jekyll draft "My new draft"
I get:

Configuration file: /Users/olly/Development/pop-website/_config.yml
jekyll 3.6.3 | Error:  no implicit conversion of nil into String

Am I missing something from my config or am I not entering the arguments correctly?

Perhaps I need a later version of Jekyll?

Time for a new release

Hello, maintainers! ๐Ÿ‘‹

By my calculations, it's time for a new release of jekyll-compose. It's been over 2 months since the last release, v0.8.0.

What else is left to be done before a new release can be made? Please make sure to update History.markdown too if it's not already updated.

Thanks! ๐Ÿ’ž โœจ

fatal: 'jekyll draft' could not be found.

gem install jekyll-compose

then use jekyll draft yields

fatal: 'jekyll draft' could not be found. You may need to install the jekyll-draft gem or a related gem to be able to use this subcommand.

jekyll-compose-0.4.1 and jekyll 3.1.1

output of jekyll help

jekyll 3.1.1 -- Jekyll is a blog-aware, static site generator in Ruby

Usage:

  jekyll <subcommand> [options]

Options:
        -s, --source [DIR]  Source directory (defaults to ./)
        -d, --destination [DIR]  Destination directory (defaults to ./_site)
            --safe         Safe mode (defaults to false)
        -p, --plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]  Plugins directory (defaults to ./_plugins)
            --layouts DIR  Layouts directory (defaults to ./_layouts)
            --profile      Generate a Liquid rendering profile
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs

Subcommands:
  docs                  
  help                  Show the help message, optionally for a given subcommand.
  new                   Creates a new Jekyll site scaffold in PATH
  clean                 Clean the site (removes site output and metadata file) without building.
  build, b              Build your site
  doctor, hyde          Search site and print specific deprecation warnings
  serve, server, s      Serve your site locally
  import                Import your old blog to Jekyll

compase commands are not registered in jekyll

I installed the latest jekyll-composed, and even added code below in Gemfile, jekyll still doesn't recognize draft, post, etc... The error came back is invalid command

group :jekyll_plugins do
  gem 'jekyll-compose'
end

Add unpublish command

would be good implement the command unpublish for the posts, for a post and convert it into a draft.

Jekyll fails with: uninitialized constant Jekyll::Commands::Draft::Compose (NameError)

I've packaged the gem for Debian. But after installation jekyll help throws an error:

$ jekyll help
Traceback (most recent call last):
	12: from /usr/bin/jekyll:6:in `<main>'
	11: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	10: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	 9: from /usr/lib/ruby/vendor_ruby/jekyll.rb:193:in `<top (required)>'
	 8: from /usr/lib/ruby/vendor_ruby/jekyll.rb:12:in `require_all'
	 7: from /usr/lib/ruby/vendor_ruby/jekyll.rb:12:in `each'
	 6: from /usr/lib/ruby/vendor_ruby/jekyll.rb:13:in `block in require_all'
	 5: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	 4: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	 3: from /usr/lib/ruby/vendor_ruby/jekyll/commands/draft.rb:3:in `<top (required)>'
	 2: from /usr/lib/ruby/vendor_ruby/jekyll/commands/draft.rb:4:in `<module:Jekyll>'
	 1: from /usr/lib/ruby/vendor_ruby/jekyll/commands/draft.rb:5:in `<module:Commands>'
/usr/lib/ruby/vendor_ruby/jekyll/commands/draft.rb:41:in `<class:Draft>': uninitialized constant Jekyll::Commands::Draft::Compose (NameError)
Did you mean?  Complex

The conflicting line is in jekyll/commands/draft.rb. Any idea? Jekyll is at version 3.8.3, Ruby is at version 2.5.2.

Configure default layout?

Started to kick the tires with this gem, and I noticed that new drafts/posts are created with layout:post

My theme uses a different layout for posts; is there a way to have jekyll-compose default to that different layout? I'm guessing it would be something in _config.yml?

If `collections_dir` is not set, `arg_parser` raises exception

I just tried installing this gem into a Jekyll 3.5.2 app, and had issues with:

TypeError: no implicit conversion of nil into String
  /Users/ttilberg/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/jekyll-compose-0.9.0/lib/jekyll-compose/arg_parser.rb:36:in `join'

This line is trying to File.join a nil argument if collections_dir is not set.

        File.join(config["source"], config["collections_dir"])

jekyll help does not show jekyll-compose commands; Mac OSX: gem 2.4.5: jekyll 2.5.3: jekyll-compose 0.2.1:

I am unable to get the jekyll-compose commands to run. Specifically I tried "jekyll draft" and I got:
Invalid command. Use --help for more information
When I look up jekyll help, I do not see the "draft", "post" or "publish" commands.
gem list --local shows me the following versions of relevant gems:
jekyll (2.5.3, 2.4.0)
jekyll-coffeescript (1.0.1)
jekyll-compose (0.2.1)
jekyll-gist (1.1.0)
jekyll-import (0.5.3)
jekyll-mentions (0.2.1)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.6.2)
jekyll-sass-converter (1.3.0, 1.2.0)
jekyll-sitemap (0.6.3)
jekyll-watch (1.2.1)

Not too sure, what I am doing wrong.

feat: generic compose command

Scenario

In order to manage my website content like a hacker
As a jekyll user using the jekyll-compose plugin
I can create all types of documents from the command line

Replace current draft and post commands, with a generic compose subcommand, that could also handle collection documents.

Creating

bundle exec jekyll compose _drafts/my-upcoming-post.md
bundle exec jekyll compose _post/new-release.md
bundle exec jekyll compose _recipes/yummy-cake.md

Given I have a collection named _recipes
And that I have defined default front matter in config 
When I run `bundle exec jekyll compose _recipes/yummy-cake.md`
Then a new document with default front matter is created in the _recipes folder

Publishing

bundle exec jekyll publish _drafts/my-upcoming-post.md
bundle exec jekyll publish _post/new-release.md
bundle exec jekyll publish __recipes/yummy-cake.md

Unpublishing

bundle exec jekyll unpublish _drafts/my-upcoming-post.md
bundle exec jekyll unpublish _post/new-release.md
bundle exec jekyll unpublish __recipes/yummy-cake.md

Front matter

Additional front-matter could be added in the `defaults:

defaults:
  -
    scope:
      path: ""
      type: "recipes" 
    values:
      layout: "recipe"
    front-matter:
      difficulty: ""
      time: ""
      ingredients: ""

Look up config file in parents recursively

Use case: I add categories to posts by putting them into folders of the same name (Jekyll supports this!), e.g.

โ”œโ”€โ”€ jekyll
โ”‚   โ””โ”€โ”€ update
โ”‚       โ””โ”€โ”€ _posts
โ”‚           โ””โ”€โ”€ 2019-04-07-welcome-to-jekyll.md

Instead of adding an option to Jekyll Compose, I think the more unix-y way of adding support for this just cding into jekyll/update and running draft, publish, etc. commands there.

However, Jekyll Compose can't locate the config file in this case, as it's only looking in the current working directory. Support for recursive search until it finds a config file in a parent would enable this.

Time for a new release

Hello, maintainers! ๐Ÿ‘‹

By my calculations, it's time for a new release of jekyll-compose. It's been over 2 months since the last release, v0.9.0.

What else is left to be done before a new release can be made? Please make sure to update History.markdown too if it's not already updated.

Thanks! ๐Ÿ’ž โœจ

Time for a new release

Hello, maintainers! ๐Ÿ‘‹

By my calculations, it's time for a new release of jekyll-compose. It's been over 2 months since the last release, v0.8.0.

What else is left to be done before a new release can be made? Please make sure to update History.markdown too if it's not already updated.

Thanks! ๐Ÿ’ž โœจ

I cannot see the compose commands

I added the gem to the gemfile

gem 'jekyll-compose'

this to the _config.yml

gems:
  - jekyll-compose

runned bundle install

and when I try jekyll --help or bundle exec jekyll --help I cannot see any of the composer commands...

I also tried adding this to the gemfile

group :jekyll_plugins do
  gem "jekyll-compose"
end

any idea??

thanks

Check for `collections_dir`

related to jekyll/jekyll#6685

Given `collections_dir` is defined in config
Then `jekyll post` should create new post in `collection_dir/_posts`
And `jekyll draft` should create new draft in `collections_dir/_drafts`
And `jekyll publish` should move draft in `collection_dir/_posts`
And `jekyll unpublish` should move post in `collections_dir/_drafts`

Custom default front matter variables not working

Hi there, sorry it's me again.

I am able to generate posts, pages, drafts etc with Jekyll-compose, however I cannot get the custom front matter variables that I put inside the jekyll_compose section of my config.yaml to appear in the front matter of any newly created posts/drafts

I have tried

jekyll_compose:
  default_front_matter:
    drafts:
        main_img_url: "https://images-we-got-pop.imgix.net/website/blog/pop-logo-small.png"
        author_name: "Me"
        categories: "general"
        description: "Description"
    posts:
        main_img_url: "https://images-we-got-pop.imgix.net/website/blog/pop-logo-small.png"
        author_name: "Me"
        categories: "general"
        description: "Description"

and also without values:

jekyll_compose:
  default_front_matter:
    drafts:
        main_img_url: 
        author_name: 
        categories: 
        description: 
    posts:
        main_img_url:
        author_name: 
        categories: 
        description: 

I have also tried to use the ones presented in the ReadMe but they did not appear in the front-matter either

But when I generate posts/drafts I only get the standard variables in my new post's front matter

---
title: this-is-a-new-post
date: 2019-10-09 11:14 +0100
---

I have tried updating my Jekyll version from 3.7.0 to 3.8.6 but this issue still persists

Am I meant to run the jekyll-compose CLI commands with --config to use the custom variables or is this unrelated?

jekyll-compose doesn't show up in help, commands don't work.

gem install jekyll-compose
Successfully installed jekyll-compose-0.2.1
Parsing documentation for jekyll-compose-0.2.1
Done installing documentation for jekyll-compose after 0 seconds
1 gem installed

=>

jekyll help
jekyll 2.4.0 -- Jekyll is a blog-aware, static site generator in Ruby

Usage:

  jekyll <subcommand> [options]

Options:
        -s, --source [DIR]  Source directory (defaults to ./)
        -d, --destination [DIR]  Destination directory (defaults to ./_site)
            --safe         Safe mode (defaults to false)
        -p, --plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]  Plugins directory (defaults to ./_plugins)
            --layouts DIR  Layouts directory (defaults to ./_layouts)
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs

Subcommands:
  build                 Build your site
  docs                  Launch local server with docs for Jekyll v2.4.0
  doctor, hyde          Search site and print specific deprecation warnings
  help                  Show the help message, optionally for a given subcommand.
  new                   Creates a new Jekyll site scaffold in PATH
  serve, server         Serve your site locally

=>

jekyll draft
Invalid command. Use --help for more information

:(

Only thing I can think of is it looks like jekyll-compose requires rake and I do have it in my /usr/local/bin but Gem list doesn't list it so I assume it got there some other way (It is 10.4.2 though).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.