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

Add jekyll-import command #532

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The new __Jekyll__ command for importing from various blogs to Jekyll format.
### Jekyll v2.x and higher

1. Install the _rubygem_ with `gem install jekyll-import`.
2. Run `jekyll import IMPORTER [options]`
2. Run `jekyll-import IMPORTER [options]`

### Jekyll v1.x

Expand Down
4 changes: 2 additions & 2 deletions docs/_docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Found an issue with one of the importers? Sorry about that! In order to better a
1. Collection information about your system: operating system and version, Ruby version, Jekyll version, jekyll-import version.
2. Which importer are you using? Note this.
3. Collect the relevant data. This may be data from your database or input file. This will help us diagnose where the issue occurred.
4. Ensure the `--trace` option is specified if you're running `jekyll import` from the command-line.
4. Ensure the `--trace` option is specified if you're running `jekyll-import` from the command-line.
4. [Open a new issue]({{ site.repository }}/issues/new) describing the four above points, as well as what you expected the outcome of your incantation to be.

You should receive help soon. As always, check out [our help repo](https://talk.jekyllrb.com/) if you just have a question.
Expand Down Expand Up @@ -90,5 +90,5 @@ Once you have your importer working (test with `script/console`), then you're re
`./docs/_importers/columbus.md`. Take a look at one of the other importers as an example. You just add basic usage and you're golden.

All set? Add everything to a branch on your fork of `jekyll-import` and
[submit a pull request](https://github.com/jekyll/jekyll-import/compare/).
[submit a pull request](https://github.com/jekyll/jekyll-import/compare/).
Thank you!
2 changes: 1 addition & 1 deletion docs/_layouts/importer.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2>Invocation</h2>

<p>
Sample snippet to invoke the importer:
<pre>jekyll import {{ page.cmd_name }}{% if page.cmd_opts %} {{ page.cmd_opts | map: 'switch' | join: ' ' }}{% endif %}</pre>
<pre>jekyll-import {{ page.cmd_name }}{% if page.cmd_opts %} {{ page.cmd_opts | map: 'switch' | join: ' ' }}{% endif %}</pre>
</p>

<div class="table-container">
Expand Down
33 changes: 33 additions & 0 deletions exe/jekyll-import
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

STDOUT.sync = true

$LOAD_PATH.unshift File.expand_path("../lib", __dir__)

require 'jekyll-import'
require 'jekyll/commands/import'
require 'mercenary'

Mercenary.program(:jekyll_import) do |p|
p.version JekyllImport::VERSION
p.description "Import from various blogs to Jekyll format."
p.syntax "jekyll-import <blog_engine> [options]"

# Create all the subcommands for the importers.
JekyllImport.add_importer_commands(p)

p.action do |args, _|
if args.empty?
Jekyll.logger.error "An importer subcommand is required."
puts p
abort
else
subcommand = args.first
unless p.has_command? subcommand
Jekyll.logger.abort_with "fatal: 'jekyll-import #{args.first}'" \
" could not be found."
end
end
end
end
5 changes: 4 additions & 1 deletion jekyll-import.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ Gem::Specification.new do |s|
s.email = "[email protected]"
s.homepage = "http://github.com/jekyll/jekyll-import"

s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).grep(%r!^lib/!)
all_files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
s.files = all_files.grep(%r!^(exe|lib|rubocop)/|^.rubocop.yml$!)
s.executables = all_files.grep(%r!^exe/!) { |f| File.basename(f) }
s.bindir = "exe"
s.require_paths = %w(lib)

s.rdoc_options = ["--charset=UTF-8"]
Expand Down
Loading