GithubHelp home page GithubHelp logo

zbruhnke / bloggy Goto Github PK

View Code? Open in Web Editor NEW
193.0 8.0 34.0 108 KB

Simple gem that allows you to run a jekyll blog inside of your existing rails app. fork and enjoy!

License: Other

Ruby 100.00%

bloggy's Introduction

Bloggy

Dependency Status

Bloggy is a simple gem that helps you generate a jekyll blog within your rails application by using generator commands similar to the ones you are used to already.

Installation

Add this line to your application's Gemfile:

gem 'bloggy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bloggy

Usage

All config elements you are used to in your jekyll blog are still present (and tucked away nicely in your rails app)

Once you run

$ rails g jekyll:blog

you will find the file structure you are used to seeing for creating blog posts, editing default layout etc. inside of the config/jekyll directory. There you can add add the same commands you would from a normal jekyll installation (they are provided at the Jekyll configuration page). So now just configure to your liking. (edit the default.html inside of _layouts for your main page and the post.html and page.html files for the corresponding results).

I have provided a rake task to name and open your new blog post for editing. To use it just run

$ bundle exec rake np post-title

By default, your post will open in textmate, but you can override this by creating a .bloggyrc file in your home directory, containing the command line invocation of your editor.

# mine for Rubymine, subl for Sublime Text, mate for TextMate, etc.
editor: mine

Your posts will be served from the public/blog directory inside of your rails application. After you write a new blog post simply run

$ bundle exec rake generate

And the new static files will be generated and ready to be re-deployed and served as static assets by your server! Be default, you can see your blog at /blog.

Some changes are sure to come as I explore and use this on my own, but for now I feel it is a good start and a step in the right direction for quickly and easily adding a blog to your application while keeping costs low. If you have questions or would just like to get in touch you can do so by contacting me here. Thanks for trying out Bloggy and please feel free to fork and contribute!

This gem was originally crafted with love by Zach Bruhnke and was created to show customers on Engine Yard how they could add a simple (and SEO friendly) blog to their existing rails application in no time and save extra time and configuration steps for custom setups that save money.

Bloggy was built on top of the Jekyll framework written by Tom Preston-Werner and uses the same config elements you're used to if you already use jekyll for blogging. The default design I included also came from Tom (clearly I am not much of a designer). Thankfully he provided them under the MIT license for us all to use. Hope you enjoy Bloggy and find it useful for your endeavors.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

bloggy's People

Contributors

brownmagik352 avatar dependabot[bot] avatar ebouchut avatar erictheise avatar facundofarias avatar jesseadams avatar thommahoney avatar zbruhnke 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

bloggy's Issues

Way to use Rails application layout and still be DRY?

Bloggly looks great, thanks for creating it. I really want to be able to use the default rails layout i have for my application on the blog which lives in the app.name/blog space. The obvious answer is to view the rendered html source of another page on my site, then use this html to paste into the jekyll layout file.

This obviously is cumbersome if a change is made on the site header, footer or other layout. CSS and JS files also would need to be updated in 2 places to maintain consistency with jekyll and bloggly.

Is there any way to make bloggy and jekyll play nice with my existing rails layouts, JS and CSS files? something a bit more DRY?

'rake generate' doesnt generate files in /public

When I run 'rake generate', I get the following now, rather than the '52 files generated' that used to display.

NAME:

jekyll

DESCRIPTION:

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

COMMANDS:

build                Build your site                
doctor               Search site and print specific deprecation warnings            
help                 Display global or [command] help documentation.                        
import               Import your old blog to Jekyll         
new                  Creates a new Jekyll site scaffold in PATH             
serve                Serve your site locally                

ALIASES:

hyde                 doctor   
server               serve   

GLOBAL 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 
    Layouts directory (defaults to ./_layouts)

-h, --help 
    Display help documentation

-v, --version 
    Display version information

-t, --trace 
    Display backtrace when an error occurs

Generator is broken

Docs read that you can do rails g jekyll:blog NAME and it will create directory public/NAME but it only returns public/blog.

Description:
The generator allows you to create a Jekyll blog within your rails app.
The default [NAME] called blog

Example:
rails generate jekyll:blog [NAME]
if you choose not to add a name your files will be automatically generated to the public/blog directory

This will create:
public/[NAME]

rake generate not working

Running rake generate for a new post takes me to the jekyll man page. Is this a known issue or something on my end?

When I remove the test post with `git rm` it breaks rake new

Because git is all fancy and also removes the empty directory config/jekyll/_posts. I don't know if this is a problem with bloggy or jekyll:

grant@johnicicleboy:~/src/openpgp-ca$ rake np welcome
rake aborted!
No such file or directory - config/jekyll/_posts/2013-02-21-welcome.markdown
/home/grant/src/openpgp-ca/lib/tasks/new_post.rake:16:in `initialize'
/home/grant/src/openpgp-ca/lib/tasks/new_post.rake:16:in `open'
/home/grant/src/openpgp-ca/lib/tasks/new_post.rake:16:in `block in <top (required)>'
/home/grant/.rvm/gems/ruby-1.9.3-p385@openpgp-ca/bin/ruby_noexec_wrapper:14:in `eval'
/home/grant/.rvm/gems/ruby-1.9.3-p385@openpgp-ca/bin/ruby_noexec_wrapper:14:in `<main>'

Why a component/JSX file to list up posts?

I see there is a component inside assets/javascripts directory with following contents:

This thing breaks the $ rake assets:precompile RAILS_ENV=production task due to the < character inside JSX file:

/** @jsx React.DOM **/

var PostsList = React.createClass({
    getInitialState: function() {
        return { posts: this.props.initialPosts };
    },

    render: function() {
        var posts = this.state.posts.map(function(post) {
            return <Post key={post.id} post={post} />;
        });

        return (
            <div className="posts">
                {posts}
            </div>
        );
    }
});

rails g jekyll:blog failing

Trying to look for a simple way to add a blog, and this option looked very promising. Rails 4.2.5 app is new, running Ruby 2.2.3, but getting the below error when I run 'rails g jekyll:blog':

/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'bloggy'. (Bundler::GemRequireError)

Thanks for any help.

'rake generate' hangs

Just installed and created my first post, ran 'rake generate' and it's just hanging after 15 minutes.

Configuration from /path/to/config/jekyll/_config.yml
Auto-regenerating enabled: /path/to/config/jekyll -> ../../public/blog
[2015-12-13 17:12:09] regeneration: 1 files changed
[2015-12-13 17:12:09] regeneration: 1 files changed
[2015-12-13 17:12:09] regeneration: 1 files changed

.... hangs here, I let it sit for 15 minutes and it's still going, I can't imagine it should take longer than this...?

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.