Code Monkey home page Code Monkey logo

enki's Introduction

This project is no longer actively developed

Both of the core collaborators have switched their blogs to Jekyll or similar static site generators. We’re still reviewing and merging PRs for Enki, but doing no active development ourselves.

Enki

A Ruby on Rails blogging app for the fashionable developer.

Preferences are for the masses. Any real coder knows the easiest and best way to customize something is by hacking code. Because you want your blog to be you, not bog standard install #4958 with 20 posts per page instead of 15. For this you need a clean, simple, easy to understand code base that stays out of your way. No liquid drops and templates hindering your path, no ugly PHP stylings burning your eyeballs.

Quick start

  git clone git://github.com/xaviershay/enki.git enki
  cd enki
  git checkout -b myblog # Create a new work branch
  bundle install         # Install all the required gems

  cp config/database.example.yml config/database.yml
  # Edit config/enki.yml and config/database.yml to taste

  # Next step needs libxml2 and libxslt1 and their headers
  # On Debian-based systems: apt-get install libxml2-dev libxslt1-dev
  # On Mac OS X: no action required

  rake secret # Paste output into place in config/initializers/secret_token.rb
  rake db:migrate
  rake            # Run tests
  rails server    # Start the server
  # Load http://localhost:3000/admin in your browser

Or for bonus points, fork Enki at github and clone that instead.

More info

Enki is a compact, easily extendable base for your blog. It does this by being highly opinionated, for example:

  • Public facing views should adhere to standards (HTML5, Atom)
  • /yyyy/mm/dd/post-title is a good URL for your posts
  • Live comment preview should be provided by default
  • Google does search better than you or I
  • You don’t need a plugin system when you’ve got decent source control
  • If you’re not using something more than just a basic username/password, you’re a chump
  • Hacking code is the easiest way to customize something

Setting up authentication

Enki uses OmniAuth for authentication. By default Enki supports Google OpenID Connect via the omniauth-google-oauth2 strategy and OpenID 2.0 via the omniauth-openid strategy. Should you wish to use a different form of authentication, you can implement any of the available OmniAuth strategies, or write your own strategy.

Using Google OpenID Connect for authentication

You will need a Google account, then:

  • Go to https://console.developers.google.com
  • Select (or create) your project
  • Click ‘APIs & auth’
  • Make sure ‘Contacts API’ and ‘Google+ API’ are enabled
  • Go to the Consent Screen, and provide an ‘Email address’ and ‘Product name’
  • Click on ‘Credentials’ under ‘APIs & auth’ and take note of your ‘Client ID’ and ‘Client secret’
  • Wait 10 minutes for changes to take effect

Create a new file called google_oauth2.yml in your config directory, add your ‘Client ID’ and ‘Client secret’ to the file thusly:

GOOGLE_CLIENT_ID: ADD_YOUR_CLIENT_ID_HERE
GOOGLE_CLIENT_SECRET: ADD_YOUR_CLIENT_SECRET_HERE

If you are deploying to Heroku, you will need to set the above as ENV variables instead of using google_oauth2.yml. For example:

$ heroku config:set GOOGLE_CLIENT_ID=my_client_id
$ heroku config:set GOOGLE_CLIENT_SECRET=my_client_secret

Open up config/enki.yml and make sure that the google_oauth2_email value matches the email address of your Google OpenID Connect identity.

Using OpenID 2.0 for authentication

Open up config/enki.yml and make sure that one or more of your OpenID identity URLs are included in the open_id value(s).

Upgrading to Enki 2016

As of January 2016, Enki no longer uses acts_as_taggable_on_steroids as it has been replaced with ActsAsTaggableOn. Commit 5e97796 contains database migrations that update the existing tag-related tables to be compatible with ActsAsTaggableOn. This is a non-destructive migration so any existing tag records in your database should be unaffected. However, just to be safe you may wish to back up your database before running bundle install and rake db:migrate to upgrade your Enki install.

Upgrading to Enki 2015

As of April 2015, Enki no longer uses the open_id_authentication gem. Commit ec85aef contains database migrations that remove both tables used by open_id_authentication and add a new table to store OmniAuth response information. Should you wish to keep any data that you may have currently stored in either the open_id_authentication_nonces or open_id_authentication_associations tables, retrieve this information before you run rake db:migrate to upgrade your Enki install.

URL path prefix

Enki can run your blog with a URL path prefix. For example, you can run it at example.com/blog instead of blog.example.com. You can do so with the RAILS_RELATIVE_URL_ROOT environment variable, set either before starting the server or in config/application.rb before Enki::Application. Uncommenting this line in config/application.rb will enable this behavior in all environments:

ENV['RAILS_RELATIVE_URL_ROOT'] = '/blog'

How it differs from Mephisto

Mephisto is feature packed and quite customizable. It can however be daunting trying to find your way around the code, which isn’t so good if you’re trying to hack in your own features. Enki strips out a lot of the features that you probably don’t need (multiple authors and liquid templates, for example), and focuses on keeping a tight code base that is easy to comprehend and extend.

How it differs from SimpleLog

Enki embodies much of the philosophy of SimpleLog, but does so in a style that is much more consistent with Rails best practices, making it easier to understand and hack the code.

Compatibility

Uses Ruby 1.9.3 or newer and Rails 4. Runs on MySQL or Postgres. Works on Heroku.

Contributors, these guys rock

git log | grep Author | sort | uniq

If you want to help out, try tackling an open issue. Please include specs for any fixes. Enki is by design feature light. Unless you feel very strongly your feature should be in core, add a link to your fork in the wiki instead.

License

GPL – See LICENSE

Admin design heavily inspired by Habari

enki's People

Contributors

akitaonrails avatar banzaiman avatar bensomers avatar chrislloyd avatar clok avatar cullepm3 avatar dependabot[bot] avatar gaelian avatar heironimus avatar jasoncheow avatar jhollinger avatar kytrinyx avatar mcary avatar pauldowman avatar pedrodelgallego avatar robc avatar rueckerl avatar toolmantim avatar xaviershay avatar zachinglis 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

enki's Issues

Dot character in tag name

Here's a funny one: on my blog, I happen to have a tag named "gov-2.0", since upgrading my blog recently I started noticing an exception being generated by crawlers visiting my site and hitting the address for my "gov-2.0" tag:

A ActionController::UnknownFormat occurred in posts#index:

  ActionController::UnknownFormat
  app/controllers/posts_controller.rb:6:in `index'

And...

Parameters: {"controller"=>"posts", "action"=>"index", "tag"=>"gov-2", "format"=>"0"}

So the dot is being considered as the format specifier and ".0" is not surprisingly an unknown format. :) One potential fix for this might be something like what this guy is talking about:

http://legacy.x3ro.de/rails-3-routing-parameters-dots/

That "gov-2.0" tag has been on my site for quite some time, I don't remember having this problem previously. I guess something has changed with Rails recently? Not exactly sure when.

I'll be fixing this for myself no doubt, but is this something to fix on master? is the above link an acceptable approach?

Change pagination to use will_paginate/kaminari instead of the Archive system?

Aloha,

I was going to go through and tear out the archive system in my fork of enki and replace it with a simple infinite scroll / will_paginate setup. Seems like I could reduce a ton of code this way and overall less to maintain. Curious if this is something you would like in the main branch for Enki or if there was a specific reason you did an archive system over the pagination?

Cheers!
Sumit

Formatting code with lesstile and coderay

How do you change the styling of highlighted code? I see that lesstile is applying colors as inline styles

<span style="color:#080;font-weight:bold">class</span> <span style="color:#B06;font-weight:bold">Post</span> &lt; <span style="color:#036;font-weight:bold">ActiveRecord</span>::<span style="color:#036;font-weight:bold">Base</span>

Is there any way to have lesstile not apply inline styles but to append the html with classes? I'd rather do the styling on the client side. This is the css I'd like to use

/* Credits: Ryan Bates, https://github.com/ryanb/railscasts-episodes/blob/master/episode-207/blog/public/stylesheets/coderay.css */
/* Note the customization of pre! */

.CodeRay {
  background-color: #232323;
  border: 1px solid black;
  font-family: 'Courier New', 'Terminal', monospace;
  color: #E6E0DB;
  padding: 3px 5px;
  overflow: auto;
  font-size: 12px;
  margin: 12px 0;
}

.CodeRay pre {                                      /* important: overwrite pre from scaffold.css */
  background-color: #232323 !important;
  margin: 0px !important;
  padding: 0px !important;
}

.CodeRay .an { color:#E7BE69 }                      /* html attribute */
.CodeRay .c  { color:#BC9358; font-style: italic; } /* comment */
.CodeRay .ch { color:#509E4F }                      /* escaped character */
.CodeRay .cl { color:#FFF }                         /* class */
.CodeRay .co { color:#FFF }                         /* constant */
.CodeRay .fl { color:#A4C260 }                      /* float */
.CodeRay .fu { color:#FFC56D }                      /* function */
.CodeRay .gv { color:#D0CFFE }                      /* global variable */
.CodeRay .i  { color:#A4C260 }                      /* integer */
.CodeRay .il { background:#151515 }                 /* inline code */
.CodeRay .iv { color:#D0CFFE }                      /* instance variable */
.CodeRay .pp { color:#E7BE69 }                      /* doctype */
.CodeRay .r  { color:#CB7832 }                      /* keyword */
.CodeRay .rx { color:#A4C260 }                      /* regex */
.CodeRay .s  { color:#A4C260 }                      /* string */
.CodeRay .sy { color:#6C9CBD }                      /* symbol */
.CodeRay .ta { color:#E7BE69 }                      /* html tag */
.CodeRay .pc { color:#6C9CBD }                      /* boolean */

So how does one change the styling of highlighted code?

Admin Login Issue

I have deployed Enki to Heroku and just recently started getting this error when I try to log into admin.

2012-11-26T22:04:05+00:00 app[web.1]: Started POST "/admin/session" for 195.327.41.20 at 2012-11-26 22:04:05 +0000 2012-11-26T22:04:05+00:00 app[web.1]: Processing by Admin::SessionsController#create as HTML 2012-11-26T22:04:05+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"asdoiD23DLFilkj39sd9dlokiDJfi2k3lfidD3fdddj=", "openid_url"=>"https://www.google.com/accounts/o8/id", "commit"=>"Login with OpenID"} 2012-11-26T22:04:05+00:00 app[web.1]: Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms) 2012-11-26T22:04:05+00:00 app[web.1]: WARNING: making https request to https://www.google.com/accounts/o8/id without verifying server certificate; no CA path was specified. 2012-11-26T22:04:05+00:00 app[web.1]: Generated checkid_setup request to https://www.google.com/accounts/o8/ud with assocication AMldfoC88djj_4MErWODKLf323kfd72t2mgFS9FDOLF33--clPvmQTF_ 2012-11-26T22:04:05+00:00 heroku[nginx]: 195.327.41.20 - - [26/Nov/2012:22:04:05 +0000] "POST /admin/session HTTP/1.1" 502 1084 "http://domain.com/admin/session/new" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.14 Safari/537.17" domain.com 2012-11-26T22:04:05+00:00 heroku[router]: at=info method=POST path=/admin/session host=domain.com fwd= dyno=web.1 queue=0 wait=0ms connect=1ms service=142ms status=303 bytes=0

Anyone have any insight?

comment openid problem

I use https://profiles.google.com/hujinpu/ to comment in some post at localhost enki app.

I got the errors:

app/models/comment.rb:30:in `requires_openid_authentication?'
app/controllers/comments_controller.rb:35:in `create'
app/controllers/comments_controller.rb:12:in `index'
NoMethodError in CommentsController#index

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.index
app/models/comment.rb:30:in `requires_openid_authentication?'
app/controllers/comments_controller.rb:35:in `create'
app/controllers/comments_controller.rb:12:in `index'

Request
Parameters:
{"year"=>"2011",
 "month"=>"03",
 "day"=>"17",
 "slug"=>"stesa"}

Fix pending spec

"PagesController route should not route /pages to show" is pending in ./spec/controllers/pages_routing_spec.rb. As far as I can tell this code works and the spec should pass. Not sure what is wrong with it.

Spree Integration

I have not tried, but could you advice on wether I could drop enki user management for devise in spree or if this is even possible?

nokogiri-1.4.4-x86-mingw32

I followed the install instructions for Enki (On a windows 7 box) and have run up against the following error:

rake aborted!
127: The specified procedure could not be found. - Init_nokogiri

From what I can tell, I need to use the 1.4.4.1 version of nokogiri (Which I installed) which fixes the bug. I am just not sure what needs to be done to have Enki use this instead.

I am new to Rails, so I am not sure if this is really an Enki issue or just an issue related to something I have messed up.

Any help would be appreciated.

Thanks,
Steve

Output from my rake command follows:

C:\Users\ssharp\Documents\My Dropbox\Rails\Enki\enki>rake
(in C:/Users/ssharp/Documents/My Dropbox/Rails/Enki/enki)
rake aborted!
127: The specified procedure could not be found. - Init_nokogiri
C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/lib/nokogiri/1.9/nokogiri.so
C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/lib/nokogiri/nokogiri.rb:1:in require' C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/lib/nokogiri/nokogiri.rb:1:in<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/lib/nokogiri.rb:13:in require' C:/Ruby192/lib/ruby/gems/1.9.1/gems/nokogiri-1.4.4-x86-mingw32/lib/nokogiri.rb:13:in<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/webrat-0.7.3/lib/webrat.rb:2:in require' C:/Ruby192/lib/ruby/gems/1.9.1/gems/webrat-0.7.3/lib/webrat.rb:2:in<top (required)>'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:inrequire' C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:inblock (2 levels) in require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:ineach' C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:inblock in require'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:ineach' C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:inrequire'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.12/lib/bundler.rb:120:in require' C:/Users/ssharp/Documents/My Dropbox/Rails/Enki/enki/config/application.rb:12:in<top (required)>'
internal:lib/rubygems/custom_require:29:in require' <internal:lib/rubygems/custom_require>:29:inrequire'
C:/Users/ssharp/Documents/My Dropbox/Rails/Enki/enki/Rakefile:4:in <top (required)>' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:inload'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in raw_load_rakefile' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:inblock in load_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in standard_exception_handling' C:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:inload_rakefile'
C:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in run' C:/Ruby192/bin/rake:31:in

'

Cucumber for loggin in passes but is actually failing

In admin_dashboard.feature

Given I am logged in <-- this passes 
And a post with comments exists
When I go to the admin root page

And show me the page
Then I should see "Latest Comments"

But when I try to go to the admin root page( /admin doesn't work either), it still shows me the login page(asking me what my login is. That's why the last step fails. Does this happen to you too? Did I just forget to set something?

Turn the app into rails engine

IMHO there are many distinct advantages to make enki Rails engine:

  • Replace RAILS_RELATIVE_URL_ROOT with route mount path
  • Mount enki on top of existing app for blogging features
  • Distribute as Gem instead of source

/tags/code link is broken

Also, posts_routing_spec.rb is failing with the error like below.

 1) PostsController route should generate tag params
 Failure/Error: {:get => "/tags/code"}.should route_to(:controller => "posts", :action => "index", :tag => "code")
 ActionController::RoutingError:
   No route matches "/tags/code"
 # ./spec/controllers/posts_routing_spec.rb:11:in `block (3 levels) in <top (required)>'

This error is reproducible here as well: http://enkiblog.com/tags/code

undefined method `buttons` for Formtastic in admin/posts/new

The following is thrown when trying to add a new post after installing:

ActionView::Template::Error (undefined method 'buttons' for #<Formtastic::FormBuilder:0xb339ea78>):
   1: <h1>New post</h1>
   2: 
   3: <%= semantic_form_for([:admin, @post]) do |form| -%>
   4:   <%= render :partial => 'form', :locals => {:form => form} -%>
   5:   <%= form.buttons do -%>
   6:     <%= form.commit_button("Save") -%>
 app/views/admin/posts/new.html.erb:3:in 'block in _app_views_admin_posts_new_html_erb___824964029_83091900'
 app/views/admin/posts/new.html.erb:3:in '_app_views_admin_posts_new_html_erb___824964029_83091900'

Enki openid doesn't seem to like Google OpenID

The enki.yml requires the URL of openid; for google this is Directed Identity (see http://lists.openid.net/pipermail/openid-general/2009-July/009271.html), which means (fsr) the app doesn't authorise me correctly - the only URL that everyone gets is https://www.google.com/accounts/o8/id.

Not sure if i'm using the openid section wrong (openID is pretty new to me) but using that URL in enki.yml doesn't let me login; it says not authorised - when using https://www.google.com/accounts/o8/id in the 'who are you' box and the same in enki.yml.

I have no idea how I'd fix it :)

Adding comments with OpenID failing with author & post failure messages

The following is happening on my 'blog running on Heroku when using an OpenID (different from the author of the 'blog post):

"Comment not added!

Please provide your name or OpenID identity URL
Please comment"

I was hoping to use this as a learning experience, but cannot find the source, it seems as though both an author and body error are occurring as though the comment is becoming lost somewhere between the form, preview and writing to the database. This problem only occurs when using OpenID's.

Thanks for any help (even if I'm made a fool of!).

The blog is hosted on Heroku at the following address: http://panth0r.heroku.com/

Ruby 1.9.2 compatibility and rbx-require-relative

Looks like there's something that's requiring rbx-require-relative which apparently isn't compatible with Ruby 1.9.2.

Gem::InstallError: rbx-require-relative requires Ruby version ~> 1.8.7.
An error occured while installing rbx-require-relative (0.0.5), and Bundler cannot continue.
Make sure that gem install rbx-require-relative -v '0.0.5' succeeds before bundling.

Adding heroku gem causes specs to fail

Running specs on a fresh clone of enki works as expected, but as soon as I add the heroku gem to the gemfile I get this when running rake spec:

  1. Admin::PostsController handling DELETE to destroy, JSON request deletes post
    Failure/Error: delete :destroy, :id => 1, :format => 'json'
    TypeError:
    wrong argument type JSON::Pure::Generator::State (expected Data)

    ./app/controllers/admin/posts_controller.rb:81:in `destroy'

    ./app/controllers/admin/posts_controller.rb:71:in`destroy'

    ./spec/controllers/admin/posts_controller_spec.rb:156:in `do_delete'

    ./spec/controllers/admin/posts_controller_spec.rb:161

  2. Admin::PostsController handling DELETE to destroy, JSON request renders json including a description of the post
    Failure/Error: delete :destroy, :id => 1, :format => 'json'
    TypeError:
    wrong argument type JSON::Pure::Generator::State (expected Data)

    ./app/controllers/admin/posts_controller.rb:81:in `destroy'

    ./app/controllers/admin/posts_controller.rb:71:in`destroy'

    ./spec/controllers/admin/posts_controller_spec.rb:156:in `do_delete'

    ./spec/controllers/admin/posts_controller_spec.rb:165

  3. Admin::UndoItemsController handling POST to undo accepting JSON renders json
    Failure/Error: post :undo, :id => 1, :format => 'json'
    TypeError:
    wrong argument type JSON::Pure::Generator::State (expected Data)

    ./app/controllers/admin/undo_items_controller.rb:23:in `undo'

    ./app/controllers/admin/undo_items_controller.rb:14:in`undo'

    ./spec/controllers/admin/undo_items_controller_spec.rb:45:in `do_post'

    ./spec/controllers/admin/undo_items_controller_spec.rb:48

  4. Admin::UndoItemsController handling POST to undo accepting JSON processes the item
    Failure/Error: post :undo, :id => 1, :format => 'json'
    TypeError:
    wrong argument type JSON::Pure::Generator::State (expected Data)

    ./app/controllers/admin/undo_items_controller.rb:23:in `undo'

    ./app/controllers/admin/undo_items_controller.rb:14:in`undo'

    ./spec/controllers/admin/undo_items_controller_spec.rb:45:in `do_post'

    ./spec/controllers/admin/undo_items_controller_spec.rb:49

Bump to Rails 4

@xaviershay Any objection if I spend a bit time bumping this up to Rails 4? I could not guarantee the app will work with both Rails 3 and 4 altogether. So IMO we should drop support for Rails 3.

"OpenID verification failed" when logging into /admin

Running Rails 3.0.4 on Heroku. My fork is here - there are a lot of commits with me tweaking OpenID config / adding hacks to try and get it to work. It seems to work sometimes, but not others. I can't quite figure out what conditions it works under, it seems to be random.

This is running on Heroku's Cedar stack on Postgres, Rails 3.0.4. I use delegation to my myOpenID, and this works well with other sites I use it on - StackOverflow, music sites, Disqus, etc. I just can't log into Enki's /admin section for some reason.

Upgrading to rails 3.1

I'm posting this just to let you know I've started migrating enki to rails 3.1.0.rc4. I'm focusing on moving javascripts/stylesheets/images to assets pipeline. I'll send a pull request this week.

Cannot delete post in admin

Deleting post in admin (clicking the red '-' button) doesn't delete the post and the following error message is displayed:

Could not delete item, or maybe it has already been deleted

Afterwards, if I refresh the page, I am forced to re-login to admin and the post still exist.

Problem with OpenID login to the admin area

Opening this as an issue rather than a pull request as I'd like to see if my understanding is correct.

Just updated my blog to the latest Enki code. haven't needed to log in for a while but needed to now, so I tried to log into the admin area using OpenID as normal and found myself back at the login screen with no error message shown. Noticed this line in my log file:

Can't verify CSRF token authenticity

I then remembered there was that issue a while back with OpenID and comments (issue #37) and tried the same fix for the admin/sessions_controller.rb so that it looks like this:

class Admin::SessionsController < ApplicationController
  skip_before_filter :verify_authenticity_token, :only => :create
  before_filter :verify_authenticity_token_unless_openid, :only => :create

  layout 'login'

  def show
    if using_open_id?
      create
    else
      redirect_to :action => 'new'
    end
  end

  def new
  end

  def create
    return successful_login if allow_login_bypass? && params[:bypass_login]

    if params[:openid_url].blank? && !request.env[Rack::OpenID::RESPONSE]
      flash.now[:error] = "You must provide an OpenID URL"
      render :action => 'new'
    else
      authenticate_with_open_id(params[:openid_url]) do |result, identity_url|
        if result.successful?
          if enki_config.author_open_ids.include?(URI.parse(identity_url))
            return successful_login
          else
            flash.now[:error] = "You are not authorized"
          end
        else
          flash.now[:error] = result.message
        end
        render :action => 'new'
      end
    end
  end

  def destroy
    session[:logged_in] = false
    redirect_to('/')
  end

protected

  def successful_login
    session[:logged_in] = true
    redirect_to(admin_root_path)
  end

  def allow_login_bypass?
    %w(development test).include?(Rails.env)
  end

  def verify_authenticity_token_unless_openid
    verify_authenticity_token unless using_open_id?
  end

  helper_method :allow_login_bypass?
end

I now seem to be able to log in again. Can anyone else reproduce this problem? And if so, is this the best fix?

Remove admin/tags

I don't ever use it, and I don't see how it is useful.
For tag migrations you probably need a bit more control than simple edit (combining tags, etc...), so will probably use code anyways.

Ensure that tags with no taggables are removed from the db automatically.

Support Markdown

Seems to me enki is a Textile-pro project. But I think it'd be great if enki support Markdown syntax too. I could submit pull request.

I can not push to Heroku

I'm so new to Rails and want to have my blog based on Rails.
I trided to push to Heroku but got the following error.

➜ enki git:(myblog) ✗ git push heroku master
Counting objects: 11940, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5507/5507), done.
Writing objects: 100% (11940/11940), 10.90 MiB | 30 KiB/s, done.
Total 11940 (delta 5649), reused 11859 (delta 5596)

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.pre
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from https://rubygems.org/.......
Installing rake (0.9.2.2)
Installing RedCloth (4.2.9) with native extensions
Installing aaronh-chronic (0.3.9)
Installing i18n (0.6.0)
Installing multi_json (1.0.4)
Installing activesupport (3.2.6)
Installing builder (3.0.0)
Installing activemodel (3.2.6)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.1)
Installing rack-cache (1.2)
Installing rack-test (0.6.1)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.1.3)
Installing actionpack (3.2.6)
Installing mime-types (1.18)
Installing polyglot (0.3.3)
Installing treetop (1.4.10)
Installing mail (2.4.4)
Installing actionmailer (3.2.6)
Installing arel (3.0.2)
Installing tzinfo (0.3.33)
Installing activerecord (3.2.6)
Installing activeresource (3.2.6)
Installing coderay (1.0.5)
Installing exception_notification (2.5.2)
Installing formtastic (2.2.1)
Installing rack-ssl (1.3.2)
Installing json (1.7.3) with native extensions
Installing rdoc (3.12)
Installing thor (0.15.2)
Installing railties (3.2.6)
Installing jquery-rails (2.0.0)
Installing lesstile (1.0.1)
Installing ruby-openid (2.1.8)
Installing rack-openid (1.3.1)
Installing open_id_authentication (1.1.0)
Using bundler (1.2.0.pre)
Installing rails (3.2.6)
Installing sass (3.1.12)
Installing sass-rails (3.2.3)
Installing sqlite3 (1.3.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-sqlite3-dir
--without-sqlite3-dir
--with-sqlite3-include
--without-sqlite3-include=${sqlite3-dir}/include
--with-sqlite3-lib
--without-sqlite3-lib=${sqlite3-dir}/lib
--enable-local
--disable-local
Gem files will remain installed in /tmp/build_36qpjnifzkajm/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5 for inspection.
Results logged to /tmp/build_36qpjnifzkajm/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.3.5' succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app

To [email protected]:freezing-window-5669.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:freezing-window-5669.git'
➜ enki git:(myblog) ✗

What i am missing, how can i solve it?
Thanks...

Question about Open ID being shut down

Next month, Google is shutting down Open ID. If I'm currently using my google profile to log into Enki, does that mean I won't be able to log in anymore? If so, any suggestions?

rake spec (or autospec) fails comment specs due to undefined method `destroyed?'

Is there some magic I should know about here :) I have forked ya, and am prepared to do some patches for ya. Nice looking code my friend.

There are a dozen of these:

NoMethodError in 'CommentsController handling commenting with a successful OpenID completion GET to #index records email'
undefined method destroyed?' for #<Post:0x1a552ac @name="Post_1109"> /Users/dreamr/development/enki/app/controllers/comments_controller.rb:54:increate'
/Users/dreamr/development/enki/app/controllers/comments_controller.rb:12:in `index'
./spec/controllers/comments_controller_spec.rb:160:

App breaks when comment is nil

After creating the first post, the app stopped working and throwed error about many methods where "comments" method used. Because on those places it was not chcked if comments are empty or not. for example, on _post.html.erb line no: 9
(

  • <%= link_to_post_comments post %>
  • )
    It is not checked if post.comments is empty or not. So it throws error if manually unless post.comments.empty? is not set. Similar case on admin panel too.
    ( app/views/admin/dashboard/show.html.erb ) line: 13

    Pages' title

    For some reason 'yield(:smth)' in layouts now returns empty string instead of 'nil' in case, when the appropriate 'content_for' block is absent. So an expression from app/views/layouts/application.html.erb:

    <title><%= yield(:page_title) || enki_config[:title] %></title>

    now doesn't work properly for me (rails 3.0.3, mri 1.8.7.p302).

    I've used the following solution:

    <title><%= ((t = yield(:page_title)).empty?) ? enki_config[:title] : t %></title>

    But I'm not sure, that it's clear, so I'm opening an issue instead of making pull-request.

    Merge master in internationalized?

    I am planning on adding i18n for Spanish but it seems the internationalized branch is a little bit outdated. Are you planning on merging master and internationalized to get the beautifulness of both?

    Left over prototype javascript files are confusing for new users

    Hello Xavier,

    When I first forked enki and started customizing UI I checked what's in stock as far as javascript is concerned. Took me a moment to investigate and realize that the prototype javascript files are not included anywhere in the application.

    I suggest that we remove the following files:
    controls.js
    dragdrop.js
    effects.js
    prototype.js

    This doesn't break anything in stock enki installation and if someone has used anything of this in their own installation then he will know how to handle the merge.

    Cheers

    gem install bug

    config.gem "mislav-will_paginate", :lib => "will_paginate", :version => "~> 2.3",

    should change to

    config.gem "mislav-will_paginate", :lib => "will_paginate", :version => "~> 2.3", :source => 'http://gems.github.com'

    hehe:) easy to change..

    Security check fails - Sorry, the OpenID server couldn't be found

    I just installed Enki, but for some reason I can't login using OpenID. I just the the "Sorry, the OpenID server couldn't be found"-error

    I'm running Enki under niginx/passenger with postgressql as database

    This is what's in the logfil. Please tell me what I can do in order to help finding the problem.

    Started POST "/admin/session" for 213.185.7.168 at 2010-11-20 00:58:27 +0100
    Processing by Admin::SessionsController#create as HTML
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"zpE5EJ5dVgiRjbAC5jEWRPWsMTjLE7YW1fKa9p5SvqU=", "openid_url"=>"http://arvidbottiger.myopenid.com/", "commit"=>"Login with OpenID"}
    Completed 401 Unauthorized in 1ms
    Generated checkid_setup request to http://www.myopenid.com/server with assocication {HMAC-SHA1}{4ce70dc2}{86hU7Q==}

    Started GET "/admin/session?_method=post&openid.assoc_handle=%7BHMAC-SHA1%7D%7B4ce70dc2%7D%7B86hU7Q%3D%3D%7D&openid.claimed_id=http%3A%2F%2Farvidbottiger.myopenid.com%2F&openid.identity=http%3A%2F%2Farvidbottiger.myopenid.com%2F&openid.mode=id_res&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.op_endpoint=http%3A%2F%2Fwww.myopenid.com%2Fserver&openid.response_nonce=2010-11-19T23%3A58%3A31ZSaAuO9&openid.return_to=http%3A%2F%2Fbetadev.bottiger.org%2Fadmin%2Fsession%3F_method%3Dpost&openid.sig=9Z9bwI7%2FfInNtTVX%2BfwncNf4nDc%3D&openid.signed=assoc_handle%2Cclaimed_id%2Cidentity%2Cmode%2Cns%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Csigned" for 213.185.7.168 at 2010-11-20 00:58:32 +0100
    Processing by Admin::SessionsController#create as HTML
    Rendered admin/sessions/new.html.erb within layouts/login (22.3ms)
    Completed 200 OK in 30ms (Views: 28.7ms | ActiveRecord: 0.0ms)

    session[:logged_in] isn't persisting

    Hi! I'm trying to get enki up and running on a personal blog, but I'm running into a problem logging in via OpenID. Everything appears to be working as expected, but somewhere between session/create and the redirect to the admin dashboard, the session isn't persisting. Here's what the console output from the server looks like (I'm debugging session[:logged_in]:

    session[:logged_in] = true
    Redirected to http://localhost:3000/admin
    Completed 302 Found in 2ms (ActiveRecord: 0.0ms)
    
    
    Started GET "/admin" for 127.0.0.1 at 2013-08-28 18:49:20 -0400
    Processing by Admin::DashboardController#show as HTML
    from admin basecontroller: session[:logged_in] =
    Redirected to http://localhost:3000/admin/session
    Filter chain halted as :require_login rendered or redirected
    Completed 302 Found in 2ms (ActiveRecord: 0.0ms)
    

    I added the debug messages re: session[:logged_in] to test what it was set to. In the create method, it's set to true. When it reaches the admin dashboard, it's apparently empty.

    Any idea what might be causing this?

    Comments of post with same name are being appended to the first post

    I i create 3 post, Post A, Post B and Post C, give them all different contents but the same title, e.g. "My Post". After all Post had been created, i add a comment to the very last Post (Post C e.g.), the comment is now being added to the very first Post (e.g. Post A).

    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.