Basic weblog based on Rails 3.1 with roles for authors next to admins. Feel free to take a look at a running blog of the current version here.
The basics seems to be mostly covered on the back end. CanCan is used to distinguish between guests, registered users, authors and admins. For admins there is an admin namespace where users and posts can be edited. There is also an index of comments which might help when removing spammy comments in bulk.
Redcarpet is used to provide markdown in posts. It is the only option for formatting available, but those inclined can easily change this as everything is passed through the markdown helper function in the application helper.
No significant lay-out has been created. Some basics with Twitter's bootstrap have been introduced so that there is at least something to look at.
Deploying on Heroku
Installing the app is fairly trivial, just clone this repository and create a valid
.env file. (there is an example in
.env_example. Don't forget to generate and change the session_secret in
.env if you want to use this in production. The current one is unsafe because it is public. You can generate a session secret using
rake secret). Then run the following commands:
# Create a new heroku app heroku create my_weblog # Install the heroku config plugin heroku plugins:install git://github.com/ddollar/heroku-config.git # Pull the basic environmental variables from heroku heroku config:pull --overwrite --interactive # copy your .env variables to heroku heroku config:push # Push your app to heroku git push heroku master # Migrate! heroku run rake db:migrate
You should now be able to view the weblog at http://my_weblog.herokuapp.com. Don't forget to pick a new name
In addition to private settings in the .env file, I use config/app_config.yml to store general application settings. Currently this is just the e-mail address that will be set for the 'deleted' user. This is a proxy user that will be used to assign orphaned posts to.
production: deleted_user_email: 'firstname.lastname@example.org' # Used for the deleted user, optional
WebL does not create an admin user by default. You can use the rails console to do this:
u = User.new(:name => "Admin", :password => "secret", :password_confirmation => "secret", :email => "email@example.com") u.roles = ['admin'] u.save
I wrote this blog mostly for personal use, however, I welcome any improvements. If you need ideas for a small project, feel free to pick something form the list below (by no means exhaustive):
- Password reset function
- Improved search
- formtastic-bootstrap or simple_form
- better 404 errors
Because the app needs some of the environmental variables to work, I advise you to create a
.env_development and a
.env_test file. You can then run your app in development mode using:
foreman start -e .env_development
And you can run tests using
foreman run -e .env_test rspec spec