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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost Importer #100

Merged
merged 7 commits into from Dec 8, 2013

Conversation

Projects
None yet
4 participants
@gr4y
Contributor

gr4y commented Dec 6, 2013

Hey there,

I quickly hacked together an Importer for the Ghost SQLite Database. 馃槃

Show outdated Hide outdated lib/jekyll-import/importers/ghost.rb
end
def self.specify_options(c)
c.option 'dbfile', '--dbfile', 'Database file'

This comment has been minimized.

@parkr

parkr Dec 6, 2013

Member

Can you please add a not to 'Database file' that it defaults to ./ghost.db?

@parkr

parkr Dec 6, 2013

Member

Can you please add a not to 'Database file' that it defaults to ./ghost.db?

Show outdated Hide outdated lib/jekyll-import/importers/ghost.rb
%w[dbfile].each do |option|
if options[option].nil?
abort "Missing mandatory option --#{option}."
end

This comment has been minimized.

@parkr

parkr Dec 6, 2013

Member

You can remove the each loop and just check for option["dbfile"]

@parkr

parkr Dec 6, 2013

Member

You can remove the each loop and just check for option["dbfile"]

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Dec 6, 2013

Member

Looks awesome!! Thanks so much for writing this :)

Would you please split the process method into smaller methods that process calls? Easier to maintain that way :)

Member

parkr commented Dec 6, 2013

Looks awesome!! Thanks so much for writing this :)

Would you please split the process method into smaller methods that process calls? Easier to maintain that way :)

@gr4y

This comment has been minimized.

Show comment
Hide comment
@gr4y

gr4y Dec 6, 2013

Contributor

@parkr Sure. I just realized that the ghost importer even imports the drafts, but doesn't move it to the _drafts directory, so I am currently working on that.

Contributor

gr4y commented Dec 6, 2013

@parkr Sure. I just realized that the ghost importer even imports the drafts, but doesn't move it to the _drafts directory, so I am currently working on that.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Dec 6, 2013

Member

@gr4y you rock. thanks!

Member

parkr commented Dec 6, 2013

@gr4y you rock. thanks!

@gr4y

This comment has been minimized.

Show comment
Hide comment
@gr4y

gr4y Dec 6, 2013

Contributor

@parkr There we go. The importer now copies drafts to the _drafts directory and the published posts to _posts. One question I ask myself: Why should the --dbfile option be mandatory when it defaults to `ghost.db? Shouldn't I remove that line of code?

Contributor

gr4y commented Dec 6, 2013

@parkr There we go. The importer now copies drafts to the _drafts directory and the published posts to _posts. One question I ask myself: Why should the --dbfile option be mandatory when it defaults to `ghost.db? Shouldn't I remove that line of code?

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Dec 7, 2013

Member

It doesn't need to be mandatory if you're ok with having a default. :)

Member

parkr commented Dec 7, 2013

It doesn't need to be mandatory if you're ok with having a default. :)

Show outdated Hide outdated lib/jekyll-import/importers/ghost.rb
directory = draft ? "_drafts" : "_posts"
# the filename under which the post is stored
filename = "%s/%02d-%02d-%02d-%s.markdown" % [directory, date.year, date.month, date.day, post[:slug]]

This comment has been minimized.

@parkr

parkr Dec 7, 2013

Member

This is a very interesting way to approach this. What's your primary dev language? Looks very Python/C :)

What do you think of the following?

filename = File.join(directory, "#{date.strftime('%Y-%m-%d')}-#{post[:slug]}.markdown")

It's a bit more idiomatic to Ruby (but that doesn't mean we have to do it that way)

@parkr

parkr Dec 7, 2013

Member

This is a very interesting way to approach this. What's your primary dev language? Looks very Python/C :)

What do you think of the following?

filename = File.join(directory, "#{date.strftime('%Y-%m-%d')}-#{post[:slug]}.markdown")

It's a bit more idiomatic to Ruby (but that doesn't mean we have to do it that way)

This comment has been minimized.

@gr4y

gr4y Dec 7, 2013

Contributor

I copied that line from the Joomla Importer, but I think you are right. The File.join approach is a little more descriptive and easier to read. I updated my branch.

I would consider Ruby as my primary language, cause I write most of my stuff in Ruby, but I am also writing Java and PHP when I have to.

@gr4y

gr4y Dec 7, 2013

Contributor

I copied that line from the Joomla Importer, but I think you are right. The File.join approach is a little more descriptive and easier to read. I updated my branch.

I would consider Ruby as my primary language, cause I write most of my stuff in Ruby, but I am also writing Java and PHP when I have to.

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Dec 7, 2013

Member

Looking really great so far!

Member

parkr commented Dec 7, 2013

Looking really great so far!

@mattr-

This comment has been minimized.

Show comment
Hide comment
@mattr-

mattr- Dec 7, 2013

Member

馃憤 so far. Really excited about this. 馃槂

@gr4y Should we consider this complete now?

Member

mattr- commented Dec 7, 2013

馃憤 so far. Really excited about this. 馃槂

@gr4y Should we consider this complete now?

@gr4y

This comment has been minimized.

Show comment
Hide comment
@gr4y

gr4y Dec 7, 2013

Contributor

@parkr I removed the self.validate stub completely, cause --dbfile has a default.
@mattr- Yes, I would consider it complete! 馃榾

Contributor

gr4y commented Dec 7, 2013

@parkr I removed the self.validate stub completely, cause --dbfile has a default.
@mattr- Yes, I would consider it complete! 馃榾

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Dec 7, 2013

Member

Looks so good. Would you please add tests? Once those are in place, I'll merge :)

Member

parkr commented Dec 7, 2013

Looks so good. Would you please add tests? Once those are in place, I'll merge :)

@@ -0,0 +1,69 @@
# NOTE: This migrator is made for Ghost sqlite databases.

This comment has been minimized.

@parkr

parkr Dec 7, 2013

Member

No one will see this note -- remove it? 馃槃

@parkr

parkr Dec 7, 2013

Member

No one will see this note -- remove it? 馃槃

parkr added a commit that referenced this pull request Dec 8, 2013

@parkr parkr merged commit 488e713 into jekyll:master Dec 8, 2013

1 check passed

default The Travis CI build passed
Details

parkr added a commit that referenced this pull request Dec 8, 2013

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.